|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: mpx playback utility stub for unit testing |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: 1 % |
|
19 |
|
20 |
|
21 #include <mpxcommandgeneraldefs.h> |
|
22 #include <mpxplaybackcommanddefs.h> |
|
23 #include <mpxmediageneralextdefs.h> |
|
24 |
|
25 #include "mpxplaybackutilityimp_stub.h" |
|
26 #include "mpxvideoplayerconstants.h" |
|
27 #include "testutilities.h" |
|
28 #include "testvideoappuiengine.h" |
|
29 #include <mpxvideoplaybackdefs.h> |
|
30 #include "mpxvideo_debug.h" |
|
31 |
|
32 |
|
33 MMPXPlaybackUtility* MMPXPlaybackUtility::UtilityL( const TMPXCategory aCategory, const TUid& aModeId ) |
|
34 { |
|
35 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::UtilityL()")); |
|
36 |
|
37 TestUtilities* utility = reinterpret_cast<TestUtilities*>( UserSvr::DllTls(12345678) ); |
|
38 |
|
39 if ( !utility ) |
|
40 { |
|
41 utility = new (ELeave) TestUtilities; |
|
42 |
|
43 UserSvr::DllSetTls(12345678, utility); |
|
44 |
|
45 utility = reinterpret_cast<TestUtilities*>( UserSvr::DllTls(12345678) ); |
|
46 } |
|
47 |
|
48 |
|
49 if ( ! utility->iPlaybackUtility ) |
|
50 { |
|
51 utility->iPlaybackUtility = new (ELeave) CMPXPlaybackUtility(); |
|
52 } |
|
53 |
|
54 utility->iPlaybackUtility->AddRefCount(); |
|
55 |
|
56 return utility->iPlaybackUtility; |
|
57 |
|
58 |
|
59 } |
|
60 |
|
61 CMPXPlaybackUtility::~CMPXPlaybackUtility() |
|
62 { |
|
63 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::~CMPXPlaybackUtility()")); |
|
64 |
|
65 iObservers.Close(); |
|
66 } |
|
67 |
|
68 CMPXPlaybackUtility::CMPXPlaybackUtility() |
|
69 { |
|
70 } |
|
71 |
|
72 void CMPXPlaybackUtility::AddRefCount() |
|
73 { |
|
74 iRefCount++; |
|
75 } |
|
76 |
|
77 void CMPXPlaybackUtility::StartPdlPlaybackUtility() |
|
78 { |
|
79 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::StartPdlPlaybackUtility()")); |
|
80 |
|
81 /* if ( iTestObserver ) |
|
82 { |
|
83 TCallbackEvent* event = new TCallbackEvent; |
|
84 event->iEvent = EPlaybackUtilityPdlInstance; |
|
85 iTestObserver->HandleUtilityEvent( event ); |
|
86 } |
|
87 */ |
|
88 } |
|
89 |
|
90 void CMPXPlaybackUtility::AddTestObserverL( MAppUiEngineUnitTestObserver* aObserver ) |
|
91 { |
|
92 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::AddTestObserverL()")); |
|
93 |
|
94 iTestObserver= aObserver; |
|
95 } |
|
96 |
|
97 void CMPXPlaybackUtility::RemoveTestObserverL() |
|
98 { |
|
99 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::RemoveTestObserverL()")); |
|
100 |
|
101 iTestObserver = NULL; |
|
102 } |
|
103 |
|
104 |
|
105 // ------------------------------------------------------------------------------------------------- |
|
106 // MMPXPlaybackUtility Implementation |
|
107 // ------------------------------------------------------------------------------------------------- |
|
108 |
|
109 void CMPXPlaybackUtility::AddObserverL( MMPXPlaybackObserver& aObs ) |
|
110 { |
|
111 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::AddObserverL()")); |
|
112 iObservers.AppendL(&aObs); |
|
113 } |
|
114 |
|
115 void CMPXPlaybackUtility::RemoveObserverL( MMPXPlaybackObserver& aObs ) |
|
116 { |
|
117 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::RemoveObserverL()")); |
|
118 |
|
119 TInt i = iObservers.FindL(&aObs); |
|
120 iObservers.Remove(i); |
|
121 } |
|
122 |
|
123 |
|
124 void CMPXPlaybackUtility::GetClientsL( RArray<TProcessId>& /*aClients*/ ) |
|
125 { |
|
126 } |
|
127 |
|
128 void CMPXPlaybackUtility::UpdatePlaylistL( const CMPXCollectionPlaylist& /*aPlaylist*/ ) |
|
129 { |
|
130 } |
|
131 |
|
132 void CMPXPlaybackUtility::InitL( const CMPXCollectionPlaylist& /*aPlaylist*/, TBool /*aPlay*/ ) |
|
133 { |
|
134 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::InitL(CMPXCollectionPlaylist)")); |
|
135 |
|
136 if ( iTestObserver ) |
|
137 { |
|
138 TCallbackEvent* event = new TCallbackEvent; |
|
139 event->iEvent = EPlaybackUtilityInitPlaylist; |
|
140 iTestObserver->HandleUtilityEvent( event ); |
|
141 } |
|
142 |
|
143 } |
|
144 |
|
145 void CMPXPlaybackUtility::InitL( const TDesC& aUri, const TDesC8* /*aType*/ ) |
|
146 { |
|
147 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::InitL()"), |
|
148 _L("aUri = %S"), &aUri ); |
|
149 |
|
150 if ( iTestObserver ) |
|
151 { |
|
152 TCallbackEvent* event = new TCallbackEvent; |
|
153 event->iEvent = EPlaybackUtilityInitFileName; |
|
154 event->iFileName = aUri; |
|
155 iTestObserver->HandleUtilityEvent( event ); |
|
156 } |
|
157 |
|
158 } |
|
159 |
|
160 void CMPXPlaybackUtility::InitL( RFile& aShareableFile ) |
|
161 { |
|
162 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::InitL( RFile )")); |
|
163 |
|
164 /* if ( iTestObserver ) |
|
165 { |
|
166 TCallbackEvent* event = new TCallbackEvent; |
|
167 event->iEvent = EPlaybackUtilityInitFileHandle; |
|
168 aShareableFile.FullName( event->iFileName ); |
|
169 iTestObserver->HandleUtilityEvent( event ); |
|
170 } |
|
171 */ |
|
172 } |
|
173 |
|
174 void CMPXPlaybackUtility::Close() |
|
175 { |
|
176 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::Close()"), |
|
177 _L("iRefCount = %d"), iRefCount ); |
|
178 |
|
179 // |
|
180 // When the ref count is 2, it should be the app ui engine closing the utility |
|
181 // |
|
182 if ( iRefCount == 2 ) |
|
183 { |
|
184 /* if ( iTestObserver ) |
|
185 { |
|
186 TCallbackEvent* event = new TCallbackEvent; |
|
187 event->iEvent = EPlaybackUtilityClose; |
|
188 iTestObserver->HandleUtilityEvent( event ); |
|
189 } |
|
190 */ |
|
191 } |
|
192 |
|
193 if ( --iRefCount == 0 ) |
|
194 { |
|
195 TestUtilities* utility = reinterpret_cast<TestUtilities*>( UserSvr::DllTls(12345678) ); |
|
196 |
|
197 utility->DeletePlaybackUtility(); |
|
198 } |
|
199 } |
|
200 |
|
201 void CMPXPlaybackUtility::CancelRequest() |
|
202 { |
|
203 } |
|
204 |
|
205 void CMPXPlaybackUtility::CommandL( TMPXPlaybackCommand aCmd, TInt /*aData*/ ) |
|
206 { |
|
207 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::CommandL()"), |
|
208 _L("aCmd = %d"), aCmd ); |
|
209 |
|
210 switch ( aCmd ) |
|
211 { |
|
212 case EPbCmdPlay: |
|
213 { |
|
214 if ( iTestObserver ) |
|
215 { |
|
216 TCallbackEvent* event = new TCallbackEvent; |
|
217 event->iEvent = EPlaybackUtilityPlayCmd; |
|
218 iTestObserver->HandleUtilityEvent( event ); |
|
219 } |
|
220 |
|
221 break; |
|
222 } |
|
223 } |
|
224 } |
|
225 |
|
226 void CMPXPlaybackUtility::CommandL( CMPXCommand& aCmd, MMPXPlaybackCallback* /*aCallback*/ ) |
|
227 { |
|
228 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::CommandL( CMPXCommand )")); |
|
229 |
|
230 if ( aCmd.IsSupported( KMPXCommandGeneralId ) ) |
|
231 { |
|
232 TInt cmdId = *aCmd.Value<TInt>(KMPXCommandGeneralId); |
|
233 |
|
234 MPX_DEBUG(_L("CMPXPlaybackUtility::CommandL() id = 0x%08x"), cmdId ); |
|
235 |
|
236 switch ( cmdId ) |
|
237 { |
|
238 case KMPXCommandIdPlaybackGeneral: |
|
239 { |
|
240 break; |
|
241 } |
|
242 case KMPXMediaIdVideoPlayback: |
|
243 { |
|
244 TMPXVideoPlaybackCommand videoCmd = |
|
245 static_cast<TMPXVideoPlaybackCommand>( |
|
246 *aCmd.Value<TInt>(KMPXMediaVideoPlaybackCommand) ); |
|
247 |
|
248 switch ( videoCmd ) |
|
249 { |
|
250 case EPbCmdUpdateSeekable: |
|
251 { |
|
252 TBool seekable = *aCmd.Value<TBool>( KMPXMediaGeneralExtVideoSeekable ); |
|
253 |
|
254 if ( iTestObserver ) |
|
255 { |
|
256 TCallbackEvent* event = new TCallbackEvent; |
|
257 event->iEvent = EAsxAttributeSeekUpdate; |
|
258 event->iExtra = seekable; |
|
259 iTestObserver->HandleUtilityEvent( event ); |
|
260 } |
|
261 |
|
262 break; |
|
263 } |
|
264 } |
|
265 |
|
266 break; |
|
267 } |
|
268 |
|
269 } |
|
270 } |
|
271 } |
|
272 |
|
273 TMPXPlaybackState CMPXPlaybackUtility::StateL() const |
|
274 { |
|
275 return EPbStateNotInitialised; |
|
276 } |
|
277 |
|
278 MMPXSource* CMPXPlaybackUtility::Source() |
|
279 { |
|
280 return this; |
|
281 } |
|
282 |
|
283 MMPXPlayerManager& CMPXPlaybackUtility::PlayerManager() |
|
284 { |
|
285 return *this; |
|
286 } |
|
287 |
|
288 void CMPXPlaybackUtility::SetL( TMPXPlaybackProperty /*aProperty*/, TInt /*aValue*/ ) |
|
289 { |
|
290 } |
|
291 |
|
292 void CMPXPlaybackUtility::ValueL( MMPXPlaybackCallback& /*aCallback*/, |
|
293 TMPXPlaybackProperty /*aProperty*/ ) |
|
294 { |
|
295 } |
|
296 |
|
297 void CMPXPlaybackUtility::PropertyL( MMPXPlaybackCallback& /*aCallback*/, |
|
298 TMPXPlaybackProperty /*aProperty*/ ) |
|
299 { |
|
300 } |
|
301 |
|
302 CDesCArray* CMPXPlaybackUtility::SupportedMimeTypes() |
|
303 { |
|
304 return NULL; |
|
305 } |
|
306 |
|
307 CDesCArray* CMPXPlaybackUtility::SupportedExtensions() |
|
308 { |
|
309 return NULL; |
|
310 } |
|
311 |
|
312 CDesCArray* CMPXPlaybackUtility::SupportedSchemas() |
|
313 { |
|
314 return NULL; |
|
315 } |
|
316 |
|
317 void CMPXPlaybackUtility::SetPriority( TInt /*aPriority*/ ) |
|
318 { |
|
319 } |
|
320 |
|
321 void CMPXPlaybackUtility::AddSubscriptionL( const CMPXSubscription& /*aSubscription*/ ) |
|
322 { |
|
323 } |
|
324 |
|
325 void CMPXPlaybackUtility::RemoveSubscriptionL( const CMPXSubscription& /*aSubscription*/ ) |
|
326 { |
|
327 } |
|
328 |
|
329 void CMPXPlaybackUtility::ClearSubscriptionsL() |
|
330 { |
|
331 } |
|
332 |
|
333 void CMPXPlaybackUtility::InitStreamingL( const TDesC& aUri, |
|
334 const TDesC8* /*aType*/, |
|
335 const TInt aAccessPoint ) |
|
336 { |
|
337 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::InitStreamingL()"), |
|
338 _L("aUri = %S, aAccessPoint = %d"), &aUri, aAccessPoint ); |
|
339 |
|
340 if ( iTestObserver ) |
|
341 { |
|
342 TCallbackEvent* event = new TCallbackEvent; |
|
343 event->iEvent = EPlaybackUtilityInitStreamingUrl; |
|
344 event->iFileName = aUri; |
|
345 event->iApId = aAccessPoint; |
|
346 iTestObserver->HandleUtilityEvent( event ); |
|
347 } |
|
348 |
|
349 } |
|
350 |
|
351 void CMPXPlaybackUtility::InitStreamingL( RFile& aShareableFile, const TInt aAccessPoint ) |
|
352 { |
|
353 MPX_ENTER_EXIT(_L("CMPXPlaybackUtility::InitStreamingL( RFile )"), |
|
354 _L("aAccessPoint = %d"), aAccessPoint ); |
|
355 /* |
|
356 if ( iTestObserver ) |
|
357 { |
|
358 TCallbackEvent* event = new TCallbackEvent; |
|
359 event->iEvent = EPlaybackUtilityInitStreamingFileHandle; |
|
360 aShareableFile.FullName( event->iFileName ); |
|
361 event->iApId = aAccessPoint; |
|
362 iTestObserver->HandleUtilityEvent( event ); |
|
363 } |
|
364 */ |
|
365 } |
|
366 |
|
367 |
|
368 // ------------------------------------------------------------------------------------------------- |
|
369 // MMPXPlayerManager Implementation |
|
370 // ------------------------------------------------------------------------------------------------- |
|
371 |
|
372 void CMPXPlaybackUtility::GetPlayerTypesL( RArray<TMPXPlaybackPlayerType>& /*aTypes*/ ) |
|
373 { |
|
374 } |
|
375 |
|
376 HBufC* CMPXPlaybackUtility::PlayerTypeDisplayNameL( TMPXPlaybackPlayerType /*aType*/ ) |
|
377 { |
|
378 return NULL; |
|
379 } |
|
380 |
|
381 void CMPXPlaybackUtility::GetPlayerListL( RArray<TUid>& /*aPlayers*/ ) |
|
382 { |
|
383 } |
|
384 |
|
385 void CMPXPlaybackUtility::GetPlayerListL( RArray<TUid>& /*aPlayers*/, |
|
386 TMPXPlaybackPlayerType /*aType*/ ) |
|
387 { |
|
388 } |
|
389 |
|
390 void CMPXPlaybackUtility::SubPlayerNamesL( MMPXPlaybackCallback& /*aCallback*/, TUid /*aPlayer*/ ) |
|
391 { |
|
392 } |
|
393 |
|
394 void CMPXPlaybackUtility::SelectPlayersL( TMPXPlaybackPlayerType /*aType*/ ) |
|
395 { |
|
396 } |
|
397 |
|
398 void CMPXPlaybackUtility::SelectSubPlayerL( TUid /*aPlayer*/, TInt /*aSubPlayerIndex*/ ) |
|
399 { |
|
400 } |
|
401 |
|
402 void CMPXPlaybackUtility::SelectPlayerL( TUid /*aPlayer*/ ) |
|
403 { |
|
404 } |
|
405 |
|
406 void CMPXPlaybackUtility::ClearSelectPlayersL() |
|
407 { |
|
408 } |
|
409 |
|
410 void CMPXPlaybackUtility::GetSelectionL( TMPXPlaybackPlayerType& /*aType*/, |
|
411 TUid& /*aPlayer*/, |
|
412 TInt& /*aSubPlayerIndex*/, |
|
413 HBufC*& /*aSubPlayerName*/ ) |
|
414 { |
|
415 } |
|
416 |
|
417 MMPXPlayer* CMPXPlaybackUtility::CurrentPlayer() |
|
418 { |
|
419 return this; |
|
420 } |
|
421 |
|
422 |
|
423 // ------------------------------------------------------------------------------------------------- |
|
424 // MMPXPlayer Implementation |
|
425 // ------------------------------------------------------------------------------------------------- |
|
426 |
|
427 TMPXPlaybackPlayerType CMPXPlaybackUtility::TypeL() |
|
428 { |
|
429 return EPbUnknown; |
|
430 } |
|
431 |
|
432 HBufC* CMPXPlaybackUtility::TypeNameL() |
|
433 { |
|
434 return NULL; |
|
435 } |
|
436 |
|
437 void CMPXPlaybackUtility::SubPlayerNamesL( MMPXPlaybackCallback& /*aCallback*/ ) |
|
438 { |
|
439 } |
|
440 |
|
441 TInt CMPXPlaybackUtility::SubPlayerL() const |
|
442 { |
|
443 return 0; |
|
444 } |
|
445 |
|
446 TUid CMPXPlaybackUtility::UidL() const |
|
447 { |
|
448 return KNullUid; |
|
449 } |
|
450 |
|
451 |
|
452 // ------------------------------------------------------------------------------------------------- |
|
453 // MPXSource Implementation |
|
454 // ------------------------------------------------------------------------------------------------- |
|
455 |
|
456 CMPXCollectionPlaylist* CMPXPlaybackUtility::PlaylistL() |
|
457 { |
|
458 return NULL; |
|
459 } |
|
460 |
|
461 RFile* CMPXPlaybackUtility::FileL() |
|
462 { |
|
463 return NULL; |
|
464 } |
|
465 |
|
466 HBufC* CMPXPlaybackUtility::UriL() |
|
467 { |
|
468 return NULL; |
|
469 } |
|
470 |
|
471 void CMPXPlaybackUtility::MediaL( const TArray<TMPXAttribute>& /*aAttrs*/, |
|
472 MMPXPlaybackCallback& /*aCallback*/ ) |
|
473 { |
|
474 } |
|
475 |
|
476 void CMPXPlaybackUtility::MediaL( const TArray<TMPXAttribute>& /*aAttrs*/, |
|
477 MMPXPlaybackCallback& /*aCallback*/, |
|
478 CMPXAttributeSpecs* /*aSpecs*/ ) |
|
479 { |
|
480 } |
|
481 |
|
482 // End of file |