*/
// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/video-player-plugin.h>
+#include <dali/devel-api/adaptor-framework/video-sync-mode.h>
#include <dali/devel-api/threading/mutex.h>
-#include <dali/public-api/adaptor-framework/timer.h>
#include <dali/public-api/adaptor-framework/native-image-source.h>
-#include <dali/devel-api/adaptor-framework/video-player-plugin.h>
+#include <dali/public-api/adaptor-framework/timer.h>
+#include <dali/public-api/animation/constraints.h>
+#include <dali/public-api/object/weak-handle.h>
#include <player.h>
#include <string>
+#include <list>
#ifndef HAVE_WAYLAND
#define HAVE_WAYLAND
#endif
-#include <player_internal.h>
#include <Ecore_Wl2.h>
+#include <player_internal.h>
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
+ WINDOW_SURFACE, ///< HW underlay @SINCE_1_9.28
+ NATIVE_IMAGE ///< texture stream @SINCE_1_9.28
};
/**
* @brief Constructor.
- * @SINCE_1_1.38
*/
- TizenVideoPlayer();
+ TizenVideoPlayer(Dali::Actor actor, Dali::VideoSyncMode syncMode);
/**
* @brief Destructor.
/**
* @copydoc Dali::VideoPlayerPlugin::SetUrl()
*/
- virtual void SetUrl( const std::string& url );
+ virtual void SetUrl(const std::string& url);
/**
* @copydoc Dali::VideoPlayerPlugin::GetUrl()
/**
* @copydoc Dali::VideoPlayerPlugin::SetMute()
*/
- virtual void SetMute( bool mute );
+ virtual void SetMute(bool mute);
/**
* @copydoc Dali::VideoPlayerPlugin::IsMute()
/**
* @copydoc Dali::VideoPlayerPlugin::SetVolume()
*/
- virtual void SetVolume( float left, float right );
+ virtual void SetVolume(float left, float right);
/**
* @copydoc Dali::VideoPlayerPlugin::GetVolume()
*/
- virtual void GetVolume( float& left, float& right );
+ virtual void GetVolume(float& left, float& right);
/**
* @copydoc Dali::VideoPlayerPlugin::SetRenderingTarget()
*/
- void SetRenderingTarget( Any target );
+ void SetRenderingTarget(Any target);
/**
* @copydoc Dali::VideoPlayerPlugin::SetPlayPosition()
*/
- virtual void SetPlayPosition( int millisecond );
+ virtual void SetPlayPosition(int millisecond);
/**
* @copydoc Dali::VideoPlayerPlugin::GetPlayPosition()
/**
* @copydoc Dali::VideoPlayerPlugin::SetDisplayArea()
*/
- virtual void SetDisplayArea( DisplayArea area );
+ virtual void SetDisplayArea(DisplayArea area);
/**
* @copydoc Dali::VideoPlayerPlugin::SetDisplayRotation()
*/
- virtual void SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation );
+ virtual void SetDisplayRotation(Dali::VideoPlayerPlugin::DisplayRotation rotation);
/**
* @copydoc Dali::VideoPlayerPlugin::GetDisplayRotation()
/**
* @brief Push media packet with video frame image
*/
- void PushPacket( media_packet_h packet );
+ void PushPacket(media_packet_h packet);
/**
* @brief Dali::VideoPlayer::Forward()
*/
- void Forward( int millisecond );
+ void Forward(int millisecond);
/**
* @brief Dali::VideoPlayer::Backward()
*/
- void Backward( int millisecond );
+ void Backward(int millisecond);
/**
* @brief Dali::VideoPlayer::IsVideoTextureSupported()
/**
* @brief Dali::VideoPlayer::SetCodecType()
*/
- void SetCodecType( Dali::VideoPlayerPlugin::CodecType type );
+ void SetCodecType(Dali::VideoPlayerPlugin::CodecType type);
/**
* @brief Dali::VideoPlayer::GetCodecType()
/**
* @copydoc Dali::VideoPlayerPlugin::SetDisplayMode()
*/
- void SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode );
+ void SetDisplayMode(Dali::VideoPlayerPlugin::DisplayMode::Type mode);
/**
* @copydoc Dali::VideoPlayerPlugin::GetDisplayMode()
*/
Dali::VideoPlayerPlugin::DisplayMode::Type GetDisplayMode() const;
-private:
+ /**
+ * @copydoc Dali::VideoPlayerPlugin::GetMediaPlayer()
+ */
+ Any GetMediaPlayer();
/**
+ * @copydoc Dali::VideoPlayerPlugin::StartSynchronization()
+ */
+ void StartSynchronization();
+
+ /**
+ * @copydoc Dali::VideoPlayerPlugin::FinishSynchronization()
+ */
+ void FinishSynchronization();
+
+ /**
+ * @copydoc Dali::VideoPlayerPlugin::RaiseAbove()
+ */
+ void RaiseAbove(Any videoSurface);
+
+ /**
+ * @copydoc Dali::VideoPlayerPlugin::LowerBelow()
+ */
+ void LowerBelow(Any videoSurface);
+
+ /**
+ * @copydoc Dali::VideoPlayerPlugin::RaiseToTop()
+ */
+ void RaiseToTop();
+
+ /**
+ * @copydoc Dali::VideoPlayerPlugin::LowerToBottom()
+ */
+ void LowerToBottom();
+
+ /**
+ * @copydoc Dali::VideoPlayerPlugin::GetVideoPlayerSurface()
+ */
+ Any GetVideoPlayerSurface();
+
+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 ) const;
+ void GetPlayerState(player_state_e* state) const;
/**
* @brief Destroy all packests, which this plugin stores
/**
* @brief Initializes player for video rendering using native image source
*/
- void InitializeTextureStreamMode( Dali::NativeImageSourcePtr nativeImageSourcePtr );
+ void InitializeTextureStreamMode(Dali::NativeImageSourcePtr nativeImageSourcePtr);
/**
* @brief Initializes player for video rendering using wayland window surface
*/
- void InitializeUnderlayMode( Ecore_Wl2_Window* ecoreWlWindow );
+ void InitializeUnderlayMode(Ecore_Wl2_Window* ecoreWlWindow);
+
+ /**
+ * @brief Initializes player for video rendering with synchronization mode.
+ *
+ * @param[in] ecoreWlWindow The window for synchronization mode.
+ */
+ void InitializeEnableSyncMode(Ecore_Wl2_Window* ecoreWlWindow);
/**
* @brief Destroys player handle
*/
void DestroyPlayer();
-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
+ /**
+ * @brief Create Constraint for synchronization
+ */
+ void CreateConstraint();
- Dali::Mutex mPacketMutex;
- Dali::Vector< media_packet_h > mPacketVector; ///< Container for media packet handle from Tizen player callback
+ /**
+ * @brief Destroy Constraint for synchronization
+ */
+ void DestroyConstraint();
- Ecore_Wl2_Window* mEcoreWlWindow;
+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
- bool mAlphaBitChanged; ///< True if underlay rendering initialization changes window alpha
+ Dali::Mutex mPacketMutex;
+ std::list<media_packet_h> mPacketList; ///< Container for media packet handle from Tizen player callback
sound_stream_info_h mStreamInfo;
sound_stream_type_e mStreamType;
player_video_codec_type_ex_e mCodecType;
-public:
+ Ecore_Wl2_Window* mEcoreWlWindow; ///< ecore native window handle
+ Ecore_Wl2_Subsurface* mEcoreSubVideoWindow; ///< ecore native subsurface for synchronization with video player
+ Dali::WeakHandle<Dali::Actor> mSyncActor;
+ Constraint mVideoSizePropertyConstraint;
+ Property::Index mVideoSizePropertyIndex;
+ Dali::VideoSyncMode mSyncMode;
+
+ bool mIsInitForSyncMode; ///< the flag for synchronization with video player
+ bool mIsMovedHandle; ///< the flag for moved the handle
+
+public:
Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
};
} // namespace Plugin
-} // namespace Dali;
+} // namespace Dali
#endif