Merge "[4.0] clear cache when locale is changed" into tizen_4.0
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-video-player.cpp
1 /*
2  * Copyright (c) 2016 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 "toolkit-video-player.h"
20
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/any.h>
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 namespace Adaptor
31 {
32
33 class VideoPlayer: public Dali::BaseObject
34 {
35 public:
36
37   VideoPlayer()
38   {
39     mMuted = false;
40     mLooping = false;
41     mPlayPosition = 0;
42   }
43
44   void SetMuted( bool muted )
45   {
46     mMuted = muted;
47   }
48
49   bool IsMuted()
50   {
51     return mMuted;
52   }
53
54   void SetLooping( bool looping )
55   {
56     mLooping = looping;
57   }
58
59   bool IsLooping()
60   {
61     return mLooping;
62   }
63
64   void Stop()
65   {
66     if( !mFinishedSignal.Empty() )
67     {
68       mFinishedSignal.Emit();
69     }
70   }
71
72   int GetPlayPosition()
73   {
74     return mPlayPosition;
75   }
76
77   void SetPlayPosition( int pos )
78   {
79     mPlayPosition = pos;
80   }
81
82 public:
83
84   std::string mUrl;
85   float mVolumeLeft;
86   float mVolumeRight;
87   Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
88
89 private:
90
91   bool mMuted;
92   bool mLooping;
93   int mPlayPosition;
94 };
95
96 inline VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
97 {
98   DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
99   BaseObject& handle = player.GetBaseObject();
100   return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
101 }
102
103 inline const VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
104 {
105   DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
106   const BaseObject& handle = player.GetBaseObject();
107   return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
108 }
109
110 } // namespace Adaptor
111
112 } // namespace Internal
113
114
115 /********************************************************************************/
116 /*********************************  PUBLIC CLASS  *******************************/
117 /********************************************************************************/
118
119 VideoPlayer::VideoPlayer()
120 {
121 }
122
123 VideoPlayer::VideoPlayer( Internal::Adaptor::VideoPlayer* internal )
124 : BaseHandle( internal )
125 {
126 }
127
128 VideoPlayer::~VideoPlayer()
129 {
130 }
131
132 VideoPlayer VideoPlayer::New()
133 {
134   Internal::Adaptor::VideoPlayer* player = new Internal::Adaptor::VideoPlayer();
135
136   return VideoPlayer( player );
137 }
138
139 VideoPlayer::VideoPlayer( const VideoPlayer& player )
140 : BaseHandle( player )
141 {
142 }
143
144 VideoPlayer& VideoPlayer::operator=( const VideoPlayer& player )
145 {
146   BaseHandle::operator=( player );
147   return *this;
148 }
149
150 VideoPlayer VideoPlayer::DownCast( BaseHandle handle )
151 {
152   VideoPlayer videoPlayer;
153   return videoPlayer;
154 }
155
156 void VideoPlayer::SetUrl( const std::string& url )
157 {
158   Internal::Adaptor::GetImplementation( *this ).mUrl = url;
159 }
160
161 std::string VideoPlayer::GetUrl()
162 {
163   return Internal::Adaptor::GetImplementation( *this ).mUrl;
164 }
165
166 void VideoPlayer::SetLooping(bool looping)
167 {
168   Internal::Adaptor::GetImplementation( *this ).SetLooping( looping );
169 }
170
171 bool VideoPlayer::IsLooping()
172 {
173   return Internal::Adaptor::GetImplementation( *this ).IsLooping();
174 }
175
176 void VideoPlayer::Play()
177 {
178 }
179
180 void VideoPlayer::Pause()
181 {
182 }
183
184 void VideoPlayer::Stop()
185 {
186   Internal::Adaptor::GetImplementation( *this ).Stop();
187 }
188
189 void VideoPlayer::SetMute( bool mute )
190 {
191   Internal::Adaptor::GetImplementation( *this ).SetMuted( mute );
192 }
193
194 bool VideoPlayer::IsMuted()
195 {
196   return Internal::Adaptor::GetImplementation( *this ).IsMuted();
197 }
198
199 void VideoPlayer::SetVolume( float left, float right )
200 {
201   Internal::Adaptor::GetImplementation( *this ).mVolumeLeft = left;
202   Internal::Adaptor::GetImplementation( *this ).mVolumeRight = right;
203 }
204
205 void VideoPlayer::GetVolume( float& left, float& right )
206 {
207   left = Internal::Adaptor::GetImplementation( *this ).mVolumeLeft;
208   right = Internal::Adaptor::GetImplementation( *this ).mVolumeRight;
209 }
210
211 void VideoPlayer::SetRenderingTarget( Any target )
212 {
213 }
214
215 void VideoPlayer::SetPlayPosition( int millisecond )
216 {
217   Internal::Adaptor::GetImplementation( *this ).SetPlayPosition( millisecond );
218 }
219
220 int VideoPlayer::GetPlayPosition()
221 {
222   return Internal::Adaptor::GetImplementation( *this ).GetPlayPosition();
223 }
224
225 void VideoPlayer::SetDisplayArea( DisplayArea area )
226 {
227 }
228
229 void VideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation )
230 {
231 }
232
233 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
234 {
235   return Dali::VideoPlayerPlugin::ROTATION_NONE;
236 }
237
238 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
239 {
240   return Internal::Adaptor::GetImplementation( *this ).mFinishedSignal;
241 }
242
243 void VideoPlayer::Forward( int millisecond )
244 {
245 }
246
247 void VideoPlayer::Backward( int millisecond )
248 {
249 }
250
251 bool VideoPlayer::IsVideoTextureSupported()
252 {
253   return ToolkitApplication::DECODED_IMAGES_SUPPORTED;
254 }
255
256 void VideoPlayer::SetCodecType( Dali::VideoPlayerPlugin::CodecType type )
257 {
258 }
259
260 Dali::VideoPlayerPlugin::CodecType VideoPlayer::GetCodecType() const
261 {
262   return Dali::VideoPlayerPlugin::CodecType::DEFAULT;
263 }
264
265 } // namespace Dali;
266