[dali_2.3.25] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / video-player-plugin.h
1 #ifndef DALI_VIDEO_PLAYER_PLUGIN_H
2 #define DALI_VIDEO_PLAYER_PLUGIN_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 // EXTERNAL INCLUDES
22 #include <dali/public-api/actors/actor.h>
23 #include <dali/public-api/math/rect.h>
24 #include <dali/public-api/signals/dali-signal.h>
25
26 namespace Dali
27 {
28 class Any;
29 typedef Dali::Rect<int> DisplayArea;
30
31 /**
32  * @brief VideoPlayerPlugin is an abstract interface, used by dali-adaptor to access video player plugin.
33  * A concrete implementation must be created for each platform and provided as dynamic library.
34  * @SINCE_1_1.38
35  */
36 class VideoPlayerPlugin
37 {
38 public:
39   typedef Signal<void()> VideoPlayerSignalType;
40
41   /**
42    * @brief Video display rotation option
43    * @SINCE_1_1.38
44    * @remarks The option is needed only for window surface rendering target
45    */
46   enum DisplayRotation
47   {
48     ROTATION_NONE, ///< Display isn't rotated. @SINCE_1_1.38
49     ROTATION_90,   ///< Display is rotated 90 degree. @SINCE_1_1.38
50     ROTATION_180,  ///< Display is rotated 180 degree. @SINCE_1_1.38
51     ROTATION_270   ///< Display is rotated 270 degree. @SINCE_1_1.38
52   };
53
54   /**
55    * @brief Enumeration for video codec type
56    */
57   enum class CodecType
58   {
59     DEFAULT, ///< Codec which has higher priority as default. Platform selects it. Usually the H/W codec has higher priority than S/W codec if it exist.
60     HW,      ///< H/W codec
61     SW       ///< S/W codec
62   };
63
64   /**
65    * @brief The values of this enum determine how the video should be display mode to the view
66    */
67   struct DisplayMode
68   {
69     enum Type
70     {
71       LETTER_BOX = 0,   /**< Letter box */
72       ORIGIN_SIZE,      /**< Origin size */
73       FULL_SCREEN,      /**< Full-screen */
74       CROPPED_FULL,     /**< Cropped full-screen */
75       ORIGIN_OR_LETTER, /**< 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) */
76       DST_ROI           /**< Region of Interest */
77     };
78   };
79
80   /**
81    * @brief Constructor.
82    * @SINCE_1_1.38
83    */
84   VideoPlayerPlugin()
85   {
86   }
87
88   /**
89    * @brief Destructor.
90    * @SINCE_1_1.38
91    */
92   virtual ~VideoPlayerPlugin()
93   {
94   }
95
96   /**
97    * @brief Sets a URL of the video file to play.
98    *
99    * @SINCE_1_1.38
100    * @param [in] url The url of video file
101    */
102   virtual void SetUrl(const std::string& url) = 0;
103
104   /**
105    * @brief Returns the URL of the video file.
106    * @SINCE_1_1.38
107    * @return Url of string type
108    */
109   virtual std::string GetUrl() = 0;
110
111   /**
112    * @brief Sets the player looping status.
113    * @SINCE_1_1.38
114    *
115    * @param [in] looping The new looping status: true or false
116    */
117   virtual void SetLooping(bool looping) = 0;
118
119   /**
120    * @brief Returns the player looping status.
121    * @SINCE_1_1.38
122    *
123    * @return True if player is looping, false otherwise.
124    */
125   virtual bool IsLooping() = 0;
126
127   /**
128    * @brief Starts the video playback.
129    * @SINCE_1_1.38
130    */
131   virtual void Play() = 0;
132
133   /**
134    * @brief Pauses the video playback.
135    * @SINCE_1_1.38
136    */
137   virtual void Pause() = 0;
138
139   /**
140    * @brief Stops the video playback.
141    * @SINCE_1_1.38
142    */
143   virtual void Stop() = 0;
144
145   /**
146    * @brief Sets the player mute status.
147    * @SINCE_1_1.38
148    * @param[in] mute The new mute status, true is mute.
149    */
150   virtual void SetMute(bool mute) = 0;
151
152   /**
153    * @brief Returns the player mute status.
154    * @SINCE_1_1.38
155    * @return True if player is mute.
156    */
157   virtual bool IsMuted() = 0;
158
159   /**
160    * @brief Sets the player volume.
161    * @SINCE_1_1.38
162    * @param[in] left The left volume scalar
163    * @param[in] right The right volume scalar
164    */
165   virtual void SetVolume(float left, float right) = 0;
166
167   /**
168    * @brief Gets current volume factor.
169    * @SINCE_1_1.38
170    * @param[out] left The current left volume scalar
171    * @param[out] right The current right volume scalar
172    */
173   virtual void GetVolume(float& left, float& right) = 0;
174
175   /**
176    * @brief Sets video rendering target.
177    * @SINCE_1_1.38
178    * @param[in] target The target for video rendering, window surface or native image source
179    */
180   virtual void SetRenderingTarget(Any target) = 0;
181
182   /**
183    * @brief Sets the position for playback.
184    * @SINCE_1_1.38
185    *
186    * @param[in] millisecond The position for playback
187    */
188   virtual void SetPlayPosition(int millisecond) = 0;
189
190   /**
191    * @brief Returns the current position in milliseconds.
192    * @SINCE_1_1.38
193    *
194    * @return The current position of playback
195    */
196   virtual int GetPlayPosition() = 0;
197
198   /**
199    * @brief Sets the area of video display.
200    * @SINCE_1_2.46
201    * param[in] area The left-top position and size of the video display area
202    */
203   virtual void SetDisplayArea(DisplayArea area) = 0;
204
205   /**
206    * @brief Sets video display rotation
207    * @SINCE_1_1.38
208    * @param[in] rotation The rotation of display
209    */
210   virtual void SetDisplayRotation(Dali::VideoPlayerPlugin::DisplayRotation rotation) = 0;
211
212   /**
213    * @brief Returns rotation of current video display
214    * @SINCE_1_1.38
215    * @return The rotation of current display
216    */
217   virtual Dali::VideoPlayerPlugin::DisplayRotation GetDisplayRotation() = 0;
218
219   /**
220    * @brief Connect to this signal to be notified when a video playback have finished.
221    *
222    * @SINCE_1_1.38
223    * @return A signal object to connect with.
224    */
225   virtual VideoPlayerSignalType& FinishedSignal() = 0;
226
227   /**
228    * @brief Seeks forward by the specified number of milliseconds.
229    *
230    * @SINCE_1_2.46
231    * @param[in] millisecond The position for forward playback
232    */
233   virtual void Forward(int millisecond) = 0;
234
235   /**
236    * @brief Seeks backward by the specified number of milliseconds.
237    *
238    * @SINCE_1_2.46
239    * @param[in] millisecond The position for backward playback
240    */
241   virtual void Backward(int millisecond) = 0;
242
243   /**
244    * @brief Checks whether the video texture is supported
245    * @return True if supported, otherwise false.
246    */
247   virtual bool IsVideoTextureSupported() = 0;
248
249   /**
250    * @brief Sets codec type
251    * @param[in] type The CodecType
252    */
253   virtual void SetCodecType(VideoPlayerPlugin::CodecType type) = 0;
254
255   /**
256    * @brief Gets codec type
257    * @return CodecType
258    */
259   virtual VideoPlayerPlugin::CodecType GetCodecType() const = 0;
260
261   /**
262    * @brief Sets the display mode for playback.
263    * @param[in] mode of playback
264    */
265   virtual void SetDisplayMode(VideoPlayerPlugin::DisplayMode::Type mode) = 0;
266
267   /**
268    * @brief Returns the current display mode.
269    * @return The current display mode of playback
270    */
271   virtual VideoPlayerPlugin::DisplayMode::Type GetDisplayMode() const = 0;
272
273   /**
274    * @brief Returns the current internal media player.
275    * @return The current internal media player of video player
276    */
277   virtual Any GetMediaPlayer() = 0;
278
279   /**
280    * @brief calls synchronization function in window system
281    * This function is called, the synchronization is started between UI(transparent hole) and video player.
282    */
283   virtual void StartSynchronization() = 0;
284
285   /**
286    * @brief calls desynchronization function in window system
287    * This function is called, the synchronization is finished between UI(transparent hole) and video player.
288    */
289   virtual void FinishSynchronization() = 0;
290
291   /**
292    * @brief Raise the video player above the target video plaer.
293    *
294    * @param[in] target The target video player
295    */
296   virtual void RaiseAbove(Any target) = 0;
297
298   /**
299    * @brief Lower the video player to below the target video player.
300    *
301    * @param[in] target The target video player
302    */
303   virtual void LowerBelow(Any target) = 0;
304
305   /**
306    * @brief Raise video player above all other sibling video players.
307    *
308    */
309   virtual void RaiseToTop() = 0;
310
311   /**
312    * @brief Lower video player to the bottom of all other sibling video players.
313    *
314    */
315   virtual void LowerToBottom() = 0;
316
317   /**
318    * @brief Gets Video Player's native surface.
319    *
320    * @return The return of native surface pointer of video player
321    */
322   virtual Any GetVideoPlayerSurface() = 0;
323 };
324
325 } // namespace Dali
326
327 #endif // DALI_VIDEO_PLAYER_PLUGIN_H