[4.0] Added APIs for setting codec type 28/169028/2
authortaeyoon0.lee <taeyoon0.lee@samsung.com>
Wed, 17 Jan 2018 09:40:49 +0000 (18:40 +0900)
committertaeyoon0.lee <taeyoon0.lee@samsung.com>
Tue, 6 Feb 2018 08:02:51 +0000 (17:02 +0900)
Change-Id: Ifc6d98f70104d5320596983eddd06c9e7c1a59d1

dali-extension/video-player/tizen-video-player.cpp
dali-extension/video-player/tizen-video-player.h

index 1003c05..18286c6 100644 (file)
@@ -219,7 +219,8 @@ TizenVideoPlayer::TizenVideoPlayer()
   mPacketMutex(),
   mPacketVector(),
   mEcoreWlWindow( NULL ),
-  mAlphaBitChanged( false )
+  mAlphaBitChanged( false ),
+  mCodecType( PLAYER_CODEC_TYPE_DEFAULT )
 {
 }
 
@@ -228,7 +229,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 )
   {
@@ -787,5 +788,32 @@ void TizenVideoPlayer::DestroyPlayer()
   }
 }
 
+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 );
+}
+
 } // namespace Plugin
 } // namespace Dali;
index 0f8845b..57db37f 100644 (file)
@@ -178,6 +178,16 @@ public:
    */
   bool IsVideoTextureSupported();
 
+  /**
+   * @brief Dali::VideoPlayer::SetCodecType()
+   */
+  void SetCodecType( Dali::VideoPlayerPlugin::CodecType type );
+
+  /**
+   * @brief Dali::VideoPlayer::GetCodecType()
+   */
+  Dali::VideoPlayerPlugin::CodecType GetCodecType() const;
+
 private:
 
   /**
@@ -188,7 +198,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 +239,8 @@ private:
 
   bool mAlphaBitChanged; ///< True if underlay rendering initialization changes window alpha
 
+  player_codec_type_e mCodecType;
+
 public:
 
   Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;