Changed Player Internal enum
authorJoogab Yun <joogab.yun@samsung.com>
Tue, 17 Sep 2019 01:38:44 +0000 (10:38 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Wed, 13 Nov 2019 01:35:14 +0000 (10:35 +0900)
: The Player's enum value changes.
  So modify it to match the changed enum value.

FROM :
typedef enum {
     PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT,    /**< This is an optional flag for using codec which has higher priority */
     PLAYER_VIDEO_CODEC_TYPE_EX_HW,           /**< This is an optional flag for using the h/w codec */
     PLAYER_VIDEO_CODEC_TYPE_EX_SW,           /**< This is an optional flag for using the s/w codec */
 } player_video_codec_type_ex_e;

TO :
typedef enum {
     PLAYER_VIDEO_CODEC_TYPE_EX_HW,           /**< This is an optional flag for using the h/w codec */
     PLAYER_VIDEO_CODEC_TYPE_EX_SW,           /**< This is an optional flag for using the s/w codec */

     PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT,    /**< This is an optional flag for using codec which has higher priority */
 } player_video_codec_type_ex_e;

And an error code has been added.
 - PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC Not supported video codec type

Change-Id: Icac989cce5d6719fdf50472821beb0ef2b9e19f4

dali-extension/video-player/ecore-wl/tizen-video-player-ecore-wl.cpp
dali-extension/video-player/ecore-wl/tizen-video-player.h
dali-extension/video-player/ecore-wl2/tizen-video-player-ecore-wl2.cpp
dali-extension/video-player/ecore-wl2/tizen-video-player.h

index 50b7bf8..a407f20 100755 (executable)
@@ -200,6 +200,16 @@ void LogPlayerError( int error )
         DALI_LOG_ERROR( "Player error: Buffer space\n" );
         return;
       }
+      case PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC:
+      {
+        DALI_LOG_ERROR( "Player error: The target should not support the codec type\n" );
+        return;
+      }
+      default :
+      {
+        DALI_LOG_ERROR( "Player error: Unknown error code ( %d ) \n", error );
+        return;
+      }
     }
   }
 }
@@ -220,7 +230,6 @@ TizenVideoPlayer::TizenVideoPlayer()
   mPacketVector(),
   mEcoreWlWindow( NULL ),
   mAlphaBitChanged( false ),
-  mCodecType( PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT ),
   mStreamInfo( NULL ),
   mStreamType( SOUND_STREAM_TYPE_MEDIA )
 {
@@ -813,14 +822,26 @@ void TizenVideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
 
     if( mPlayerState == PLAYER_STATE_IDLE )
     {
-      error = player_set_video_codec_type_ex( mPlayer, static_cast< player_video_codec_type_ex_e >( type ) );
-      LogPlayerError( error );
-
-      if( error == PLAYER_ERROR_INVALID_OPERATION )
+      player_video_codec_type_ex_e codecType = PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT;
+      switch( type )
       {
-        DALI_LOG_ERROR( "The target should not support the codec type\n" );
+        case Dali::VideoPlayerPlugin::CodecType::DEFAULT :
+        {
+          codecType = PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT;
+          break;
+        }
+        case Dali::VideoPlayerPlugin::CodecType::HW :
+        {
+          codecType = PLAYER_VIDEO_CODEC_TYPE_EX_HW;
+          break;
+        }
+        case Dali::VideoPlayerPlugin::CodecType::SW :
+        {
+          codecType = PLAYER_VIDEO_CODEC_TYPE_EX_SW;
+          break;
+        }
       }
-      error = player_get_video_codec_type_ex( mPlayer, &mCodecType );
+      error = player_set_video_codec_type_ex( mPlayer, codecType );
       LogPlayerError( error );
     }
   }
@@ -828,7 +849,37 @@ void TizenVideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
 
 Dali::VideoPlayerPlugin::CodecType TizenVideoPlayer::GetCodecType() const
 {
-  return static_cast< Dali::VideoPlayerPlugin::CodecType >( mCodecType );
+  Dali::VideoPlayerPlugin::CodecType type = Dali::VideoPlayerPlugin::CodecType::DEFAULT;
+  if( mPlayerState != PLAYER_STATE_NONE )
+  {
+    player_video_codec_type_ex_e codecType = PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT;
+    int error = player_get_video_codec_type_ex( mPlayer, &codecType );
+    if( error != PLAYER_ERROR_NONE )
+    {
+      LogPlayerError( error );
+      return type;
+    }
+
+    switch( codecType )
+    {
+      case PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT :
+      {
+        type = Dali::VideoPlayerPlugin::CodecType::DEFAULT;
+        break;
+      }
+      case PLAYER_VIDEO_CODEC_TYPE_EX_HW :
+      {
+        type = Dali::VideoPlayerPlugin::CodecType::HW;
+        break;
+      }
+      case PLAYER_VIDEO_CODEC_TYPE_EX_SW :
+      {
+        type = Dali::VideoPlayerPlugin::CodecType::SW;
+        break;
+      }
+    }
+  }
+  return type;
 }
 
 void TizenVideoPlayer::SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode )
