1 #ifndef __DALI_TIZEN_VIDEO_PLAYER_PLUGIN_H__
2 #define __DALI_TIZEN_VIDEO_PLAYER_PLUGIN_H__
5 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/devel-api/threading/mutex.h>
29 #include <player_internal.h>
32 #include <native-image-source.h>
33 #include <video-player-plugin.h>
43 * @brief Implementation of the Tizen video player class which has Tizen platform dependency.
46 class TizenVideoPlayer : public Dali::VideoPlayerPlugin, public Dali::ConnectionTracker
51 * @brief Video rendering target type
54 enum RenderingTargetType
56 WindowSurface, ///< HW underlay
57 NativeImage ///< texture stream
70 virtual ~TizenVideoPlayer();
73 * @copydoc Dali::VideoPlayerPlugin::SetUrl()
75 virtual void SetUrl( const std::string& url );
78 * @copydoc Dali::VideoPlayerPlugin::GetUrl()
80 virtual std::string GetUrl();
83 * @copydoc Dali::VideoPlayerPlugin::SetLooping()
85 virtual void SetLooping(bool looping);
88 * @copydoc Dali::VideoPlayerPlugin::IsLooping()
90 virtual bool IsLooping();
93 * @copydoc Dali::VideoPlayerPlugin::Play()
98 * @copydoc Dali::VideoPlayerPlugin::Pause()
100 virtual void Pause();
103 * @copydoc Dali::VideoPlayerPlugin::Stop()
108 * @copydoc Dali::VideoPlayerPlugin::SetMute()
110 virtual void SetMute( bool mute );
113 * @copydoc Dali::VideoPlayerPlugin::IsMute()
115 virtual bool IsMuted();
118 * @copydoc Dali::VideoPlayerPlugin::SetVolume()
120 virtual void SetVolume( float left, float right );
123 * @copydoc Dali::VideoPlayerPlugin::GetVolume()
125 virtual void GetVolume( float& left, float& right );
128 * @copydoc Dali::VideoPlayerPlugin::SetRenderingTarget()
130 void SetRenderingTarget( Any target );
133 * @copydoc Dali::VideoPlayerPlugin::SetPlayPosition()
135 virtual void SetPlayPosition( int millisecond );
138 * @copydoc Dali::VideoPlayerPlugin::GetPlayPosition()
140 virtual int GetPlayPosition();
143 * @copydoc Dali::VideoPlayerPlugin::SetDisplayRotation()
145 virtual void SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation );
148 * @copydoc Dali::VideoPlayerPlugin::GetDisplayRotation()
150 virtual Dali::VideoPlayerPlugin::DisplayRotation GetDisplayRotation();
153 * @copydoc Dali::VideoPlayerPlugin::FinishedSignal()
155 virtual Dali::VideoPlayerPlugin::VideoPlayerSignalType& FinishedSignal();
158 * @brief Push media packet with video frame image
160 void PushPacket( media_packet_h packet );
165 * @brief Updates video frame image by timer if rendering targe is native image source
170 * @brief Gets current player state
172 void GetPlayerState( player_state_e* state );
175 * @brief Destroy all packests, which this plugin stores
177 void DestroyPackets();
180 * @brief Initializes player for video rendering using native image source
182 void InitializeTextureStreamMode( Dali::NativeImageSourcePtr nativeImageSourcePtr );
185 * @brief Initializes player for video rendering using wayland window surface
187 void InitializeUnderlayMode( Ecore_Wl_Window* ecoreWlWindow );
191 std::string mUrl; ///< The video file path
192 player_h mPlayer; ///< Tizen player handle
193 player_state_e mPlayerState; ///< Tizen player state
194 tbm_surface_h mTbmSurface; ///< tbm surface handle
195 media_packet_h mPacket; ///< Media packet handle with tbm surface of current video frame image
196 Dali::NativeImageSourcePtr mNativeImageSourcePtr; ///< native image source for video rendering
197 Dali::Timer mTimer; ///< Timer for texture streaming rendering
198 Dali::Vector4 mBackgroundColor; ///< Current background color, which texturestream mode needs.
199 RenderingTargetType mTargetType; ///< Current rendering target type
201 Dali::Mutex mPacketMutex;
202 Dali::Vector< media_packet_h > mPacketVector; ///< Container for media packet handle from Tizen player callback
206 Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
209 } // namespace Plugin