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 )
67 Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
75 inline VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
77 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
78 BaseObject& handle = player.GetBaseObject();
79 return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
82 inline const VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
84 DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
85 const BaseObject& handle = player.GetBaseObject();
86 return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
89 } // namespace Adaptor
91 } // namespace Internal
94 /********************************************************************************/
95 /********************************* PUBLIC CLASS *******************************/
96 /********************************************************************************/
98 VideoPlayer::VideoPlayer()
102 VideoPlayer::VideoPlayer( Internal::Adaptor::VideoPlayer* internal )
103 : BaseHandle( internal )
107 VideoPlayer::~VideoPlayer()
111 VideoPlayer VideoPlayer::New()
113 Internal::Adaptor::VideoPlayer* player = new Internal::Adaptor::VideoPlayer();
115 return VideoPlayer( player );
118 VideoPlayer::VideoPlayer( const VideoPlayer& player )
119 : BaseHandle( player )
123 VideoPlayer& VideoPlayer::operator=( const VideoPlayer& player )
125 BaseHandle::operator=( player );
129 VideoPlayer VideoPlayer::DownCast( BaseHandle handle )
131 VideoPlayer videoPlayer;
135 void VideoPlayer::SetUrl( const std::string& url )
137 Internal::Adaptor::GetImplementation( *this ).mUrl = url;
140 std::string VideoPlayer::GetUrl()
142 return Internal::Adaptor::GetImplementation( *this ).mUrl;
145 void VideoPlayer::SetLooping(bool looping)
147 Internal::Adaptor::GetImplementation( *this ).SetLooping( looping );
150 bool VideoPlayer::IsLooping()
152 return Internal::Adaptor::GetImplementation( *this ).IsLooping();
155 void VideoPlayer::Play()
159 void VideoPlayer::Pause()
163 void VideoPlayer::Stop()
167 void VideoPlayer::SetMute( bool mute )
169 Internal::Adaptor::GetImplementation( *this ).SetMuted( mute );
172 bool VideoPlayer::IsMuted()
174 return Internal::Adaptor::GetImplementation( *this ).IsMuted();
177 void VideoPlayer::SetVolume( float left, float right )
179 Internal::Adaptor::GetImplementation( *this ).mVolumeLeft = left;
180 Internal::Adaptor::GetImplementation( *this ).mVolumeRight = right;
183 void VideoPlayer::GetVolume( float& left, float& right )
185 left = Internal::Adaptor::GetImplementation( *this ).mVolumeLeft;
186 right = Internal::Adaptor::GetImplementation( *this ).mVolumeRight;
189 void VideoPlayer::SetRenderingTarget( Any target )
193 void VideoPlayer::SetPlayPosition( int millisecond )
197 int VideoPlayer::GetPlayPosition()
202 void VideoPlayer::SetDisplayArea( DisplayArea area )
206 void VideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation )
210 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
212 return Dali::VideoPlayerPlugin::ROTATION_NONE;
215 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
217 return Internal::Adaptor::GetImplementation( *this ).mFinishedSignal;
220 void VideoPlayer::Forward( int millisecond )
224 void VideoPlayer::Backward( int millisecond )
228 bool VideoPlayer::IsVideoTextureSupported() const
230 return ToolkitApplication::DECODED_IMAGES_SUPPORTED;