index 5b1a606..60c5a87 100755 (executable)
@@ -249,8 +249,6 @@ private:
 
   bool mAlphaBitChanged; ///< True if underlay rendering initialization changes window alpha
 
-  player_video_codec_type_ex_e mCodecType;
-
   sound_stream_info_h mStreamInfo;
   sound_stream_type_e mStreamType;
 public:
index 58f10a6..90221ca 100755 (executable)
@@ -200,6 +200,16 @@ void LogPlayerError( int error )
         DALI_LOG_ERROR( "Player error: Buffer space\n" );
         return;
       }
+      case PLAYER_ERROR_NOT_SUPPORTED_VIDEO_CODEC:
+      {
+        DALI_LOG_ERROR( "Player error: The target should not support the codec type\n" );
+        return;
+      }
+      default :
+      {
+        DALI_LOG_ERROR( "Player error: Unknown error code ( %d ) \n", error );
+        return;
+      }
     }
   }
 }
@@ -220,7 +230,6 @@ TizenVideoPlayer::TizenVideoPlayer()
   mPacketVector(),
   mEcoreWlWindow( NULL ),
   mAlphaBitChanged( false ),
-  mCodecType( PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT ),
   mStreamInfo( NULL ),
   mStreamType( SOUND_STREAM_TYPE_MEDIA )
 {
@@ -805,14 +814,26 @@ void TizenVideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
 
     if( mPlayerState == PLAYER_STATE_IDLE )
     {
-      error = player_set_video_codec_type_ex( mPlayer, static_cast< player_video_codec_type_ex_e >( type ) );
-      LogPlayerError( error );
-
-      if( error == PLAYER_ERROR_INVALID_OPERATION )
+      player_video_codec_type_ex_e codecType = PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT;
+      switch( type )
       {
-        DALI_LOG_ERROR( "The target should not support the codec type\n" );
+        case Dali::VideoPlayerPlugin::CodecType::DEFAULT :
+        {
+          codecType = PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT;
+          break;
+        }
+        case Dali::VideoPlayerPlugin::CodecType::HW :
+        {
+          codecType = PLAYER_VIDEO_CODEC_TYPE_EX_HW;
+          break;
+        }
+        case Dali::VideoPlayerPlugin::CodecType::SW :
+        {
+          codecType = PLAYER_VIDEO_CODEC_TYPE_EX_SW;
+          break;
+        }
       }
-      error = player_get_video_codec_type_ex( mPlayer, &mCodecType );
+      error = player_set_video_codec_type_ex( mPlayer, codecType );
       LogPlayerError( error );
     }
   }
@@ -820,7 +841,37 @@ void TizenVideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
 
 Dali::VideoPlayerPlugin::CodecType TizenVideoPlayer::GetCodecType() const
 {
-  return static_cast< Dali::VideoPlayerPlugin::CodecType >( mCodecType );
+  Dali::VideoPlayerPlugin::CodecType type = Dali::VideoPlayerPlugin::CodecType::DEFAULT;
+  if( mPlayerState != PLAYER_STATE_NONE )
+  {
+    player_video_codec_type_ex_e codecType = PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT;
+    int error = player_get_video_codec_type_ex( mPlayer, &codecType );
+    if( error != PLAYER_ERROR_NONE )
+    {
+      LogPlayerError( error );
+      return type;
+    }
+
+    switch( codecType )
+    {
+      case PLAYER_VIDEO_CODEC_TYPE_EX_DEFAULT :
+      {
+        type = Dali::VideoPlayerPlugin::CodecType::DEFAULT;
+        break;
+      }
+      case PLAYER_VIDEO_CODEC_TYPE_EX_HW :
+      {
+        type = Dali::VideoPlayerPlugin::CodecType::HW;
+        break;
+      }
+      case PLAYER_VIDEO_CODEC_TYPE_EX_SW :
+      {
+        type = Dali::VideoPlayerPlugin::CodecType::SW;
+        break;
+      }
+    }
+  }
+  return type;
 }
 
 void TizenVideoPlayer::SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode )
index ec03d74..1d34778 100755 (executable)
@@ -249,8 +249,6 @@ private:
 
   bool mAlphaBitChanged; ///< True if underlay rendering initialization changes window alpha
 
-  player_video_codec_type_ex_e mCodecType;
-
   sound_stream_info_h mStreamInfo;
   sound_stream_type_e mStreamType;
 public: