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: Implementation of Video base playback view |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: da1mmcf#37 % |
|
19 |
|
20 |
|
21 |
|
22 // Include Files |
|
23 |
|
24 #include <w32std.h> |
|
25 #include <eikenv.h> |
|
26 |
|
27 #include <mpxplaybackcommanddefs.h> |
|
28 #include <mpxvideoplaybackdefs.h> |
|
29 #include <mpxcommandgeneraldefs.h> |
|
30 #include <mpxcommand.h> |
|
31 #include <mpxmessagegeneraldefs.h> |
|
32 #include <mpxplaybackmessage.h> |
|
33 #include <mpxmediageneraldefs.h> |
|
34 #include <mpxmediavideodefs.h> |
|
35 #include <mpxplaybackutility.h> |
|
36 #include <mmf/common/mmferrors.h> |
|
37 #include <mpxcollectionutility.h> |
|
38 #include <mpxcollectionplaylist.h> |
|
39 #include <mpxmediageneralextdefs.h> |
|
40 |
|
41 #include "mpxvideo_debug.h" |
|
42 #include "mpxvideoregion.h" |
|
43 #include "mpxvideoviewwrapper.h" |
|
44 #include "mpxvideoplaybackuids.hrh" |
|
45 #include "mpxhbvideocommondefs.h" |
|
46 #include "hbvideobaseplaybackview.h" |
|
47 #include "mpxvideoplaybackcontrol.hrh" |
|
48 #include "mpxvideoplaybackviewfiledetails.h" |
|
49 #include "mpxvideoplaybackdisplayhandler.h" |
|
50 #include "mpxcommonvideoplaybackview.hrh" |
|
51 #include "mpxvideoplaybackcontrolscontroller.h" |
|
52 #include "mpxvideoplaybackuserinputhandler.h" |
|
53 |
|
54 // Member Functions |
|
55 |
|
56 // ------------------------------------------------------------------------------------------------- |
|
57 // CMPXVideoViewWrapper::CMPXVideoViewWrapper() |
|
58 // ------------------------------------------------------------------------------------------------- |
|
59 // |
|
60 CMPXVideoViewWrapper::CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView ) |
|
61 : iView( aView ) |
|
62 , iControlsController( NULL ) |
|
63 , iMediaRequestStatus( MediaNotRequested ) |
|
64 , iPlaylistView( false ) |
|
65 { |
|
66 } |
|
67 |
|
68 // ------------------------------------------------------------------------------------------------- |
|
69 // CMPXVideoViewWrapper::NewL() |
|
70 // ------------------------------------------------------------------------------------------------- |
|
71 // |
|
72 CMPXVideoViewWrapper* CMPXVideoViewWrapper::NewL( HbVideoBasePlaybackView* aView ) |
|
73 { |
|
74 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::NewL()")); |
|
75 |
|
76 CMPXVideoViewWrapper* self = new (ELeave) CMPXVideoViewWrapper( aView ); |
|
77 |
|
78 CleanupStack::PushL( self ); |
|
79 self->ConstructL(); |
|
80 CleanupStack::Pop(); |
|
81 |
|
82 return self; |
|
83 } |
|
84 |
|
85 // ------------------------------------------------------------------------------------------------- |
|
86 // CMPXVideoViewWrapper::ConstructL() |
|
87 // ------------------------------------------------------------------------------------------------- |
|
88 // |
|
89 void CMPXVideoViewWrapper::ConstructL() |
|
90 { |
|
91 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ConstructL()")); |
|
92 |
|
93 iPlaybackUtility = |
|
94 MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault ); |
|
95 iPlaybackUtility->AddObserverL( *this ); |
|
96 iPlaybackUtility->SetPrimaryClientL(); |
|
97 |
|
98 // |
|
99 // Create Active Object for closing player |
|
100 // |
|
101 iCloseAO = CIdle::NewL( CActive::EPriorityStandard ); |
|
102 |
|
103 // |
|
104 // Create Video Playback Display Handler |
|
105 // |
|
106 iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, this ); |
|
107 |
|
108 // |
|
109 // Create control's controller |
|
110 // |
|
111 CreateControlsL(); |
|
112 |
|
113 // |
|
114 // Create user input handler |
|
115 // |
|
116 iUserInputHandler = CMPXVideoPlaybackUserInputHandler::NewL( this, iFileDetails->mTvOutConnected ); |
|
117 } |
|
118 |
|
119 // ------------------------------------------------------------------------------------------------- |
|
120 // CMPXVideoViewWrapper::~CMPXVideoViewWrapper() |
|
121 // ------------------------------------------------------------------------------------------------- |
|
122 // |
|
123 CMPXVideoViewWrapper::~CMPXVideoViewWrapper() |
|
124 { |
|
125 MPX_DEBUG(_L("CMPXVideoViewWrapper::~CMPXVideoViewWrapper()")); |
|
126 |
|
127 // |
|
128 // Delete the display handler when the view is deactivated |
|
129 // |
|
130 if ( iDisplayHandler ) |
|
131 { |
|
132 delete iDisplayHandler; |
|
133 iDisplayHandler = NULL; |
|
134 } |
|
135 |
|
136 if ( iUserInputHandler ) |
|
137 { |
|
138 delete iUserInputHandler; |
|
139 iUserInputHandler = NULL; |
|
140 } |
|
141 |
|
142 if ( iControlsController ) |
|
143 { |
|
144 delete iControlsController; |
|
145 iControlsController = NULL; |
|
146 } |
|
147 |
|
148 if ( iCloseAO ) |
|
149 { |
|
150 delete iCloseAO; |
|
151 iCloseAO = NULL; |
|
152 } |
|
153 |
|
154 if ( iFileDetails ) |
|
155 { |
|
156 delete iFileDetails; |
|
157 iFileDetails = NULL; |
|
158 } |
|
159 |
|
160 if ( iPlaybackUtility ) |
|
161 { |
|
162 TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); |
|
163 iPlaybackUtility->Close(); |
|
164 iPlaybackUtility = NULL; |
|
165 } |
|
166 |
|
167 if ( iCollectionUtility ) |
|
168 { |
|
169 iCollectionUtility->Close(); |
|
170 } |
|
171 } |
|
172 |
|
173 // ------------------------------------------------------------------------------------------------- |
|
174 // CMPXVideoViewWrapper::IsLive() |
|
175 // ------------------------------------------------------------------------------------------------- |
|
176 // |
|
177 TBool CMPXVideoViewWrapper::IsLive() |
|
178 { |
|
179 return ( iFileDetails->mPlaybackMode == EMPXVideoLiveStreaming ); |
|
180 } |
|
181 |
|
182 // ------------------------------------------------------------------------------------------------- |
|
183 // CMPXVideoViewWrapper::IsPlaylist() |
|
184 // ------------------------------------------------------------------------------------------------- |
|
185 // |
|
186 TBool CMPXVideoViewWrapper::IsPlaylist() |
|
187 { |
|
188 return iPlaylistView; |
|
189 } |
|
190 |
|
191 // ------------------------------------------------------------------------------------------------- |
|
192 // CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL() |
|
193 // ------------------------------------------------------------------------------------------------- |
|
194 // |
|
195 void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( TMPXPlaybackCommand aCmd, TBool aDoSync ) |
|
196 { |
|
197 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::CreateGeneralPlaybackCommandL()"), |
|
198 _L("aCmd = %d, aDoSync, = %d"), aCmd, aDoSync ); |
|
199 |
|
200 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
201 CleanupStack::PushL( cmd ); |
|
202 |
|
203 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, aDoSync ); |
|
204 cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue ); |
|
205 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
|
206 cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, aCmd ); |
|
207 |
|
208 iPlaybackUtility->CommandL( *cmd, this ); |
|
209 |
|
210 CleanupStack::PopAndDestroy( cmd ); |
|
211 } |
|
212 |
|
213 // ------------------------------------------------------------------------------------------------- |
|
214 // CMPXVideoViewWrapper::HandleCommandL() |
|
215 // ------------------------------------------------------------------------------------------------- |
|
216 // |
|
217 void CMPXVideoViewWrapper::HandleCommandL( TInt aCommand ) |
|
218 { |
|
219 MPX_ENTER_EXIT( |
|
220 _L("CMPXVideoViewWrapper::HandleCommandL()"), |
|
221 _L("aCommand = %d"), aCommand ); |
|
222 |
|
223 switch ( aCommand ) |
|
224 { |
|
225 case EMPXPbvCmdPlay: |
|
226 { |
|
227 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EPbCmdPlay")); |
|
228 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
|
229 break; |
|
230 } |
|
231 case EMPXPbvCmdPause: |
|
232 { |
|
233 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPause")); |
|
234 CreateGeneralPlaybackCommandL( EPbCmdPause ); |
|
235 break; |
|
236 } |
|
237 case EMPXPbvCmdClose: |
|
238 { |
|
239 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdClose")); |
|
240 |
|
241 // |
|
242 // closing playback view occurs: |
|
243 // - synchronously (mSyncClose=true) for PDL case (when PDL is supported) |
|
244 // - asynchronously (mSyncClose=false) for all other cases |
|
245 // |
|
246 CreateGeneralPlaybackCommandL( EPbCmdClose, iView->mSyncClose ); |
|
247 break; |
|
248 } |
|
249 case EMPXPbvCmdSeekForward: |
|
250 { |
|
251 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdSeekForward")); |
|
252 CreateVideoSpecificCmdL( EPbCmdStartVideoSeekingForward ); |
|
253 break; |
|
254 } |
|
255 case EMPXPbvCmdSeekBackward: |
|
256 { |
|
257 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdSeekBackward")); |
|
258 CreateVideoSpecificCmdL( EPbCmdStartVideoSeekingBackward ); |
|
259 break; |
|
260 } |
|
261 case EMPXPbvCmdEndSeek: |
|
262 { |
|
263 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdEndSeek")); |
|
264 CreateVideoSpecificCmdL( EPbCmdStopVideoSeeking ); |
|
265 break; |
|
266 } |
|
267 case EMPXPbvCmdPlayPause: |
|
268 { |
|
269 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPlayPause")); |
|
270 |
|
271 if ( iPlaybackState == EPbStatePlaying ) |
|
272 { |
|
273 CreateGeneralPlaybackCommandL( EPbCmdPause ); |
|
274 } |
|
275 else if ( iPlaybackState == EPbStatePaused ) |
|
276 { |
|
277 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
|
278 } |
|
279 |
|
280 break; |
|
281 } |
|
282 case EMPXPbvCmdStop: |
|
283 { |
|
284 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdStop")); |
|
285 CreateGeneralPlaybackCommandL( EPbCmdStop ); |
|
286 break; |
|
287 } |
|
288 case EMPXPbvCmdDecreaseVolume: |
|
289 { |
|
290 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdDecreaseVolume")); |
|
291 HandleVolumeCmdL( EPbCmdDecreaseVolume ); |
|
292 break; |
|
293 } |
|
294 case EMPXPbvCmdIncreaseVolume: |
|
295 { |
|
296 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdIncreaseVolume")); |
|
297 HandleVolumeCmdL( EPbCmdIncreaseVolume ); |
|
298 break; |
|
299 } |
|
300 case EMPXPbvCmdNaturalAspectRatio: |
|
301 { |
|
302 MPX_DEBUG( |
|
303 _L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdNaturalAspectRatio")); |
|
304 SetAspectRatioL( EPbCmdNaturalAspectRatio ); |
|
305 break; |
|
306 } |
|
307 case EMPXPbvCmdZoomAspectRatio: |
|
308 { |
|
309 MPX_DEBUG( |
|
310 _L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdZoomAspectRatio")); |
|
311 SetAspectRatioL( EPbCmdZoomAspectRatio ); |
|
312 break; |
|
313 } |
|
314 case EMPXPbvCmdStretchAspectRatio: |
|
315 { |
|
316 MPX_DEBUG( |
|
317 _L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdStretchAspectRatio")); |
|
318 SetAspectRatioL( EPbCmdStretchAspectRatio ); |
|
319 break; |
|
320 } |
|
321 case EMPXPbvCmdMute: |
|
322 { |
|
323 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdMute")); |
|
324 HandleVolumeCmdL( EPbCmdMuteVolume ); |
|
325 break; |
|
326 } |
|
327 case EMPXPbvCmdUnMute: |
|
328 { |
|
329 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdUnMute")); |
|
330 HandleVolumeCmdL( EPbCmdUnMuteVolume ); |
|
331 break; |
|
332 } |
|
333 case EMPXPbvCmdShortPressBackward: |
|
334 { |
|
335 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdShortPressBackward")); |
|
336 |
|
337 HandleShortPressBackwardL(); |
|
338 break; |
|
339 } |
|
340 case EMPXPbvCmdResetControls: |
|
341 { |
|
342 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdResetControls")); |
|
343 |
|
344 CreateControlsL(); |
|
345 iView->retrievePdlInformation(); |
|
346 break; |
|
347 } |
|
348 case EMPXPbvCmdNextListItem: |
|
349 { |
|
350 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdNextListItem")); |
|
351 |
|
352 if ( iPlaylistView && iFileDetails->mMultiItemPlaylist ) |
|
353 { |
|
354 CreateGeneralPlaybackCommandL( EPbCmdNext ); |
|
355 } |
|
356 else |
|
357 { |
|
358 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() ignore EMPXPbvCmdNextListItem")); |
|
359 } |
|
360 |
|
361 break; |
|
362 } |
|
363 case EMPXPbvCmdPreviousListItem: |
|
364 { |
|
365 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPreviousListItem")); |
|
366 |
|
367 if ( iPlaylistView && iFileDetails->mMultiItemPlaylist ) |
|
368 { |
|
369 // |
|
370 // Need to send sync message to go back to a previous clip |
|
371 // regardless of current positoin |
|
372 // |
|
373 CreateGeneralPlaybackCommandL( EPbCmdPrevious ); |
|
374 } |
|
375 else |
|
376 { |
|
377 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() ignore EMPXPbvCmdNextListItem")); |
|
378 } |
|
379 |
|
380 break; |
|
381 } |
|
382 case EMPXPbvCmdEndOfClip: |
|
383 { |
|
384 CreateVideoSpecificCmdL( EPbCmdEndofClipReached ); |
|
385 break; |
|
386 } |
|
387 case EMPXPbvCmdCustomPause: |
|
388 { |
|
389 CreateVideoSpecificCmdL( EPbCmdCustomPause ); |
|
390 break; |
|
391 } |
|
392 case EMPXPbvCmdCustomPlay: |
|
393 { |
|
394 CreateVideoSpecificCmdL( EPbCmdCustomPlay ); |
|
395 break; |
|
396 } |
|
397 case EMPXPbvCmdRealOneBitmapTimeout: |
|
398 { |
|
399 IssuePlayCommandL(); |
|
400 |
|
401 break; |
|
402 } |
|
403 } |
|
404 } |
|
405 |
|
406 // ------------------------------------------------------------------------------------------------- |
|
407 // From MMPXPlaybackObserver |
|
408 // Handle playback message. |
|
409 // ------------------------------------------------------------------------------------------------- |
|
410 // |
|
411 void CMPXVideoViewWrapper::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError ) |
|
412 { |
|
413 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandlePlaybackMessage()"), |
|
414 _L("aError = %d"), aError ); |
|
415 |
|
416 if ( aError ) |
|
417 { |
|
418 MPX_TRAPD( err, DoHandleErrorPlaybackMessageL( aError ) ); |
|
419 } |
|
420 else if ( aMessage ) |
|
421 { |
|
422 MPX_TRAPD( err, DoHandlePlaybackMessageL( aMessage ) ); |
|
423 } |
|
424 } |
|
425 |
|
426 // ------------------------------------------------------------------------------------------------- |
|
427 // Request for the media object |
|
428 // ------------------------------------------------------------------------------------------------- |
|
429 // |
|
430 void CMPXVideoViewWrapper::RequestMediaL() |
|
431 { |
|
432 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::RequestMediaL()")); |
|
433 |
|
434 if ( iMediaRequestStatus == MediaNotRequested && |
|
435 iPlaybackUtility->StateL() == EPbStateInitialised ) |
|
436 { |
|
437 iMediaRequestStatus = MediaRequested; |
|
438 |
|
439 // |
|
440 // Request the volume for the controls |
|
441 // |
|
442 iPlaybackUtility->PropertyL( *this, EPbPropertyVolume ); |
|
443 |
|
444 // |
|
445 // Request the clip's meta data |
|
446 // |
|
447 MMPXSource* s = iPlaybackUtility->Source(); |
|
448 |
|
449 if ( s ) |
|
450 { |
|
451 RArray<TMPXAttribute> attrs; |
|
452 CleanupClosePushL(attrs); |
|
453 |
|
454 // |
|
455 // General Media Attributes |
|
456 // |
|
457 attrs.Append( KMPXMediaGeneralUri | |
|
458 KMPXMediaGeneralDuration | |
|
459 KMPXMediaGeneralTitle | |
|
460 KMPXMediaGeneralMimeType ); |
|
461 |
|
462 // |
|
463 // Video specific Attributes |
|
464 // |
|
465 attrs.Append( KMPXMediaVideoAll ); |
|
466 |
|
467 // Set the attribute to always route the media call to playback plugin |
|
468 CMPXAttributeSpecs* specs = CMPXAttributeSpecs::NewL(); |
|
469 CleanupStack::PushL( specs ); |
|
470 |
|
471 specs->SetTObjectValueL<TBool>(KMPXMediaGeneralExtMediaRedirect, ETrue); |
|
472 |
|
473 s->MediaL( attrs.Array(), *this, specs ); |
|
474 |
|
475 CleanupStack::PopAndDestroy( specs ); |
|
476 CleanupStack::PopAndDestroy( &attrs ); |
|
477 } |
|
478 } |
|
479 } |
|
480 |
|
481 // ------------------------------------------------------------------------------------------------- |
|
482 // CMPXVideoViewWrapper::DoHandlePlaybackMessageL() |
|
483 // ------------------------------------------------------------------------------------------------- |
|
484 // |
|
485 void CMPXVideoViewWrapper::DoHandlePlaybackMessageL( CMPXMessage* aMessage ) |
|
486 { |
|
487 TMPXMessageId id( *(aMessage->Value<TMPXMessageId>(KMPXMessageGeneralId)) ); |
|
488 |
|
489 MPX_ENTER_EXIT( |
|
490 _L("CMPXVideoViewWrapper::DoHandlePlaybackMessageL()"), |
|
491 _L("id = 0x%08x"), id ); |
|
492 |
|
493 if ( KMPXMessageGeneral == id ) |
|
494 { |
|
495 HandleGeneralPlaybackMessageL( aMessage ); |
|
496 } |
|
497 else if ( KMPXMediaIdVideoPlayback == id ) |
|
498 { |
|
499 HandleVideoPlaybackMessage( aMessage ); |
|
500 } |
|
501 else if ( KMPXMediaIdVideoDisplayMessage == id ) |
|
502 { |
|
503 if ( iDisplayHandler ) |
|
504 { |
|
505 iDisplayHandler->HandleVideoDisplayMessageL( aMessage ); |
|
506 } |
|
507 } |
|
508 } |
|
509 |
|
510 // ------------------------------------------------------------------------------------------------- |
|
511 // CMPXVideoViewWrapper::HandleGeneralPlaybackMessageL() |
|
512 // ------------------------------------------------------------------------------------------------- |
|
513 // |
|
514 void CMPXVideoViewWrapper::HandleGeneralPlaybackMessageL( CMPXMessage* aMessage ) |
|
515 { |
|
516 TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) ); |
|
517 TInt type( *aMessage->Value<TInt>( KMPXMessageGeneralType ) ); |
|
518 TInt data( *aMessage->Value<TInt>( KMPXMessageGeneralData ) ); |
|
519 |
|
520 MPX_DEBUG( |
|
521 _L("CMPXVideoViewWrapper::HandleGeneralPlaybackMessageL() event = %d type = %d value = %d"), |
|
522 event, type, data ); |
|
523 |
|
524 switch ( event ) |
|
525 { |
|
526 case TMPXPlaybackMessage::EStateChanged: |
|
527 { |
|
528 DoHandleStateChangeL( type ); |
|
529 |
|
530 break; |
|
531 } |
|
532 case TMPXPlaybackMessage::EPropertyChanged: |
|
533 { |
|
534 TMPXPlaybackProperty property( |
|
535 static_cast<TMPXPlaybackProperty>( type ) ); |
|
536 |
|
537 HandlePropertyL( property, data, KErrNone ); |
|
538 break; |
|
539 } |
|
540 case TMPXPlaybackMessage::EDownloadPositionChanged: |
|
541 { |
|
542 if ( iControlsController ) |
|
543 { |
|
544 iControlsController->handleEvent( EMPXControlCmdDownloadUpdated, data ); |
|
545 } |
|
546 |
|
547 break; |
|
548 } |
|
549 case TMPXPlaybackMessage::EDownloadStateChanged: |
|
550 { |
|
551 break; |
|
552 } |
|
553 case TMPXPlaybackMessage::ECommandReceived: |
|
554 { |
|
555 break; |
|
556 } |
|
557 case TMPXPlaybackMessage::EReachedEndOfPlaylist: |
|
558 { |
|
559 iView->closePlaybackView(); |
|
560 break; |
|
561 } |
|
562 case TMPXPlaybackMessage::ESongChanged: |
|
563 { |
|
564 break; |
|
565 } |
|
566 } |
|
567 } |
|
568 |
|
569 // ------------------------------------------------------------------------------------------------- |
|
570 // CMPXVideoViewWrapper::HandleVideoPlaybackMessage() |
|
571 // ------------------------------------------------------------------------------------------------- |
|
572 // |
|
573 void CMPXVideoViewWrapper::HandleVideoPlaybackMessage( CMPXMessage* aMessage ) |
|
574 { |
|
575 TMPXVideoPlaybackCommand message = |
|
576 ( *(aMessage->Value<TMPXVideoPlaybackCommand>(KMPXMediaVideoPlaybackCommand)) ); |
|
577 |
|
578 MPX_DEBUG( |
|
579 _L("CMPXVideoViewWrapper::HandleVideoPlaybackMessage() message = %d"), message ); |
|
580 |
|
581 switch ( message ) |
|
582 { |
|
583 case EPbCmdPluginError: |
|
584 { |
|
585 TInt error( *aMessage->Value<TInt>( KMPXMediaVideoError ) ); |
|
586 |
|
587 iView->handlePluginError( error ); |
|
588 break; |
|
589 } |
|
590 case EPbCmdTvOutEvent: |
|
591 { |
|
592 TMPXVideoPlaybackControlCommandIds cmdId = EMPXControlCmdTvOutDisconnected; |
|
593 |
|
594 TBool tvOutConnected( *aMessage->Value<TInt>( KMPXMediaVideoTvOutConnected ) ); |
|
595 |
|
596 if ( tvOutConnected ) |
|
597 { |
|
598 cmdId = EMPXControlCmdTvOutConnected; |
|
599 } |
|
600 |
|
601 if ( iUserInputHandler ) |
|
602 { |
|
603 TRAP_IGNORE(iUserInputHandler->HandleTVOutEventL( tvOutConnected )); |
|
604 } |
|
605 |
|
606 if ( iControlsController ) |
|
607 { |
|
608 iControlsController->handleEvent( cmdId ); |
|
609 } |
|
610 break; |
|
611 } |
|
612 } |
|
613 } |
|
614 |
|
615 // ------------------------------------------------------------------------------------------------- |
|
616 // CMPXVideoViewWrapper::HandlePluginError() |
|
617 // ------------------------------------------------------------------------------------------------- |
|
618 // |
|
619 void CMPXVideoViewWrapper::HandlePluginError( int aError ) |
|
620 { |
|
621 MPX_DEBUG( |
|
622 _L("CMPXVideoViewWrapper::HandlePluginError() aError = %d"), aError ); |
|
623 |
|
624 iView->handlePluginError( aError ); |
|
625 } |
|
626 |
|
627 // ------------------------------------------------------------------------------------------------- |
|
628 // Handle playback state changes |
|
629 // ------------------------------------------------------------------------------------------------- |
|
630 // |
|
631 void CMPXVideoViewWrapper::DoHandleStateChangeL( TInt aNewState ) |
|
632 { |
|
633 MPX_ENTER_EXIT( |
|
634 _L("CMPXVideoViewWrapper::DoHandleStateChangeL()"), |
|
635 _L("aNewState = %d"), aNewState ); |
|
636 |
|
637 if ( aNewState != iPlaybackState ) |
|
638 { |
|
639 switch ( aNewState ) |
|
640 { |
|
641 case EPbStateInitialising: |
|
642 { |
|
643 if ( iControlsController ) |
|
644 { |
|
645 // |
|
646 // If transitioning from Not Initialized to Initialising there is |
|
647 // no need to update the playback information that was gathered |
|
648 // when the container was created |
|
649 // |
|
650 if ( iPlaybackState != EPbStateNotInitialised ) |
|
651 { |
|
652 iMediaRequestStatus = MediaNotRequested; |
|
653 HandleCommandL( EMPXPbvCmdResetControls ); |
|
654 |
|
655 if ( iFileDetails ) |
|
656 { |
|
657 iFileDetails->clearFileDetails(); |
|
658 } |
|
659 } |
|
660 } |
|
661 break; |
|
662 } |
|
663 case EPbStateBuffering: |
|
664 { |
|
665 HandleBufferingStateL(); |
|
666 |
|
667 break; |
|
668 } |
|
669 case EPbStatePluginSeeking: |
|
670 { |
|
671 // no-op |
|
672 break; |
|
673 } |
|
674 case EPbStateStopped: |
|
675 { |
|
676 if ( iFileDetails->mMultiItemPlaylist ) |
|
677 { |
|
678 iView->handleStoppedState(); |
|
679 } |
|
680 else |
|
681 { |
|
682 iView->closePlaybackView(); |
|
683 } |
|
684 |
|
685 break; |
|
686 } |
|
687 case EPbStateInitialised: |
|
688 { |
|
689 RequestMediaL(); |
|
690 break; |
|
691 } |
|
692 default: |
|
693 { |
|
694 break; |
|
695 } |
|
696 } |
|
697 |
|
698 iPlaybackState = (TMPXPlaybackState)aNewState; |
|
699 |
|
700 if ( iControlsController ) |
|
701 { |
|
702 iControlsController->handleEvent( EMPXControlCmdStateChanged, aNewState ); |
|
703 } |
|
704 } |
|
705 } |
|
706 |
|
707 // ------------------------------------------------------------------------------------------------- |
|
708 // CMPXVideoViewWrapper::HandleBufferingStateL |
|
709 // ------------------------------------------------------------------------------------------------- |
|
710 // |
|
711 void CMPXVideoViewWrapper::HandleBufferingStateL() |
|
712 { |
|
713 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleBufferingStateL()")); |
|
714 |
|
715 } |
|
716 |
|
717 // ------------------------------------------------------------------------------------------------- |
|
718 // Handle playback error message. |
|
719 // ------------------------------------------------------------------------------------------------- |
|
720 // |
|
721 void CMPXVideoViewWrapper::DoHandleErrorPlaybackMessageL( TInt aError ) |
|
722 { |
|
723 MPX_ENTER_EXIT( _L("CMPXVideoViewWrapper::DoHandleErrorPlaybackMessageL()"), |
|
724 _L("aError = %d"), aError ); |
|
725 |
|
726 HandleCommandL( EMPXPbvCmdResetControls ); |
|
727 iView->handlePluginError(aError); |
|
728 } |
|
729 |
|
730 // ------------------------------------------------------------------------------------------------- |
|
731 // CMPXVideoViewWrapper::HandlePlaybackCommandComplete() |
|
732 // ------------------------------------------------------------------------------------------------- |
|
733 // |
|
734 void CMPXVideoViewWrapper::HandlePlaybackCommandComplete( CMPXCommand* /*aCommandResult*/, |
|
735 TInt /*aError*/ ) |
|
736 { |
|
737 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandlePlaybackCommandComplete()")); |
|
738 } |
|
739 |
|
740 // ------------------------------------------------------------------------------------------------- |
|
741 // CMPXVideoViewWrapper::ParseMetaDataL() |
|
742 // ------------------------------------------------------------------------------------------------- |
|
743 // |
|
744 void CMPXVideoViewWrapper::ParseMetaDataL( const CMPXMessage& aMedia ) |
|
745 { |
|
746 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ParseMetaDataL()")); |
|
747 |
|
748 // |
|
749 // Clip Name |
|
750 // |
|
751 if ( aMedia.IsSupported( KMPXMediaGeneralUri ) ) |
|
752 { |
|
753 TPtrC uri( aMedia.ValueText( KMPXMediaGeneralUri ) ); |
|
754 const QString qClipname( (QChar*)uri.Ptr(), uri.Length() ); |
|
755 iFileDetails->mClipName = qClipname; |
|
756 } |
|
757 |
|
758 // |
|
759 // Title |
|
760 // |
|
761 if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) ) |
|
762 { |
|
763 TPtrC title( aMedia.ValueText( KMPXMediaGeneralTitle ) ); |
|
764 const QString qTitle( (QChar*)title.Ptr(), title.Length() ); |
|
765 iFileDetails->mTitle = qTitle; |
|
766 } |
|
767 |
|
768 // |
|
769 // Artist |
|
770 // |
|
771 if ( aMedia.IsSupported( KMPXMediaVideoArtist ) ) |
|
772 { |
|
773 TPtrC artist( aMedia.ValueText( KMPXMediaVideoArtist ) ); |
|
774 const QString qArtist( (QChar*)artist.Ptr(), artist.Length() ); |
|
775 iFileDetails->mArtist = qArtist; |
|
776 } |
|
777 |
|
778 // |
|
779 // Mime Type |
|
780 // |
|
781 if ( aMedia.IsSupported( KMPXMediaGeneralMimeType ) ) |
|
782 { |
|
783 TPtrC mimeType( aMedia.ValueText( KMPXMediaGeneralMimeType ) ); |
|
784 const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() ); |
|
785 iFileDetails->mMimeType = qMimeType; |
|
786 } |
|
787 |
|
788 // |
|
789 // Duration |
|
790 // |
|
791 if ( aMedia.IsSupported( KMPXMediaGeneralDuration ) ) |
|
792 { |
|
793 iFileDetails->mDuration = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralDuration ); |
|
794 } |
|
795 |
|
796 // |
|
797 // Audio Enabled |
|
798 // |
|
799 if ( aMedia.IsSupported( KMPXMediaVideoAudioEnabled ) ) |
|
800 { |
|
801 iFileDetails->mAudioEnabled = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoAudioEnabled ); |
|
802 } |
|
803 |
|
804 // |
|
805 // Video Enabled |
|
806 // |
|
807 if ( aMedia.IsSupported( KMPXMediaVideoVideoEnabled ) ) |
|
808 { |
|
809 iFileDetails->mVideoEnabled = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoVideoEnabled ); |
|
810 } |
|
811 |
|
812 // |
|
813 // Partial Playback |
|
814 // |
|
815 if ( aMedia.IsSupported( KMPXMediaVideoPartialPlayback ) ) |
|
816 { |
|
817 iFileDetails->mPartialPlayback = |
|
818 aMedia.ValueTObjectL<TInt>( KMPXMediaVideoPartialPlayback ); |
|
819 } |
|
820 |
|
821 // |
|
822 // Playback Mode |
|
823 // |
|
824 if ( aMedia.IsSupported( KMPXMediaVideoPlaybackMode ) ) |
|
825 { |
|
826 iFileDetails->mPlaybackMode = |
|
827 (TMPXVideoMode)aMedia.ValueTObjectL<TInt>( KMPXMediaVideoPlaybackMode ); |
|
828 } |
|
829 |
|
830 // |
|
831 // Seekable |
|
832 // |
|
833 if ( aMedia.IsSupported( KMPXMediaVideoSeekable ) ) |
|
834 { |
|
835 iFileDetails->mSeekable = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoSeekable ); |
|
836 } |
|
837 |
|
838 // |
|
839 // Pausable |
|
840 // |
|
841 if ( aMedia.IsSupported( KMPXMediaVideoPausableStream ) ) |
|
842 { |
|
843 iFileDetails->mPausableStream = aMedia.ValueTObjectL<TBool>( KMPXMediaVideoPausableStream ); |
|
844 } |
|
845 |
|
846 // |
|
847 // Video Height |
|
848 // |
|
849 if ( aMedia.IsSupported( KMPXMediaVideoHeight ) ) |
|
850 { |
|
851 iFileDetails->mVideoHeight = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoHeight ); |
|
852 } |
|
853 |
|
854 // |
|
855 // Video Width |
|
856 // |
|
857 if ( aMedia.IsSupported( KMPXMediaVideoWidth ) ) |
|
858 { |
|
859 iFileDetails->mVideoWidth = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoWidth ); |
|
860 } |
|
861 |
|
862 // |
|
863 // TV-Out Connected |
|
864 // |
|
865 if ( aMedia.IsSupported( KMPXMediaVideoTvOutConnected ) ) |
|
866 { |
|
867 iFileDetails->mTvOutConnected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected ); |
|
868 } |
|
869 |
|
870 // |
|
871 // BitRate |
|
872 // |
|
873 if ( aMedia.IsSupported( KMPXMediaVideoBitRate ) ) |
|
874 { |
|
875 iFileDetails->mBitRate = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoBitRate ); |
|
876 } |
|
877 |
|
878 // |
|
879 // Drm Protected |
|
880 // |
|
881 if ( aMedia.IsSupported( KMPXMediaVideoDrmProtected ) ) |
|
882 { |
|
883 iFileDetails->mDrmProtected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoDrmProtected ); |
|
884 } |
|
885 |
|
886 // |
|
887 // Description |
|
888 // |
|
889 if ( aMedia.IsSupported( KMPXMediaVideoDescription ) ) |
|
890 { |
|
891 TPtrC description( aMedia.ValueText( KMPXMediaVideoDescription ) ); |
|
892 const QString qDescription( (QChar*)description.Ptr(), description.Length() ); |
|
893 iFileDetails->mDescription = qDescription; |
|
894 } |
|
895 |
|
896 // |
|
897 // Location |
|
898 // |
|
899 if ( aMedia.IsSupported( KMPXMediaVideoLocation ) ) |
|
900 { |
|
901 TPtrC location( aMedia.ValueText( KMPXMediaVideoLocation ) ); |
|
902 const QString qLocation( (QChar*)location.Ptr(), location.Length() ); |
|
903 iFileDetails->mLocation = qLocation; |
|
904 } |
|
905 |
|
906 // |
|
907 // Copyright |
|
908 // |
|
909 if ( aMedia.IsSupported( KMPXMediaVideoCopyright ) ) |
|
910 { |
|
911 TPtrC copyright( aMedia.ValueText( KMPXMediaVideoCopyright ) ); |
|
912 const QString qCopyright( (QChar*)copyright.Ptr(), copyright.Length() ); |
|
913 iFileDetails->mCopyright = qCopyright; |
|
914 } |
|
915 |
|
916 // |
|
917 // Language |
|
918 // |
|
919 if ( aMedia.IsSupported( KMPXMediaVideoLanguage ) ) |
|
920 { |
|
921 TPtrC language( aMedia.ValueText( KMPXMediaVideoLanguage ) ); |
|
922 const QString qLanguage( (QChar*)language.Ptr(), language.Length() ); |
|
923 iFileDetails->mLanguage = qLanguage; |
|
924 } |
|
925 |
|
926 // |
|
927 // Keywords |
|
928 // |
|
929 if ( aMedia.IsSupported( KMPXMediaVideoKeywords ) ) |
|
930 { |
|
931 TPtrC keywords( aMedia.ValueText( KMPXMediaVideoKeywords ) ); |
|
932 const QString qKeywords( (QChar*)keywords.Ptr(), keywords.Length() ); |
|
933 iFileDetails->mKeywords = qKeywords; |
|
934 } |
|
935 |
|
936 // |
|
937 // Creation date/time |
|
938 // |
|
939 if ( aMedia.IsSupported( KMPXMediaVideoCreated ) ) |
|
940 { |
|
941 iFileDetails->mCreationTime = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoCreated ); |
|
942 } |
|
943 |
|
944 // |
|
945 // Last Modified date/time |
|
946 // |
|
947 if ( aMedia.IsSupported( KMPXMediaVideoLastModified ) ) |
|
948 { |
|
949 iFileDetails->mModificationTime = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoLastModified ); |
|
950 } |
|
951 |
|
952 } |
|
953 |
|
954 // ------------------------------------------------------------------------------------------------- |
|
955 // Handle media properties. |
|
956 // Notes: The client is responsible for delete the object of aProperties. |
|
957 // ------------------------------------------------------------------------------------------------- |
|
958 // |
|
959 void CMPXVideoViewWrapper::DoHandleMediaL( const CMPXMessage& aMedia, TInt aError ) |
|
960 { |
|
961 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoHandleMediaL()"), |
|
962 _L("aError = %d"), aError ); |
|
963 |
|
964 if ( aError == KErrNone ) |
|
965 { |
|
966 iMediaRequestStatus = MediaDelivered; |
|
967 |
|
968 if ( ! iFileDetails ) |
|
969 { |
|
970 iFileDetails = new QMPXVideoPlaybackViewFileDetails(); |
|
971 } |
|
972 |
|
973 // |
|
974 // Read in the media data |
|
975 // |
|
976 ParseMetaDataL( aMedia ); |
|
977 |
|
978 // |
|
979 // If RN logo is still visible, wait for timeout of rn logo timer |
|
980 // If RN logo is not visible, issue play |
|
981 // |
|
982 if ( ! iControlsController->isRNLogoBitmapInControlList() ) |
|
983 { |
|
984 IssuePlayCommandL(); |
|
985 } |
|
986 } |
|
987 else |
|
988 { |
|
989 iMediaRequestStatus = MediaNotRequested; |
|
990 } |
|
991 } |
|
992 |
|
993 // ------------------------------------------------------------------------------------------------- |
|
994 // From MMPXPlaybackCallback |
|
995 // Handle media event. |
|
996 // Notes: The client is responsible for delete the object of aProperties. |
|
997 // ------------------------------------------------------------------------------------------------- |
|
998 // |
|
999 void CMPXVideoViewWrapper::HandleMediaL( const CMPXMedia& aMedia, TInt aError) |
|
1000 { |
|
1001 MPX_ENTER_EXIT(_L( "CMPXVideoViewWrapper::HandleMediaL()" )); |
|
1002 |
|
1003 if ( aMedia.IsSupported( KMPXMediaVideoError ) ) |
|
1004 { |
|
1005 TInt error = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoError ); |
|
1006 // Reset the controls |
|
1007 HandleCommandL( EMPXPbvCmdResetControls ); |
|
1008 // Set the iMediaRequested flag to false |
|
1009 iMediaRequestStatus = MediaNotRequested; |
|
1010 // Reset the playback state to stopped |
|
1011 iPlaybackState = EPbStateStopped; |
|
1012 // Handle the plugin error |
|
1013 iView->handlePluginError( error ); |
|
1014 } |
|
1015 else |
|
1016 { |
|
1017 DoHandleMediaL( aMedia, aError ); |
|
1018 } |
|
1019 } |
|
1020 |
|
1021 // ------------------------------------------------------------------------------------------------- |
|
1022 // CMPXVideoViewWrapper::SetPropertyL() |
|
1023 // ------------------------------------------------------------------------------------------------- |
|
1024 // |
|
1025 void CMPXVideoViewWrapper::SetPropertyL( TMPXPlaybackProperty aProperty, TInt aValue ) |
|
1026 { |
|
1027 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::SetPropertyL"), |
|
1028 _L("aProperty = %d, aValue = %d"), aProperty, aValue ); |
|
1029 |
|
1030 iPlaybackUtility->SetL( aProperty, aValue ); |
|
1031 } |
|
1032 |
|
1033 // ------------------------------------------------------------------------------------------------- |
|
1034 // CMPXVideoViewWrapper::HandlePropertyL() |
|
1035 // ------------------------------------------------------------------------------------------------- |
|
1036 // |
|
1037 void |
|
1038 CMPXVideoViewWrapper::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError ) |
|
1039 { |
|
1040 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandlePropertyL - Error(%d)"), aError ); |
|
1041 |
|
1042 if ( aError == KErrNone ) |
|
1043 { |
|
1044 switch ( aProperty ) |
|
1045 { |
|
1046 case EPbPropertyPosition: |
|
1047 { |
|
1048 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL position(%d)"), aValue ); |
|
1049 |
|
1050 if ( iControlsController ) |
|
1051 { |
|
1052 iControlsController->handleEvent( EMPXControlCmdSetPosition, aValue ); |
|
1053 } |
|
1054 |
|
1055 iPlayPosition = aValue; |
|
1056 |
|
1057 break; |
|
1058 } |
|
1059 case EPbPropertyDuration: |
|
1060 { |
|
1061 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL duration(%d)"), aValue ); |
|
1062 |
|
1063 if ( iControlsController ) |
|
1064 { |
|
1065 iControlsController->handleEvent( EMPXControlCmdSetDuration, aValue ); |
|
1066 } |
|
1067 |
|
1068 break; |
|
1069 } |
|
1070 case EPbPropertyMaxVolume: |
|
1071 { |
|
1072 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL max volume(%d)"), aValue ); |
|
1073 |
|
1074 break; |
|
1075 } |
|
1076 case EPbPropertyVolume: |
|
1077 { |
|
1078 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL volume(%d)"), aValue ); |
|
1079 |
|
1080 if ( iControlsController ) |
|
1081 { |
|
1082 iControlsController->handleEvent( EMPXControlCmdSetVolume, aValue ); |
|
1083 } |
|
1084 |
|
1085 break; |
|
1086 } |
|
1087 case EPbPropertyMute: |
|
1088 { |
|
1089 MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL mute(%d)"), aValue ); |
|
1090 |
|
1091 if ( iControlsController && aValue ) |
|
1092 { |
|
1093 iControlsController->handleEvent( EMPXControlCmdSetVolume, 0 ); |
|
1094 } |
|
1095 |
|
1096 break; |
|
1097 } |
|
1098 } |
|
1099 } |
|
1100 } |
|
1101 |
|
1102 // ------------------------------------------------------------------------------------------------- |
|
1103 // CMPXVideoViewWrapper::RetrieveFileNameAndModeL |
|
1104 // ------------------------------------------------------------------------------------------------- |
|
1105 // |
|
1106 void CMPXVideoViewWrapper::RetrieveFileNameAndModeL( CMPXCommand* aCmd ) |
|
1107 { |
|
1108 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::RetrieveFileNameAndModeL()")); |
|
1109 |
|
1110 // |
|
1111 // set attributes on the command |
|
1112 // |
|
1113 aCmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1114 |
|
1115 aCmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1116 |
|
1117 aCmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, |
|
1118 EPbCmdInitView ); |
|
1119 |
|
1120 iPlaybackUtility->CommandL( *aCmd ); |
|
1121 } |
|
1122 |
|
1123 // ------------------------------------------------------------------------------------------------- |
|
1124 // CMPXVideoViewWrapper::ActivateClosePlayerActiveObject |
|
1125 // ------------------------------------------------------------------------------------------------- |
|
1126 // |
|
1127 void CMPXVideoViewWrapper::ActivateClosePlayerActiveObject() |
|
1128 { |
|
1129 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ActivateClosePlayerActiveObject()")); |
|
1130 |
|
1131 if ( ! iCloseAO->IsActive() ) |
|
1132 { |
|
1133 iCloseAO->Start( TCallBack( CMPXVideoViewWrapper::ClosePlayer, this ) ); |
|
1134 } |
|
1135 } |
|
1136 |
|
1137 // ------------------------------------------------------------------------------------------------- |
|
1138 // CMPXVideoViewWrapper::ClosePlayer |
|
1139 // ------------------------------------------------------------------------------------------------- |
|
1140 // |
|
1141 TInt CMPXVideoViewWrapper::ClosePlayer( TAny* aPtr ) |
|
1142 { |
|
1143 MPX_DEBUG(_L("CMPXVideoViewWrapper::ClosePlayer()")); |
|
1144 |
|
1145 static_cast<CMPXVideoViewWrapper*>(aPtr)->DoClosePlayer(); |
|
1146 return KErrNone; |
|
1147 } |
|
1148 |
|
1149 // ------------------------------------------------------------------------------------------------- |
|
1150 // CMPXVideoViewWrapper::DoClosePlayer |
|
1151 // ------------------------------------------------------------------------------------------------- |
|
1152 // |
|
1153 void CMPXVideoViewWrapper::DoClosePlayer() |
|
1154 { |
|
1155 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoClosePlayer()")); |
|
1156 |
|
1157 iView->doClosePlayer(); |
|
1158 } |
|
1159 |
|
1160 // ------------------------------------------------------------------------------------------------- |
|
1161 // CMPXVideoViewWrapper::RetrievePdlInformationL |
|
1162 // ------------------------------------------------------------------------------------------------- |
|
1163 // |
|
1164 void CMPXVideoViewWrapper::RetrievePdlInformationL() |
|
1165 { |
|
1166 MPX_DEBUG(_L("CMPXVideoViewWrapper::RetrievePdlInformationL()")); |
|
1167 } |
|
1168 |
|
1169 // ------------------------------------------------------------------------------------------------- |
|
1170 // CMPXVideoViewWrapper::CreateVideoSpecificCmdL() |
|
1171 // ------------------------------------------------------------------------------------------------- |
|
1172 // |
|
1173 void CMPXVideoViewWrapper::CreateVideoSpecificCmdL( TMPXVideoPlaybackCommand aCmd ) |
|
1174 { |
|
1175 // |
|
1176 // create command to pass to playback plugin |
|
1177 // |
|
1178 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1179 CleanupStack::PushL( cmd ); |
|
1180 |
|
1181 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1182 |
|
1183 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1184 |
|
1185 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, aCmd ); |
|
1186 |
|
1187 iPlaybackUtility->CommandL( *cmd ); |
|
1188 |
|
1189 CleanupStack::PopAndDestroy( cmd ); |
|
1190 } |
|
1191 |
|
1192 // ------------------------------------------------------------------------------------------------- |
|
1193 // CMPXVideoViewWrapper::SetAspectRatioL() |
|
1194 // ------------------------------------------------------------------------------------------------- |
|
1195 // |
|
1196 void CMPXVideoViewWrapper::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ) |
|
1197 { |
|
1198 MPX_DEBUG(_L("CMPXVideoViewWrapper::SetAspectRatioL()")); |
|
1199 |
|
1200 TInt newAspectRatio = iDisplayHandler->SetAspectRatioL( aCmd ); |
|
1201 |
|
1202 if ( iControlsController ) |
|
1203 { |
|
1204 iControlsController->handleEvent( EMPXControlCmdSetAspectRatio, newAspectRatio ); |
|
1205 } |
|
1206 } |
|
1207 |
|
1208 // ------------------------------------------------------------------------------------------------- |
|
1209 // CMPXVideoViewWrapper::IsAppInFrontL() |
|
1210 // Returns true if app is foreground. Uses windowgroup id |
|
1211 // ------------------------------------------------------------------------------------------------- |
|
1212 // |
|
1213 TBool CMPXVideoViewWrapper::IsAppInFrontL() |
|
1214 { |
|
1215 TBool ret = EFalse; |
|
1216 RWsSession wsSession; |
|
1217 |
|
1218 User::LeaveIfError( wsSession.Connect() ); |
|
1219 |
|
1220 if( wsSession.Handle() ) |
|
1221 { |
|
1222 CArrayFixFlat<TInt>* wgList = |
|
1223 new (ELeave) CArrayFixFlat<TInt>( wsSession.NumWindowGroups() ); |
|
1224 |
|
1225 // check if our window is front or not |
|
1226 if ( wsSession.WindowGroupList( 0, wgList ) == KErrNone ) |
|
1227 { |
|
1228 ret = ( CEikonEnv::Static()->RootWin().Identifier() == wgList->At(0) ); |
|
1229 } |
|
1230 else |
|
1231 { |
|
1232 ret = EFalse; |
|
1233 } |
|
1234 |
|
1235 delete wgList; |
|
1236 } |
|
1237 |
|
1238 wsSession.Close(); |
|
1239 |
|
1240 MPX_DEBUG(_L("CMPXVideoViewWrapper::IsAppInFrontL (%d)" ), ret); |
|
1241 |
|
1242 return ret; |
|
1243 } |
|
1244 |
|
1245 // ------------------------------------------------------------------------------------------------- |
|
1246 // CMPXVideoViewWrapper::ClosePlaybackViewL() |
|
1247 // ------------------------------------------------------------------------------------------------- |
|
1248 // |
|
1249 void CMPXVideoViewWrapper::ClosePlaybackViewL() |
|
1250 { |
|
1251 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::closePlaybackView()")); |
|
1252 |
|
1253 iView->closePlaybackView(); |
|
1254 } |
|
1255 |
|
1256 // ------------------------------------------------------------------------------------------------- |
|
1257 // CMPXVideoViewWrapper::HandleVolumeCmdL() |
|
1258 // ------------------------------------------------------------------------------------------------- |
|
1259 // |
|
1260 void CMPXVideoViewWrapper::HandleVolumeCmdL( TMPXPlaybackCommand aCmd ) |
|
1261 { |
|
1262 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandleVolumeCmdL()")); |
|
1263 |
|
1264 // |
|
1265 // In case user try to change the volume via media key, rocker key or etc |
|
1266 // We need to show the controls though the volume level doesn't get changed |
|
1267 // For examples : - try to change the volume with a clip without audio track |
|
1268 // - try to reduce the volume with volume level 0 |
|
1269 // - try to increase the volume with max volume level |
|
1270 // |
|
1271 iControlsController->handleEvent( EMPXControlCmdShowVolumeControls ); |
|
1272 |
|
1273 switch( aCmd ) |
|
1274 { |
|
1275 case EPbCmdDecreaseVolume: |
|
1276 { |
|
1277 CreateVideoSpecificCmdL( EPbCmdHandleDecreaseVolume ); |
|
1278 break; |
|
1279 } |
|
1280 case EPbCmdIncreaseVolume: |
|
1281 { |
|
1282 CreateVideoSpecificCmdL( EPbCmdHandleIncreaseVolume ); |
|
1283 break; |
|
1284 } |
|
1285 default: |
|
1286 { |
|
1287 iPlaybackUtility->CommandL( aCmd ); |
|
1288 break; |
|
1289 } |
|
1290 } |
|
1291 } |
|
1292 |
|
1293 // ------------------------------------------------------------------------------------------------- |
|
1294 // CMPXVideoViewWrapper::HandleShortPressBackwardL() |
|
1295 // ------------------------------------------------------------------------------------------------- |
|
1296 // |
|
1297 void CMPXVideoViewWrapper::HandleShortPressBackwardL() |
|
1298 { |
|
1299 MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleShortPressBackwardL()")); |
|
1300 |
|
1301 if( !iPlaylistView ) |
|
1302 { |
|
1303 SetPropertyL( EPbPropertyPosition, 0 ); |
|
1304 } |
|
1305 } |
|
1306 |
|
1307 // ------------------------------------------------------------------------------------------------- |
|
1308 // CMPXVideoViewWrapper::IssueVideoAppForegroundCmd() |
|
1309 // ------------------------------------------------------------------------------------------------- |
|
1310 // |
|
1311 void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aForeground ) |
|
1312 { |
|
1313 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL()"), |
|
1314 _L("aForeground = %d"), aForeground ); |
|
1315 |
|
1316 TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground; |
|
1317 |
|
1318 if ( aForeground ) |
|
1319 { |
|
1320 videoCmd = EPbCmdHandleForeground; |
|
1321 } |
|
1322 |
|
1323 // |
|
1324 // create command to pass to playback plugin |
|
1325 // |
|
1326 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1327 CleanupStack::PushL( cmd ); |
|
1328 |
|
1329 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1330 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1331 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, videoCmd ); |
|
1332 cmd->SetTObjectValueL<TBool>( KMPXMediaVideoAppForeground, IsAppInFrontL() ); |
|
1333 |
|
1334 iPlaybackUtility->CommandL( *cmd ); |
|
1335 CleanupStack::PopAndDestroy( cmd ); |
|
1336 } |
|
1337 |
|
1338 // ------------------------------------------------------------------------------------------------- |
|
1339 // CMPXVideoViewWrapper::CreateControlsL() |
|
1340 // ------------------------------------------------------------------------------------------------- |
|
1341 // |
|
1342 void CMPXVideoViewWrapper::CreateControlsL() |
|
1343 { |
|
1344 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::CreateControlsL()")); |
|
1345 |
|
1346 // |
|
1347 // Query playback plugin for filename and mode |
|
1348 // |
|
1349 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1350 CleanupStack::PushL( cmd ); |
|
1351 |
|
1352 RetrieveFileNameAndModeL( cmd ); |
|
1353 |
|
1354 // |
|
1355 // Create a temporary file details that is populated with the |
|
1356 // file name and playback mode. This will be delete when |
|
1357 // plugin initialization is complete |
|
1358 // |
|
1359 if ( iFileDetails ) |
|
1360 { |
|
1361 delete iFileDetails; |
|
1362 iFileDetails = NULL; |
|
1363 } |
|
1364 |
|
1365 iFileDetails = new QMPXVideoPlaybackViewFileDetails(); |
|
1366 |
|
1367 TPtrC fileName( cmd->ValueText( KMPXMediaVideoPlaybackFileName ) ); |
|
1368 const QString qFilename( (QChar*)fileName.Ptr(), fileName.Length() ); |
|
1369 iFileDetails->mClipName = qFilename; |
|
1370 |
|
1371 iFileDetails->mPlaybackMode = (TMPXVideoMode) cmd->ValueTObjectL<TInt>( KMPXMediaVideoMode ); |
|
1372 |
|
1373 iFileDetails->mTvOutConnected = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected ); |
|
1374 |
|
1375 TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) ); |
|
1376 const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() ); |
|
1377 iFileDetails->mMimeType = qMimeType; |
|
1378 |
|
1379 // |
|
1380 // get playlist information and set mMultiItemPlaylist flag |
|
1381 // |
|
1382 TInt numItems = 1; |
|
1383 MMPXSource* s = iPlaybackUtility->Source(); |
|
1384 |
|
1385 if ( s ) |
|
1386 { |
|
1387 CMPXCollectionPlaylist* playlist = NULL; |
|
1388 |
|
1389 MPX_TRAPD( err, playlist = s->PlaylistL() ); |
|
1390 |
|
1391 if ( err == KErrNone && playlist ) |
|
1392 { |
|
1393 iPlaylistView = ETrue; |
|
1394 numItems = playlist->Count(); |
|
1395 delete playlist; |
|
1396 } |
|
1397 } |
|
1398 |
|
1399 iFileDetails->mMultiItemPlaylist = ( numItems > 1 ); |
|
1400 |
|
1401 CleanupStack::PopAndDestroy( cmd ); |
|
1402 |
|
1403 if ( iControlsController ) |
|
1404 { |
|
1405 delete iControlsController; |
|
1406 iControlsController = NULL; |
|
1407 } |
|
1408 |
|
1409 iControlsController = new QMPXVideoPlaybackControlsController( iView, this, iFileDetails ); |
|
1410 } |
|
1411 |
|
1412 // ------------------------------------------------------------------------------------------------- |
|
1413 // CMPXVideoViewWrapper::IsMultiItemPlaylist() |
|
1414 // ------------------------------------------------------------------------------------------------- |
|
1415 // |
|
1416 TBool CMPXVideoViewWrapper::IsMultiItemPlaylist() |
|
1417 { |
|
1418 |
|
1419 bool multiLinks( false ); |
|
1420 |
|
1421 if ( iFileDetails ) |
|
1422 { |
|
1423 multiLinks = iFileDetails->mMultiItemPlaylist; |
|
1424 } |
|
1425 |
|
1426 MPX_DEBUG(_L("CMPXVideoViewWrapper::IsMultiItemPlaylist() ret %d"), multiLinks ); |
|
1427 |
|
1428 return multiLinks; |
|
1429 } |
|
1430 |
|
1431 // ------------------------------------------------------------------------------------------------- |
|
1432 // CMPXVideoViewWrapper::UpdateVideoRect() |
|
1433 // ------------------------------------------------------------------------------------------------- |
|
1434 // |
|
1435 void CMPXVideoViewWrapper::UpdateVideoRect( |
|
1436 TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect ) |
|
1437 { |
|
1438 MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRect()")); |
|
1439 |
|
1440 TRect rect( TPoint( aX, aY ), TSize( aWidth, aHeight ) ); |
|
1441 TRAP_IGNORE( iDisplayHandler->UpdateVideoRectL( rect, transitionEffect ) ); |
|
1442 } |
|
1443 |
|
1444 // ------------------------------------------------------------------------------------------------- |
|
1445 // CMPXVideoViewWrapper::UpdateVideoRectDone() |
|
1446 // ------------------------------------------------------------------------------------------------- |
|
1447 // |
|
1448 void CMPXVideoViewWrapper::UpdateVideoRectDone() |
|
1449 { |
|
1450 MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRectDone()")); |
|
1451 |
|
1452 iControlsController->updateVideoRectDone(); |
|
1453 } |
|
1454 |
|
1455 // ------------------------------------------------------------------------------------------------- |
|
1456 // CMPXVideoViewWrapper::IssuePlayCommandL() |
|
1457 // ------------------------------------------------------------------------------------------------- |
|
1458 // |
|
1459 void CMPXVideoViewWrapper::IssuePlayCommandL() |
|
1460 { |
|
1461 MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssuePlayCommandL()"), |
|
1462 _L("iMediaRequestStatus = %d"), iMediaRequestStatus ); |
|
1463 |
|
1464 if ( iMediaRequestStatus == MediaDelivered ) |
|
1465 { |
|
1466 // |
|
1467 // Create controls since file details are available |
|
1468 // |
|
1469 if ( iControlsController ) |
|
1470 { |
|
1471 iControlsController->addFileDetails( iFileDetails ); |
|
1472 } |
|
1473 |
|
1474 if ( iFileDetails->mVideoEnabled ) |
|
1475 { |
|
1476 // |
|
1477 // get window size |
|
1478 // |
|
1479 RWindow *window = iView->getWindow(); |
|
1480 TRect displayRect = TRect( TPoint( window->Position() ), TSize( window->Size() ) ); |
|
1481 |
|
1482 // |
|
1483 // get window aspect ratio |
|
1484 // if device is in landscape mode, width > height |
|
1485 // if device is in portrait mode, width < height |
|
1486 // |
|
1487 TReal32 width = (TReal32) displayRect.Width(); |
|
1488 TReal32 height = (TReal32) displayRect.Height(); |
|
1489 TReal32 displayAspectRatio = (width > height)? (width / height) : (height / width); |
|
1490 |
|
1491 // |
|
1492 // get new aspect ratio |
|
1493 TInt newAspectRatio = |
|
1494 iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, displayAspectRatio ); |
|
1495 |
|
1496 // |
|
1497 // Setup the display window and issue play command |
|
1498 // |
|
1499 iDisplayHandler->CreateDisplayWindowL( CCoeEnv::Static()->WsSession(), |
|
1500 *(CCoeEnv::Static()->ScreenDevice()), |
|
1501 *window, |
|
1502 displayRect ); |
|
1503 |
|
1504 if ( iControlsController ) |
|
1505 { |
|
1506 iControlsController->handleEvent( EMPXControlCmdSetAspectRatio, newAspectRatio ); |
|
1507 } |
|
1508 } |
|
1509 |
|
1510 // if coming back after a forced termination, the playback position must |
|
1511 // be restored and state be set to paused, as forced termination can only |
|
1512 // happen when app is on background, in which case Video Player is paused |
|
1513 // by default |
|
1514 if ( iView->mStayPaused ) |
|
1515 { |
|
1516 CreateGeneralPlaybackCommandL( EPbCmdPause ); |
|
1517 SetPropertyL( EPbPropertyPosition, iView->mLastPlayPosition ); |
|
1518 iView->mStayPaused = false; |
|
1519 } |
|
1520 else |
|
1521 { |
|
1522 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
|
1523 } |
|
1524 |
|
1525 } |
|
1526 } |
|
1527 |
|
1528 // EOF |
|