2 * Copyright (c) 2016 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.
19 #include "toolkit-video-player.h"
22 #include <dali/public-api/object/any.h>
33 class VideoPlayer: public Dali::BaseObject
44 void SetMuted( bool muted )
54 void SetLooping( bool looping )
66 if( !mFinishedSignal.Empty() )
68 mFinishedSignal.Emit();
77 void SetPlayPosition( int pos )
87 Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
96 inline VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
98 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
99 BaseObject& handle = player.GetBaseObject();
100 return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
103 inline const VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
105 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
106 const BaseObject& handle = player.GetBaseObject();
107 return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
110 } // namespace Adaptor
112 } // namespace Internal
115 /********************************************************************************/
116 /********************************* PUBLIC CLASS *******************************/
117 /********************************************************************************/
119 VideoPlayer::VideoPlayer()
123 VideoPlayer::VideoPlayer( Internal::Adaptor::VideoPlayer* internal )
124 : BaseHandle( internal )
128 VideoPlayer::~VideoPlayer()
132 VideoPlayer VideoPlayer::New()
134 Internal::Adaptor::VideoPlayer* player = new Internal::Adaptor::VideoPlayer();
136 return VideoPlayer( player );
139 VideoPlayer::VideoPlayer( const VideoPlayer& player )
140 : BaseHandle( player )
144 VideoPlayer& VideoPlayer::operator=( const VideoPlayer& player )
146 BaseHandle::operator=( player );
150 VideoPlayer VideoPlayer::DownCast( BaseHandle handle )
152 VideoPlayer videoPlayer;
156 void VideoPlayer::SetUrl( const std::string& url )
158 Internal::Adaptor::GetImplementation( *this ).mUrl = url;
161 std::string VideoPlayer::GetUrl()
163 return Internal::Adaptor::GetImplementation( *this ).mUrl;
166 void VideoPlayer::SetLooping(bool looping)
168 Internal::Adaptor::GetImplementation( *this ).SetLooping( looping );
171 bool VideoPlayer::IsLooping()
173 return Internal::Adaptor::GetImplementation( *this ).IsLooping();
176 void VideoPlayer::Play()
180 void VideoPlayer::Pause()
184 void VideoPlayer::Stop()
186 Internal::Adaptor::GetImplementation( *this ).Stop();
189 void VideoPlayer::SetMute( bool mute )
191 Internal::Adaptor::GetImplementation( *this ).SetMuted( mute );
194 bool VideoPlayer::IsMuted()
196 return Internal::Adaptor::GetImplementation( *this ).IsMuted();
199 void VideoPlayer::SetVolume( float left, float right )
201 Internal::Adaptor::GetImplementation( *this ).mVolumeLeft = left;
202 Internal::Adaptor::GetImplementation( *this ).mVolumeRight = right;
205 void VideoPlayer::GetVolume( float& left, float& right )
207 left = Internal::Adaptor::GetImplementation( *this ).mVolumeLeft;
208 right = Internal::Adaptor::GetImplementation( *this ).mVolumeRight;
211 void VideoPlayer::SetRenderingTarget( Any target )
215 void VideoPlayer::SetPlayPosition( int millisecond )
217 Internal::Adaptor::GetImplementation( *this ).SetPlayPosition( millisecond );
220 int VideoPlayer::GetPlayPosition()
222 return Internal::Adaptor::GetImplementation( *this ).GetPlayPosition();
225 void VideoPlayer::SetDisplayArea( DisplayArea area )
229 void VideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation )
233 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
235 return Dali::VideoPlayerPlugin::ROTATION_NONE;
238 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
240 return Internal::Adaptor::GetImplementation( *this ).mFinishedSignal;
243 void VideoPlayer::Forward( int millisecond )
247 void VideoPlayer::Backward( int millisecond )
251 bool VideoPlayer::IsVideoTextureSupported()
253 return ToolkitApplication::DECODED_IMAGES_SUPPORTED;
256 void VideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
260 Dali::VideoPlayerPlugin::CodecType VideoPlayer::GetCodecType() const
262 return Dali::VideoPlayerPlugin::CodecType::DEFAULT;