[4.0] add doc for API reference
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / video-view / video-view.h
1 #ifndef __DALI_TOOLKIT_VIDEO_VIEW_H__
2 #define __DALI_TOOLKIT_VIDEO_VIEW_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 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 namespace Internal DALI_INTERNAL
31 {
32   class VideoView;
33 } // namespace Internal
34
35 /**
36  * @addtogroup dali_toolkit_controls_video_view
37  * @{
38  */
39
40 /**
41  * @brief VideoView is a control for video playback and display.
42  *
43  * For working VideoView, a video plugin for a platform should be provided.
44  *
45  * Signals
46  * | %Signal Name  | Method                  |
47  * |---------------|-------------------------|
48  * | finished      | @ref FinishedSignal()   |
49  * @SINCE_1_1.38
50  *
51  * Actions
52  * | %Action Name    | Attributes                                         | Description                                             |
53  * |-----------------|----------------------------------------------------|---------------------------------------------------------|
54  * | videoPlay       | Doesn't have attributes                            | Plays video. See @ref DoAction()                        |
55  * | videoPause      | Doesn't have attributes                            | Pauses video. See @ref DoAction()                       |
56  * | videoStop       | Doesn't have attributes                            | Stops video. See @ref DoAction()                        |
57  * | videoForward    | The position ( millisecond ) for forward playback  | Sets forward position for playback. See @ref DoAction() |
58  * | videoBackward   | The position ( millisecond ) for backward playback | Sets backward position for playback. See @ref DoAction()|
59  * @SINCE_1_1.38
60  *
61  */
62 class DALI_IMPORT_API VideoView: public Control
63 {
64 public:
65
66   // Signal
67   typedef Signal< void (VideoView&) > VideoViewSignalType; ///< Video playback finished signal type @ SINCE_1_1.38
68
69 public:
70
71   /**
72    * @brief Enumeration for the start and end property ranges for this control.
73    * @SINCE_1_0.0
74    */
75   enum PropertyRange
76   {
77     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,  ///< @SINCE_1_0.0
78   };
79
80   /**
81    * @brief Enumeration for the instance of properties belonging to the VideoView class.
82    * @SINCE_1_1.38
83    */
84   struct Property
85   {
86     /**
87      * @brief Enumeration for the instance of properties belonging to the VideoView class.
88      * @SINCE_1_1.38
89      */
90     enum
91     {
92       /**
93        * @brief name "video", video file url as string type or Property::Map.
94        * @SINCE_1_1.38
95        * @REMARK_INTERNET
96        * @REMARK_STORAGE
97        */
98       VIDEO = PROPERTY_START_INDEX,
99
100      /**
101        * @brief name "looping", looping status, true or false.
102        * @SINCE_1_1.38
103        */
104       LOOPING,
105
106      /**
107        * @brief name "muted", mute status, true or false.
108        * @SINCE_1_1.38
109        */
110       MUTED,
111
112      /**
113        * @brief name "volume", left and right volume scalar as float type, Property::Map with two values ( "left" and "right" ).
114        * @SINCE_1_1.38
115        */
116       VOLUME,
117
118      /**
119        * @brief name "underlay", Video rendering by underlay, true or false
120        * This shows video composited underneath the window by the system. This means it may ignore rotation of the video-view
121        * @SINCE_1_2.62
122        * @REMARK_RAWVIDEO
123        */
124       UNDERLAY,
125
126      /**
127        * @brief The play position (millisecond) of the video.
128        * @details Name "playPosition", type Property::INTEGER
129        * @SINCE_1_3_9
130        */
131       PLAY_POSITION,
132
133       /**
134         * @brief The display mode of the video.
135         * @SINCE_1_3_15
136         */
137       DISPLAY_MODE
138     };
139   };
140
141   /**
142    * @brief The values of this enum determine how the video should be display mode to the view
143    * @SINCE_1_3_15
144    */
145   struct DisplayMode
146   {
147     /**
148      * @brief The values of this enum determine how the video should be display mode to the view.
149      * @SINCE_1_3_15
150      */
151     enum Type
152     {
153       /**
154        * @brief Letter box
155        * @SINCE_1_3_15
156        */
157       LETTER_BOX = 0,
158       /**
159        * @brief Origin size
160        * @SINCE_1_3_15
161        */
162       ORIGIN_SIZE,
163       /**
164        * @brief Full-screen
165        * @SINCE_1_3_15
166        */
167       FULL_SCREEN,
168       /**
169        * @brief Cropped full-screen
170        * @SINCE_1_3_15
171        */
172       CROPPED_FULL,
173       /**
174        * @brief  Origin size (if surface size is larger than video size(width/height)) or Letter box (if video size(width/height) is larger than surface size)
175        * @SINCE_1_3_15
176        */
177       ORIGIN_OR_LETTER,
178       /**
179        * @brief  Region of Interest
180        * @SINCE_1_3_15
181        */
182       DST_ROI
183     };
184   };
185
186 public:
187
188   /**
189    * @brief Creates an initialized VideoView.
190    * @SINCE_1_1.38
191    * @return A handle to a newly allocated Dali ImageView
192    *
193    */
194   static VideoView New();
195
196   /**
197    * @brief Creates an initialized VideoView.
198    * If the string is empty, VideoView will not display anything.
199    *
200    * @SINCE_1_1.38
201    * @REMARK_INTERNET
202    * @REMARK_STORAGE
203    * @param[in] url The url of the video resource to display
204    * @return A handle to a newly allocated Dali VideoView
205    */
206   static VideoView New( const std::string& url );
207
208   /**
209    * @brief Creates an initialized VideoView.
210    * @SINCE_1_3_9
211    * @param[in] swCodec Video rendering by H/W codec if false
212    * @return A handle to a newly allocated Dali ImageView
213    *
214    * @note If platform or target does not support sw codec, video-view shows an error message and video by default codec type
215    */
216   static VideoView New( bool swCodec );
217
218   /**
219    * @brief Creates an initialized VideoView.
220    * If the string is empty, VideoView will not display anything.
221    *
222    * @SINCE_1_3_9
223    * @REMARK_INTERNET
224    * @REMARK_STORAGE
225    * @param[in] url The url of the video resource to display
226    * @param[in] swCodec Video rendering by H/W codec if false
227    * @return A handle to a newly allocated Dali VideoView
228    *
229    * @note If platform or target does not support sw codec, video-view shows an error message and video by default codec type
230    */
231   static VideoView New( const std::string& url, bool swCodec );
232
233   /**
234    * @brief Creates an uninitialized VideoView.
235    * @SINCE_1_1.38
236    */
237   VideoView();
238
239   /**
240    * @brief Destructor.
241    *
242    * This is non-virtual since derived Handel types must not contain data or virtual methods.
243    * @SINCE_1_1.38
244    */
245   ~VideoView();
246
247   /**
248    * @brief Copy constructor.
249    *
250    * @SINCE_1_1.38
251    * @param[in] videoView VideoView to copy. The copied VideoView will point at the same implementation
252    */
253   VideoView( const VideoView& videoView );
254
255   /**
256    * @brief Assignment operator.
257    *
258    * @SINCE_1_1.38
259    * @param[in] videoView The VideoView to assign from
260    * @return The updated VideoView
261    */
262   VideoView& operator=( const VideoView& videoView );
263
264   /**
265    * @brief Downcasts a handle to VideoView handle.
266    *
267    * If handle points to a VideoView, the downcast produces valid handle.
268    * If not, the returned handle is left uninitialized.
269    *
270    * @SINCE_1_1.38
271    * @param[in] handle Handle to an object
272    * @return Handle to a VideoView or an uninitialized handle
273    */
274   static VideoView DownCast( BaseHandle handle );
275
276   /**
277    * @brief Starts the video playback.
278    * @SINCE_1_1.38
279    */
280   void Play();
281
282   /**
283    * @brief Pauses the video playback.
284    * @SINCE_1_1.38
285    */
286   void Pause();
287
288   /**
289    * @brief Stops the video playback.
290    * @SINCE_1_1.38
291    */
292   void Stop();
293
294   /**
295    * @brief Seeks forward by the specified number of milliseconds.
296    *
297    * @SINCE_1_1.38
298    * @param[in] millisecond The position for forward playback
299    */
300   void Forward( int millisecond );
301
302   /**
303    * @brief Seeks backward by the specified number of milliseconds.
304    *
305    * @SINCE_1_1.38
306    * @param[in] millisecond The position for backward playback
307    */
308   void Backward( int millisecond );
309
310   /**
311    * @brief Connects to this signal to be notified when a video playback is finished.
312    *
313    * @SINCE_1_1.38
314    * @return A signal object to connect with
315    */
316   VideoViewSignalType& FinishedSignal();
317
318 public: // Not intended for application developers
319
320   /// @cond internal
321   /**
322    * @brief Creates a handle using the Toolkit::Internal implementation.
323    *
324    * @SINCE_1_1.38
325    * @param[in] implementation The VideoView implementation
326    */
327   DALI_INTERNAL VideoView( Internal::VideoView& implementation );
328
329   /**
330    * @brief Allows the creation of this VideoView from an Internal::CustomActor pointer.
331    *
332    * @SINCE_1_1.38
333    * @param[in] internal A pointer to the internal CustomActor
334    */
335   DALI_INTERNAL VideoView( Dali::Internal::CustomActor* internal );
336   /// @endcond
337
338 };
339
340 /**
341  * @}
342  */
343
344 } // namespace Toolkit
345
346 } // namespace Dali
347
348 #endif // __DALI_TOOLKIT_VIDEO_VIEW_H__