Add the synchronization between Ui and Video player 33/235933/17
authorWonsik Jung <sidein@samsung.com>
Thu, 11 Jun 2020 05:45:13 +0000 (14:45 +0900)
committerWonsik Jung <sidein@samsung.com>
Fri, 24 Jul 2020 00:55:20 +0000 (09:55 +0900)
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

dali/devel-api/adaptor-framework/video-player-plugin.h
dali/devel-api/adaptor-framework/video-player.cpp
dali/devel-api/adaptor-framework/video-player.h
dali/devel-api/adaptor-framework/video-sync-mode.h [new file with mode: 0644]
dali/devel-api/file.list
dali/internal/video/common/video-player-impl.cpp
dali/internal/video/common/video-player-impl.h

index 73d175e..9cfc799 100755 (executable)
@@ -21,6 +21,7 @@
 // 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
 {
@@ -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;
index 870571b..ecbd537 100755 (executable)
@@ -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;
 
index 6db7304..a019131 100755 (executable)
@@ -20,6 +20,7 @@
 
 // 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>
@@ -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 (file)
index 0000000..dd4ce6f
--- /dev/null
@@ -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
+
index 789939d..91c5cee 100755 (executable)
@@ -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
 )
 
 
index 64ed46a..7fd5bd8 100755 (executable)
@@ -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;
index 71a493e..cac7744 100755 (executable)
@@ -20,6 +20,7 @@
 
 // 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>
@@ -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;