2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/devel-api/adaptor-framework/video-player.h>
19 #include <dali/public-api/object/any.h>
20 #include <dali/public-api/object/base-object.h>
21 #include <toolkit-application.h>
32 class VideoPlayer: public Dali::BaseObject
44 mDisplyMode( Dali::VideoPlayerPlugin::DisplayMode::DST_ROI )
48 void SetMuted( bool muted )
58 void SetLooping( bool looping )
70 if( !mFinishedSignal.Empty() )
72 mFinishedSignal.Emit();
81 void SetPlayPosition( int pos )
86 Dali::VideoPlayerPlugin::DisplayMode::Type GetDisplayMode() const
91 void SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode )
107 Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
114 Dali::VideoPlayerPlugin::DisplayMode::Type mDisplyMode;
117 inline VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
119 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
120 BaseObject& handle = player.GetBaseObject();
121 return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
124 inline const VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
126 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
127 const BaseObject& handle = player.GetBaseObject();
128 return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
131 } // namespace Adaptor
133 } // namespace Internal
136 /********************************************************************************/
137 /********************************* PUBLIC CLASS *******************************/
138 /********************************************************************************/
140 VideoPlayer::VideoPlayer()
144 VideoPlayer::VideoPlayer( Internal::Adaptor::VideoPlayer* internal )
145 : BaseHandle( internal )
149 VideoPlayer::~VideoPlayer()
153 VideoPlayer VideoPlayer::New()
155 Internal::Adaptor::VideoPlayer* player = new Internal::Adaptor::VideoPlayer();
157 return VideoPlayer( player );
160 VideoPlayer::VideoPlayer( const VideoPlayer& player )
161 : BaseHandle( player )
165 VideoPlayer& VideoPlayer::operator=( const VideoPlayer& player )
167 BaseHandle::operator=( player );
171 VideoPlayer VideoPlayer::DownCast( BaseHandle handle )
173 VideoPlayer videoPlayer;
177 void VideoPlayer::SetUrl( const std::string& url )
179 Internal::Adaptor::GetImplementation( *this ).mUrl = url;
182 std::string VideoPlayer::GetUrl()
184 return Internal::Adaptor::GetImplementation( *this ).mUrl;
187 void VideoPlayer::SetLooping(bool looping)
189 Internal::Adaptor::GetImplementation( *this ).SetLooping( looping );
192 bool VideoPlayer::IsLooping()
194 return Internal::Adaptor::GetImplementation( *this ).IsLooping();
197 void VideoPlayer::Play()
201 void VideoPlayer::Pause()
205 void VideoPlayer::Stop()
207 Internal::Adaptor::GetImplementation( *this ).Stop();
210 void VideoPlayer::SetMute( bool mute )
212 Internal::Adaptor::GetImplementation( *this ).SetMuted( mute );
215 bool VideoPlayer::IsMuted()
217 return Internal::Adaptor::GetImplementation( *this ).IsMuted();
220 void VideoPlayer::SetVolume( float left, float right )
222 Internal::Adaptor::GetImplementation( *this ).mVolumeLeft = left;
223 Internal::Adaptor::GetImplementation( *this ).mVolumeRight = right;
226 void VideoPlayer::GetVolume( float& left, float& right )
228 left = Internal::Adaptor::GetImplementation( *this ).mVolumeLeft;
229 right = Internal::Adaptor::GetImplementation( *this ).mVolumeRight;
232 void VideoPlayer::SetRenderingTarget( Any target )
236 void VideoPlayer::SetPlayPosition( int millisecond )
238 Internal::Adaptor::GetImplementation( *this ).SetPlayPosition( millisecond );
241 int VideoPlayer::GetPlayPosition()
243 return Internal::Adaptor::GetImplementation( *this ).GetPlayPosition();
246 void VideoPlayer::SetDisplayArea( DisplayArea area )
250 void VideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation )
254 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
256 return Dali::VideoPlayerPlugin::ROTATION_NONE;
259 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
261 return Internal::Adaptor::GetImplementation( *this ).mFinishedSignal;
264 void VideoPlayer::Forward( int millisecond )
268 void VideoPlayer::Backward( int millisecond )
272 bool VideoPlayer::IsVideoTextureSupported()
274 return ToolkitApplication::DECODED_IMAGES_SUPPORTED;
277 void VideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
281 Dali::VideoPlayerPlugin::CodecType VideoPlayer::GetCodecType() const
283 return Dali::VideoPlayerPlugin::CodecType::DEFAULT;
286 void VideoPlayer::SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode )
288 Internal::Adaptor::GetImplementation( *this ).SetDisplayMode( mode );
291 Dali::VideoPlayerPlugin::DisplayMode::Type VideoPlayer::GetDisplayMode() const
293 return Internal::Adaptor::GetImplementation( *this ).GetDisplayMode();
296 Any VideoPlayer::GetMediaPlayer()
298 return Internal::Adaptor::GetImplementation( *this ).GetMediaPlayer();