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 )
102 Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
109 Dali::VideoPlayerPlugin::DisplayMode::Type mDisplyMode;
112 inline VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
114 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
115 BaseObject& handle = player.GetBaseObject();
116 return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
119 inline const VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
121 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
122 const BaseObject& handle = player.GetBaseObject();
123 return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
126 } // namespace Adaptor
128 } // namespace Internal
131 /********************************************************************************/
132 /********************************* PUBLIC CLASS *******************************/
133 /********************************************************************************/
135 VideoPlayer::VideoPlayer()
139 VideoPlayer::VideoPlayer( Internal::Adaptor::VideoPlayer* internal )
140 : BaseHandle( internal )
144 VideoPlayer::~VideoPlayer()
148 VideoPlayer VideoPlayer::New()
150 Internal::Adaptor::VideoPlayer* player = new Internal::Adaptor::VideoPlayer();
152 return VideoPlayer( player );
155 VideoPlayer::VideoPlayer( const VideoPlayer& player )
156 : BaseHandle( player )
160 VideoPlayer& VideoPlayer::operator=( const VideoPlayer& player )
162 BaseHandle::operator=( player );
166 VideoPlayer VideoPlayer::DownCast( BaseHandle handle )
168 VideoPlayer videoPlayer;
172 void VideoPlayer::SetUrl( const std::string& url )
174 Internal::Adaptor::GetImplementation( *this ).mUrl = url;
177 std::string VideoPlayer::GetUrl()
179 return Internal::Adaptor::GetImplementation( *this ).mUrl;
182 void VideoPlayer::SetLooping(bool looping)
184 Internal::Adaptor::GetImplementation( *this ).SetLooping( looping );
187 bool VideoPlayer::IsLooping()
189 return Internal::Adaptor::GetImplementation( *this ).IsLooping();
192 void VideoPlayer::Play()
196 void VideoPlayer::Pause()
200 void VideoPlayer::Stop()
202 Internal::Adaptor::GetImplementation( *this ).Stop();
205 void VideoPlayer::SetMute( bool mute )
207 Internal::Adaptor::GetImplementation( *this ).SetMuted( mute );
210 bool VideoPlayer::IsMuted()
212 return Internal::Adaptor::GetImplementation( *this ).IsMuted();
215 void VideoPlayer::SetVolume( float left, float right )
217 Internal::Adaptor::GetImplementation( *this ).mVolumeLeft = left;
218 Internal::Adaptor::GetImplementation( *this ).mVolumeRight = right;
221 void VideoPlayer::GetVolume( float& left, float& right )
223 left = Internal::Adaptor::GetImplementation( *this ).mVolumeLeft;
224 right = Internal::Adaptor::GetImplementation( *this ).mVolumeRight;
227 void VideoPlayer::SetRenderingTarget( Any target )
231 void VideoPlayer::SetPlayPosition( int millisecond )
233 Internal::Adaptor::GetImplementation( *this ).SetPlayPosition( millisecond );
236 int VideoPlayer::GetPlayPosition()
238 return Internal::Adaptor::GetImplementation( *this ).GetPlayPosition();
241 void VideoPlayer::SetDisplayArea( DisplayArea area )
245 void VideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation )
249 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
251 return Dali::VideoPlayerPlugin::ROTATION_NONE;
254 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
256 return Internal::Adaptor::GetImplementation( *this ).mFinishedSignal;
259 void VideoPlayer::Forward( int millisecond )
263 void VideoPlayer::Backward( int millisecond )
267 bool VideoPlayer::IsVideoTextureSupported()
269 return ToolkitApplication::DECODED_IMAGES_SUPPORTED;
272 void VideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
276 Dali::VideoPlayerPlugin::CodecType VideoPlayer::GetCodecType() const
278 return Dali::VideoPlayerPlugin::CodecType::DEFAULT;
281 void VideoPlayer::SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode )
283 Internal::Adaptor::GetImplementation( *this ).SetDisplayMode( mode );
286 Dali::VideoPlayerPlugin::DisplayMode::Type VideoPlayer::GetDisplayMode() const
288 return Internal::Adaptor::GetImplementation( *this ).GetDisplayMode();