Merge "Added an devel-API to check whether video texture is supported" into devel...
[platform/core/uifw/dali-adaptor.git] / adaptors / devel-api / adaptor-framework / video-player.h
1 #ifndef __DALI_VIDEO_PLAYER_H__
2 #define __DALI_VIDEO_PLAYER_H__
3
4 /*
5  * Copyright (c) 2016 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-handle.h>
23
24 //INTERNAL INCLUDES
25 #include "video-player-plugin.h"
26
27 namespace Dali
28 {
29
30 class Any;
31
32 namespace Internal
33 {
34
35 namespace Adaptor
36 {
37   class VideoPlayer;
38 } // namespace Adaptor
39
40 } // namespace Internal
41
42 /**
43  * @brief VideoPlayer class is used for video playback.
44  * @SINCE_1_1.38
45  */
46 class DALI_IMPORT_API VideoPlayer: public BaseHandle
47 {
48 public:
49
50   /**
51    * @brief Constructor.
52    * @SINCE_1_1.38
53    */
54   VideoPlayer();
55
56   /**
57    * @brief Destructor.
58    * @SINCE_1_1.38
59    */
60   ~VideoPlayer();
61
62   /**
63    * @brief Creates a new instance of a VideoPlayer.
64    * @SINCE_1_1.38
65    */
66   static VideoPlayer New();
67
68  /**
69    * @brief Copy constructor.
70    *
71    * @SINCE_1_1.38
72    * @param[in] player VideoPlayer to copy. The copied player will point at the same implementation
73    */
74   VideoPlayer( const VideoPlayer& player );
75
76  /**
77    * @brief Assignment operator.
78    *
79    * @SINCE_1_1.38
80    * @param[in] player The VideoPlayer to assign from.
81    * @return The updated VideoPlayer.
82    */
83   VideoPlayer& operator=( const VideoPlayer& player );
84
85   /**
86    * @brief Downcast a handle to VideoPlayer handle.
87    *
88    * If handle points to a VideoPlayer the downcast produces valid
89    * handle. If not the returned handle is left uninitialized.
90    *
91    * @SINCE_1_1.38
92    * @param[in] handle Handle to an object
93    * @return Handle to a VideoPlayer or an uninitialized handle
94    */
95   static VideoPlayer DownCast( BaseHandle handle );
96
97   /**
98    * @brief Sets a URL of the video file to play.
99    *
100    * @SINCE_1_1.38
101    * @param [in] url The url of video file
102    */
103   void SetUrl( const std::string& url );
104
105   /**
106    * @brief Returns the URL of the video file.
107    * @SINCE_1_1.38
108    * @return Url of string type
109    */
110   std::string GetUrl();
111
112   /**
113    * @brief Sets the player looping status.
114    * @SINCE_1_1.38
115    *
116    * @param [in] looping The new looping status: true or false
117    */
118   void SetLooping(bool looping);
119
120   /**
121    * @brief Returns the player looping status.
122    * @SINCE_1_1.38
123    *
124    * @return True if player is looping, false otherwise.
125    */
126   bool IsLooping();
127
128   /**
129    * @brief Starts the video playback.
130    * @SINCE_1_1.38
131    */
132   void Play();
133
134   /**
135    * @brief Pauses the video playback.
136    * @SINCE_1_1.38
137    */
138   void Pause();
139
140   /**
141    * @brief Stops the video playback.
142    * @SINCE_1_1.38
143    */
144   void Stop();
145
146   /**
147    * @brief Sets the player mute status.
148    * @SINCE_1_1.38
149    * @param[in] mute The new mute status, true is mute.
150    */
151   void SetMute( bool mute );
152
153   /**
154    * @brief Returns the player mute status.
155    * @SINCE_1_1.38
156    * @return True if player is mute.
157    */
158   bool IsMuted();
159
160   /**
161    * @brief Sets the player volume.
162    * @SINCE_1_1.38
163    * @param[in] left The left volume scalar
164    * @param[in] right The right volume scalar
165    */
166   void SetVolume( float left, float right );
167
168   /**
169    * @brief Returns current volume factor.
170    * @SINCE_1_1.38
171    * @param[out] left The current left volume scalar
172    * @param[out] right The current right volume scalar
173    */
174   void GetVolume( float& left, float& right );
175
176   /**
177    * @brief Sets video rendering target.
178    * @SINCE_1_1.38
179    * @param[in] target The target for video rendering, window surface or native image source
180    */
181   void SetRenderingTarget( Any target );
182
183   /**
184    * @brief Sets the position for playback.
185    * @SINCE_1_1.38
186    *
187    * @param[in] millisecond The position for playback
188    */
189   void SetPlayPosition( int millisecond );
190
191   /**
192    * @brief Gets the current position in milliseconds.
193    * @SINCE_1_1.38
194    *
195    * @return The current position of playback
196    */
197   int GetPlayPosition();
198
199   /**
200    * @brief Sets the area of video display.
201    * @SINCE_1_2.46
202    * param[in] area The left-top position and size of the video display area
203    */
204   void SetDisplayArea( DisplayArea area );
205
206   /**
207    * @brief Sets video display rotation
208    * @SINCE_1_1.38
209    * @param[in] rotation The rotation of display
210    */
211   void SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation );
212
213   /**
214    * @brief Returns rotation of current video display
215    * @SINCE_1_1.38
216    * @return The rotation of current display
217    */
218   Dali::VideoPlayerPlugin::DisplayRotation GetDisplayRotation();
219
220   /**
221    * @brief Connect to this signal to be notified when a video playback have finished.
222    *
223    * @SINCE_1_1.38
224    * @return A signal object to connect with.
225    */
226   Dali::VideoPlayerPlugin::VideoPlayerSignalType& FinishedSignal();
227
228   /**
229    * @brief Seeks forward by the specified number of milliseconds.
230    *
231    * @SINCE_1_2.46
232    * @param[in] millisecond The position for forward playback
233    */
234   void Forward( int millisecond );
235
236   /**
237    * @brief Seeks backward by the specified number of milliseconds.
238    *
239    * @SINCE_1_2.46
240    * @param[in] millisecond The position for backward playback
241    */
242   void Backward( int millisecond );
243
244   /**
245    * @brief Checks whether the video texture is supported
246    * @return True if supported, otherwise false.
247    */
248   bool IsVideoTextureSupported() const;
249
250 private: // Not intended for application developers
251
252   /**
253    * @brief Internal constructor
254    * @SINCE_1_1.38
255    */
256   explicit DALI_INTERNAL VideoPlayer( Internal::Adaptor::VideoPlayer* internal );
257 };
258
259 } // namespace Dali;
260
261 #endif
262