[dali_2.3.33] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / video-player.cpp
1 /*
2  * Copyright (c) 2022 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/devel-api/adaptor-framework/video-player.h>
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/any.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/video/common/video-player-impl.h>
26
27 namespace Dali
28 {
29 VideoPlayer::VideoPlayer()
30 {
31 }
32
33 VideoPlayer::VideoPlayer(Internal::Adaptor::VideoPlayer* internal)
34 : BaseHandle(internal)
35 {
36 }
37
38 VideoPlayer::~VideoPlayer()
39 {
40 }
41
42 VideoPlayer VideoPlayer::New()
43 {
44   Internal::Adaptor::VideoPlayerPtr player = Internal::Adaptor::VideoPlayer::New();
45
46   if(player)
47   {
48     Dali::Actor actor;
49     player->Initialize(actor, VideoSyncMode::DISABLED);
50   }
51
52   return VideoPlayer(player.Get());
53 }
54
55 VideoPlayer VideoPlayer::New(Dali::Actor actor, VideoSyncMode syncMode)
56 {
57   Internal::Adaptor::VideoPlayerPtr player = Internal::Adaptor::VideoPlayer::New();
58
59   if(player)
60   {
61     player->Initialize(actor, syncMode);
62   }
63
64   return VideoPlayer(player.Get());
65 }
66
67 VideoPlayer::VideoPlayer(const VideoPlayer& player) = default;
68
69 VideoPlayer& VideoPlayer::operator=(const VideoPlayer& player) = default;
70
71 VideoPlayer::VideoPlayer(VideoPlayer&& player) = default;
72
73 VideoPlayer& VideoPlayer::operator=(VideoPlayer&& player) = default;
74
75 VideoPlayer VideoPlayer::DownCast(BaseHandle handle)
76 {
77   return VideoPlayer(dynamic_cast<Internal::Adaptor::VideoPlayer*>(handle.GetObjectPtr()));
78 }
79
80 void VideoPlayer::SetUrl(const std::string& url)
81 {
82   GetImplementation(*this).SetUrl(url);
83 }
84
85 std::string VideoPlayer::GetUrl()
86 {
87   return GetImplementation(*this).GetUrl();
88 }
89
90 void VideoPlayer::SetLooping(bool looping)
91 {
92   GetImplementation(*this).SetLooping(looping);
93 }
94
95 bool VideoPlayer::IsLooping()
96 {
97   return GetImplementation(*this).IsLooping();
98 }
99
100 void VideoPlayer::Play()
101 {
102   GetImplementation(*this).Play();
103 }
104
105 void VideoPlayer::Pause()
106 {
107   GetImplementation(*this).Pause();
108 }
109
110 void VideoPlayer::Stop()
111 {
112   GetImplementation(*this).Stop();
113 }
114
115 void VideoPlayer::SetMute(bool mute)
116 {
117   GetImplementation(*this).SetMute(mute);
118 }
119
120 bool VideoPlayer::IsMuted()
121 {
122   return GetImplementation(*this).IsMuted();
123 }
124
125 void VideoPlayer::SetVolume(float left, float right)
126 {
127   GetImplementation(*this).SetVolume(left, right);
128 }
129
130 void VideoPlayer::GetVolume(float& left, float& right)
131 {
132   GetImplementation(*this).GetVolume(left, right);
133 }
134
135 void VideoPlayer::SetRenderingTarget(Any target)
136 {
137   GetImplementation(*this).SetRenderingTarget(target);
138 }
139
140 void VideoPlayer::SetPlayPosition(int millisecond)
141 {
142   GetImplementation(*this).SetPlayPosition(millisecond);
143 }
144
145 int VideoPlayer::GetPlayPosition()
146 {
147   return GetImplementation(*this).GetPlayPosition();
148 }
149
150 void VideoPlayer::SetDisplayArea(DisplayArea area)
151 {
152   GetImplementation(*this).SetDisplayArea(area);
153 }
154
155 void VideoPlayer::SetDisplayRotation(Dali::VideoPlayerPlugin::DisplayRotation rotation)
156 {
157   GetImplementation(*this).SetDisplayRotation(rotation);
158 }
159
160 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
161 {
162   return GetImplementation(*this).GetDisplayRotation();
163 }
164
165 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
166 {
167   return GetImplementation(*this).FinishedSignal();
168 }
169
170 void VideoPlayer::Forward(int millisecond)
171 {
172   GetImplementation(*this).Forward(millisecond);
173 }
174
175 void VideoPlayer::Backward(int millisecond)
176 {
177   GetImplementation(*this).Backward(millisecond);
178 }
179
180 bool VideoPlayer::IsVideoTextureSupported()
181 {
182   return GetImplementation(*this).IsVideoTextureSupported();
183 }
184
185 void VideoPlayer::SetCodecType(Dali::VideoPlayerPlugin::CodecType type)
186 {
187   GetImplementation(*this).SetCodecType(type);
188 }
189
190 Dali::VideoPlayerPlugin::CodecType VideoPlayer::GetCodecType() const
191 {
192   return GetImplementation(*this).GetCodecType();
193 }
194
195 void VideoPlayer::SetDisplayMode(Dali::VideoPlayerPlugin::DisplayMode::Type mode)
196 {
197   GetImplementation(*this).SetDisplayMode(mode);
198 }
199
200 Dali::VideoPlayerPlugin::DisplayMode::Type VideoPlayer::GetDisplayMode() const
201 {
202   return GetImplementation(*this).GetDisplayMode();
203 }
204
205 Any VideoPlayer::GetMediaPlayer()
206 {
207   return GetImplementation(*this).GetMediaPlayer();
208 }
209
210 void VideoPlayer::StartSynchronization()
211 {
212   GetImplementation(*this).StartSynchronization();
213 }
214
215 void VideoPlayer::FinishSynchronization()
216 {
217   GetImplementation(*this).FinishSynchronization();
218 }
219
220 void VideoPlayer::RaiseAbove(Dali::VideoPlayer target)
221 {
222   GetImplementation(*this).RaiseAbove(target);
223 }
224
225 void VideoPlayer::LowerBelow(Dali::VideoPlayer target)
226 {
227   GetImplementation(*this).LowerBelow(target);
228 }
229
230 void VideoPlayer::RaiseToTop()
231 {
232   GetImplementation(*this).RaiseToTop();
233 }
234
235 void VideoPlayer::LowerToBottom()
236 {
237   GetImplementation(*this).LowerToBottom();
238 }
239
240 } // namespace Dali