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.
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
43 void SetMuted( bool muted )
53 void SetLooping( bool looping )
65 if( !mFinishedSignal.Empty() )
67 mFinishedSignal.Emit();
76 void SetPlayPosition( int pos )
86 Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
95 inline VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
97 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
98 BaseObject& handle = player.GetBaseObject();
99 return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
102 inline const VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
104 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
105 const BaseObject& handle = player.GetBaseObject();
106 return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
109 } // namespace Adaptor
111 } // namespace Internal
114 /********************************************************************************/
115 /********************************* PUBLIC CLASS *******************************/
116 /********************************************************************************/
118 VideoPlayer::VideoPlayer()
122 VideoPlayer::VideoPlayer( Internal::Adaptor::VideoPlayer* internal )
123 : BaseHandle( internal )
127 VideoPlayer::~VideoPlayer()
131 VideoPlayer VideoPlayer::New()
133 Internal::Adaptor::VideoPlayer* player = new Internal::Adaptor::VideoPlayer();
135 return VideoPlayer( player );
138 VideoPlayer::VideoPlayer( const VideoPlayer& player )
139 : BaseHandle( player )
143 VideoPlayer& VideoPlayer::operator=( const VideoPlayer& player )
145 BaseHandle::operator=( player );
149 VideoPlayer VideoPlayer::DownCast( BaseHandle handle )
151 VideoPlayer videoPlayer;
155 void VideoPlayer::SetUrl( const std::string& url )
157 Internal::Adaptor::GetImplementation( *this ).mUrl = url;
160 std::string VideoPlayer::GetUrl()
162 return Internal::Adaptor::GetImplementation( *this ).mUrl;
165 void VideoPlayer::SetLooping(bool looping)
167 Internal::Adaptor::GetImplementation( *this ).SetLooping( looping );
170 bool VideoPlayer::IsLooping()
172 return Internal::Adaptor::GetImplementation( *this ).IsLooping();
175 void VideoPlayer::Play()
179 void VideoPlayer::Pause()
183 void VideoPlayer::Stop()
185 Internal::Adaptor::GetImplementation( *this ).Stop();
188 void VideoPlayer::SetMute( bool mute )
190 Internal::Adaptor::GetImplementation( *this ).SetMuted( mute );
193 bool VideoPlayer::IsMuted()
195 return Internal::Adaptor::GetImplementation( *this ).IsMuted();
198 void VideoPlayer::SetVolume( float left, float right )
200 Internal::Adaptor::GetImplementation( *this ).mVolumeLeft = left;
201 Internal::Adaptor::GetImplementation( *this ).mVolumeRight = right;
204 void VideoPlayer::GetVolume( float& left, float& right )
206 left = Internal::Adaptor::GetImplementation( *this ).mVolumeLeft;
207 right = Internal::Adaptor::GetImplementation( *this ).mVolumeRight;
210 void VideoPlayer::SetRenderingTarget( Any target )
214 void VideoPlayer::SetPlayPosition( int millisecond )
216 Internal::Adaptor::GetImplementation( *this ).SetPlayPosition( millisecond );
219 int VideoPlayer::GetPlayPosition()
221 return Internal::Adaptor::GetImplementation( *this ).GetPlayPosition();
224 void VideoPlayer::SetDisplayArea( DisplayArea area )
228 void VideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation )
232 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
234 return Dali::VideoPlayerPlugin::ROTATION_NONE;
237 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
239 return Internal::Adaptor::GetImplementation( *this ).mFinishedSignal;
242 void VideoPlayer::Forward( int millisecond )
246 void VideoPlayer::Backward( int millisecond )
250 bool VideoPlayer::IsVideoTextureSupported()
252 return ToolkitApplication::DECODED_IMAGES_SUPPORTED;
255 void VideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
259 Dali::VideoPlayerPlugin::CodecType VideoPlayer::GetCodecType() const
261 return Dali::VideoPlayerPlugin::CodecType::DEFAULT;