From 4b90e5d19595580802cf68da1cbac73b8fb3ea4a Mon Sep 17 00:00:00 2001 From: "taeyoon0.lee" Date: Tue, 19 Sep 2017 16:36:02 +0900 Subject: [PATCH] Removed video player plugin - video plugin was moved in dali-extension Change-Id: I30c96d75fd37a98547e9994e8899952de492b94a --- build/tizen/configure.ac | 8 +- build/tizen/plugins/Makefile.am | 86 +--- build/tizen/plugins/configure.ac | 10 - packaging/dali-adaptor.spec | 70 +-- plugins/file.list | 3 - plugins/video-player/tizen-video-player.cpp | 743 ---------------------------- plugins/video-player/tizen-video-player.h | 231 --------- 7 files changed, 5 insertions(+), 1146 deletions(-) delete mode 100644 plugins/video-player/tizen-video-player.cpp delete mode 100644 plugins/video-player/tizen-video-player.h diff --git a/build/tizen/configure.ac b/build/tizen/configure.ac index 98b840c..c0d295d 100644 --- a/build/tizen/configure.ac +++ b/build/tizen/configure.ac @@ -24,15 +24,9 @@ AC_ARG_ENABLE([feedback], [enable_feedback=yes], [enable_feedback=no]) -AC_ARG_ENABLE([videoplayer], - [AC_HELP_STRING([ --enable-videoplayer], - [Enable video player plugin])], - [enable_videoplayer=yes], - [enable_videoplayer=no]) - AC_CONFIG_SUBDIRS(adaptor) -if test "x$enable_feedback" = "xyes" || test "x$enable_videoplayer" = "xyes"; then +if test "x$enable_feedback" = "xyes"; then # build dali-adaptor & plugins AC_CONFIG_SUBDIRS(plugins) fi diff --git a/build/tizen/plugins/Makefile.am b/build/tizen/plugins/Makefile.am index 7e690be..71e55d0 100644 --- a/build/tizen/plugins/Makefile.am +++ b/build/tizen/plugins/Makefile.am @@ -31,25 +31,13 @@ if USE_FEEDBACK lib_LTLIBRARIES += libdali-feedback-plugin.la endif -if WAYLAND -if USE_VIDEOPLAYER -lib_LTLIBRARIES += libdali-video-player-plugin.la -endif -endif - -else +else # ENABLE_CXX03_ABI if USE_FEEDBACK lib_LTLIBRARIES += libdali-feedback-plugin-cxx11.la endif -if WAYLAND - -if USE_VIDEOPLAYER -lib_LTLIBRARIES += libdali-video-player-plugin-cxx11.la -endif -endif -endif +endif # ENABLE_CXX03_ABI if USE_FEEDBACK dalisounddir = ${dataReadOnlyDir}/plugins/sounds/ @@ -88,42 +76,6 @@ LIBDALI_FEEDBACK_PLUGIN_LA_LIBADD += \ endif -# VideoPlayer -if WAYLAND -if USE_VIDEOPLAYER - -LIBDALI_VIDEO_PLAYER_PLUGIN_LA_SOURCES = \ - $(video_player_plugin_src_files) - -libdali_video_player_plugin_la__DEPENDENCIES = - -LIBDALI_VIDEO_PLAYER_PLUGIN_LA_CXXFLAGS = -DDALI_COMPILATION \ - -DDALI_ADAPTOR_COMPILATION \ - $(DLOG_CFLAGS) \ - $(DALICORE_CFLAGS) \ - $(ECORE_WAYLAND_CFLAGS) \ - $(CAPI_MEDIA_PLAYER_CFLAGS) \ - $(DALI_PROFILE_CFLAGS) \ - $(DALI_ADAPTOR_CFLAGS) \ - -I../../../adaptors/public-api \ - -I../../../adaptors/devel-api \ - -I../../../adaptors/devel-api/adaptor-framework \ - -I../../../adaptors/integration-api \ - -I../../../adaptors/public-api/adaptor-framework \ - -I../../../plugins/video-player \ - -Werror -Wall - -LIBDALI_VIDEO_PLAYER_PLUGIN_LA_LIBADD = \ - $(DLOG_LIBS) \ - $(ECORE_WAYLAND_LIBS) \ - $(CAPI_MEDIA_PLAYER_LIBS) - -LIBDALI_VIDEO_PLAYER_PLUGIN_LA_LDFLAGS = \ - -rdynamic - -endif # USE_VIDEOPLAYER -endif # WAYLAND - if ENABLE_CXX03_ABI if USE_FEEDBACK @@ -141,23 +93,6 @@ install: install-am endif endif -if WAYLAND -if USE_VIDEOPLAYER -libdali_video_player_plugin_la_SOURCES = $(LIBDALI_VIDEO_PLAYER_PLUGIN_LA_SOURCES) -libdali_video_player_plugin_la_CXXFLAGS = $(LIBDALI_VIDEO_PLAYER_PLUGIN_LA_CXXFLAGS) -libdali_video_player_plygin_la_LIBADD = $(LIBDALI_VIDEO_PLAYER_PLUGIN_LA_LIBADD) -libdali_video_player_plugin_la_LDFLAGS = $(LIBDALI_VIDEO_PLAYER_PLUGIN_LA_LDFLAGS) - -if ENABLE_RENAME_SO -#rename -install: install-am - rm -rf $(libdir)/libdali_video_player_plugin.so - rm -rf $(libdir)/libdali_video_player_plugin-cxx03.so - ln -s $(libdir)/libdali_video_player_plugin.so.0.0.* $(libdir)/libdali_video_player_plugin-cxx03.so -endif -endif -endif - else # CXX03 if USE_FEEDBACK @@ -175,21 +110,4 @@ install: install-am endif endif -if WAYLAND -if USE_VIDEOPLAYER -libdali_video_player_plugin_cxx11_la_SOURCES = $(LIBDALI_VIDEO_PLAYER_PLUGIN_LA_SOURCES) -libdali_video_player_plugin_cxx11_la_CXXFLAGS = $(LIBDALI_VIDEO_PLAYER_PLUGIN_LA_CXXFLAGS) -libdali_video_player_plygin_cxx11_la_LIBADD = $(LIBDALI_VIDEO_PLAYER_PLUGIN_LA_LIBADD) -libdali_video_player_plugin_cxx11_la_LDFLAGS = $(LIBDALI_VIDEO_PLAYER_PLUGIN_LA_LDFLAGS) - -if ENABLE_RENAME_SO -#rename -install: install-am - rm -rf $(libdir)/libdali_video_player_plugin-cxx11.so - rm -rf $(libdir)/libdali_video_player_plugin.so - ln -s $(libdir)/libdali_video_player_plugin-cxx11.so.0.0.* $(libdir)/libdali_video_player_plugin.so -endif -endif -endif - endif # CXX03 diff --git a/build/tizen/plugins/configure.ac b/build/tizen/plugins/configure.ac index fc950ba..83b8a95 100644 --- a/build/tizen/plugins/configure.ac +++ b/build/tizen/plugins/configure.ac @@ -23,7 +23,6 @@ AM_CONDITIONAL([UBUNTU_PROFILE], [test x$enable_profile = xUBUNTU]) AM_CONDITIONAL([WAYLAND], [test x$enable_wayland = xyes]) AM_CONDITIONAL([USE_FEEDBACK], [test x$enable_feedback = xyes]) -AM_CONDITIONAL([USE_VIDEOPLAYER], [test x$enable_videoplayer = xyes]) AM_CONDITIONAL([ENABLE_CXX03_ABI], [test x$enable_cxx03_abi = xyes]) AM_CONDITIONAL([ENABLE_RENAME_SO], [test x$enable_rename_so = xyes]) @@ -32,15 +31,6 @@ if test "x$enable_cxx03_abi" = "xyes"; then DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -D_GLIBCXX_USE_CXX11_ABI=0" fi -if test "x$enable_wayland" = "xyes"; then -if test "x$enable_videoplayer" = "xyes"; then -if test "x$enable_profile" != "xUBUNTU"; then -PKG_CHECK_MODULES(CAPI_MEDIA_PLAYER, capi-media-player) -PKG_CHECK_MODULES(ECORE_WAYLAND, ecore-wayland) -fi -fi # enable_videoplayer -fi # enable_wayland - if test "x$enable_feedback" = "xyes"; then if test "x$enable_profile" != "xUBUNTU"; then diff --git a/packaging/dali-adaptor.spec b/packaging/dali-adaptor.spec index 77c210c..9ce7c1c 100644 --- a/packaging/dali-adaptor.spec +++ b/packaging/dali-adaptor.spec @@ -135,10 +135,6 @@ BuildRequires: pkgconfig(mm-sound) BuildRequires: pkgconfig(feedback) %endif -# for videoplayer Plugin -BuildRequires: pkgconfig(capi-media-player) - - # for multiprofile Requires: %{name}-compat = %{version}-%{release} Recommends: %{name}-profile_common = %{version}-%{release} @@ -369,18 +365,6 @@ Requires: %{name} = %{version}-%{release} %description dali-feedback-plugin Feedback plugin to play haptic and audio feedback for Dali -############################## -# Dali VideoPlayer Plugin -############################## -%if %{with wayland} - -%package dali-video-player-plugin -Summary: Plugin to play a video file for Dali -Group: System/Libraries -%description dali-video-player-plugin -VideoPlayer plugin to play a video file for Dali -%endif - %if !0%{?disable_cxx03_build} ############################## # Dali Feedback Plugin cxx03 @@ -393,17 +377,6 @@ Requires: %{name}-cxx03 = %{version}-%{release} %description dali-feedback-plugin-cxx03 Feedback plugin to play haptic and audio feedback for Dali -############################## -# Dali VideoPlayer Plugin -############################## -%if %{with wayland} - -%package dali-video-player-plugin-cxx03 -Summary: Plugin to play a video file for Dali with cxx03 abi -Group: System/Libraries -%description dali-video-player-plugin-cxx03 -VideoPlayer plugin to play a video file for Dali -%endif %endif ############################## @@ -492,7 +465,6 @@ TIZEN_PLATFORM_CONFIG_SUPPORTED="%{tizen_platform_config_supported}" ; export TI %if 0%{?tizen_version_major} >= 3 --enable-feedback \ %endif - --enable-videoplayer \ %if 0%{?tizen_2_2_compatibility} --with-tizen-2-2-compatibility \ %endif @@ -535,7 +507,6 @@ make clean %if 0%{?tizen_version_major} >= 3 --enable-feedback \ %endif - --enable-videoplayer \ %if 0%{?tizen_2_2_compatibility} --with-tizen-2-2-compatibility \ %endif @@ -577,7 +548,6 @@ make clean %if 0%{?tizen_version_major} >= 3 --enable-feedback \ %endif - --enable-videoplayer \ %if 0%{?tizen_2_2_compatibility} --with-tizen-2-2-compatibility \ %endif @@ -619,7 +589,6 @@ make clean %if 0%{?tizen_version_major} >= 3 --enable-feedback \ %endif - --enable-videoplayer \ %if 0%{?tizen_2_2_compatibility} --with-tizen-2-2-compatibility \ %endif @@ -653,7 +622,7 @@ make clean %endif ####################################################################### -# common ( build dali_videoplayer_plugin for common uses ) +# common # This is for backward-compatibility. This does not deteriorate 4.0 Configurability # if common ||"undefined" %if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "mobile" @@ -663,7 +632,6 @@ make clean %if 0%{?tizen_version_major} >= 3 --enable-feedback \ %endif - --enable-videoplayer \ %if 0%{?tizen_2_2_compatibility} --with-tizen-2-2-compatibility \ %endif @@ -714,7 +682,6 @@ make clean %if 0%{?tizen_version_major} >= 3 --enable-feedback \ %endif - --enable-videoplayer \ --enable-cxx03-abi=yes \ %if 0%{?tizen_2_2_compatibility} --with-tizen-2-2-compatibility \ @@ -758,7 +725,6 @@ make clean %if 0%{?tizen_version_major} >= 3 --enable-feedback \ %endif - --enable-videoplayer \ --enable-cxx03-abi=yes \ %if 0%{?tizen_2_2_compatibility} --with-tizen-2-2-compatibility \ @@ -801,7 +767,6 @@ make clean %if 0%{?tizen_version_major} >= 3 --enable-feedback \ %endif - --enable-videoplayer \ --enable-cxx03-abi=yes \ %if 0%{?tizen_2_2_compatibility} --with-tizen-2-2-compatibility \ @@ -844,7 +809,6 @@ make clean %if 0%{?tizen_version_major} >= 3 --enable-feedback \ %endif - --enable-videoplayer \ --enable-cxx03-abi=yes \ %if 0%{?tizen_2_2_compatibility} --with-tizen-2-2-compatibility \ @@ -877,7 +841,7 @@ make clean %endif ####################################################################### -# common ( build dali_videoplayer_plugin for common uses ) +# common # This is for backward-compatibility. This does not deteriorate 4.0 Configurability # if common ||"undefined" %if "%{?profile}" != "wearable" && "%{?profile}" != "tv" && "%{?profile}" != "ivi" && "%{?profile}" != "mobile" @@ -888,7 +852,6 @@ make clean %if 0%{?tizen_version_major} >= 3 --enable-feedback \ %endif - --enable-videoplayer \ --enable-cxx03-abi=yes \ %if 0%{?tizen_2_2_compatibility} --with-tizen-2-2-compatibility \ @@ -1024,19 +987,6 @@ exit 0 /sbin/ldconfig exit 0 -%if %{with wayland} -%post dali-video-player-plugin -/sbin/ldconfig -exit 0 -%endif - -%if %{with wayland} -%postun dali-video-player-plugin -/sbin/ldconfig -exit 0 -%endif - - ############################## # This is for backward-compatibility. This does not deteriorate 4.0 Configurability @@ -1220,14 +1170,6 @@ exit 0 %exclude %{_libdir}/libdali-adap*.so*.ivi #%endif -%if %{with wayland} -%files dali-video-player-plugin-cxx03 -%manifest dali-adaptor.manifest -%defattr(-,root,root,-) -%{_libdir}/libdali-video-player-plugin.so* -%license LICENSE -%endif - %if 0%{?tizen_version_major} >= 3 %files dali-feedback-plugin-cxx03 %manifest dali-adaptor.manifest @@ -1239,14 +1181,6 @@ exit 0 ################################################# -%if %{with wayland} -%files dali-video-player-plugin -%manifest dali-adaptor.manifest -%defattr(-,root,root,-) -%{_libdir}/libdali-video-player-plugin-cxx11.so* -%license LICENSE -%endif - %if 0%{?tizen_version_major} >= 3 %files dali-feedback-plugin %manifest dali-adaptor.manifest diff --git a/plugins/file.list b/plugins/file.list index 80f8b58..80ab92b 100644 --- a/plugins/file.list +++ b/plugins/file.list @@ -2,6 +2,3 @@ feedback_plugin_src_files = \ $(plugin_src_dir)/dali-feedback.cpp - -video_player_plugin_src_files = \ - $(plugin_src_dir)/video-player/tizen-video-player.cpp diff --git a/plugins/video-player/tizen-video-player.cpp b/plugins/video-player/tizen-video-player.cpp deleted file mode 100644 index e11736e..0000000 --- a/plugins/video-player/tizen-video-player.cpp +++ /dev/null @@ -1,743 +0,0 @@ -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL INCLUDES -#include -#include -#include - -// INTERNAL INCLUDES - -// The plugin factories -extern "C" DALI_EXPORT_API Dali::VideoPlayerPlugin* CreateVideoPlayerPlugin( void ) -{ - return new Dali::Plugin::TizenVideoPlayer; -} - -extern "C" DALI_EXPORT_API void DestroyVideoPlayerPlugin( Dali::VideoPlayerPlugin* plugin ) -{ - if( plugin != NULL ) - { - delete plugin; - } -} - -namespace Dali -{ - -namespace Plugin -{ - -namespace -{ - -const int TIMER_INTERVAL( 20 ); - -static void MediaPacketVideoDecodedCb( media_packet_h packet, void* user_data ) -{ - TizenVideoPlayer* player = static_cast< TizenVideoPlayer* >( user_data ); - - if( player == NULL ) - { - DALI_LOG_ERROR( "Decoded callback got Null pointer as user_data.\n" ); - return; - } - - player->PushPacket( packet ); -} - -static void EmitPlaybackFinishedSignal( void* user_data ) -{ - TizenVideoPlayer* player = static_cast< TizenVideoPlayer* >( user_data ); - DALI_LOG_ERROR( "EmitPlaybackFinishedSignal.\n" ); - - if( player == NULL ) - { - DALI_LOG_ERROR( "Decoded callback got Null pointer as user_data.\n" ); - return; - } - - DALI_LOG_ERROR( "EmitPlaybackFinishedSignal.\n" ); - - if( !player->mFinishedSignal.Empty() ) - { - DALI_LOG_ERROR( "EmitPlaybackFinishedSignal.3\n" ); - player->mFinishedSignal.Emit(); - } - - player->Stop(); -} - -// ToDo: VD player_set_play_position() doesn't work when callback pointer is NULL. -// We should check whether this callback is needed in platform. -static void PlayerSeekCompletedCb( void* data ) -{ -} - -void LogPlayerError( int error ) -{ - if( error != PLAYER_ERROR_NONE ) - { - switch( error ) - { - case PLAYER_ERROR_OUT_OF_MEMORY: - { - DALI_LOG_ERROR( "Player error: Out of memory\n" ); - return; - } - case PLAYER_ERROR_INVALID_PARAMETER: - { - DALI_LOG_ERROR( "Player error: Invalid parameter\n" ); - return; - } - case PLAYER_ERROR_NO_SUCH_FILE: - { - DALI_LOG_ERROR( "Player error: No such file\n" ); - return; - } - case PLAYER_ERROR_INVALID_OPERATION: - { - DALI_LOG_ERROR( "Player error: Invalid operation\n" ); - return; - } - case PLAYER_ERROR_FILE_NO_SPACE_ON_DEVICE: - { - DALI_LOG_ERROR( "Player error: No space on device\n" ); - return; - } - case PLAYER_ERROR_FEATURE_NOT_SUPPORTED_ON_DEVICE: - { - DALI_LOG_ERROR( "Player error: Not supported feature on device\n" ); - return; - } - case PLAYER_ERROR_SEEK_FAILED: - { - DALI_LOG_ERROR( "Player error: Seek failed\n" ); - return; - } - case PLAYER_ERROR_INVALID_STATE: - { - DALI_LOG_ERROR( "Player error: Invalid state\n" ); - return; - } - case PLAYER_ERROR_NOT_SUPPORTED_FILE: - { - DALI_LOG_ERROR( "Player error: Not supported file\n" ); - return; - } - case PLAYER_ERROR_INVALID_URI: - { - DALI_LOG_ERROR( "Player error: Invalid uri\n" ); - return; - } - case PLAYER_ERROR_SOUND_POLICY: - { - DALI_LOG_ERROR( "Player error: Sound policy\n" ); - return; - } - case PLAYER_ERROR_CONNECTION_FAILED: - { - DALI_LOG_ERROR( "Player error: Connection failed\n" ); - return; - } - case PLAYER_ERROR_VIDEO_CAPTURE_FAILED: - { - DALI_LOG_ERROR( "Player error: Video capture failed\n" ); - return; - } - case PLAYER_ERROR_DRM_EXPIRED: - { - DALI_LOG_ERROR( "Player error: DRM expired\n" ); - return; - } - case PLAYER_ERROR_DRM_NO_LICENSE: - { - DALI_LOG_ERROR( "Player error: No license\n" ); - return; - } - case PLAYER_ERROR_DRM_FUTURE_USE: - { - DALI_LOG_ERROR( "Player error: License for future use\n" ); - return; - } - case PLAYER_ERROR_DRM_NOT_PERMITTED: - { - DALI_LOG_ERROR( "Player error: Format not permitted\n" ); - return; - } - case PLAYER_ERROR_RESOURCE_LIMIT: - { - DALI_LOG_ERROR( "Player error: Resource limit\n" ); - return; - } - case PLAYER_ERROR_PERMISSION_DENIED: - { - DALI_LOG_ERROR( "Player error: Permission denied\n" ); - return; - } - case PLAYER_ERROR_SERVICE_DISCONNECTED: - { - DALI_LOG_ERROR( "Player error: Service disconnected\n" ); - return; - } - case PLAYER_ERROR_BUFFER_SPACE: - { - DALI_LOG_ERROR( "Player error: Buffer space\n" ); - return; - } - } - } -} - -} // unnamed namespace - -TizenVideoPlayer::TizenVideoPlayer() -: mUrl(), - mPlayer( NULL ), - mPlayerState( PLAYER_STATE_NONE ), - mTbmSurface( NULL ), - mPacket( NULL ), - mNativeImageSourcePtr( NULL ), - mTimer( NULL ), - mBackgroundColor( Vector4( 1.0f, 1.0f, 1.0f, 0.0f ) ), - mTargetType( NativeImage ), - mPacketMutex(), - mPacketVector(), - mEcoreWlWindow( NULL ), - mAlphaBitChanged( false ) -{ -} - -TizenVideoPlayer::~TizenVideoPlayer() -{ -} - -void TizenVideoPlayer::GetPlayerState( player_state_e* state ) -{ - if( mPlayer != NULL && player_get_state( mPlayer, state ) != PLAYER_ERROR_NONE ) - { - DALI_LOG_ERROR( "player_get_state error: Invalid parameter\n" ); - *state = PLAYER_STATE_NONE; - } -} - -void TizenVideoPlayer::SetUrl( const std::string& url ) -{ - if( mUrl != url ) - { - mUrl = url; - - GetPlayerState( &mPlayerState ); - - if( mPlayerState != PLAYER_STATE_NONE && mPlayerState != PLAYER_STATE_IDLE ) - { - Stop(); - int error = player_unprepare( mPlayer ); - LogPlayerError( error ); - } - - if( mPlayerState == PLAYER_STATE_IDLE ) - { - int error = player_set_uri( mPlayer, mUrl.c_str() ); - LogPlayerError( error ); - - error = player_prepare( mPlayer ); - LogPlayerError( error ); - } - } -} - -std::string TizenVideoPlayer::GetUrl() -{ - return mUrl; -} - -void TizenVideoPlayer::SetRenderingTarget( Any target ) -{ - int error; - if( mPlayerState != PLAYER_STATE_NONE ) - { - GetPlayerState( &mPlayerState ); - - if( mPlayerState != PLAYER_STATE_IDLE ) - { - Stop(); - error = player_unprepare( mPlayer ); - LogPlayerError( error ); - } - - error = player_destroy( mPlayer ); - LogPlayerError( error ); - mPlayerState = PLAYER_STATE_NONE; - mPlayer = NULL; - mUrl = ""; - } - - mNativeImageSourcePtr = NULL; - mEcoreWlWindow = NULL; - - if( target.GetType() == typeid( Dali::NativeImageSourcePtr ) ) - { - mTargetType = TizenVideoPlayer::NativeImage; - - Dali::NativeImageSourcePtr nativeImageSourcePtr = AnyCast< Dali::NativeImageSourcePtr >( target ); - - InitializeTextureStreamMode( nativeImageSourcePtr ); - } - else if( target.GetType() == typeid( Ecore_Wl_Window* ) ) - { - mTargetType = TizenVideoPlayer::WindowSurface; - - Ecore_Wl_Window* nativeWindow = Dali::AnyCast< Ecore_Wl_Window* >( target ); - InitializeUnderlayMode( nativeWindow ); - } - else - { - DALI_LOG_ERROR( "Video rendering target is unknown\n" ); - } -} - -void TizenVideoPlayer::SetLooping( bool looping ) -{ - GetPlayerState( &mPlayerState ); - - if( mPlayerState != PLAYER_STATE_NONE ) - { - int error = player_set_looping( mPlayer, looping ); - LogPlayerError( error ); - } -} - -bool TizenVideoPlayer::IsLooping() -{ - GetPlayerState( &mPlayerState ); - - bool looping = false; - if( mPlayerState != PLAYER_STATE_NONE ) - { - int error = player_is_looping( mPlayer, &looping ); - LogPlayerError( error ); - } - - return looping; -} - -void TizenVideoPlayer::Play() -{ - GetPlayerState( &mPlayerState ); - - if( mPlayerState == PLAYER_STATE_READY || mPlayerState == PLAYER_STATE_PAUSED ) - { - if( mNativeImageSourcePtr != NULL && mTimer ) - { - mTimer.Start(); - } - - int error = player_start( mPlayer ); - LogPlayerError( error ); - } -} - -void TizenVideoPlayer::Pause() -{ - GetPlayerState( &mPlayerState ); - - if( mPlayerState == PLAYER_STATE_PLAYING ) - { - int error = player_pause( mPlayer ); - LogPlayerError( error ); - - if( mNativeImageSourcePtr != NULL && mTimer ) - { - mTimer.Stop(); - DestroyPackets(); - } - } -} - -void TizenVideoPlayer::Stop() -{ - GetPlayerState( &mPlayerState ); - - if( mPlayerState == PLAYER_STATE_PLAYING || mPlayerState == PLAYER_STATE_PAUSED ) - { - int error = player_stop( mPlayer ); - LogPlayerError( error ); - } - - if( mNativeImageSourcePtr != NULL && mTimer ) - { - mTimer.Stop(); - DestroyPackets(); - } -} - -void TizenVideoPlayer::SetMute( bool muted ) -{ - GetPlayerState( &mPlayerState ); - - if( mPlayerState == PLAYER_STATE_IDLE || - mPlayerState == PLAYER_STATE_READY || - mPlayerState == PLAYER_STATE_PLAYING || - mPlayerState == PLAYER_STATE_PAUSED - ) - { - int error = player_set_mute( mPlayer, muted ); - LogPlayerError( error ); - } -} - -bool TizenVideoPlayer::IsMuted() -{ - GetPlayerState( &mPlayerState ); - bool muted = false; - - if( mPlayerState == PLAYER_STATE_IDLE || - mPlayerState == PLAYER_STATE_READY || - mPlayerState == PLAYER_STATE_PLAYING || - mPlayerState == PLAYER_STATE_PAUSED - ) - { - int error = player_is_muted( mPlayer, &muted ); - LogPlayerError( error ); - } - - return muted; -} - -void TizenVideoPlayer::SetVolume( float left, float right ) -{ - GetPlayerState( &mPlayerState ); - - int error = player_set_volume( mPlayer, left, right ); - LogPlayerError( error ); -} - -void TizenVideoPlayer::GetVolume( float& left, float& right ) -{ - GetPlayerState( &mPlayerState ); - - int error = player_get_volume( mPlayer, &left, &right ); - LogPlayerError( error ); -} - -void TizenVideoPlayer::SetPlayPosition( int millisecond ) -{ - int error; - - GetPlayerState( &mPlayerState ); - - if( mPlayerState == PLAYER_STATE_READY || - mPlayerState == PLAYER_STATE_PLAYING || - mPlayerState == PLAYER_STATE_PAUSED - ) - { - error = player_set_play_position( mPlayer, millisecond, false, PlayerSeekCompletedCb, NULL ); - LogPlayerError( error ); - } -} - -int TizenVideoPlayer::GetPlayPosition() -{ - int error; - int millisecond = 0; - - GetPlayerState( &mPlayerState ); - - if( mPlayerState == PLAYER_STATE_IDLE || - mPlayerState == PLAYER_STATE_READY || - mPlayerState == PLAYER_STATE_PLAYING || - mPlayerState == PLAYER_STATE_PAUSED - ) - { - error = player_get_play_position( mPlayer, &millisecond ); - LogPlayerError( error ); - } - - return millisecond; -} - -void TizenVideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation ) -{ - if( mNativeImageSourcePtr != NULL ) - { - DALI_LOG_ERROR( "SetDisplayRotation is only for window rendering target.\n" ); - return; - } - - int error; - if( mPlayerState != PLAYER_STATE_NONE ) - { - error = player_set_display_rotation( mPlayer, static_cast< player_display_rotation_e >( rotation ) ); - LogPlayerError( error ); - } -} - -Dali::VideoPlayerPlugin::DisplayRotation TizenVideoPlayer::GetDisplayRotation() -{ - if( mNativeImageSourcePtr != NULL ) - { - DALI_LOG_ERROR( "GetDisplayRotation is only for window rendering target.\n" ); - return Dali::VideoPlayerPlugin::ROTATION_NONE; - } - - int error; - player_display_rotation_e rotation = PLAYER_DISPLAY_ROTATION_NONE; - if( mPlayerState != PLAYER_STATE_NONE ) - { - error = player_get_display_rotation( mPlayer, &rotation ); - LogPlayerError( error ); - } - return static_cast< Dali::VideoPlayerPlugin::DisplayRotation >( rotation ); -} - -Dali::VideoPlayerPlugin::VideoPlayerSignalType& TizenVideoPlayer::FinishedSignal() -{ - return mFinishedSignal; -} - -void TizenVideoPlayer::InitializeTextureStreamMode( Dali::NativeImageSourcePtr nativeImageSourcePtr ) -{ - int error; - - mNativeImageSourcePtr = nativeImageSourcePtr; - - if( mAlphaBitChanged ) - { - ecore_wl_window_alpha_set( mEcoreWlWindow, false ); - mAlphaBitChanged = false; - } - - if( mPlayerState == PLAYER_STATE_NONE ) - { - error = player_create( &mPlayer ); - LogPlayerError( error ); - } - - GetPlayerState( &mPlayerState ); - - if( mPlayerState == PLAYER_STATE_IDLE ) - { - error = player_set_completed_cb( mPlayer, EmitPlaybackFinishedSignal, this ); - LogPlayerError( error ); - - error = player_set_media_packet_video_frame_decoded_cb( mPlayer, MediaPacketVideoDecodedCb, this ); - LogPlayerError( error ); - - error = player_set_sound_type( mPlayer, SOUND_TYPE_MEDIA ); - LogPlayerError( error ); - - error = player_set_display_mode( mPlayer, PLAYER_DISPLAY_MODE_FULL_SCREEN ); - LogPlayerError( error ); - - error = player_set_display( mPlayer, PLAYER_DISPLAY_TYPE_NONE, NULL ); - LogPlayerError( error ); - - error = player_set_display_visible( mPlayer, true ); - LogPlayerError( error ); - - mTimer = Dali::Timer::New( TIMER_INTERVAL ); - mTimer.TickSignal().Connect( this, &TizenVideoPlayer::Update ); - } -} - -void TizenVideoPlayer::InitializeUnderlayMode( Ecore_Wl_Window* ecoreWlWindow ) -{ - int error; - if( mPlayerState == PLAYER_STATE_NONE ) - { - error = player_create( &mPlayer ); - LogPlayerError( error ); - } - - GetPlayerState( &mPlayerState ); - mEcoreWlWindow = ecoreWlWindow; - - if( mPlayerState == PLAYER_STATE_IDLE ) - { - error = player_set_completed_cb( mPlayer, EmitPlaybackFinishedSignal, this ); - LogPlayerError( error ); - - error = player_set_sound_type( mPlayer, SOUND_TYPE_MEDIA ); - LogPlayerError( error ); - - error = player_set_display_mode( mPlayer, PLAYER_DISPLAY_MODE_DST_ROI ); - LogPlayerError( error ); - - error = player_set_display_roi_area( mPlayer, 0, 0, 1, 1 ); - - int width, height; - mAlphaBitChanged = ( ecore_wl_window_alpha_get( mEcoreWlWindow ) )? false: true; - ecore_wl_screen_size_get( &width, &height ); - - if( mAlphaBitChanged ) - { - ecore_wl_window_alpha_set( mEcoreWlWindow, true ); - } - error = player_set_ecore_wl_display( mPlayer, PLAYER_DISPLAY_TYPE_OVERLAY, mEcoreWlWindow, 0, 0, width, height ); - LogPlayerError( error ); - - error = player_set_display_visible( mPlayer, true ); - LogPlayerError( error ); - } -} - -bool TizenVideoPlayer::Update() -{ - Dali::Mutex::ScopedLock lock( mPacketMutex ); - - int error; - - if( mPacket != NULL ) - { - error = media_packet_destroy( mPacket ); - if( error != MEDIA_PACKET_ERROR_NONE ) - { - DALI_LOG_ERROR( "Media packet destroy error: %d\n", error ); - } - mPacket = NULL; - } - - if( !mPacketVector.Empty() ) - { - mPacket = static_cast< media_packet_h >( mPacketVector[0] ); - mPacketVector.Remove( mPacketVector.Begin() ); - } - - if( mPacket == NULL ) - { - return true; - } - - error = media_packet_get_tbm_surface( mPacket, &mTbmSurface ); - if( error != MEDIA_PACKET_ERROR_NONE ) - { - media_packet_destroy( mPacket ); - mPacket = NULL; - DALI_LOG_ERROR( " error: %d\n", error ); - return true; - } - - Any source( mTbmSurface ); - mNativeImageSourcePtr->SetSource( source ); - Dali::Stage::GetCurrent().KeepRendering( 0.0f ); - - return true; -} - -void TizenVideoPlayer::DestroyPackets() -{ - int error; - if( mPacket != NULL ) - { - error = media_packet_destroy( mPacket ); - DALI_LOG_ERROR( "Media packet destroy error: %d\n", error ); - mPacket = NULL; - } - - for(unsigned int i = 0; i < mPacketVector.Size(); ++i) - { - mPacket = static_cast< media_packet_h >( mPacketVector[i] ); - error = media_packet_destroy( mPacket ); - DALI_LOG_ERROR( "Media packet destroy error: %d\n", error ); - mPacket = NULL; - } - mPacketVector.Clear(); -} - -void TizenVideoPlayer::PushPacket( media_packet_h packet ) -{ - Dali::Mutex::ScopedLock lock( mPacketMutex ); - mPacketVector.PushBack( packet ); -} - -void TizenVideoPlayer::SetDisplayArea( DisplayArea area ) -{ - GetPlayerState( &mPlayerState ); - - if( mNativeImageSourcePtr != NULL ) - { - DALI_LOG_ERROR( "SetDisplayArea is only for window surface target.\n" ); - return; - } - - if( mPlayerState == PLAYER_STATE_IDLE || - mPlayerState == PLAYER_STATE_READY || - mPlayerState == PLAYER_STATE_PLAYING || - mPlayerState == PLAYER_STATE_PAUSED - - ) - { - int error = player_set_display_roi_area( mPlayer, area.x, area.y, area.width, area.height ); - LogPlayerError( error ); - } -} - -void TizenVideoPlayer::Forward( int millisecond ) -{ - int error; - - GetPlayerState( &mPlayerState ); - - if( mPlayerState == PLAYER_STATE_READY || - mPlayerState == PLAYER_STATE_PLAYING || - mPlayerState == PLAYER_STATE_PAUSED - ) - { - int currentPosition = 0; - int nextPosition = 0; - - error = player_get_play_position( mPlayer, ¤tPosition ); - LogPlayerError( error ); - - nextPosition = currentPosition + millisecond; - - error = player_set_play_position( mPlayer, nextPosition, false, PlayerSeekCompletedCb, NULL ); - LogPlayerError( error ); - } -} - -void TizenVideoPlayer::Backward( int millisecond ) -{ - int error; - - GetPlayerState( &mPlayerState ); - - if( mPlayerState == PLAYER_STATE_READY || - mPlayerState == PLAYER_STATE_PLAYING || - mPlayerState == PLAYER_STATE_PAUSED - ) - { - int currentPosition = 0; - int nextPosition = 0; - - error = player_get_play_position( mPlayer, ¤tPosition ); - LogPlayerError( error ); - - nextPosition = currentPosition - millisecond; - nextPosition = ( nextPosition < 0 )? 0 : nextPosition; - - error = player_set_play_position( mPlayer, nextPosition, false, PlayerSeekCompletedCb, NULL ); - LogPlayerError( error ); - } -} - -} // namespace Plugin -} // namespace Dali; diff --git a/plugins/video-player/tizen-video-player.h b/plugins/video-player/tizen-video-player.h deleted file mode 100644 index 9f870cc..0000000 --- a/plugins/video-player/tizen-video-player.h +++ /dev/null @@ -1,231 +0,0 @@ -#ifndef __DALI_TIZEN_VIDEO_PLAYER_PLUGIN_H__ -#define __DALI_TIZEN_VIDEO_PLAYER_PLUGIN_H__ - -/* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -// EXTERNAL INCLUDES -#include -#include -#include - -#ifndef HAVE_WAYLAND -#define HAVE_WAYLAND -#endif -#include - -// INTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ - -namespace Plugin -{ - -/** - * @brief Implementation of the Tizen video player class which has Tizen platform dependency. - * @SINCE_1_1.38 - */ -class TizenVideoPlayer : public Dali::VideoPlayerPlugin, public Dali::ConnectionTracker -{ -public: - - /** - * @brief Video rendering target type - * @SINCE_1_1.38 - */ - enum RenderingTargetType - { - WindowSurface, ///< HW underlay - NativeImage ///< texture stream - }; - - /** - * @brief Constructor. - * @SINCE_1_1.38 - */ - TizenVideoPlayer(); - - /** - * @brief Destructor. - * @SINCE_1_1.38 - */ - virtual ~TizenVideoPlayer(); - - /** - * @copydoc Dali::VideoPlayerPlugin::SetUrl() - */ - virtual void SetUrl( const std::string& url ); - - /** - * @copydoc Dali::VideoPlayerPlugin::GetUrl() - */ - virtual std::string GetUrl(); - - /** - * @copydoc Dali::VideoPlayerPlugin::SetLooping() - */ - virtual void SetLooping(bool looping); - - /** - * @copydoc Dali::VideoPlayerPlugin::IsLooping() - */ - virtual bool IsLooping(); - - /** - * @copydoc Dali::VideoPlayerPlugin::Play() - */ - virtual void Play(); - - /** - * @copydoc Dali::VideoPlayerPlugin::Pause() - */ - virtual void Pause(); - - /** - * @copydoc Dali::VideoPlayerPlugin::Stop() - */ - virtual void Stop(); - - /** - * @copydoc Dali::VideoPlayerPlugin::SetMute() - */ - virtual void SetMute( bool mute ); - - /** - * @copydoc Dali::VideoPlayerPlugin::IsMute() - */ - virtual bool IsMuted(); - - /** - * @copydoc Dali::VideoPlayerPlugin::SetVolume() - */ - virtual void SetVolume( float left, float right ); - - /** - * @copydoc Dali::VideoPlayerPlugin::GetVolume() - */ - virtual void GetVolume( float& left, float& right ); - - /** - * @copydoc Dali::VideoPlayerPlugin::SetRenderingTarget() - */ - void SetRenderingTarget( Any target ); - - /** - * @copydoc Dali::VideoPlayerPlugin::SetPlayPosition() - */ - virtual void SetPlayPosition( int millisecond ); - - /** - * @copydoc Dali::VideoPlayerPlugin::GetPlayPosition() - */ - virtual int GetPlayPosition(); - - /** - * @copydoc Dali::VideoPlayerPlugin::SetDisplayArea() - */ - virtual void SetDisplayArea( DisplayArea area ); - - /** - * @copydoc Dali::VideoPlayerPlugin::SetDisplayRotation() - */ - virtual void SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation ); - - /** - * @copydoc Dali::VideoPlayerPlugin::GetDisplayRotation() - */ - virtual Dali::VideoPlayerPlugin::DisplayRotation GetDisplayRotation(); - - /** - * @copydoc Dali::VideoPlayerPlugin::FinishedSignal() - */ - virtual Dali::VideoPlayerPlugin::VideoPlayerSignalType& FinishedSignal(); - - /** - * @brief Push media packet with video frame image - */ - void PushPacket( media_packet_h packet ); - - /** - * @brief Dali::VideoPlayer::Forward() - */ - void Forward( int millisecond ); - - /** - * @brief Dali::VideoPlayer::Backward() - */ - void Backward( int millisecond ); - -private: - - /** - * @brief Updates video frame image by timer if rendering targe is native image source - */ - bool Update(); - - /** - * @brief Gets current player state - */ - void GetPlayerState( player_state_e* state ); - - /** - * @brief Destroy all packests, which this plugin stores - */ - void DestroyPackets(); - - /** - * @brief Initializes player for video rendering using native image source - */ - void InitializeTextureStreamMode( Dali::NativeImageSourcePtr nativeImageSourcePtr ); - - /** - * @brief Initializes player for video rendering using wayland window surface - */ - void InitializeUnderlayMode( Ecore_Wl_Window* ecoreWlWindow ); - -private: - - std::string mUrl; ///< The video file path - player_h mPlayer; ///< Tizen player handle - player_state_e mPlayerState; ///< Tizen player state - tbm_surface_h mTbmSurface; ///< tbm surface handle - media_packet_h mPacket; ///< Media packet handle with tbm surface of current video frame image - Dali::NativeImageSourcePtr mNativeImageSourcePtr; ///< native image source for video rendering - Dali::Timer mTimer; ///< Timer for texture streaming rendering - Dali::Vector4 mBackgroundColor; ///< Current background color, which texturestream mode needs. - RenderingTargetType mTargetType; ///< Current rendering target type - - Dali::Mutex mPacketMutex; - Dali::Vector< media_packet_h > mPacketVector; ///< Container for media packet handle from Tizen player callback - - Ecore_Wl_Window* mEcoreWlWindow; - - bool mAlphaBitChanged; ///< True if underlay rendering initialization changes window alpha - -public: - - Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal; -}; - -} // namespace Plugin -} // namespace Dali; - -#endif -- 2.7.4