From: Wonsik Jung Date: Thu, 11 Jun 2020 05:45:13 +0000 (+0900) Subject: Add the synchronization between Ui and Video player X-Git-Tag: dali_1.9.23~8 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git;a=commitdiff_plain;h=2330036d3c9b9b78633284e60ec6f60c2d1464da Add the synchronization between Ui and Video player This patch is to support the synchronization between video player and UI. To do that, video player's changing function as resize/move should be called before calling eglSwapBuffers Change-Id: I543f3646646bc8cbea6bacd9d8e81c12f6fe9187 --- diff --git a/dali/devel-api/adaptor-framework/video-player-plugin.h b/dali/devel-api/adaptor-framework/video-player-plugin.h index 73d175e..9cfc799 100755 --- a/dali/devel-api/adaptor-framework/video-player-plugin.h +++ b/dali/devel-api/adaptor-framework/video-player-plugin.h @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include namespace Dali { @@ -273,6 +274,18 @@ public: */ virtual Any GetMediaPlayer() = 0; + /** + * @brief calls synchronization function in window system + * This function is called, the synchronization is started between UI(transparent hole) and video player. + */ + virtual void StartSynchronization() = 0; + + /** + * @brief calls desynchronization function in window system + * This function is called, the synchronization is finished between UI(transparent hole) and video player. + */ + virtual void FinishSynchronization() = 0; + }; } // namespace Dali; diff --git a/dali/devel-api/adaptor-framework/video-player.cpp b/dali/devel-api/adaptor-framework/video-player.cpp index 870571b..ecbd537 100755 --- a/dali/devel-api/adaptor-framework/video-player.cpp +++ b/dali/devel-api/adaptor-framework/video-player.cpp @@ -46,7 +46,20 @@ VideoPlayer VideoPlayer::New() if( player ) { - player->Initialize(); + Dali::Actor actor; + player->Initialize( actor, VideoSyncMode::DISABLED ); + } + + return VideoPlayer( player.Get() ); +} + +VideoPlayer VideoPlayer::New( Dali::Actor actor, VideoSyncMode syncMode ) +{ + Internal::Adaptor::VideoPlayerPtr player = Internal::Adaptor::VideoPlayer::New(); + + if( player ) + { + player->Initialize( actor, syncMode ); } return VideoPlayer( player.Get() ); @@ -201,5 +214,15 @@ Any VideoPlayer::GetMediaPlayer() return GetImplementation( *this ).GetMediaPlayer(); } +void VideoPlayer::StartSynchronization() +{ + GetImplementation( *this ).StartSynchronization(); +} + +void VideoPlayer::FinishSynchronization() +{ + GetImplementation( *this ).FinishSynchronization(); +} + } // namespace Dali; diff --git a/dali/devel-api/adaptor-framework/video-player.h b/dali/devel-api/adaptor-framework/video-player.h index 6db7304..a019131 100755 --- a/dali/devel-api/adaptor-framework/video-player.h +++ b/dali/devel-api/adaptor-framework/video-player.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include //INTERNAL INCLUDES #include @@ -66,6 +67,17 @@ public: */ static VideoPlayer New(); + /** + * @brief Creates a new instance of a VideoPlayer. + * + * If you want the video player works with Ui synchronous when video player is resized/moved, + * put the video view actor and the enabled syncMode. + * + * @param[in] actor video view's actor instance + * @param[in] syncMode The synchronization mode between the UI (transparent hole) and VideoPlayer. + */ + static VideoPlayer New( Dali::Actor actor, VideoSyncMode syncMode ); + /** * @brief Copy constructor. * @@ -278,6 +290,18 @@ public: */ Any GetMediaPlayer(); + /** + * @brief calls synchronization function in window system + * This function is called, the synchronization is started between UI(transparent hole) and video player. + */ + void StartSynchronization(); + + /** + * @brief calls desynchronization function in window system + * This function is called, the synchronization is ended between UI(transparent hole) and video player. + */ + void FinishSynchronization(); + private: // Not intended for application developers /** diff --git a/dali/devel-api/adaptor-framework/video-sync-mode.h b/dali/devel-api/adaptor-framework/video-sync-mode.h new file mode 100644 index 0000000..dd4ce6f --- /dev/null +++ b/dali/devel-api/adaptor-framework/video-sync-mode.h @@ -0,0 +1,34 @@ +#ifndef DALI_VIDEO_SYNC_MODE +#define DALI_VIDEO_SYNC_MODE + +/* + * Copyright (c) 2019 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. + * + */ + +namespace Dali +{ + /** + * @brief Enumeration for the synchronization is ended between UI(transparent hole) and video player. + */ + enum class VideoSyncMode + { + DISABLED = 0, + ENABLED + }; + +} // Dali +#endif // DALI_VIDEO_SYNC_MODE + diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index 789939d..91c5cee 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -85,6 +85,7 @@ SET( devel_api_adaptor_framework_header_files ${adaptor_devel_api_dir}/adaptor-framework/thread-settings.h ${adaptor_devel_api_dir}/adaptor-framework/window-devel.h ${adaptor_devel_api_dir}/adaptor-framework/component-application.h + ${adaptor_devel_api_dir}/adaptor-framework/video-sync-mode.h ) diff --git a/dali/internal/video/common/video-player-impl.cpp b/dali/internal/video/common/video-player-impl.cpp index 64ed46a..7fd5bd8 100755 --- a/dali/internal/video/common/video-player-impl.cpp +++ b/dali/internal/video/common/video-player-impl.cpp @@ -77,7 +77,7 @@ VideoPlayer::~VideoPlayer() } } -void VideoPlayer::Initialize() +void VideoPlayer::Initialize( Dali::Actor actor, VideoSyncMode syncMode ) { char* error = NULL; @@ -99,7 +99,7 @@ void VideoPlayer::Initialize() return; } - mPlugin = mCreateVideoPlayerPtr(); + mPlugin = mCreateVideoPlayerPtr( actor, syncMode ); if( mPlugin == NULL ) { @@ -343,6 +343,22 @@ Any VideoPlayer::GetMediaPlayer() return NULL; } +void VideoPlayer::StartSynchronization() +{ + if( mPlugin != NULL ) + { + mPlugin->StartSynchronization(); + } +} + +void VideoPlayer::FinishSynchronization() +{ + if( mPlugin != NULL ) + { + mPlugin->FinishSynchronization(); + } +} + } // namespace Adaptor; } // namespace Internal; } // namespace Dali; diff --git a/dali/internal/video/common/video-player-impl.h b/dali/internal/video/common/video-player-impl.h index 71a493e..cac7744 100755 --- a/dali/internal/video/common/video-player-impl.h +++ b/dali/internal/video/common/video-player-impl.h @@ -20,6 +20,7 @@ // EXTERNAL INCLUDES #include +#include // INTERNAL INCLUDES #include @@ -147,7 +148,7 @@ public: /** * @brief Initializes member data. */ - void Initialize(); + void Initialize( Dali::Actor actor, VideoSyncMode syncMode ); /** * @brief Dali::VideoPlayer::Forward() @@ -189,6 +190,16 @@ public: */ Any GetMediaPlayer(); + /** + * @brief Dali::VideoPlayer::StartSynchronization() + */ + void StartSynchronization(); + + /** + * @copydoc Dali::VideoPlayer::FinishSynchronization() + */ + void FinishSynchronization(); + private: /** @@ -214,7 +225,7 @@ private: Dali::VideoPlayerPlugin* mPlugin; ///< Videoplayer plugin handle void* mHandle; ///< Handle for the loaded library - typedef Dali::VideoPlayerPlugin* (*CreateVideoPlayerFunction)(); + typedef Dali::VideoPlayerPlugin* (*CreateVideoPlayerFunction)( Dali::Actor actor, Dali::VideoSyncMode syncMode ); typedef void (*DestroyVideoPlayerFunction)( Dali::VideoPlayerPlugin* plugin ); CreateVideoPlayerFunction mCreateVideoPlayerPtr;