propagate unhandled key( DALI_KEY_SEARCH )
[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 #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>
22
23 namespace Dali
24 {
25
26 namespace Internal
27 {
28
29 namespace Adaptor
30 {
31
32 class VideoPlayer: public Dali::BaseObject
33 {
34 public:
35
36   VideoPlayer()
37   {
38     mMuted = false;
39     mLooping = false;
40   }
41
42   void SetMuted( bool muted )
43   {
44     mMuted = muted;
45   }
46
47   bool IsMuted()
48   {
49     return mMuted;
50   }
51
52   void SetLooping( bool looping )
53   {
54     mLooping = looping;
55   }
56
57   bool IsLooping()
58   {
59     return mLooping;
60   }
61
62 public:
63
64   std::string mUrl;
65   float mVolumeLeft;
66   float mVolumeRight;
67   Dali::VideoPlayerPlugin::VideoPlayerSignalType mFinishedSignal;
68
69 private:
70
71   bool mMuted;
72   bool mLooping;
73 };
74
75 inline VideoPlayer& GetImplementation( Dali::VideoPlayer& player )
76 {
77   DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
78   BaseObject& handle = player.GetBaseObject();
79   return static_cast< Internal::Adaptor::VideoPlayer& >( handle );
80 }
81
82 inline const VideoPlayer& GetImplementation( const Dali::VideoPlayer& player )
83 {
84   DALI_ASSERT_ALWAYS(player && "VideoPlayer handle is empty");
85   const BaseObject& handle = player.GetBaseObject();
86   return static_cast< const Internal::Adaptor::VideoPlayer& >( handle );
87 }
88
89 } // namespace Adaptor
90
91 } // namespace Internal
92
93
94 /********************************************************************************/
95 /*********************************  PUBLIC CLASS  *******************************/
96 /********************************************************************************/
97
98 VideoPlayer::VideoPlayer()
99 {
100 }
101
102 VideoPlayer::VideoPlayer( Internal::Adaptor::VideoPlayer* internal )
103 : BaseHandle( internal )
104 {
105 }
106
107 VideoPlayer::~VideoPlayer()
108 {
109 }
110
111 VideoPlayer VideoPlayer::New()
112 {
113   Internal::Adaptor::VideoPlayer* player = new Internal::Adaptor::VideoPlayer();
114
115   return VideoPlayer( player );
116 }
117
118 VideoPlayer::VideoPlayer( const VideoPlayer& player )
119 : BaseHandle( player )
120 {
121 }
122
123 VideoPlayer& VideoPlayer::operator=( const VideoPlayer& player )
124 {
125   BaseHandle::operator=( player );
126   return *this;
127 }
128
129 VideoPlayer VideoPlayer::DownCast( BaseHandle handle )
130 {
131   VideoPlayer videoPlayer;
132   return videoPlayer;
133 }
134
135 void VideoPlayer::SetUrl( const std::string& url )
136 {
137   Internal::Adaptor::GetImplementation( *this ).mUrl = url;
138 }
139
140 std::string VideoPlayer::GetUrl()
141 {
142   return Internal::Adaptor::GetImplementation( *this ).mUrl;
143 }
144
145 void VideoPlayer::SetLooping(bool looping)
146 {
147   Internal::Adaptor::GetImplementation( *this ).SetLooping( looping );
148 }
149
150 bool VideoPlayer::IsLooping()
151 {
152   return Internal::Adaptor::GetImplementation( *this ).IsLooping();
153 }
154
155 void VideoPlayer::Play()
156 {
157 }
158
159 void VideoPlayer::Pause()
160 {
161 }
162
163 void VideoPlayer::Stop()
164 {
165 }
166
167 void VideoPlayer::SetMute( bool mute )
168 {
169   Internal::Adaptor::GetImplementation( *this ).SetMuted( mute );
170 }
171
172 bool VideoPlayer::IsMuted()
173 {
174   return Internal::Adaptor::GetImplementation( *this ).IsMuted();
175 }
176
177 void VideoPlayer::SetVolume( float left, float right )
178 {
179   Internal::Adaptor::GetImplementation( *this ).mVolumeLeft = left;
180   Internal::Adaptor::GetImplementation( *this ).mVolumeRight = right;
181 }
182
183 void VideoPlayer::GetVolume( float& left, float& right )
184 {
185   left = Internal::Adaptor::GetImplementation( *this ).mVolumeLeft;
186   right = Internal::Adaptor::GetImplementation( *this ).mVolumeRight;
187 }
188
189 void VideoPlayer::SetRenderingTarget( Any target )
190 {
191 }
192
193 void VideoPlayer::SetPlayPosition( int millisecond )
194 {
195 }
196
197 int VideoPlayer::GetPlayPosition()
198 {
199   return 0;
200 }
201
202 void VideoPlayer::SetDisplayArea( DisplayArea area )
203 {
204 }
205
206 void VideoPlayer::SetDisplayRotation( Dali::VideoPlayerPlugin::DisplayRotation rotation )
207 {
208 }
209
210 Dali::VideoPlayerPlugin::DisplayRotation VideoPlayer::GetDisplayRotation()
211 {
212   return Dali::VideoPlayerPlugin::ROTATION_NONE;
213 }
214
215 Dali::VideoPlayerPlugin::VideoPlayerSignalType& VideoPlayer::FinishedSignal()
216 {
217   return Internal::Adaptor::GetImplementation( *this ).mFinishedSignal;
218 }
219
220 void VideoPlayer::Forward( int millisecond )
221 {
222 }
223
224 void VideoPlayer::Backward( int millisecond )
225 {
226 }
227
228 bool VideoPlayer::IsVideoTextureSupported() const
229 {
230   return ToolkitApplication::DECODED_IMAGES_SUPPORTED;
231 }
232
233 } // namespace Dali;
234