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