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
42 void SetMuted( bool muted )
52 void SetLooping( bool looping )
64 if( !mFinishedSignal.Empty() )
66 mFinishedSignal.Emit();
75 Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
83 inline VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
85 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
86 BaseObject& handle = player.GetBaseObject();
87 return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
90 inline const VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
92 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
93 const BaseObject& handle = player.GetBaseObject();
94 return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
97 } // namespace Adaptor
99 } // namespace Internal
102 /********************************************************************************/
103 /********************************* PUBLIC CLASS *******************************/
104 /********************************************************************************/
106 VideoPlayer::VideoPlayer()
110 VideoPlayer::VideoPlayer( Internal::Adaptor::VideoPlayer* internal )
111 : BaseHandle( internal )
115 VideoPlayer::~VideoPlayer()
119 VideoPlayer VideoPlayer::New()
121 Internal::Adaptor::VideoPlayer* player = new Internal::Adaptor::VideoPlayer();
123 return VideoPlayer( player );
126 VideoPlayer::VideoPlayer( const VideoPlayer& player )
127 : BaseHandle( player )
131 VideoPlayer& VideoPlayer::operator=( const VideoPlayer& player )
133 BaseHandle::operator=( player );
137 VideoPlayer VideoPlayer::DownCast( BaseHandle handle )
139 VideoPlayer videoPlayer;
143 void VideoPlayer::SetUrl( const std::string& url )
145 Internal::Adaptor::GetImplementation( *this ).mUrl = url;
148 std::string VideoPlayer::GetUrl()
150 return Internal::Adaptor::GetImplementation( *this ).mUrl;
153 void VideoPlayer::SetLooping(bool looping)
155 Internal::Adaptor::GetImplementation( *this ).SetLooping( looping );
158 bool VideoPlayer::IsLooping()
160 return Internal::Adaptor::GetImplementation( *this ).IsLooping();
163 void VideoPlayer::Play()
167 void VideoPlayer::Pause()
171 void VideoPlayer::Stop()
173 Internal::Adaptor::GetImplementation( *this ).Stop();
176 void VideoPlayer::SetMute( bool mute )
178 Internal::Adaptor::GetImplementation( *this ).SetMuted( mute );
181 bool VideoPlayer::IsMuted()
183 return Internal::Adaptor::GetImplementation( *this ).IsMuted();
186 void VideoPlayer::SetVolume( float left, float right )
188 Internal::Adaptor::GetImplementation( *this ).mVolumeLeft = left;
189 Internal::Adaptor::GetImplementation( *this ).mVolumeRight = right;
192 void VideoPlayer::GetVolume( float& left, float& right )
194 left = Internal::Adaptor::GetImplementation( *this ).mVolumeLeft;
195 right = Internal::Adaptor::GetImplementation( *this ).mVolumeRight;
198 void VideoPlayer::SetRenderingTarget( Any target )
202 void VideoPlayer::SetPlayPosition( int millisecond )
206 int VideoPlayer::GetPlayPosition()
211 void VideoPlayer::SetDisplayArea( DisplayArea area )
215 void VideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation )
219 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
221 return Dali::VideoPlayerPlugin::ROTATION_NONE;
224 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
226 return Internal::Adaptor::GetImplementation( *this ).mFinishedSignal;
229 void VideoPlayer::Forward( int millisecond )
233 void VideoPlayer::Backward( int millisecond )
237 bool VideoPlayer::IsVideoTextureSupported() const
239 return ToolkitApplication::DECODED_IMAGES_SUPPORTED;