2 * Copyright (c) 2022 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 <dali/devel-api/adaptor-framework/video-player.h>
22 #include <dali/public-api/object/any.h>
25 #include <dali/internal/video/common/video-player-impl.h>
29 VideoPlayer::VideoPlayer()
33 VideoPlayer::VideoPlayer(Internal::Adaptor::VideoPlayer* internal)
34 : BaseHandle(internal)
38 VideoPlayer::~VideoPlayer()
42 VideoPlayer VideoPlayer::New()
44 Internal::Adaptor::VideoPlayerPtr player = Internal::Adaptor::VideoPlayer::New();
49 player->Initialize(actor, VideoSyncMode::DISABLED);
52 return VideoPlayer(player.Get());
55 VideoPlayer VideoPlayer::New(Dali::Actor actor, VideoSyncMode syncMode)
57 Internal::Adaptor::VideoPlayerPtr player = Internal::Adaptor::VideoPlayer::New();
61 player->Initialize(actor, syncMode);
64 return VideoPlayer(player.Get());
67 VideoPlayer::VideoPlayer(const VideoPlayer& player) = default;
69 VideoPlayer& VideoPlayer::operator=(const VideoPlayer& player) = default;
71 VideoPlayer::VideoPlayer(VideoPlayer&& player) = default;
73 VideoPlayer& VideoPlayer::operator=(VideoPlayer&& player) = default;
75 VideoPlayer VideoPlayer::DownCast(BaseHandle handle)
77 return VideoPlayer(dynamic_cast<Internal::Adaptor::VideoPlayer*>(handle.GetObjectPtr()));
80 void VideoPlayer::SetUrl(const std::string& url)
82 GetImplementation(*this).SetUrl(url);
85 std::string VideoPlayer::GetUrl()
87 return GetImplementation(*this).GetUrl();
90 void VideoPlayer::SetLooping(bool looping)
92 GetImplementation(*this).SetLooping(looping);
95 bool VideoPlayer::IsLooping()
97 return GetImplementation(*this).IsLooping();
100 void VideoPlayer::Play()
102 GetImplementation(*this).Play();
105 void VideoPlayer::Pause()
107 GetImplementation(*this).Pause();
110 void VideoPlayer::Stop()
112 GetImplementation(*this).Stop();
115 void VideoPlayer::SetMute(bool mute)
117 GetImplementation(*this).SetMute(mute);
120 bool VideoPlayer::IsMuted()
122 return GetImplementation(*this).IsMuted();
125 void VideoPlayer::SetVolume(float left, float right)
127 GetImplementation(*this).SetVolume(left, right);
130 void VideoPlayer::GetVolume(float& left, float& right)
132 GetImplementation(*this).GetVolume(left, right);
135 void VideoPlayer::SetRenderingTarget(Any target)
137 GetImplementation(*this).SetRenderingTarget(target);
140 void VideoPlayer::SetPlayPosition(int millisecond)
142 GetImplementation(*this).SetPlayPosition(millisecond);
145 int VideoPlayer::GetPlayPosition()
147 return GetImplementation(*this).GetPlayPosition();
150 void VideoPlayer::SetDisplayArea(DisplayArea area)
152 GetImplementation(*this).SetDisplayArea(area);
155 void VideoPlayer::SetDisplayRotation(Dali::VideoPlayerPlugin::DisplayRotation rotation)
157 GetImplementation(*this).SetDisplayRotation(rotation);
160 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
162 return GetImplementation(*this).GetDisplayRotation();
165 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
167 return GetImplementation(*this).FinishedSignal();
170 void VideoPlayer::Forward(int millisecond)
172 GetImplementation(*this).Forward(millisecond);
175 void VideoPlayer::Backward(int millisecond)
177 GetImplementation(*this).Backward(millisecond);
180 bool VideoPlayer::IsVideoTextureSupported()
182 return GetImplementation(*this).IsVideoTextureSupported();
185 void VideoPlayer::SetCodecType(Dali::VideoPlayerPlugin::CodecType type)
187 GetImplementation(*this).SetCodecType(type);
190 Dali::VideoPlayerPlugin::CodecType VideoPlayer::GetCodecType() const
192 return GetImplementation(*this).GetCodecType();
195 void VideoPlayer::SetDisplayMode(Dali::VideoPlayerPlugin::DisplayMode::Type mode)
197 GetImplementation(*this).SetDisplayMode(mode);
200 Dali::VideoPlayerPlugin::DisplayMode::Type VideoPlayer::GetDisplayMode() const
202 return GetImplementation(*this).GetDisplayMode();
205 Any VideoPlayer::GetMediaPlayer()
207 return GetImplementation(*this).GetMediaPlayer();
210 void VideoPlayer::StartSynchronization()
212 GetImplementation(*this).StartSynchronization();
215 void VideoPlayer::FinishSynchronization()
217 GetImplementation(*this).FinishSynchronization();
220 void VideoPlayer::RaiseAbove(Dali::VideoPlayer target)
222 GetImplementation(*this).RaiseAbove(target);
225 void VideoPlayer::LowerBelow(Dali::VideoPlayer target)
227 GetImplementation(*this).LowerBelow(target);
230 void VideoPlayer::RaiseToTop()
232 GetImplementation(*this).RaiseToTop();
235 void VideoPlayer::LowerToBottom()
237 GetImplementation(*this).LowerToBottom();