From: taeyoon0.lee Date: Wed, 17 Jan 2018 09:40:49 +0000 (+0900) Subject: [4.0] Added APIs for setting codec type X-Git-Tag: accepted/tizen/4.0/unified/20180223.062029~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F28%2F169028%2F2;p=platform%2Fcore%2Fuifw%2Fdali-extension.git [4.0] Added APIs for setting codec type Change-Id: Ifc6d98f70104d5320596983eddd06c9e7c1a59d1 --- diff --git a/dali-extension/video-player/tizen-video-player.cpp b/dali-extension/video-player/tizen-video-player.cpp index 1003c05..18286c6 100644 --- a/dali-extension/video-player/tizen-video-player.cpp +++ b/dali-extension/video-player/tizen-video-player.cpp @@ -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; diff --git a/dali-extension/video-player/tizen-video-player.h b/dali-extension/video-player/tizen-video-player.h index 0f8845b..57db37f 100644 --- a/dali-extension/video-player/tizen-video-player.h +++ b/dali-extension/video-player/tizen-video-player.h @@ -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;