[Tizen] Add ecore-wl2 03/174703/1 accepted/tizen/unified/20180405.064355 submit/tizen/20180403.133913
authordongsug.song <dongsug.song@samsung.com>
Tue, 3 Apr 2018 12:59:38 +0000 (21:59 +0900)
committerdongsug.song <dongsug.song@samsung.com>
Tue, 3 Apr 2018 12:59:38 +0000 (21:59 +0900)
Change-Id: Iff454c71fe960c211e9853bc62e319516cd4ac7b
Signed-off-by: dongsug.song <dongsug.song@samsung.com>
dali-extension/video-player/ecore-wl2/tizen-video-player-ecore-wl2.cpp [changed mode: 0644->0755]
dali-extension/video-player/ecore-wl2/tizen-video-player.h [changed mode: 0644->0755]
packaging/dali-extension.spec [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index aaae82c..98caeb2
@@ -219,7 +219,10 @@ TizenVideoPlayer::TizenVideoPlayer()
   mPacketMutex(),
   mPacketVector(),
   mEcoreWlWindow( NULL ),
-  mAlphaBitChanged( false )
+  mAlphaBitChanged( false ),
+  mCodecType( PLAYER_CODEC_TYPE_DEFAULT ),
+  mStreamInfo( NULL ),
+  mStreamType( SOUND_STREAM_TYPE_MEDIA )
 {
 }
 
@@ -228,7 +231,7 @@ TizenVideoPlayer::~TizenVideoPlayer()
   DestroyPlayer();
 }
 
-void TizenVideoPlayer::GetPlayerState( player_state_e* state )
+void TizenVideoPlayer::GetPlayerState( player_state_e* state ) const
 {
   if( mPlayer != NULL && player_get_state( mPlayer, state ) != PLAYER_ERROR_NONE )
   {
@@ -241,20 +244,45 @@ void TizenVideoPlayer::SetUrl( const std::string& url )
 {
   if( mUrl != url )
   {
+    int error = PLAYER_ERROR_NONE;
+
     mUrl = url;
 
     GetPlayerState( &mPlayerState );
 
     if( mPlayerState != PLAYER_STATE_NONE && mPlayerState != PLAYER_STATE_IDLE )
     {
+      if( mNativeImageSourcePtr )
+      {
+        error = player_unset_media_packet_video_frame_decoded_cb( mPlayer );
+        LogPlayerError( error );
+      }
       Stop();
-      int error = player_unprepare( mPlayer );
+
+      error = player_unprepare( mPlayer );
+      LogPlayerError( error );
+
+      if( mNativeImageSourcePtr )
+      {
+        error = player_set_media_packet_video_frame_decoded_cb( mPlayer, MediaPacketVideoDecodedCb, this );
+        LogPlayerError( error );
+      }
+      else
+      {
+        int width, height;
+        Ecore_Wl2_Display *wl2_display = ecore_wl2_connected_display_get(NULL);
+        ecore_wl2_display_screen_size_get( wl2_display, &width, &height );
+
+        error = player_set_ecore_wl_display( mPlayer, PLAYER_DISPLAY_TYPE_OVERLAY, mEcoreWlWindow, 0, 0, width, height );
+        LogPlayerError( error );
+      }
+      GetPlayerState( &mPlayerState );
       LogPlayerError( error );
     }
 
     if( mPlayerState == PLAYER_STATE_IDLE )
     {
-      int error = player_set_uri( mPlayer, mUrl.c_str() );
+      error = player_set_uri( mPlayer, mUrl.c_str() );
       LogPlayerError( error );
 
       error = player_prepare( mPlayer );
@@ -523,7 +551,10 @@ void TizenVideoPlayer::InitializeTextureStreamMode( Dali::NativeImageSourcePtr n
     error = player_set_media_packet_video_frame_decoded_cb( mPlayer, MediaPacketVideoDecodedCb, this );
     LogPlayerError( error );
 
-    error = player_set_sound_type( mPlayer, SOUND_TYPE_MEDIA );
+    error = sound_manager_create_stream_information( mStreamType, NULL, NULL, &mStreamInfo );
+    LogPlayerError( error );
+
+    error = player_set_sound_stream_info( mPlayer, mStreamInfo );
     LogPlayerError( error );
 
     error = player_set_display_mode( mPlayer, PLAYER_DISPLAY_MODE_FULL_SCREEN );
@@ -557,7 +588,10 @@ void TizenVideoPlayer::InitializeUnderlayMode( Ecore_Wl2_Window* ecoreWlWindow )
     error = player_set_completed_cb( mPlayer, EmitPlaybackFinishedSignal, this );
     LogPlayerError( error );
 
-    error = player_set_sound_type( mPlayer, SOUND_TYPE_MEDIA );
+    error = sound_manager_create_stream_information( mStreamType, NULL, NULL, &mStreamInfo );
+    LogPlayerError( error );
+
+    error = player_set_sound_stream_info( mPlayer, mStreamInfo );
     LogPlayerError( error );
 
     error = player_set_display_mode( mPlayer, PLAYER_DISPLAY_MODE_DST_ROI );
@@ -724,7 +758,7 @@ void TizenVideoPlayer::Backward( int millisecond )
   }
 }
 
-bool TizenVideoPlayer::IsVideoTextureSupported() const
+bool TizenVideoPlayer::IsVideoTextureSupported()
 {
   bool featureFlag = true;
   int error = SYSTEM_INFO_ERROR_NONE;
@@ -756,11 +790,57 @@ void TizenVideoPlayer::DestroyPlayer()
 
     error = player_destroy( mPlayer );
     LogPlayerError( error );
+
+    error = sound_manager_destroy_stream_information(mStreamInfo);
+    LogPlayerError( error );
+
     mPlayerState = PLAYER_STATE_NONE;
     mPlayer = NULL;
     mUrl = "";
   }
 }
 
+void TizenVideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
+{
+  int error;
+  if( mPlayerState != PLAYER_STATE_NONE )
+  {
+    GetPlayerState( &mPlayerState );
+
+    if( mPlayerState == PLAYER_STATE_IDLE )
+    {
+      error = player_set_codec_type( mPlayer, PLAYER_STREAM_TYPE_VIDEO, static_cast< player_codec_type_e >( type ) );
+      LogPlayerError( error );
+
+      if( error == PLAYER_ERROR_INVALID_OPERATION )
+      {
+        DALI_LOG_ERROR( "The target should not support the codec type\n" );
+      }
+      error = player_get_codec_type( mPlayer, PLAYER_STREAM_TYPE_VIDEO, &mCodecType );
+      LogPlayerError( error );
+    }
+  }
+}
+
+Dali::VideoPlayerPlugin::CodecType TizenVideoPlayer::GetCodecType() const
+{
+  return static_cast< Dali::VideoPlayerPlugin::CodecType >( mCodecType );
+}
+
+void TizenVideoPlayer::SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode )
+{
+  int error;
+  error = player_set_display_mode( mPlayer, static_cast< player_display_mode_e >( mode ) );
+  LogPlayerError( error );
+}
+
+Dali::VideoPlayerPlugin::DisplayMode::Type TizenVideoPlayer::GetDisplayMode() const
+{
+  player_display_mode_e mode;
+  player_get_display_mode( mPlayer, &mode );
+  return static_cast< Dali::VideoPlayerPlugin::DisplayMode::Type >( mode );
+}
+
+
 } // namespace Plugin
 } // namespace Dali;
