1 #ifndef __DALI_VIDEO_PLAYER_H__
2 #define __DALI_VIDEO_PLAYER_H__
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/object/base-handle.h>
25 #include <dali/devel-api/adaptor-framework/video-player-plugin.h>
26 #include <dali/public-api/dali-adaptor-common.h>
39 } // namespace Adaptor
41 } // namespace Internal
44 * @brief VideoPlayer class is used for video playback.
47 class DALI_ADAPTOR_API VideoPlayer: public BaseHandle
64 * @brief Creates a new instance of a VideoPlayer.
67 static VideoPlayer New();
70 * @brief Copy constructor.
73 * @param[in] player VideoPlayer to copy. The copied player will point at the same implementation
75 VideoPlayer( const VideoPlayer& player );
78 * @brief Assignment operator.
81 * @param[in] player The VideoPlayer to assign from.
82 * @return The updated VideoPlayer.
84 VideoPlayer& operator=( const VideoPlayer& player );
87 * @brief Downcast a handle to VideoPlayer handle.
89 * If handle points to a VideoPlayer the downcast produces valid
90 * handle. If not the returned handle is left uninitialized.
93 * @param[in] handle Handle to an object
94 * @return Handle to a VideoPlayer or an uninitialized handle
96 static VideoPlayer DownCast( BaseHandle handle );
99 * @brief Sets a URL of the video file to play.
102 * @param [in] url The url of video file
104 void SetUrl( const std::string& url );
107 * @brief Returns the URL of the video file.
109 * @return Url of string type
111 std::string GetUrl();
114 * @brief Sets the player looping status.
117 * @param [in] looping The new looping status: true or false
119 void SetLooping(bool looping);
122 * @brief Returns the player looping status.
125 * @return True if player is looping, false otherwise.
130 * @brief Starts the video playback.
136 * @brief Pauses the video playback.
142 * @brief Stops the video playback.
148 * @brief Sets the player mute status.
150 * @param[in] mute The new mute status, true is mute.
152 void SetMute( bool mute );
155 * @brief Returns the player mute status.
157 * @return True if player is mute.
162 * @brief Sets the player volume.
164 * @param[in] left The left volume scalar
165 * @param[in] right The right volume scalar
167 void SetVolume( float left, float right );
170 * @brief Returns current volume factor.
172 * @param[out] left The current left volume scalar
173 * @param[out] right The current right volume scalar
175 void GetVolume( float& left, float& right );
178 * @brief Sets video rendering target.
180 * @param[in] target The target for video rendering, window surface or native image source
182 void SetRenderingTarget( Any target );
185 * @brief Sets the position for playback.
188 * @param[in] millisecond The position for playback
190 void SetPlayPosition( int millisecond );
193 * @brief Gets the current position in milliseconds.
196 * @return The current position of playback
198 int GetPlayPosition();
201 * @brief Sets the area of video display.
203 * param[in] area The left-top position and size of the video display area
205 void SetDisplayArea( DisplayArea area );
208 * @brief Sets video display rotation
210 * @param[in] rotation The rotation of display
212 void SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation );
215 * @brief Returns rotation of current video display
217 * @return The rotation of current display
219 Dali::VideoPlayerPlugin::DisplayRotation GetDisplayRotation();
222 * @brief Connect to this signal to be notified when a video playback have finished.
225 * @return A signal object to connect with.
227 Dali::VideoPlayerPlugin::VideoPlayerSignalType& FinishedSignal();
230 * @brief Seeks forward by the specified number of milliseconds.
233 * @param[in] millisecond The position for forward playback
235 void Forward( int millisecond );
238 * @brief Seeks backward by the specified number of milliseconds.
241 * @param[in] millisecond The position for backward playback
243 void Backward( int millisecond );
246 * @brief Checks whether the video texture is supported
247 * @return True if supported, otherwise false.
249 bool IsVideoTextureSupported();
252 * @brief Sets codec type
253 * @param[in] type The VideoCodec::Type
255 void SetCodecType( Dali::VideoPlayerPlugin::CodecType type );
258 * @brief Gets codec type
259 * @return VideoCodec::Type
261 Dali::VideoPlayerPlugin::CodecType GetCodecType() const;
264 * @brief Sets the display mode for playback.
265 * @param[in] mode of playback
267 void SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode );
270 * @brief Gets display mode
271 * @return DisplayMode
273 Dali::VideoPlayerPlugin::DisplayMode::Type GetDisplayMode() const;
275 private: // Not intended for application developers
278 * @brief Internal constructor
281 explicit DALI_INTERNAL VideoPlayer( Internal::Adaptor::VideoPlayer* internal );