Merge branch 'devel/master' into sandbox/dkdk/tizen
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / video-player.cpp
1 /*
2  * Copyright (c) 2020 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)
68 : BaseHandle(player)
69 {
70 }
71
72 VideoPlayer& VideoPlayer::operator=(const VideoPlayer& player)
73 {
74   if(*this != player)
75   {
76     BaseHandle::operator=(player);
77   }
78   return *this;
79 }
80
81 VideoPlayer VideoPlayer::DownCast(BaseHandle handle)
82 {
83   return VideoPlayer(dynamic_cast<Internal::Adaptor::VideoPlayer*>(handle.GetObjectPtr()));
84 }
85
86 void VideoPlayer::SetUrl(const std::string& url)
87 {
88   GetImplementation(*this).SetUrl(url);
89 }
90
91 std::string VideoPlayer::GetUrl()
92 {
93   return GetImplementation(*this).GetUrl();
94 }
95
96 void VideoPlayer::SetLooping(bool looping)
97 {
98   GetImplementation(*this).SetLooping(looping);
99 }
100
101 bool VideoPlayer::IsLooping()
102 {
103   return GetImplementation(*this).IsLooping();
104 }
105
106 void VideoPlayer::Play()
107 {
108   GetImplementation(*this).Play();
109 }
110
111 void VideoPlayer::Pause()
112 {
113   GetImplementation(*this).Pause();
114 }
115
116 void VideoPlayer::Stop()
117 {
118   GetImplementation(*this).Stop();
119 }
120
121 void VideoPlayer::SetMute(bool mute)
122 {
123   GetImplementation(*this).SetMute(mute);
124 }
125
126 bool VideoPlayer::IsMuted()
127 {
128   return GetImplementation(*this).IsMuted();
129 }
130
131 void VideoPlayer::SetVolume(float left, float right)
132 {
133   GetImplementation(*this).SetVolume(left, right);
134 }
135
136 void VideoPlayer::GetVolume(float& left, float& right)
137 {
138   GetImplementation(*this).GetVolume(left, right);
139 }
140
141 void VideoPlayer::SetRenderingTarget(Any target)
142 {
143   GetImplementation(*this).SetRenderingTarget(target);
144 }
145
146 void VideoPlayer::SetPlayPosition(int millisecond)
147 {
148   GetImplementation(*this).SetPlayPosition(millisecond);
149 }
150
151 int VideoPlayer::GetPlayPosition()
152 {
153   return GetImplementation(*this).GetPlayPosition();
154 }
155
156 void VideoPlayer::SetDisplayArea(DisplayArea area)
157 {
158   GetImplementation(*this).SetDisplayArea(area);
159 }
160
161 void VideoPlayer::SetDisplayRotation(Dali::VideoPlayerPlugin::DisplayRotation rotation)
162 {
163   GetImplementation(*this).SetDisplayRotation(rotation);
164 }
165
166 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
167 {
168   return GetImplementation(*this).GetDisplayRotation();
169 }
170
171 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
172 {
173   return GetImplementation(*this).FinishedSignal();
174 }
175
176 void VideoPlayer::Forward(int millisecond)
177 {
178   GetImplementation(*this).Forward(millisecond);
179 }
180
181 void VideoPlayer::Backward(int millisecond)
182 {
183   GetImplementation(*this).Backward(millisecond);
184 }
185
186 bool VideoPlayer::IsVideoTextureSupported()
187 {
188   return GetImplementation(*this).IsVideoTextureSupported();
189 }
190
191 void VideoPlayer::SetCodecType(Dali::VideoPlayerPlugin::CodecType type)
192 {
193   GetImplementation(*this).SetCodecType(type);
194 }
195
196 Dali::VideoPlayerPlugin::CodecType VideoPlayer::GetCodecType() const
197 {
198   return GetImplementation(*this).GetCodecType();
199 }
200
201 void VideoPlayer::SetDisplayMode(Dali::VideoPlayerPlugin::DisplayMode::Type mode)
202 {
203   GetImplementation(*this).SetDisplayMode(mode);
204 }
205
206 Dali::VideoPlayerPlugin::DisplayMode::Type VideoPlayer::GetDisplayMode() const
207 {
208   return GetImplementation(*this).GetDisplayMode();
209 }
210
211 Any VideoPlayer::GetMediaPlayer()
212 {
213   return GetImplementation(*this).GetMediaPlayer();
214 }
215
216 void VideoPlayer::StartSynchronization()
217 {
218   GetImplementation(*this).StartSynchronization();
219 }
220
221 void VideoPlayer::FinishSynchronization()
222 {
223   GetImplementation(*this).FinishSynchronization();
224 }
225
226 } // namespace Dali