old mode 100644 (file)
new mode 100755 (executable)
index 2f5bdae..40b7dd8
@@ -176,7 +176,27 @@ public:
   /**
    * @brief Dali::VideoPlayer::IsVideoTextureSupported()
    */
-  bool IsVideoTextureSupported() const;
+  bool IsVideoTextureSupported();
+
+  /**
+   * @brief Dali::VideoPlayer::SetCodecType()
+   */
+  void SetCodecType( Dali::VideoPlayerPlugin::CodecType type );
+
+  /**
+   * @brief Dali::VideoPlayer::GetCodecType()
+   */
+  Dali::VideoPlayerPlugin::CodecType GetCodecType() const;
+
+  /**
+   * @copydoc Dali::VideoPlayerPlugin::SetDisplayMode()
+   */
+  void SetDisplayMode(  Dali::VideoPlayerPlugin::DisplayMode::Type mode );
+
+  /**
+   * @copydoc Dali::VideoPlayerPlugin::GetDisplayMode()
+   */
+  Dali::VideoPlayerPlugin::DisplayMode::Type GetDisplayMode() const;
 
 private:
 
@@ -188,7 +208,7 @@ private:
   /**
    * @brief Gets current player state
    */
-  void GetPlayerState( player_state_e* state );
+  void GetPlayerState( player_state_e* state ) const;
 
   /**
    * @brief Destroy all packests, which this plugin stores
@@ -229,6 +249,10 @@ private:
 
   bool mAlphaBitChanged; ///< True if underlay rendering initialization changes window alpha
 
+  player_codec_type_e mCodecType;
+
+  sound_stream_info_h mStreamInfo;
+  sound_stream_type_e mStreamType;
 public:
 
   Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
old mode 100644 (file)
new mode 100755 (executable)
index f99cb74..0eac370
@@ -7,7 +7,7 @@
 
 Name:       dali-extension
 Summary:    The DALi Tizen Extensions
-Version:    1.3.9
+Version:    1.3.17
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT