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
// EXTERNAL INCLUDES
#include <dali/public-api/signals/dali-signal.h>
#include <dali/public-api/math/rect.h>
+#include <dali/public-api/actors/actor.h>
namespace Dali
{
*/
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;
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() );
return GetImplementation( *this ).GetMediaPlayer();
}
+void VideoPlayer::StartSynchronization()
+{
+ GetImplementation( *this ).StartSynchronization();
+}
+
+void VideoPlayer::FinishSynchronization()
+{
+ GetImplementation( *this ).FinishSynchronization();
+}
+
} // namespace Dali;
// EXTERNAL INCLUDES
#include <dali/public-api/object/base-handle.h>
+#include <dali/devel-api/adaptor-framework/video-sync-mode.h>
//INTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/video-player-plugin.h>
*/
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.
*
*/
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
/**
--- /dev/null
+#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
+
${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
)
}
}
-void VideoPlayer::Initialize()
+void VideoPlayer::Initialize( Dali::Actor actor, VideoSyncMode syncMode )
{
char* error = NULL;
return;
}
- mPlugin = mCreateVideoPlayerPtr();
+ mPlugin = mCreateVideoPlayerPtr( actor, syncMode );
if( mPlugin == NULL )
{
return NULL;
}
+void VideoPlayer::StartSynchronization()
+{
+ if( mPlugin != NULL )
+ {
+ mPlugin->StartSynchronization();
+ }
+}
+
+void VideoPlayer::FinishSynchronization()
+{
+ if( mPlugin != NULL )
+ {
+ mPlugin->FinishSynchronization();
+ }
+}
+
} // namespace Adaptor;
} // namespace Internal;
} // namespace Dali;
// EXTERNAL INCLUDES
#include <dali/public-api/object/base-object.h>
+#include <dali/devel-api/adaptor-framework/video-sync-mode.h>
// INTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/video-player.h>
/**
* @brief Initializes member data.
*/
- void Initialize();
+ void Initialize( Dali::Actor actor, VideoSyncMode syncMode );
/**
* @brief Dali::VideoPlayer::Forward()
*/
Any GetMediaPlayer();
+ /**
+ * @brief Dali::VideoPlayer::StartSynchronization()
+ */
+ void StartSynchronization();
+
+ /**
+ * @copydoc Dali::VideoPlayer::FinishSynchronization()
+ */
+ void FinishSynchronization();
+
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;