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