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
43 void SetMuted( bool muted )
53 void SetLooping( bool looping )
68 Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
76 inline VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
78 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
79 BaseObject& handle = player.GetBaseObject();
80 return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
83 inline const VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
85 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
86 const BaseObject& handle = player.GetBaseObject();
87 return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
90 } // namespace Adaptor
92 } // namespace Internal
95 /********************************************************************************/
96 /********************************* PUBLIC CLASS *******************************/
97 /********************************************************************************/
99 VideoPlayer::VideoPlayer()
103 VideoPlayer::VideoPlayer( Internal::Adaptor::VideoPlayer* internal )
104 : BaseHandle( internal )
108 VideoPlayer::~VideoPlayer()
112 VideoPlayer VideoPlayer::New()
114 Internal::Adaptor::VideoPlayer* player = new Internal::Adaptor::VideoPlayer();
116 return VideoPlayer( player );
119 VideoPlayer::VideoPlayer( const VideoPlayer& player )
120 : BaseHandle( player )
124 VideoPlayer& VideoPlayer::operator=( const VideoPlayer& player )
126 BaseHandle::operator=( player );
130 VideoPlayer VideoPlayer::DownCast( BaseHandle handle )
132 VideoPlayer videoPlayer;
136 void VideoPlayer::SetUrl( const std::string& url )
138 Internal::Adaptor::GetImplementation( *this ).mUrl = url;
141 std::string VideoPlayer::GetUrl()
143 return Internal::Adaptor::GetImplementation( *this ).mUrl;
146 void VideoPlayer::SetLooping(bool looping)
148 Internal::Adaptor::GetImplementation( *this ).SetLooping( looping );
151 bool VideoPlayer::IsLooping()
153 return Internal::Adaptor::GetImplementation( *this ).IsLooping();
156 void VideoPlayer::Play()
160 void VideoPlayer::Pause()
164 void VideoPlayer::Stop()
168 void VideoPlayer::SetMute( bool mute )
170 Internal::Adaptor::GetImplementation( *this ).SetMuted( mute );
173 bool VideoPlayer::IsMuted()
175 return Internal::Adaptor::GetImplementation( *this ).IsMuted();
178 void VideoPlayer::SetVolume( float left, float right )
180 Internal::Adaptor::GetImplementation( *this ).mVolumeLeft = left;
181 Internal::Adaptor::GetImplementation( *this ).mVolumeRight = right;
184 void VideoPlayer::GetVolume( float& left, float& right )
186 left = Internal::Adaptor::GetImplementation( *this ).mVolumeLeft;
187 right = Internal::Adaptor::GetImplementation( *this ).mVolumeRight;
190 void VideoPlayer::SetRenderingTarget( Any target )
194 void VideoPlayer::SetPlayPosition( int millisecond )
198 int VideoPlayer::GetPlayPosition()
203 void VideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation )
207 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
209 return Dali::VideoPlayerPlugin::ROTATION_NONE;
212 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
214 return Internal::Adaptor::GetImplementation( *this ).mFinishedSignal;