71a493e3b173f9d29f2de8b9f6dc6824fcdc3cd4
[platform/core/uifw/dali-adaptor.git] / dali / internal / video / common / video-player-impl.h
1 #ifndef DALI_VIDEO_PLAYER_IMPL_H
2 #define DALI_VIDEO_PLAYER_IMPL_H
3
4 /*
5  * Copyright (c) 2019 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/base-object.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/devel-api/adaptor-framework/video-player.h>
26 #include <dali/devel-api/adaptor-framework/video-player-plugin.h>
27
28 namespace Dali
29 {
30 class Any;
31
32 namespace Internal
33 {
34
35 namespace Adaptor
36 {
37
38 class VideoPlayer;
39
40 typedef IntrusivePtr< VideoPlayer > VideoPlayerPtr;
41
42 /**
43  * @brief VideoPlayer class is used for video playback.
44  * @SINCE_1_1.24
45  */
46 class VideoPlayer: public Dali::BaseObject
47 {
48 public:
49
50   /**
51    * @brief Creates a new VideoPlayer handle
52    * @SINCE_1_1.24
53    * @return VideoPlayer pointer
54    */
55   static VideoPlayerPtr New();
56
57   /**
58    * @copydoc Dali::VideoPlayer::SetUrl()
59    */
60   void SetUrl( const std::string& url );
61
62   /**
63    * @copydoc Dali::VideoPlayer::GetUrl()
64    */
65   std::string GetUrl();
66
67   /**
68    * @copydoc Dali::VideoPlayer::SetLooping()
69    */
70   void SetLooping(bool looping);
71
72   /**
73    * @copydoc Dali::VideoPlayer::IsLooping()
74    */
75   bool IsLooping();
76
77   /**
78    * @copydoc Dali::VideoPlayer::Play()
79    */
80   void Play();
81
82   /**
83    * @copydoc Dali::VideoPlayer::Pause()
84    */
85   void Pause();
86
87   /**
88    * @copydoc Dali::VideoPlayer::Stop()
89    */
90   void Stop();
91
92   /**
93    * @copydoc Dali::VideoPlayer::SetMute()
94    */
95   void SetMute( bool mute );
96
97   /**
98    * @copydoc Dali::VideoPlayer::IsMuted()
99    */
100   bool IsMuted();
101
102   /**
103    * @copydoc Dali::VideoPlayer::SetVolume()
104    */
105   void SetVolume( float left, float right );
106
107   /**
108    * @copydoc Dali::VideoPlayer::GetVolume()
109    */
110   void GetVolume( float& left, float& right );
111
112   /**
113    * @copydoc Dali::VideoPlayer::SetRenderingTarget()
114    */
115   void SetRenderingTarget( Dali::Any target );
116
117   /**
118    * @copydoc Dali::VideoPlayer::SetPlayPosition()
119    */
120   void SetPlayPosition( int millisecond );
121
122   /**
123    * @copydoc Dali::VideoPlayer::GetPlayPosition()
124    */
125   int GetPlayPosition();
126
127   /**
128    * @copydoc Dali::VideoPlayer::SetDisplayArea()
129    */
130   void SetDisplayArea( DisplayArea area );
131
132   /**
133    * @copydoc Dali::VideoPlayer::SetSetDisplayRotation()
134    */
135   void SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation );
136
137   /**
138    * @copydoc Dali::VideoPlayer::GetDisplayRotation()
139    */
140   Dali::VideoPlayerPlugin::DisplayRotation GetDisplayRotation();
141
142   /**
143    * @copydoc Dali::VideoPlayer::FinishedSignal()
144    */
145   Dali::VideoPlayerPlugin::VideoPlayerSignalType& FinishedSignal();
146
147   /**
148    * @brief Initializes member data.
149    */
150   void Initialize();
151
152   /**
153    * @brief Dali::VideoPlayer::Forward()
154    */
155   void Forward( int millisecond );
156
157   /**
158    * @brief Dali::VideoPlayer::Backward()
159    */
160   void Backward( int millisecond );
161
162   /**
163    * @brief Dali::VideoPlayer::IsVideoTextureSupported()
164    */
165   bool IsVideoTextureSupported();
166
167   /**
168    * @brief Dali::VideoPlayer::SetCodecType()
169    */
170   void SetCodecType( Dali::VideoPlayerPlugin::CodecType type );
171
172   /**
173    * @brief Dali::VideoPlayer::GetCodecType()
174    */
175   Dali::VideoPlayerPlugin::CodecType GetCodecType() const;
176
177   /**
178    * @copydoc Dali::VideoPlayer::SetDisplayMode()
179    */
180   void SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode );
181
182   /**
183    * @brief Dali::VideoPlayer::GetDisplayMode()
184    */
185   Dali::VideoPlayerPlugin::DisplayMode::Type GetDisplayMode() const;
186
187   /**
188    * @brief Dali::VideoPlayer::GetMediaPlayer()
189    */
190   Any GetMediaPlayer();
191
192 private:
193
194   /**
195    * @brief Constructor.
196    * @SINCE_1_1.24
197    */
198   VideoPlayer();
199
200   /**
201    * @brief Destructor.
202    * @SINCE_1_1.24
203    */
204   virtual ~VideoPlayer();
205
206   // Undefined copy constructor
207   VideoPlayer( const VideoPlayer& player );
208
209   // Undefined assignment operator
210   VideoPlayer& operator=( const VideoPlayer& player );
211
212 private:
213
214   Dali::VideoPlayerPlugin* mPlugin; ///< Videoplayer plugin handle
215   void* mHandle; ///< Handle for the loaded library
216
217   typedef Dali::VideoPlayerPlugin* (*CreateVideoPlayerFunction)();
218   typedef void (*DestroyVideoPlayerFunction)( Dali::VideoPlayerPlugin* plugin );
219
220   CreateVideoPlayerFunction mCreateVideoPlayerPtr;
221   DestroyVideoPlayerFunction mDestroyVideoPlayerPtr;
222
223   Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
224 };
225
226 } // namespace Adaptor
227 } // namespace Internal
228
229 inline static Internal::Adaptor::VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
230 {
231   DALI_ASSERT_ALWAYS( player && "VideoPlayer handle is empty." );
232
233   BaseObject& handle = player.GetBaseObject();
234
235   return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
236 }
237
238 inline static const Internal::Adaptor::VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
239 {
240   DALI_ASSERT_ALWAYS( player && "VideoPlayer handle is empty." );
241
242   const BaseObject& handle = player.GetBaseObject();
243
244   return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
245 }
246
247 } // namespace Dali;
248
249 #endif // DALI_VIDEO_PLAYER_IMPL_H
250