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
41 mDisplyMode = Dali::VideoPlayerPlugin::DisplayMode::DST_ROI;
44 void SetMuted( bool muted )
54 void SetLooping( bool looping )
66 if( !mFinishedSignal.Empty() )
68 mFinishedSignal.Emit();
77 void SetPlayPosition( int pos )
82 Dali::VideoPlayerPlugin::DisplayMode::Type GetDisplayMode() const
87 void SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mDisplyMode )
89 mDisplyMode = mDisplyMode;
98 Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
105 Dali::VideoPlayerPlugin::DisplayMode::Type mDisplyMode;
108 inline VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
110 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
111 BaseObject& handle = player.GetBaseObject();
112 return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
115 inline const VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
117 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
118 const BaseObject& handle = player.GetBaseObject();
119 return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
122 } // namespace Adaptor
124 } // namespace Internal
127 /********************************************************************************/
128 /********************************* PUBLIC CLASS *******************************/
129 /********************************************************************************/
131 VideoPlayer::VideoPlayer()
135 VideoPlayer::VideoPlayer( Internal::Adaptor::VideoPlayer* internal )
136 : BaseHandle( internal )
140 VideoPlayer::~VideoPlayer()
144 VideoPlayer VideoPlayer::New()
146 Internal::Adaptor::VideoPlayer* player = new Internal::Adaptor::VideoPlayer();
148 return VideoPlayer( player );
151 VideoPlayer::VideoPlayer( const VideoPlayer& player )
152 : BaseHandle( player )
156 VideoPlayer& VideoPlayer::operator=( const VideoPlayer& player )
158 BaseHandle::operator=( player );
162 VideoPlayer VideoPlayer::DownCast( BaseHandle handle )
164 VideoPlayer videoPlayer;
168 void VideoPlayer::SetUrl( const std::string& url )
170 Internal::Adaptor::GetImplementation( *this ).mUrl = url;
173 std::string VideoPlayer::GetUrl()
175 return Internal::Adaptor::GetImplementation( *this ).mUrl;
178 void VideoPlayer::SetLooping(bool looping)
180 Internal::Adaptor::GetImplementation( *this ).SetLooping( looping );
183 bool VideoPlayer::IsLooping()
185 return Internal::Adaptor::GetImplementation( *this ).IsLooping();
188 void VideoPlayer::Play()
192 void VideoPlayer::Pause()
196 void VideoPlayer::Stop()
198 Internal::Adaptor::GetImplementation( *this ).Stop();
201 void VideoPlayer::SetMute( bool mute )
203 Internal::Adaptor::GetImplementation( *this ).SetMuted( mute );
206 bool VideoPlayer::IsMuted()
208 return Internal::Adaptor::GetImplementation( *this ).IsMuted();
211 void VideoPlayer::SetVolume( float left, float right )
213 Internal::Adaptor::GetImplementation( *this ).mVolumeLeft = left;
214 Internal::Adaptor::GetImplementation( *this ).mVolumeRight = right;
217 void VideoPlayer::GetVolume( float& left, float& right )
219 left = Internal::Adaptor::GetImplementation( *this ).mVolumeLeft;
220 right = Internal::Adaptor::GetImplementation( *this ).mVolumeRight;
223 void VideoPlayer::SetRenderingTarget( Any target )
227 void VideoPlayer::SetPlayPosition( int millisecond )
229 Internal::Adaptor::GetImplementation( *this ).SetPlayPosition( millisecond );
232 int VideoPlayer::GetPlayPosition()
234 return Internal::Adaptor::GetImplementation( *this ).GetPlayPosition();
237 void VideoPlayer::SetDisplayArea( DisplayArea area )
241 void VideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation )
245 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
247 return Dali::VideoPlayerPlugin::ROTATION_NONE;
250 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
252 return Internal::Adaptor::GetImplementation( *this ).mFinishedSignal;
255 void VideoPlayer::Forward( int millisecond )
259 void VideoPlayer::Backward( int millisecond )
263 bool VideoPlayer::IsVideoTextureSupported()
265 return ToolkitApplication::DECODED_IMAGES_SUPPORTED;
268 void VideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
272 Dali::VideoPlayerPlugin::CodecType VideoPlayer::GetCodecType() const
274 return Dali::VideoPlayerPlugin::CodecType::DEFAULT;
277 void VideoPlayer::SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode )
279 Internal::Adaptor::GetImplementation( *this ).SetDisplayMode( mode );
282 Dali::VideoPlayerPlugin::DisplayMode::Type VideoPlayer::GetDisplayMode() const
284 return Internal::Adaptor::GetImplementation( *this ).GetDisplayMode();