|
1 /* |
|
2 * Copyright (c) 2008 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 |
|
19 // Version : %version: 86 % |
|
20 |
|
21 |
|
22 // Include Files |
|
23 |
|
24 #include <aknViewAppUi.h> |
|
25 #include <w32std.h> |
|
26 #include <eikenv.h> |
|
27 #include <bautils.h> |
|
28 #include <AknUtils.h> |
|
29 #include <coemain.h> |
|
30 #include <hlplch.h> |
|
31 #include <akntoolbar.h> |
|
32 #include <AknUtils.h> |
|
33 #include <data_caging_path_literals.hrh> |
|
34 |
|
35 #include <mpxplaybackcommanddefs.h> |
|
36 #include <mpxcommandgeneraldefs.h> |
|
37 #include <mpxcommand.h> |
|
38 #include <mpxmessagegeneraldefs.h> |
|
39 #include <mpxplaybackmessage.h> |
|
40 #include <mpxmediageneraldefs.h> |
|
41 #include <mpxplaybackutility.h> |
|
42 #include <mpxviewutility.h> |
|
43 #include <StringLoader.h> |
|
44 #include <aknnotewrappers.h> |
|
45 #include <mpxvideoplaybackviews.rsg> |
|
46 #include <textresolver.h> |
|
47 #include <mmf/common/mmferrors.h> |
|
48 #include <DRMHelper.h> |
|
49 #include <mpxcollectionutility.h> |
|
50 #include <mpxcollectionutility.h> |
|
51 #include <mpxcollectionplaylist.h> |
|
52 #include <mpxcollectionpath.h> |
|
53 #include <mpxmediageneralextdefs.h> |
|
54 #include <vcxmyvideosuids.h> |
|
55 |
|
56 #include <drmuihandling.h> |
|
57 #include <drmerrorhandling.h> |
|
58 |
|
59 #include "mpxvideobaseplaybackview.h" |
|
60 #include "mpxvideoplaybackcontainer.h" |
|
61 #include "mpxvideoplaybackcontrol.hrh" |
|
62 #include "mpxcommonvideoplaybackview.hrh" |
|
63 #include "mpxvideoplaybackviewfiledetails.h" |
|
64 #include "mpxvideoplaybackuids.hrh" |
|
65 #include "MPFileDetailsDialog.h" |
|
66 #include <mpxvideoplaybackdefs.h> |
|
67 #include "mpxmediavideodefs.h" |
|
68 #include "mpxvideo_debug.h" |
|
69 #include "mpxvideoplayercustomviewmsgconsts.h" |
|
70 |
|
71 // |
|
72 // Set a constant for the information timeout of 5 seconds |
|
73 // |
|
74 const TInt KInformationNoteTimeout = 5000000; |
|
75 |
|
76 // ------------------------------------------------------------------------------------------------- |
|
77 // CMPXVideoBasePlaybackView::CMPXVideoBasePlaybackView() |
|
78 // ------------------------------------------------------------------------------------------------- |
|
79 // |
|
80 CMPXVideoBasePlaybackView::CMPXVideoBasePlaybackView() |
|
81 // note, CBase initialises all member variables to zero |
|
82 { |
|
83 } |
|
84 |
|
85 // ------------------------------------------------------------------------------------------------- |
|
86 // CMPXVideoBasePlaybackView::InitializeVideoPlaybackViewL() |
|
87 // ------------------------------------------------------------------------------------------------- |
|
88 // |
|
89 void CMPXVideoBasePlaybackView::InitializeVideoPlaybackViewL() |
|
90 { |
|
91 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::InitializeVideoPlaybackViewL()")); |
|
92 |
|
93 _LIT( KMPXVideoPlaybackViewsRscPath, "mpxvideoplaybackviews.rsc" ); |
|
94 |
|
95 CCoeEnv* coeEnv = iEikonEnv; |
|
96 TParse parse; |
|
97 parse.Set( KMPXVideoPlaybackViewsRscPath, &KDC_APP_RESOURCE_DIR, NULL ); |
|
98 TFileName resourceFile = parse.FullName(); |
|
99 User::LeaveIfError( AddDllPath( resourceFile ) ); |
|
100 BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile ); |
|
101 |
|
102 iVideoResourceOffset = coeEnv->AddResourceFileL( resourceFile ); |
|
103 |
|
104 // |
|
105 // Get an instance of view utility |
|
106 // |
|
107 iViewUtility = MMPXViewUtility::UtilityL(); |
|
108 |
|
109 // |
|
110 // Get an instance of collection utility |
|
111 // Used for the Collection Observer to get the MediaL callbacks |
|
112 // |
|
113 iCollectionUtility = MMPXCollectionUtility::NewL( this ); |
|
114 |
|
115 // |
|
116 // Create Active Object for closing player |
|
117 // |
|
118 iCloseAO = CIdle::NewL( CActive::EPriorityStandard ); |
|
119 |
|
120 BaseConstructL( R_MPX_VIDEO_PLAYBACK_VIEW ); |
|
121 |
|
122 iAknEventMonitor = static_cast<CAknAppUiBase*>(CCoeEnv::Static()->AppUi())->EventMonitor(); |
|
123 } |
|
124 |
|
125 // ------------------------------------------------------------------------------------------------- |
|
126 // CMPXVideoBasePlaybackView::~CMPXVideoBasePlaybackView() |
|
127 // ------------------------------------------------------------------------------------------------- |
|
128 // |
|
129 CMPXVideoBasePlaybackView::~CMPXVideoBasePlaybackView() |
|
130 { |
|
131 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::~CMPXVideoBasePlaybackView()")); |
|
132 |
|
133 if ( iClipName ) |
|
134 { |
|
135 delete iClipName; |
|
136 iClipName = NULL; |
|
137 } |
|
138 |
|
139 if ( iCloseAO ) |
|
140 { |
|
141 delete iCloseAO; |
|
142 iCloseAO = NULL; |
|
143 } |
|
144 |
|
145 if ( iFileDetails ) |
|
146 { |
|
147 delete iFileDetails; |
|
148 iFileDetails = NULL; |
|
149 } |
|
150 |
|
151 if ( iDisplayHandler ) |
|
152 { |
|
153 delete iDisplayHandler; |
|
154 iDisplayHandler = NULL; |
|
155 } |
|
156 |
|
157 if ( iPlaybackUtility ) |
|
158 { |
|
159 TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); |
|
160 iPlaybackUtility->Close(); |
|
161 iPlaybackUtility = NULL; |
|
162 } |
|
163 |
|
164 if ( iViewUtility ) |
|
165 { |
|
166 iViewUtility->Close(); |
|
167 iViewUtility = NULL; |
|
168 } |
|
169 |
|
170 if ( iCollectionUtility ) |
|
171 { |
|
172 iCollectionUtility->Close(); |
|
173 } |
|
174 |
|
175 if ( iVideoResourceOffset ) |
|
176 { |
|
177 iEikonEnv->DeleteResourceFile( iVideoResourceOffset ); |
|
178 } |
|
179 |
|
180 if ( iContainer ) |
|
181 { |
|
182 AppUi()->RemoveFromStack( iContainer ); |
|
183 delete iContainer; |
|
184 iContainer = NULL; |
|
185 } |
|
186 } |
|
187 |
|
188 // ------------------------------------------------------------------------------------------------- |
|
189 // CMPXVideoBasePlaybackView::CreateGeneralPlaybackCommandL() |
|
190 // ------------------------------------------------------------------------------------------------- |
|
191 // |
|
192 void CMPXVideoBasePlaybackView::CreateGeneralPlaybackCommandL( TMPXPlaybackCommand aCmd, |
|
193 TBool aDoSync ) |
|
194 { |
|
195 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::CreateGeneralPlaybackCommandL()"), |
|
196 _L("aCmd = %d, aDoSync, = %d"), aCmd, aDoSync ); |
|
197 |
|
198 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
199 CleanupStack::PushL( cmd ); |
|
200 |
|
201 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, aDoSync ); |
|
202 cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue ); |
|
203 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral ); |
|
204 cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, aCmd ); |
|
205 |
|
206 iPlaybackUtility->CommandL( *cmd, this ); |
|
207 |
|
208 CleanupStack::PopAndDestroy( cmd ); |
|
209 } |
|
210 |
|
211 // ------------------------------------------------------------------------------------------------- |
|
212 // CMPXVideoBasePlaybackView::HandleCommandL() |
|
213 // ------------------------------------------------------------------------------------------------- |
|
214 // |
|
215 void CMPXVideoBasePlaybackView::HandleCommandL( TInt aCommand ) |
|
216 { |
|
217 MPX_ENTER_EXIT( |
|
218 _L("CMPXVideoBasePlaybackView::HandleCommandL()"), |
|
219 _L("aCommand = %d"), aCommand ); |
|
220 |
|
221 switch ( aCommand ) |
|
222 { |
|
223 case EMPXPbvCmdPlay: |
|
224 { |
|
225 IssuePlayCommandL(); |
|
226 break; |
|
227 } |
|
228 case EMPXPbvCmdPause: |
|
229 { |
|
230 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdPause")); |
|
231 CreateGeneralPlaybackCommandL( EPbCmdPause ); |
|
232 break; |
|
233 } |
|
234 case EAknSoftkeyClose: |
|
235 case EMPXPbvCmdClose: |
|
236 { |
|
237 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdClose")); |
|
238 CreateGeneralPlaybackCommandL( EPbCmdClose, iSyncClose ); |
|
239 break; |
|
240 } |
|
241 case EMPXPbvCmdSeekForward: |
|
242 { |
|
243 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdSeekForward")); |
|
244 CreateVideoSpecificCmdL( EPbCmdStartVideoSeekingForward ); |
|
245 break; |
|
246 } |
|
247 case EMPXPbvCmdSeekBackward: |
|
248 { |
|
249 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdSeekBackward")); |
|
250 CreateVideoSpecificCmdL( EPbCmdStartVideoSeekingBackward ); |
|
251 break; |
|
252 } |
|
253 case EMPXPbvCmdEndSeek: |
|
254 { |
|
255 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdEndSeek")); |
|
256 CreateVideoSpecificCmdL( EPbCmdStopVideoSeeking ); |
|
257 break; |
|
258 } |
|
259 case EMPXPbvCmdPlayPause: |
|
260 { |
|
261 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdPause")); |
|
262 iPlaybackUtility->CommandL( EPbCmdPlayPause ); |
|
263 break; |
|
264 } |
|
265 case EAknSoftkeyBack: |
|
266 { |
|
267 ClosePlaybackViewL(); |
|
268 break; |
|
269 } |
|
270 case EMPXPbvCmdStop: |
|
271 { |
|
272 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdStop")); |
|
273 CreateGeneralPlaybackCommandL( EPbCmdStop ); |
|
274 break; |
|
275 } |
|
276 case EMPXPbvCmdDecreaseVolume: |
|
277 { |
|
278 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdDecreaseVolume")); |
|
279 HandleVolumeCmdL( EPbCmdDecreaseVolume ); |
|
280 break; |
|
281 } |
|
282 case EMPXPbvCmdIncreaseVolume: |
|
283 { |
|
284 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdIncreaseVolume")); |
|
285 HandleVolumeCmdL( EPbCmdIncreaseVolume ); |
|
286 break; |
|
287 } |
|
288 case EMPXPbvCmdNaturalAspectRatio: |
|
289 { |
|
290 MPX_DEBUG( |
|
291 _L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdNaturalAspectRatio")); |
|
292 SetAspectRatioL( EPbCmdNaturalAspectRatio ); |
|
293 break; |
|
294 } |
|
295 case EMPXPbvCmdZoomAspectRatio: |
|
296 { |
|
297 MPX_DEBUG( |
|
298 _L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdZoomAspectRatio")); |
|
299 SetAspectRatioL( EPbCmdZoomAspectRatio ); |
|
300 break; |
|
301 } |
|
302 case EMPXPbvCmdStretchAspectRatio: |
|
303 { |
|
304 MPX_DEBUG( |
|
305 _L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdStretchAspectRatio")); |
|
306 SetAspectRatioL( EPbCmdStretchAspectRatio ); |
|
307 break; |
|
308 } |
|
309 case EMPXPbvCmdMute: |
|
310 { |
|
311 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdMute")); |
|
312 HandleVolumeCmdL( EPbCmdMuteVolume ); |
|
313 break; |
|
314 } |
|
315 case EMPXPbvCmdUnMute: |
|
316 { |
|
317 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdUnMute")); |
|
318 HandleVolumeCmdL( EPbCmdUnMuteVolume ); |
|
319 break; |
|
320 } |
|
321 case EMPXPbvCmdShortPressBackward: |
|
322 { |
|
323 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdShortPressBackward")); |
|
324 |
|
325 HandleShortPressBackwardL(); |
|
326 break; |
|
327 } |
|
328 case EAknCmdHelp: |
|
329 { |
|
330 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), |
|
331 AppUi()->AppHelpContextL() ); |
|
332 break; |
|
333 } |
|
334 case EMPXPbvCmdShowFileDetails: |
|
335 { |
|
336 if ( AknLayoutUtils::PenEnabled() ) |
|
337 { |
|
338 iContainer->HandleEventL( EMPXControlCmdShowFileDetailsViewer ); |
|
339 } |
|
340 else |
|
341 { |
|
342 ShowFileDetailsDialogL(); |
|
343 } |
|
344 break; |
|
345 } |
|
346 case EMPXPbvCmdEndOfClip: |
|
347 { |
|
348 CreateVideoSpecificCmdL( EPbCmdEndofClipReached ); |
|
349 break; |
|
350 } |
|
351 case EMPXPbvCmdCustomPause: |
|
352 { |
|
353 CreateVideoSpecificCmdL( EPbCmdCustomPause ); |
|
354 break; |
|
355 } |
|
356 case EMPXPbvCmdCustomPlay: |
|
357 { |
|
358 CreateVideoSpecificCmdL( EPbCmdCustomPlay ); |
|
359 break; |
|
360 } |
|
361 case EMPXPbvLaunchDRMDetails: |
|
362 { |
|
363 LaunchDRMDetailsL(); |
|
364 break; |
|
365 } |
|
366 case KMpxVideoPlaybackPdlReloading: |
|
367 { |
|
368 iPdlReloading = ETrue; |
|
369 iMediaRequested = EFalse; |
|
370 break; |
|
371 } |
|
372 case KMpxVideoPlaybackPdlReloadComplete: |
|
373 { |
|
374 HandlePdlReloadComplete(); |
|
375 break; |
|
376 } |
|
377 case EMPXPbvCmdRealOneBitmapTimeout: |
|
378 { |
|
379 HandleRealOneBitmapTimeoutL(); |
|
380 break; |
|
381 } |
|
382 } |
|
383 } |
|
384 |
|
385 // ------------------------------------------------------------------------------------------------- |
|
386 // CMPXVideoBasePlaybackView::ProcessCommandL() |
|
387 // ------------------------------------------------------------------------------------------------- |
|
388 // |
|
389 void CMPXVideoBasePlaybackView::ProcessCommandL( TInt aCommand ) |
|
390 { |
|
391 MPX_ENTER_EXIT( |
|
392 _L("CMPXVideoBasePlaybackView::ProcessCommandL()"), |
|
393 _L("aCommand = %d"), aCommand ); |
|
394 |
|
395 if ( aCommand == EAknCmdExit ) |
|
396 { |
|
397 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::ProcessCommandL() EAknCmdExit")); |
|
398 |
|
399 if ( MenuBar() ) |
|
400 { |
|
401 MenuBar()->StopDisplayingMenuBar(); |
|
402 } |
|
403 } |
|
404 |
|
405 CAknView::ProcessCommandL( aCommand ); |
|
406 } |
|
407 |
|
408 // ------------------------------------------------------------------------------------------------- |
|
409 // CMPXVideoBasePlaybackView::HandleStatusPaneSizeChange() |
|
410 // ------------------------------------------------------------------------------------------------- |
|
411 // |
|
412 void CMPXVideoBasePlaybackView::HandleStatusPaneSizeChange() |
|
413 { |
|
414 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleStatusPaneSizeChange()")); |
|
415 } |
|
416 |
|
417 // ------------------------------------------------------------------------------------------------- |
|
418 // CMPXVideoBasePlaybackView::DoActivateL() |
|
419 // ------------------------------------------------------------------------------------------------- |
|
420 // |
|
421 void CMPXVideoBasePlaybackView::DoActivateL( const TVwsViewId& /* aPrevViewId */, |
|
422 TUid /* aCustomMessageId */, |
|
423 const TDesC8& /* aCustomMessage */ ) |
|
424 { |
|
425 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DoActivateL()")); |
|
426 |
|
427 // |
|
428 // Get the playback utility instance from playback utility |
|
429 // |
|
430 iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault ); |
|
431 iPlaybackUtility->AddObserverL( *this ); |
|
432 iPlaybackUtility->SetPrimaryClientL(); |
|
433 |
|
434 // |
|
435 // Initialize the playback state |
|
436 // |
|
437 iPlaybackState = iPlaybackUtility->StateL(); |
|
438 |
|
439 // |
|
440 // Observe the View Framework when the view is active |
|
441 // |
|
442 iViewUtility->AddObserverL( this ); |
|
443 |
|
444 // |
|
445 // Disable tool bar in playback view |
|
446 // |
|
447 AppUi()->CurrentFixedToolbar()->SetToolbarVisibility( EFalse ); |
|
448 |
|
449 if ( ! iContainer ) |
|
450 { |
|
451 AppUi()->SetOrientationL( CAknAppUiBase::EAppUiOrientationLandscape ); |
|
452 |
|
453 iContainer = CMPXVideoPlaybackContainer::NewL( this ); |
|
454 |
|
455 AppUi()->AddToStackL( *this, iContainer ); |
|
456 |
|
457 iContainer->GetWindow().SetVisible( ETrue ); |
|
458 |
|
459 // |
|
460 // Create Video Playback Display Handler |
|
461 // |
|
462 iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, iContainer ); |
|
463 } |
|
464 |
|
465 // |
|
466 // Register for window visibility changes |
|
467 // |
|
468 iContainer->GetWindow().EnableVisibilityChangeEvents(); |
|
469 |
|
470 iKeyboardInFocus = ETrue; |
|
471 iAknEventMonitor->Enable( ETrue ); |
|
472 iAknEventMonitor->AddObserverL( this ); |
|
473 |
|
474 // |
|
475 // Determine if the playback is from a playlist on view activation |
|
476 // |
|
477 MMPXSource* s = iPlaybackUtility->Source(); |
|
478 CMPXCollectionPlaylist* playlist = s->PlaylistL(); |
|
479 iPlaylistView = (playlist) ? ETrue : EFalse; |
|
480 delete playlist; |
|
481 |
|
482 // |
|
483 // Retrieve PDL information for container |
|
484 // |
|
485 RetrievePdlInformationL(); |
|
486 |
|
487 // |
|
488 // Request the needed Media from the Playback Plugin |
|
489 // |
|
490 RequestMediaL(); |
|
491 } |
|
492 |
|
493 // ------------------------------------------------------------------------------------------------- |
|
494 // From CAknView |
|
495 // View deactivation function. |
|
496 // ------------------------------------------------------------------------------------------------- |
|
497 // |
|
498 void CMPXVideoBasePlaybackView::DoDeactivate() |
|
499 { |
|
500 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DoDeactivate()")); |
|
501 |
|
502 // |
|
503 // Close the playback plugin to release all references to previous clip |
|
504 // |
|
505 MPX_TRAPD( err, HandleCommandL( EMPXPbvCmdClose ) ); |
|
506 |
|
507 iAknEventMonitor->Enable( EFalse ); |
|
508 iAknEventMonitor->RemoveObserver( this ); |
|
509 iKeyboardInFocus = EFalse; |
|
510 |
|
511 // |
|
512 // Delete the display handler when the view is deactivated |
|
513 // |
|
514 if ( iDisplayHandler ) |
|
515 { |
|
516 delete iDisplayHandler; |
|
517 iDisplayHandler = NULL; |
|
518 } |
|
519 |
|
520 if ( iPlaybackUtility ) |
|
521 { |
|
522 TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) ); |
|
523 iPlaybackUtility->Close(); |
|
524 iPlaybackUtility = NULL; |
|
525 } |
|
526 |
|
527 // |
|
528 // Stop observing the view framework when this view is deactivated |
|
529 // |
|
530 iViewUtility->RemoveObserver( this ); |
|
531 |
|
532 if ( iContainer ) |
|
533 { |
|
534 iContainer->GetWindow().SetVisible( EFalse ); |
|
535 AppUi()->RemoveFromStack( iContainer ); |
|
536 delete iContainer; |
|
537 iContainer = NULL; |
|
538 } |
|
539 |
|
540 iMediaRequested = EFalse; |
|
541 iPlaybackState = EPbStateNotInitialised; |
|
542 |
|
543 if ( iClipName ) |
|
544 { |
|
545 delete iClipName; |
|
546 iClipName = NULL; |
|
547 } |
|
548 } |
|
549 |
|
550 // ------------------------------------------------------------------------------------------------- |
|
551 // CMPXVideoBasePlaybackView::HandleForegroundEventL() |
|
552 // ------------------------------------------------------------------------------------------------- |
|
553 // |
|
554 void CMPXVideoBasePlaybackView::HandleForegroundEventL( TBool aForeground ) |
|
555 { |
|
556 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleForegroundEventL()"), |
|
557 _L("aForeground = %d"), aForeground ); |
|
558 |
|
559 if ( aForeground ) |
|
560 { |
|
561 iContainer->HandleEventL( EMPXControlCmdHandleForegroundEvent ); |
|
562 iKeyboardInFocus = ETrue; |
|
563 |
|
564 SendWindowCommandL( EPbCmdHandleForeground ); |
|
565 } |
|
566 else |
|
567 { |
|
568 iContainer->HandleEventL( EMPXControlCmdHandleBackgroundEvent ); |
|
569 iKeyboardInFocus = EFalse; |
|
570 |
|
571 SendWindowCommandL( EPbCmdHandleBackground ); |
|
572 } |
|
573 |
|
574 CAknView::HandleForegroundEventL( aForeground ); |
|
575 } |
|
576 |
|
577 // ------------------------------------------------------------------------------------------------- |
|
578 // From MEikMenuObserver |
|
579 // Dynamically initialises a menu pane. |
|
580 // ------------------------------------------------------------------------------------------------- |
|
581 // |
|
582 void CMPXVideoBasePlaybackView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane ) |
|
583 { |
|
584 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DynInitMenuPaneL()")); |
|
585 |
|
586 if ( aResourceId == R_MPX_VIDEO_PLAYBACK_VIEW_MENU ) |
|
587 { |
|
588 // |
|
589 // Make EMPXPbvCmdChangeAspectRatio menu dimmed in the followings cases: |
|
590 // - support touch |
|
591 // - a mmf controller is not prepared |
|
592 // - clip doesn't have a video track |
|
593 // - TV-out cable gets connected |
|
594 // |
|
595 if ( AknLayoutUtils::PenEnabled() || |
|
596 ! iFileDetails || |
|
597 ! iFileDetails->iVideoEnabled || |
|
598 iFileDetails->iVideoHeight <= 0 || |
|
599 iFileDetails->iVideoWidth <= 0 ) |
|
600 { |
|
601 aMenuPane->SetItemDimmed( EMPXPbvCmdChangeAspectRatio, ETrue ); |
|
602 } |
|
603 } |
|
604 } |
|
605 |
|
606 void CMPXVideoBasePlaybackView::HandleViewActivation( const TUid& aCurrentViewType, |
|
607 const TUid& aPreviousViewType ) |
|
608 { |
|
609 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleViewActivation()"), |
|
610 _L("aCurrentViewType = 0x%08x, aPreviousViewType = 0x%08x"), |
|
611 aCurrentViewType.iUid, aPreviousViewType.iUid ); |
|
612 |
|
613 // |
|
614 // This view is active since we are receiving the callback. |
|
615 // Some new view is being activated so remove surface, stop playback and |
|
616 // return to automatic orientation |
|
617 // |
|
618 iDisplayHandler->RemoveDisplayWindow(); |
|
619 |
|
620 TRAP_IGNORE( HandleCommandL( EMPXPbvCmdStop ); |
|
621 AppUi()->SetOrientationL( CAknAppUiBase::EAppUiOrientationAutomatic ) ); |
|
622 } |
|
623 |
|
624 // ------------------------------------------------------------------------------------------------- |
|
625 // From MMPXPlaybackObserver |
|
626 // Handle playback message. |
|
627 // ------------------------------------------------------------------------------------------------- |
|
628 // |
|
629 void CMPXVideoBasePlaybackView::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError ) |
|
630 { |
|
631 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandlePlaybackMessage()"), |
|
632 _L("aError = %d"), aError ); |
|
633 |
|
634 if ( aError ) |
|
635 { |
|
636 MPX_TRAPD( err, DoHandleErrorPlaybackMessageL( aError ) ); |
|
637 } |
|
638 else if ( aMessage ) |
|
639 { |
|
640 MPX_TRAPD( err, DoHandlePlaybackMessageL( aMessage ) ); |
|
641 } |
|
642 } |
|
643 |
|
644 // ------------------------------------------------------------------------------------------------- |
|
645 // CMPXVideoBasePlaybackView::IsInMemoryPlugin |
|
646 // ------------------------------------------------------------------------------------------------- |
|
647 // |
|
648 TBool CMPXVideoBasePlaybackView::IsInMemoryPlugin() |
|
649 { |
|
650 TBool retVal( EFalse ); |
|
651 |
|
652 MMPXCollection& collectionPlugin = iCollectionUtility->Collection(); |
|
653 |
|
654 TUid collectionUid; |
|
655 TUid inMemoryPluginUid = TUid::Uid( KMpxInMemoryPluginUid ); |
|
656 |
|
657 MPX_TRAPD( error, collectionUid = collectionPlugin.UidL() ); |
|
658 |
|
659 if ( ! error ) |
|
660 { |
|
661 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::IsInMemoryPlugin() collectionUid = 0x%08x"), |
|
662 collectionUid.iUid ); |
|
663 |
|
664 if ( collectionUid == inMemoryPluginUid ) |
|
665 { |
|
666 retVal = ETrue; |
|
667 } |
|
668 } |
|
669 |
|
670 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::IsInMemoryPlugin(%d)"), retVal ); |
|
671 |
|
672 return retVal; |
|
673 } |
|
674 |
|
675 // ------------------------------------------------------------------------------------------------- |
|
676 // Request for the media object |
|
677 // ------------------------------------------------------------------------------------------------- |
|
678 // |
|
679 void CMPXVideoBasePlaybackView::RequestMediaL() |
|
680 { |
|
681 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::RequestMediaL()")); |
|
682 |
|
683 if ( ! iMediaRequested && iPlaybackState == EPbStateInitialised ) |
|
684 { |
|
685 iMediaRequested = ETrue; |
|
686 |
|
687 if ( iPlaylistView && IsInMemoryPlugin() ) |
|
688 { |
|
689 // Get the media attributes from the collection plugin |
|
690 RequestCollectionMediaL(); |
|
691 } |
|
692 else |
|
693 { |
|
694 // Get the file details from playback plugin |
|
695 RequestPlaybackMediaL(); |
|
696 } |
|
697 } |
|
698 } |
|
699 |
|
700 // ------------------------------------------------------------------------------------------------- |
|
701 // Request for the media object |
|
702 // ------------------------------------------------------------------------------------------------- |
|
703 // |
|
704 void CMPXVideoBasePlaybackView::RequestPlaybackMediaL() |
|
705 { |
|
706 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::RequestPlaybackMediaL()")); |
|
707 |
|
708 // |
|
709 // Request the volume for the controls |
|
710 // |
|
711 iPlaybackUtility->PropertyL( *this, EPbPropertyVolume ); |
|
712 |
|
713 // |
|
714 // Request the clip's meta data |
|
715 // |
|
716 MMPXSource* s = iPlaybackUtility->Source(); |
|
717 |
|
718 if ( s ) |
|
719 { |
|
720 RArray<TMPXAttribute> attrs; |
|
721 CleanupClosePushL(attrs); |
|
722 |
|
723 // |
|
724 // General Media Attributes |
|
725 // |
|
726 attrs.Append( KMPXMediaGeneralUri | |
|
727 KMPXMediaGeneralDuration | |
|
728 KMPXMediaGeneralTitle | |
|
729 KMPXMediaGeneralMimeType ); |
|
730 |
|
731 // |
|
732 // Video specific Attributes |
|
733 // |
|
734 attrs.Append( KMPXMediaVideoAll ); |
|
735 |
|
736 // Set the attribute to always route the media call to playback plugin |
|
737 CMPXAttributeSpecs* specs = CMPXAttributeSpecs::NewL(); |
|
738 CleanupStack::PushL( specs ); |
|
739 |
|
740 specs->SetTObjectValueL<TBool>(KMPXMediaGeneralExtMediaRedirect, ETrue); |
|
741 |
|
742 s->MediaL( attrs.Array(), *this, specs); |
|
743 |
|
744 CleanupStack::PopAndDestroy( specs ); |
|
745 CleanupStack::PopAndDestroy( &attrs ); |
|
746 } |
|
747 } |
|
748 |
|
749 // ------------------------------------------------------------------------------------------------- |
|
750 // Request for the media object |
|
751 // ------------------------------------------------------------------------------------------------- |
|
752 // |
|
753 void CMPXVideoBasePlaybackView::RequestCollectionMediaL() |
|
754 { |
|
755 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::RequestCollectionMediaL()")); |
|
756 |
|
757 // Request the clip's meta data |
|
758 MMPXSource* s = iPlaybackUtility->Source(); |
|
759 |
|
760 if ( s ) |
|
761 { |
|
762 RArray<TMPXAttribute> attrs; |
|
763 CleanupClosePushL(attrs); |
|
764 |
|
765 // General Media Attributes |
|
766 attrs.Append( KMPXMediaGeneralExtVideoSeekable ); |
|
767 |
|
768 s->MediaL( attrs.Array(), *this ); |
|
769 |
|
770 // Set the falg to indicate that media was reuqested from collection FW |
|
771 iCollectionMediaRequested = ETrue; |
|
772 |
|
773 CleanupStack::PopAndDestroy( &attrs ); |
|
774 } |
|
775 } |
|
776 |
|
777 // ------------------------------------------------------------------------------------------------- |
|
778 // CMPXVideoBasePlaybackView::DoHandlePlaybackMessageL() |
|
779 // ------------------------------------------------------------------------------------------------- |
|
780 // |
|
781 void CMPXVideoBasePlaybackView::DoHandlePlaybackMessageL( CMPXMessage* aMessage ) |
|
782 { |
|
783 TMPXMessageId id( *(aMessage->Value<TMPXMessageId>(KMPXMessageGeneralId)) ); |
|
784 |
|
785 MPX_ENTER_EXIT( |
|
786 _L("CMPXVideoBasePlaybackView::DoHandlePlaybackMessageL()"), |
|
787 _L("id = 0x%08x"), id ); |
|
788 |
|
789 if ( KMPXMessageGeneral == id ) |
|
790 { |
|
791 HandleGeneralPlaybackMessageL( aMessage ); |
|
792 } |
|
793 else if ( KMPXMediaIdVideoPlayback == id ) |
|
794 { |
|
795 HandleVideoPlaybackMessage( aMessage ); |
|
796 } |
|
797 else if ( KMPXMediaIdVideoDisplayMessage == id ) |
|
798 { |
|
799 if ( iDisplayHandler ) |
|
800 { |
|
801 iDisplayHandler->HandleVideoDisplayMessageL( aMessage ); |
|
802 } |
|
803 } |
|
804 } |
|
805 |
|
806 // ------------------------------------------------------------------------------------------------- |
|
807 // CMPXVideoBasePlaybackView::HandleGeneralPlaybackMessageL() |
|
808 // ------------------------------------------------------------------------------------------------- |
|
809 // |
|
810 void CMPXVideoBasePlaybackView::HandleGeneralPlaybackMessageL( CMPXMessage* aMessage ) |
|
811 { |
|
812 TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) ); |
|
813 TInt type( *aMessage->Value<TInt>( KMPXMessageGeneralType ) ); |
|
814 TInt data( *aMessage->Value<TInt>( KMPXMessageGeneralData ) ); |
|
815 |
|
816 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleGeneralPlaybackMessageL()"), |
|
817 _L("event = %d type = %d value = %d"), event, type, data ); |
|
818 |
|
819 switch ( event ) |
|
820 { |
|
821 case TMPXPlaybackMessage::EStateChanged: |
|
822 { |
|
823 DoHandleStateChangeL( type ); |
|
824 break; |
|
825 } |
|
826 case TMPXPlaybackMessage::EPropertyChanged: |
|
827 { |
|
828 TMPXPlaybackProperty property( static_cast<TMPXPlaybackProperty>( type ) ); |
|
829 |
|
830 HandlePropertyL( property, data, KErrNone ); |
|
831 break; |
|
832 } |
|
833 case TMPXPlaybackMessage::EDownloadPositionChanged: |
|
834 { |
|
835 if ( iContainer ) |
|
836 { |
|
837 iContainer->HandleEventL( EMPXControlCmdDownloadUpdated, data ); |
|
838 } |
|
839 |
|
840 break; |
|
841 } |
|
842 case TMPXPlaybackMessage::EDownloadStateChanged: |
|
843 { |
|
844 HandlePdlStateChangeL( data ); |
|
845 |
|
846 break; |
|
847 } |
|
848 case TMPXPlaybackMessage::EReachedEndOfPlaylist: |
|
849 { |
|
850 HandleCommandL( EAknSoftkeyBack ); |
|
851 break; |
|
852 } |
|
853 } |
|
854 } |
|
855 |
|
856 // ------------------------------------------------------------------------------------------------- |
|
857 // CMPXVideoBasePlaybackView::HandleVideoPlaybackMessage() |
|
858 // ------------------------------------------------------------------------------------------------- |
|
859 // |
|
860 void CMPXVideoBasePlaybackView::HandleVideoPlaybackMessage( CMPXMessage* aMessage ) |
|
861 { |
|
862 TMPXVideoPlaybackCommand message = |
|
863 ( *(aMessage->Value<TMPXVideoPlaybackCommand>(KMPXMediaVideoPlaybackCommand)) ); |
|
864 |
|
865 MPX_DEBUG( |
|
866 _L("CMPXVideoBasePlaybackView::HandleVideoPlaybackMessage() message = %d"), message ); |
|
867 |
|
868 switch ( message ) |
|
869 { |
|
870 case EPbCmdPluginError: |
|
871 { |
|
872 TInt error( *aMessage->Value<TInt>( KMPXMediaVideoError ) ); |
|
873 |
|
874 MPX_TRAPD( err, HandlePluginErrorL( error ) ); |
|
875 break; |
|
876 } |
|
877 case EPbCmdTvOutEvent: |
|
878 { |
|
879 TMPXVideoPlaybackControlCommandIds cmdId = EMPXControlCmdTvOutDisconnected; |
|
880 |
|
881 TBool tvOutConnected( *aMessage->Value<TInt>( KMPXMediaVideoTvOutConnected ) ); |
|
882 |
|
883 if ( tvOutConnected ) |
|
884 { |
|
885 cmdId = EMPXControlCmdTvOutConnected; |
|
886 } |
|
887 |
|
888 if ( iContainer ) |
|
889 { |
|
890 MPX_TRAPD( err, |
|
891 iContainer->HandleEventL( cmdId, iDisplayHandler->ShowAspectRatioIcon() ) ); |
|
892 } |
|
893 |
|
894 break; |
|
895 } |
|
896 case EPbCmdLoadingStarted: |
|
897 { |
|
898 if ( iContainer ) |
|
899 { |
|
900 MPX_TRAPD( err, iContainer->HandleEventL( EMPXControlCmdLoadingStarted ) ); |
|
901 } |
|
902 |
|
903 break; |
|
904 } |
|
905 case EPbCmdHideControls: |
|
906 { |
|
907 if ( iContainer ) |
|
908 { |
|
909 MPX_TRAPD( err, iContainer->HandleEventL( EMPXControlCmdHideControls ) ); |
|
910 } |
|
911 break; |
|
912 } |
|
913 } |
|
914 } |
|
915 |
|
916 // ------------------------------------------------------------------------------------------------- |
|
917 // CMPXVideoBasePlaybackView::HandleClosePlaybackViewL() |
|
918 // ------------------------------------------------------------------------------------------------- |
|
919 // |
|
920 void CMPXVideoBasePlaybackView::HandleClosePlaybackViewL() |
|
921 { |
|
922 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()")); |
|
923 |
|
924 iPlaybackState = EPbStateStopped; |
|
925 |
|
926 if ( IsMultiItemPlaylist() ) |
|
927 { |
|
928 iPlaybackUtility->CommandL( EPbCmdNext ); |
|
929 } |
|
930 else |
|
931 { |
|
932 ClosePlaybackViewL(); |
|
933 } |
|
934 } |
|
935 |
|
936 // ------------------------------------------------------------------------------------------------- |
|
937 // CMPXVideoBasePlaybackView::HandlePluginErrorL() |
|
938 // ------------------------------------------------------------------------------------------------- |
|
939 // |
|
940 void CMPXVideoBasePlaybackView::HandlePluginErrorL( TInt aError ) |
|
941 { |
|
942 MPX_DEBUG( |
|
943 _L("CMPXVideoBasePlaybackView::HandlePluginErrorL() aError = %d"), aError ); |
|
944 |
|
945 switch ( aError ) |
|
946 { |
|
947 case KErrPathNotFound: |
|
948 case KErrNotFound: |
|
949 { |
|
950 DisplayErrorMessageL( R_MPX_CLIP_NOT_FOUND_IN_SERVER ); |
|
951 HandleClosePlaybackViewL(); |
|
952 break; |
|
953 } |
|
954 case KErrCancel: |
|
955 { |
|
956 HandleClosePlaybackViewL(); |
|
957 break; |
|
958 } |
|
959 case KErrMMDRMNotAuthorized: |
|
960 case KErrCANoRights: |
|
961 case KErrCANoPermission: |
|
962 case KErrCAPendingRights: |
|
963 { |
|
964 HandleDrmErrorsL( aError ); |
|
965 break; |
|
966 } |
|
967 case KMPXVideoCallOngoingError: |
|
968 { |
|
969 DisplayInfoMessageL( R_MPX_VIDEO_CALL_ONGOING ); |
|
970 break; |
|
971 } |
|
972 default: |
|
973 { |
|
974 // |
|
975 // TextResolver instance for error resolving. |
|
976 // |
|
977 CTextResolver* textresolver = CTextResolver::NewLC(); |
|
978 |
|
979 // |
|
980 // Resolve the error text |
|
981 // |
|
982 TPtrC text; |
|
983 text.Set( textresolver->ResolveErrorString( aError ) ); |
|
984 |
|
985 CAknErrorNote* dlg = new (ELeave) CAknErrorNote( ETrue ); |
|
986 |
|
987 dlg->ExecuteLD( text ); |
|
988 |
|
989 CleanupStack::PopAndDestroy( textresolver ); |
|
990 |
|
991 HandleClosePlaybackViewL(); |
|
992 } |
|
993 } |
|
994 } |
|
995 |
|
996 // ------------------------------------------------------------------------------------------------- |
|
997 // Handle playback state changes |
|
998 // ------------------------------------------------------------------------------------------------- |
|
999 // |
|
1000 void CMPXVideoBasePlaybackView::DoHandleStateChangeL( TInt aNewState ) |
|
1001 { |
|
1002 MPX_ENTER_EXIT( |
|
1003 _L("CMPXVideoBasePlaybackView::DoHandleStateChangeL()"), |
|
1004 _L("aNewState = %d, currentState = %d"), aNewState, iPlaybackState ); |
|
1005 |
|
1006 if ( aNewState != iPlaybackState ) |
|
1007 { |
|
1008 TBool stateChange( ETrue ); |
|
1009 |
|
1010 TMPXPlaybackState oldState = iPlaybackState; |
|
1011 iPlaybackState = (TMPXPlaybackState)aNewState; |
|
1012 |
|
1013 switch ( aNewState ) |
|
1014 { |
|
1015 case EPbStateInitialising: |
|
1016 { |
|
1017 HandleInitializingStateL( oldState ); |
|
1018 break; |
|
1019 } |
|
1020 case EPbStateBuffering: |
|
1021 { |
|
1022 TInt bufferingPercentage( 0 ); |
|
1023 |
|
1024 // |
|
1025 // If buffering percentage is 100, buffering is a transition state anc |
|
1026 // can be ignored |
|
1027 // |
|
1028 MPX_TRAPD( err, bufferingPercentage = RetrieveBufferingPercentageL() ); |
|
1029 |
|
1030 if ( bufferingPercentage == 100 ) |
|
1031 { |
|
1032 stateChange = EFalse; |
|
1033 } |
|
1034 else |
|
1035 { |
|
1036 HandleBufferingStateL(); |
|
1037 } |
|
1038 |
|
1039 break; |
|
1040 } |
|
1041 case EPbStatePluginSeeking: |
|
1042 { |
|
1043 // no-op |
|
1044 break; |
|
1045 } |
|
1046 case EPbStateStopped: |
|
1047 { |
|
1048 HandleStoppedStateL(); |
|
1049 break; |
|
1050 } |
|
1051 case EPbStateInitialised: |
|
1052 { |
|
1053 RequestMediaL(); |
|
1054 break; |
|
1055 } |
|
1056 default: |
|
1057 { |
|
1058 break; |
|
1059 } |
|
1060 } |
|
1061 |
|
1062 if ( iContainer && stateChange ) |
|
1063 { |
|
1064 iContainer->HandleEventL( EMPXControlCmdStateChanged, aNewState ); |
|
1065 } |
|
1066 } |
|
1067 } |
|
1068 |
|
1069 // ------------------------------------------------------------------------------------------------- |
|
1070 // Handle playback error message. |
|
1071 // ------------------------------------------------------------------------------------------------- |
|
1072 // |
|
1073 void CMPXVideoBasePlaybackView::DoHandleErrorPlaybackMessageL( TInt aError ) |
|
1074 { |
|
1075 MPX_ENTER_EXIT( _L("CMPXVideoBasePlaybackView::DoHandleErrorPlaybackMessageL()"), |
|
1076 _L("aError = %d"), aError ); |
|
1077 |
|
1078 iContainer->HandleCommandL( EMPXPbvCmdResetControls ); |
|
1079 HandlePluginErrorL( aError ); |
|
1080 } |
|
1081 |
|
1082 // ------------------------------------------------------------------------------------------------- |
|
1083 // CMPXVideoBasePlaybackView::HandlePlaybackCommandComplete() |
|
1084 // ------------------------------------------------------------------------------------------------- |
|
1085 // |
|
1086 void CMPXVideoBasePlaybackView::HandlePlaybackCommandComplete( CMPXCommand* /*aCommandResult*/, |
|
1087 TInt /*aError*/ ) |
|
1088 { |
|
1089 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandlePlaybackCommandComplete()")); |
|
1090 } |
|
1091 |
|
1092 // ------------------------------------------------------------------------------------------------- |
|
1093 // CMPXVideoBasePlaybackView::ParseMetaDataL() |
|
1094 // ------------------------------------------------------------------------------------------------- |
|
1095 // |
|
1096 void CMPXVideoBasePlaybackView::ParseMetaDataL( const CMPXMessage& aMedia ) |
|
1097 { |
|
1098 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::ParseMetaDataL()")); |
|
1099 |
|
1100 // |
|
1101 // Clip Name |
|
1102 // |
|
1103 if ( aMedia.IsSupported( KMPXMediaGeneralUri ) ) |
|
1104 { |
|
1105 TPtrC uri( aMedia.ValueText( KMPXMediaGeneralUri ) ); |
|
1106 iFileDetails->iClipName = uri.AllocL(); |
|
1107 } |
|
1108 |
|
1109 // |
|
1110 // Title |
|
1111 // |
|
1112 if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) ) |
|
1113 { |
|
1114 TPtrC title( aMedia.ValueText( KMPXMediaGeneralTitle ) ); |
|
1115 iFileDetails->iTitle = title.AllocL(); |
|
1116 } |
|
1117 |
|
1118 // |
|
1119 // Artist |
|
1120 // |
|
1121 if ( aMedia.IsSupported( KMPXMediaVideoArtist ) ) |
|
1122 { |
|
1123 TPtrC artist( aMedia.ValueText( KMPXMediaVideoArtist ) ); |
|
1124 iFileDetails->iArtist = artist.AllocL(); |
|
1125 } |
|
1126 |
|
1127 // |
|
1128 // Mime Type |
|
1129 // |
|
1130 if ( aMedia.IsSupported( KMPXMediaGeneralMimeType ) ) |
|
1131 { |
|
1132 TPtrC mimeType( aMedia.ValueText( KMPXMediaGeneralMimeType ) ); |
|
1133 iFileDetails->iMimeType = mimeType.AllocL(); |
|
1134 } |
|
1135 |
|
1136 // |
|
1137 // Duration |
|
1138 // |
|
1139 if ( aMedia.IsSupported( KMPXMediaGeneralDuration ) ) |
|
1140 { |
|
1141 iFileDetails->iDuration = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralDuration ); |
|
1142 } |
|
1143 |
|
1144 // |
|
1145 // Audio Enabled |
|
1146 // |
|
1147 if ( aMedia.IsSupported( KMPXMediaVideoAudioEnabled ) ) |
|
1148 { |
|
1149 iFileDetails->iAudioEnabled = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoAudioEnabled ); |
|
1150 } |
|
1151 |
|
1152 // |
|
1153 // Video Enabled |
|
1154 // |
|
1155 if ( aMedia.IsSupported( KMPXMediaVideoVideoEnabled ) ) |
|
1156 { |
|
1157 iFileDetails->iVideoEnabled = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoVideoEnabled ); |
|
1158 } |
|
1159 |
|
1160 // |
|
1161 // Partial Playback |
|
1162 // |
|
1163 if ( aMedia.IsSupported( KMPXMediaVideoPartialPlayback ) ) |
|
1164 { |
|
1165 iFileDetails->iPartialPlayback = |
|
1166 aMedia.ValueTObjectL<TInt>( KMPXMediaVideoPartialPlayback ); |
|
1167 } |
|
1168 |
|
1169 // |
|
1170 // Playback Mode |
|
1171 // |
|
1172 if ( aMedia.IsSupported( KMPXMediaVideoPlaybackMode ) ) |
|
1173 { |
|
1174 iFileDetails->iPlaybackMode = |
|
1175 (TMPXVideoMode)aMedia.ValueTObjectL<TInt>( KMPXMediaVideoPlaybackMode ); |
|
1176 } |
|
1177 |
|
1178 // |
|
1179 // Seekable |
|
1180 // |
|
1181 if ( aMedia.IsSupported( KMPXMediaVideoSeekable ) ) |
|
1182 { |
|
1183 iFileDetails->iSeekable = aMedia.ValueTObjectL<TBool>( KMPXMediaVideoSeekable ); |
|
1184 } |
|
1185 |
|
1186 // |
|
1187 // Pausable |
|
1188 // |
|
1189 if ( aMedia.IsSupported( KMPXMediaVideoPausableStream ) ) |
|
1190 { |
|
1191 iFileDetails->iPausableStream = aMedia.ValueTObjectL<TBool>( KMPXMediaVideoPausableStream ); |
|
1192 } |
|
1193 |
|
1194 // |
|
1195 // Video Height |
|
1196 // |
|
1197 if ( aMedia.IsSupported( KMPXMediaVideoHeight ) ) |
|
1198 { |
|
1199 iFileDetails->iVideoHeight = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoHeight ); |
|
1200 } |
|
1201 |
|
1202 // |
|
1203 // Video Width |
|
1204 // |
|
1205 if ( aMedia.IsSupported( KMPXMediaVideoWidth ) ) |
|
1206 { |
|
1207 iFileDetails->iVideoWidth = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoWidth ); |
|
1208 } |
|
1209 |
|
1210 // |
|
1211 // TV-Out Connected |
|
1212 // |
|
1213 if ( aMedia.IsSupported( KMPXMediaVideoTvOutConnected ) ) |
|
1214 { |
|
1215 iFileDetails->iTvOutConnected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected ); |
|
1216 } |
|
1217 |
|
1218 // |
|
1219 // Video BitRate |
|
1220 // |
|
1221 if ( aMedia.IsSupported( KMPXMediaVideoBitRate ) ) |
|
1222 { |
|
1223 iFileDetails->iBitRate = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoBitRate ); |
|
1224 } |
|
1225 |
|
1226 // |
|
1227 // ForCC Code |
|
1228 // |
|
1229 if ( aMedia.IsSupported( KMPXMediaFourCCCode ) ) |
|
1230 { |
|
1231 iFileDetails->iFourCCCode = aMedia.ValueTObjectL<TUint32>( KMPXMediaFourCCCode ); |
|
1232 } |
|
1233 |
|
1234 // |
|
1235 // Drm Protected |
|
1236 // |
|
1237 if ( aMedia.IsSupported( KMPXMediaVideoDrmProtected ) ) |
|
1238 { |
|
1239 iFileDetails->iDrmProtected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoDrmProtected ); |
|
1240 } |
|
1241 } |
|
1242 |
|
1243 // ------------------------------------------------------------------------------------------------- |
|
1244 // Handle media properties. |
|
1245 // Notes: The client is responsible for delete the object of aProperties. |
|
1246 // ------------------------------------------------------------------------------------------------- |
|
1247 // |
|
1248 void CMPXVideoBasePlaybackView::DoHandleMediaL( const CMPXMessage& aMedia, TInt aError ) |
|
1249 { |
|
1250 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DoHandleMediaL()"), |
|
1251 _L("aError = %d"), aError ); |
|
1252 |
|
1253 if ( aError == KErrNone ) |
|
1254 { |
|
1255 if ( iFileDetails ) |
|
1256 { |
|
1257 iFileDetails->ClearFileDetails(); |
|
1258 } |
|
1259 else |
|
1260 { |
|
1261 iFileDetails = CMPXVideoPlaybackViewFileDetails::NewL(); |
|
1262 } |
|
1263 |
|
1264 // |
|
1265 // Read in the media data |
|
1266 // |
|
1267 ParseMetaDataL( aMedia ); |
|
1268 |
|
1269 // |
|
1270 // Create controls since file details are available |
|
1271 // |
|
1272 iContainer->AddFileDetailsL( iFileDetails ); |
|
1273 |
|
1274 if ( iFileDetails->iVideoEnabled ) |
|
1275 { |
|
1276 // |
|
1277 // Calculate the aspect ratio and setup the display hanlder with the display window |
|
1278 // Aspect ratio should be calculated 1st so the auto scale will be set when |
|
1279 // the display window is created. |
|
1280 // |
|
1281 iDisplayHandler->CreateDisplayWindowL( *(CCoeEnv::Static()->ScreenDevice()), |
|
1282 iContainer->GetWindow(), |
|
1283 iFileDetails ); |
|
1284 } |
|
1285 else |
|
1286 { |
|
1287 // |
|
1288 // Remove the display window so the surface can be released |
|
1289 // |
|
1290 iDisplayHandler->RemoveDisplayWindow(); |
|
1291 } |
|
1292 |
|
1293 // |
|
1294 // Delay the play command while the Real One Bitmap is being shown |
|
1295 // |
|
1296 if ( iContainer->IsRealOneBitmapTimerActive() ) |
|
1297 { |
|
1298 iRealOneDelayedPlay = ETrue; |
|
1299 } |
|
1300 else |
|
1301 { |
|
1302 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
|
1303 } |
|
1304 } |
|
1305 } |
|
1306 |
|
1307 // ------------------------------------------------------------------------------------------------- |
|
1308 // CMPXVideoBasePlaybackView::UpdatePbPluginMedia() |
|
1309 // ------------------------------------------------------------------------------------------------- |
|
1310 // |
|
1311 void CMPXVideoBasePlaybackView::UpdatePbPluginMediaL( TBool aSeek) |
|
1312 { |
|
1313 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::UpdatePbPluginMediaL()"), |
|
1314 _L("aSeek = %d"), aSeek ); |
|
1315 |
|
1316 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1317 CleanupStack::PushL( cmd ); |
|
1318 |
|
1319 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1320 |
|
1321 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1322 |
|
1323 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, |
|
1324 EPbCmdUpdateSeekable ); |
|
1325 |
|
1326 cmd->SetTObjectValueL<TBool>( KMPXMediaGeneralExtVideoSeekable, aSeek ); |
|
1327 |
|
1328 iPlaybackUtility->CommandL( *cmd ); |
|
1329 |
|
1330 CleanupStack::PopAndDestroy( cmd ); |
|
1331 } |
|
1332 |
|
1333 // ------------------------------------------------------------------------------------------------- |
|
1334 // From MMPXPlaybackCallback |
|
1335 // Handle media event. |
|
1336 // Notes: The client is responsible for delete the object of aProperties. |
|
1337 // ------------------------------------------------------------------------------------------------- |
|
1338 // |
|
1339 void CMPXVideoBasePlaybackView::HandleMediaL( const CMPXMedia& aMedia, TInt aError) |
|
1340 { |
|
1341 MPX_ENTER_EXIT(_L( "CMPXVideoBasePlaybackView::HandleMediaL()" )); |
|
1342 |
|
1343 if ( iCollectionMediaRequested ) |
|
1344 { |
|
1345 TBool seek; |
|
1346 iCollectionMediaRequested = EFalse; |
|
1347 |
|
1348 if ( aMedia.IsSupported( KMPXMediaGeneralExtVideoSeekable ) ) |
|
1349 { |
|
1350 seek = aMedia.ValueTObjectL<TBool>( KMPXMediaGeneralExtVideoSeekable ); |
|
1351 UpdatePbPluginMediaL( seek ); |
|
1352 } |
|
1353 |
|
1354 // request for media from playbackplugin |
|
1355 RequestPlaybackMediaL(); |
|
1356 } |
|
1357 else |
|
1358 { |
|
1359 // |
|
1360 // Retreive the clip name for all use cases |
|
1361 // |
|
1362 if ( aMedia.IsSupported( KMPXMediaGeneralUri ) ) |
|
1363 { |
|
1364 if ( iClipName ) |
|
1365 { |
|
1366 delete iClipName; |
|
1367 iClipName = NULL; |
|
1368 } |
|
1369 |
|
1370 TPtrC uri( aMedia.ValueText( KMPXMediaGeneralUri ) ); |
|
1371 iClipName = uri.AllocL(); |
|
1372 } |
|
1373 |
|
1374 if ( aMedia.IsSupported( KMPXMediaVideoError ) ) |
|
1375 { |
|
1376 TInt error = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoError ); |
|
1377 |
|
1378 iMediaRequested = EFalse; |
|
1379 HandlePluginErrorL( error ); |
|
1380 } |
|
1381 else |
|
1382 { |
|
1383 DoHandleMediaL( aMedia, aError ); |
|
1384 } |
|
1385 } |
|
1386 } |
|
1387 |
|
1388 // ------------------------------------------------------------------------------------------------- |
|
1389 // CMPXVideoBasePlaybackView::SetPropertyL() |
|
1390 // ------------------------------------------------------------------------------------------------- |
|
1391 // |
|
1392 void CMPXVideoBasePlaybackView::SetPropertyL( TMPXPlaybackProperty aProperty, TInt aValue ) |
|
1393 { |
|
1394 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::SetPropertyL"), |
|
1395 _L("aProperty = %d, aValue = %d"), aProperty, aValue ); |
|
1396 |
|
1397 iPlaybackUtility->SetL( aProperty, aValue ); |
|
1398 } |
|
1399 |
|
1400 // ------------------------------------------------------------------------------------------------- |
|
1401 // CMPXVideoBasePlaybackView::HandlePropertyL() |
|
1402 // ------------------------------------------------------------------------------------------------- |
|
1403 // |
|
1404 void CMPXVideoBasePlaybackView::HandlePropertyL( TMPXPlaybackProperty aProperty, |
|
1405 TInt aValue, |
|
1406 TInt aError ) |
|
1407 { |
|
1408 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandlePropertyL - Error(%d)"), aError ); |
|
1409 |
|
1410 if ( aError == KErrNone ) |
|
1411 { |
|
1412 switch ( aProperty ) |
|
1413 { |
|
1414 case EPbPropertyPosition: |
|
1415 { |
|
1416 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandlePropertyL position(%d)"), aValue ); |
|
1417 |
|
1418 if ( iContainer ) |
|
1419 { |
|
1420 iContainer->HandleEventL( EMPXControlCmdSetPosition, aValue ); |
|
1421 } |
|
1422 |
|
1423 break; |
|
1424 } |
|
1425 case EPbPropertyDuration: |
|
1426 { |
|
1427 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandlePropertyL duration(%d)"), aValue ); |
|
1428 |
|
1429 if ( iContainer ) |
|
1430 { |
|
1431 iContainer->HandleEventL( EMPXControlCmdSetDuration, aValue ); |
|
1432 } |
|
1433 |
|
1434 break; |
|
1435 } |
|
1436 case EPbPropertyMaxVolume: |
|
1437 { |
|
1438 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandlePropertyL max volume(%d)"), aValue ); |
|
1439 |
|
1440 break; |
|
1441 } |
|
1442 case EPbPropertyVolume: |
|
1443 { |
|
1444 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandlePropertyL volume(%d)"), aValue ); |
|
1445 |
|
1446 if ( iContainer ) |
|
1447 { |
|
1448 iContainer->HandleEventL( EMPXControlCmdSetVolume, aValue ); |
|
1449 } |
|
1450 |
|
1451 break; |
|
1452 } |
|
1453 case EPbPropertyMute: |
|
1454 { |
|
1455 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandlePropertyL muted(%d)"), aValue ); |
|
1456 |
|
1457 if ( iContainer && aValue ) |
|
1458 { |
|
1459 iContainer->HandleEventL( EMPXControlCmdSetVolume, 0 ); |
|
1460 } |
|
1461 |
|
1462 break; |
|
1463 } |
|
1464 } |
|
1465 } |
|
1466 } |
|
1467 |
|
1468 // ------------------------------------------------------------------------------------------------- |
|
1469 // CMPXVideoBasePlaybackView::DisplayInfoMessageL |
|
1470 // ------------------------------------------------------------------------------------------------- |
|
1471 // |
|
1472 void CMPXVideoBasePlaybackView::DisplayInfoMessageL( TInt aResourceId, TBool aWaitingDialog ) |
|
1473 { |
|
1474 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DisplayInfoMessageL()"), |
|
1475 _L("resource = %08x"), aResourceId ); |
|
1476 |
|
1477 HBufC* text = StringLoader::LoadLC( aResourceId ); |
|
1478 |
|
1479 CAknInformationNote* dlg = new (ELeave) CAknInformationNote( aWaitingDialog ); |
|
1480 dlg->SetTimeout( (CAknNoteDialog::TTimeout) KInformationNoteTimeout ); |
|
1481 dlg->ExecuteLD( *text ); |
|
1482 CleanupStack::PopAndDestroy( text ); |
|
1483 } |
|
1484 |
|
1485 // ------------------------------------------------------------------------------------------------- |
|
1486 // CMPXVideoBasePlaybackView::DisplayErrorMessageL |
|
1487 // ------------------------------------------------------------------------------------------------- |
|
1488 // |
|
1489 void CMPXVideoBasePlaybackView::DisplayErrorMessageL( TInt aResourceId ) |
|
1490 { |
|
1491 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DisplayErrorMessageL()"), |
|
1492 _L("resource = %08x"), aResourceId ); |
|
1493 |
|
1494 HBufC* text = StringLoader::LoadLC( aResourceId ); |
|
1495 |
|
1496 CAknErrorNote* eDlg = new (ELeave) CAknErrorNote( ETrue ); |
|
1497 eDlg->ExecuteLD( *text ); |
|
1498 CleanupStack::PopAndDestroy( text ); |
|
1499 } |
|
1500 |
|
1501 // ------------------------------------------------------------------------------------------------- |
|
1502 // CMPXVideoBasePlaybackView::RetrieveFileNameAndModeL |
|
1503 // ------------------------------------------------------------------------------------------------- |
|
1504 // |
|
1505 void CMPXVideoBasePlaybackView::RetrieveFileNameAndModeL( CMPXCommand* aCmd ) |
|
1506 { |
|
1507 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::RetrieveFileNameAndModeL()")); |
|
1508 |
|
1509 // |
|
1510 // set attributes on the command |
|
1511 // |
|
1512 aCmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1513 aCmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1514 aCmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, |
|
1515 EPbCmdInitView ); |
|
1516 |
|
1517 iPlaybackUtility->CommandL( *aCmd ); |
|
1518 } |
|
1519 |
|
1520 // ------------------------------------------------------------------------------------------------- |
|
1521 // CMPXVideoBasePlaybackView::ActivateClosePlayerActiveObject |
|
1522 // ------------------------------------------------------------------------------------------------- |
|
1523 // |
|
1524 void CMPXVideoBasePlaybackView::ActivateClosePlayerActiveObject() |
|
1525 { |
|
1526 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::ActivateClosePlayerActiveObject()")); |
|
1527 |
|
1528 if ( ! iCloseAO->IsActive() ) |
|
1529 { |
|
1530 iCloseAO->Start( TCallBack( CMPXVideoBasePlaybackView::ClosePlayerL, this ) ); |
|
1531 } |
|
1532 } |
|
1533 |
|
1534 // ----------------------------------------------------------------------------- |
|
1535 // CMPXVideoBasePlaybackView::ClosePlayerL |
|
1536 // ----------------------------------------------------------------------------- |
|
1537 // |
|
1538 TInt CMPXVideoBasePlaybackView::ClosePlayerL( TAny* aPtr ) |
|
1539 { |
|
1540 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::ClosePlayerL()")); |
|
1541 |
|
1542 static_cast<CMPXVideoBasePlaybackView*>(aPtr)->DoClosePlayerL(); |
|
1543 return KErrNone; |
|
1544 } |
|
1545 |
|
1546 // ------------------------------------------------------------------------------------------------- |
|
1547 // CMPXVideoBasePlaybackView::DoClosePlayerL |
|
1548 // ------------------------------------------------------------------------------------------------- |
|
1549 // |
|
1550 void CMPXVideoBasePlaybackView::DoClosePlayerL() |
|
1551 { |
|
1552 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DoClosePlayerL()")); |
|
1553 AppUi()->HandleCommandL( EAknSoftkeyBack ); |
|
1554 } |
|
1555 |
|
1556 // ------------------------------------------------------------------------------------------------- |
|
1557 // CMPXVideoBasePlaybackView::IssuePlayCommandL |
|
1558 // ------------------------------------------------------------------------------------------------- |
|
1559 // |
|
1560 void CMPXVideoBasePlaybackView::IssuePlayCommandL() |
|
1561 { |
|
1562 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::IssuePlayCommandL()")); |
|
1563 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
|
1564 } |
|
1565 |
|
1566 // ------------------------------------------------------------------------------------------------- |
|
1567 // CMPXVideoBasePlaybackView::RetrievePdlInformationL |
|
1568 // ------------------------------------------------------------------------------------------------- |
|
1569 // |
|
1570 void CMPXVideoBasePlaybackView::RetrievePdlInformationL() |
|
1571 { |
|
1572 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::RetrievePdlInformationL()")); |
|
1573 } |
|
1574 |
|
1575 // ------------------------------------------------------------------------------------------------- |
|
1576 // CMPXVideoBasePlaybackView::HandleBufferingStateL |
|
1577 // ------------------------------------------------------------------------------------------------- |
|
1578 // |
|
1579 void CMPXVideoBasePlaybackView::HandleBufferingStateL() |
|
1580 { |
|
1581 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleBufferingStateL()")); |
|
1582 |
|
1583 } |
|
1584 |
|
1585 // ------------------------------------------------------------------------------------------------- |
|
1586 // CMPXVideoBasePlaybackView::CreateVideoSpecificCmdL() |
|
1587 // ------------------------------------------------------------------------------------------------- |
|
1588 // |
|
1589 void CMPXVideoBasePlaybackView::CreateVideoSpecificCmdL( TMPXVideoPlaybackCommand aCmd ) |
|
1590 { |
|
1591 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::CreateVideoSpecificCmdL(%d)"), aCmd ); |
|
1592 |
|
1593 // |
|
1594 // create command to pass to playback plugin |
|
1595 // |
|
1596 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
1597 CleanupStack::PushL( cmd ); |
|
1598 |
|
1599 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
1600 |
|
1601 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
1602 |
|
1603 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, aCmd ); |
|
1604 |
|
1605 iPlaybackUtility->CommandL( *cmd ); |
|
1606 |
|
1607 CleanupStack::PopAndDestroy( cmd ); |
|
1608 } |
|
1609 |
|
1610 // ------------------------------------------------------------------------------------------------- |
|
1611 // CMPXVideoBasePlaybackView::SetAspectRatioL() |
|
1612 // ------------------------------------------------------------------------------------------------- |
|
1613 // |
|
1614 void CMPXVideoBasePlaybackView::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd ) |
|
1615 { |
|
1616 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::SetAspectRatioL()")); |
|
1617 |
|
1618 iDisplayHandler->SetAspectRatioL( aCmd ); |
|
1619 } |
|
1620 |
|
1621 // ------------------------------------------------------------------------------------------------- |
|
1622 // CMPXVideoBasePlaybackView::IsAppInFrontL() |
|
1623 // ------------------------------------------------------------------------------------------------- |
|
1624 // |
|
1625 TBool CMPXVideoBasePlaybackView::IsAppInFrontL() |
|
1626 { |
|
1627 TBool ret = EFalse; |
|
1628 RWsSession wsSession; |
|
1629 |
|
1630 User::LeaveIfError( wsSession.Connect() ); |
|
1631 CleanupClosePushL( wsSession ); |
|
1632 |
|
1633 if ( wsSession.Handle() ) |
|
1634 { |
|
1635 CArrayFixFlat<TInt>* wgList = |
|
1636 new (ELeave) CArrayFixFlat<TInt>( wsSession.NumWindowGroups() ); |
|
1637 |
|
1638 if ( wsSession.WindowGroupList( 0, wgList ) == KErrNone ) |
|
1639 { |
|
1640 // |
|
1641 // If this window group is at the start of the window group array, |
|
1642 // this application is in the front |
|
1643 // |
|
1644 ret = ( iCoeEnv->RootWin().Identifier() == wgList->At(0) ); |
|
1645 } |
|
1646 |
|
1647 delete wgList; |
|
1648 } |
|
1649 |
|
1650 CleanupStack::PopAndDestroy(); //wsSession |
|
1651 |
|
1652 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::IsAppInFrontL (%d)" ), ret); |
|
1653 |
|
1654 return ret; |
|
1655 } |
|
1656 |
|
1657 // ------------------------------------------------------------------------------------------------- |
|
1658 // CMPXVideoBasePlaybackView::ClosePlaybackViewL() |
|
1659 // ------------------------------------------------------------------------------------------------- |
|
1660 // |
|
1661 void CMPXVideoBasePlaybackView::ClosePlaybackViewL() |
|
1662 { |
|
1663 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::ClosePlaybackViewL()")); |
|
1664 |
|
1665 if ( iFileDetailsDialog ) |
|
1666 { |
|
1667 iFileDetailsDialog->Close(); |
|
1668 } |
|
1669 |
|
1670 // |
|
1671 // The View Utility may have deactivated this view already. |
|
1672 // Check if we are the active view |
|
1673 // |
|
1674 if ( iViewUtility->ActiveViewImplementationUid() == ViewImplementationId() ) |
|
1675 { |
|
1676 if ( iViewUtility->ViewHistoryDepth() > 1 ) |
|
1677 { |
|
1678 iViewUtility->ActivatePreviousViewL(); |
|
1679 |
|
1680 // |
|
1681 // Hide controls and window since view will be deactivated. |
|
1682 // This prevents black boxes on the view switching |
|
1683 // |
|
1684 iContainer->HandleEventL( EMPXControlCmdHideControls ); |
|
1685 } |
|
1686 else |
|
1687 { |
|
1688 CloseEmbeddedPlaybackViewL(); |
|
1689 } |
|
1690 } |
|
1691 } |
|
1692 |
|
1693 // ------------------------------------------------------------------------------------------------- |
|
1694 // CMPXVideoBasePlaybackView::HandleVolumeCmdL() |
|
1695 // ------------------------------------------------------------------------------------------------- |
|
1696 // |
|
1697 void CMPXVideoBasePlaybackView::HandleVolumeCmdL( TMPXPlaybackCommand aCmd ) |
|
1698 { |
|
1699 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleVolumeCmdL()")); |
|
1700 |
|
1701 // |
|
1702 // In case user try to change the volume via media key, rocker key or etc |
|
1703 // We need to show the controls though the volume level doesn't get changed |
|
1704 // For examples : - try to change the volume with a clip without audio track |
|
1705 // - try to reduce the volume with volume level 0 |
|
1706 // - try to increase the volume with max volume level |
|
1707 // |
|
1708 iContainer->HandleEventL( EMPXControlCmdShowControls ); |
|
1709 |
|
1710 switch( aCmd ) |
|
1711 { |
|
1712 case EPbCmdDecreaseVolume: |
|
1713 { |
|
1714 CreateVideoSpecificCmdL( EPbCmdHandleDecreaseVolume ); |
|
1715 break; |
|
1716 } |
|
1717 case EPbCmdIncreaseVolume: |
|
1718 { |
|
1719 CreateVideoSpecificCmdL( EPbCmdHandleIncreaseVolume ); |
|
1720 break; |
|
1721 } |
|
1722 default: |
|
1723 { |
|
1724 iPlaybackUtility->CommandL( aCmd ); |
|
1725 break; |
|
1726 } |
|
1727 } |
|
1728 } |
|
1729 |
|
1730 // ------------------------------------------------------------------------------------------------- |
|
1731 // CMPXVideoBasePlaybackView::HandleShortPressBackwardL() |
|
1732 // ------------------------------------------------------------------------------------------------- |
|
1733 // |
|
1734 void CMPXVideoBasePlaybackView::HandleShortPressBackwardL() |
|
1735 { |
|
1736 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleShortPressBackwardL()")); |
|
1737 |
|
1738 SetPropertyL( EPbPropertyPosition, 0); |
|
1739 } |
|
1740 |
|
1741 TInt CMPXVideoBasePlaybackView::AddDllPath( TDes& aFileName ) |
|
1742 { |
|
1743 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::AddDllPath()"), |
|
1744 _L("aFileName = %S"), &aFileName); |
|
1745 |
|
1746 // |
|
1747 // Find drive for dll to search same drive for rsc |
|
1748 // |
|
1749 TFileName dllName; |
|
1750 Dll::FileName( dllName ); |
|
1751 |
|
1752 TPtrC driveAndPath = TParsePtrC( dllName ).DriveAndPath(); |
|
1753 |
|
1754 TParse parse; |
|
1755 |
|
1756 TInt error = parse.Set( aFileName, &driveAndPath, NULL ); |
|
1757 |
|
1758 if ( error == KErrNone ) |
|
1759 { |
|
1760 aFileName.Zero(); |
|
1761 aFileName.Append( parse.FullName() ); |
|
1762 } |
|
1763 |
|
1764 return error; |
|
1765 } |
|
1766 |
|
1767 void CMPXVideoBasePlaybackView::ShowFileDetailsDialogL() |
|
1768 { |
|
1769 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::ShowFileDetailsDialogL()")); |
|
1770 |
|
1771 iFileDetailsDialog = CMPFileDetailsDialog::NewL(); |
|
1772 |
|
1773 CMPFileDetails* fileDetailsDialogParams = new (ELeave) CMPFileDetails(); |
|
1774 CleanupStack::PushL( fileDetailsDialogParams ); |
|
1775 |
|
1776 HBufC* fileName = iFileDetails->GenerateFileNameL(); |
|
1777 |
|
1778 if ( fileName && fileName->Length() ) |
|
1779 { |
|
1780 fileDetailsDialogParams->iFileName = fileName; |
|
1781 } |
|
1782 |
|
1783 if ( iFileDetails->iTitle && iFileDetails->iTitle->Length() ) |
|
1784 { |
|
1785 fileDetailsDialogParams->iTitle = iFileDetails->iTitle->AllocL(); |
|
1786 } |
|
1787 |
|
1788 if ( iFileDetails->iArtist && iFileDetails->iArtist->Length() ) |
|
1789 { |
|
1790 fileDetailsDialogParams->iArtist = iFileDetails->iArtist->AllocL(); |
|
1791 } |
|
1792 |
|
1793 if ( iFileDetails->iMimeType && iFileDetails->iMimeType->Length() ) |
|
1794 { |
|
1795 fileDetailsDialogParams->iFormat = iFileDetails->iMimeType->AllocL(); |
|
1796 } |
|
1797 |
|
1798 if ( iFileDetails->iVideoHeight && iFileDetails->iVideoWidth ) |
|
1799 { |
|
1800 fileDetailsDialogParams->iResolutionHeight = iFileDetails->iVideoHeight; |
|
1801 fileDetailsDialogParams->iResolutionWidth = iFileDetails->iVideoWidth; |
|
1802 } |
|
1803 |
|
1804 if ( iFileDetails->iDuration > 0 ) |
|
1805 { |
|
1806 fileDetailsDialogParams->iDurationInSeconds = iFileDetails->iDuration / KPbMilliMultiplier; |
|
1807 } |
|
1808 |
|
1809 if (iFileDetails->iBitRate > 0 ) |
|
1810 { |
|
1811 fileDetailsDialogParams->iBitrate = iFileDetails->iBitRate; |
|
1812 } |
|
1813 |
|
1814 if ( iFileDetails->iDrmProtected ) |
|
1815 { |
|
1816 fileDetailsDialogParams->iDrmProtected = iFileDetails->iDrmProtected; |
|
1817 fileDetailsDialogParams->iFilePath = iFileDetails->iClipName->AllocL(); |
|
1818 |
|
1819 TInt openError = KErrNone; |
|
1820 |
|
1821 // |
|
1822 // based on SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API flag, |
|
1823 // fileDetailsDialogParams->iDetailsFileHandle uses either RFile64 or RFile handle, |
|
1824 // therefore, we need to handle it in the same manner here |
|
1825 // |
|
1826 |
|
1827 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
1828 |
|
1829 RFile64 tempFileHandle; |
|
1830 CleanupClosePushL( tempFileHandle ); |
|
1831 openError = OpenDrmFileHandle64L( tempFileHandle ); |
|
1832 |
|
1833 #else // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
1834 |
|
1835 RFile tempFileHandle; |
|
1836 CleanupClosePushL( tempFileHandle ); |
|
1837 openError = OpenDrmFileHandleL( tempFileHandle ); |
|
1838 |
|
1839 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
1840 |
|
1841 if ( ! openError ) |
|
1842 { |
|
1843 fileDetailsDialogParams->iDetailsFileHandle.Duplicate( tempFileHandle ); |
|
1844 } |
|
1845 |
|
1846 CleanupStack::PopAndDestroy(); // tempFileHandle |
|
1847 } |
|
1848 |
|
1849 TRAP_IGNORE( iFileDetailsDialog->ExecuteLD( fileDetailsDialogParams ) ); |
|
1850 |
|
1851 CleanupStack::PopAndDestroy(); // fileDetailsDialogParams; |
|
1852 iFileDetailsDialog = NULL; |
|
1853 } |
|
1854 |
|
1855 // ------------------------------------------------------------------------------------------------- |
|
1856 // CMPXVideoBasePlaybackView::HandleDrmErrorsL() |
|
1857 // ------------------------------------------------------------------------------------------------- |
|
1858 // |
|
1859 void CMPXVideoBasePlaybackView::HandleDrmErrorsL( TInt aError ) |
|
1860 { |
|
1861 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleDrmErrorsL()")); |
|
1862 |
|
1863 // |
|
1864 // If we receive an error when we are initialized, let the DRM UI Handler |
|
1865 // process the error. If we have been playing, display the error message |
|
1866 // and close the playback |
|
1867 // |
|
1868 if ( IsMultiItemPlaylist() || iPlaybackState != EPbStateInitialised ) |
|
1869 |
|
1870 { |
|
1871 DisplayErrorMessageL( R_MPX_DRM_RIGHTS_MISSING ); |
|
1872 } |
|
1873 else |
|
1874 { |
|
1875 TInt openError = KErrNotFound; |
|
1876 RFile fileHandle; |
|
1877 CleanupClosePushL( fileHandle ); |
|
1878 |
|
1879 MPX_TRAPD( err, openError = OpenDrmFileHandleL( fileHandle ) ); |
|
1880 |
|
1881 if ( err == KErrNone && openError == KErrNone ) |
|
1882 { |
|
1883 DRM::CDrmUiHandling* drmUiHandling = DRM::CDrmUiHandling::NewL( iCoeEnv ); |
|
1884 CleanupStack::PushL( drmUiHandling ); |
|
1885 |
|
1886 drmUiHandling->GetErrorHandler().HandleErrorL( fileHandle, |
|
1887 ContentAccess::EPlay, |
|
1888 aError, |
|
1889 NULL ); |
|
1890 |
|
1891 CleanupStack::PopAndDestroy( drmUiHandling ); |
|
1892 } |
|
1893 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
1894 else if ( err == KErrNone && openError == KErrTooBig ) |
|
1895 { |
|
1896 RFile64 fileHandle64; |
|
1897 CleanupClosePushL( fileHandle64 ); |
|
1898 |
|
1899 MPX_TRAPD( err, openError = OpenDrmFileHandle64L( fileHandle64 ) ); |
|
1900 |
|
1901 if ( err == KErrNone && openError == KErrNone ) |
|
1902 { |
|
1903 DRM::CDrmUiHandling* drmUiHandling = DRM::CDrmUiHandling::NewL( iCoeEnv ); |
|
1904 CleanupStack::PushL( drmUiHandling ); |
|
1905 |
|
1906 drmUiHandling->GetErrorHandler().HandleErrorL( fileHandle64, |
|
1907 ContentAccess::EPlay, |
|
1908 aError, |
|
1909 NULL ); |
|
1910 CleanupStack::PopAndDestroy( drmUiHandling ); |
|
1911 } |
|
1912 else |
|
1913 { |
|
1914 DisplayErrorMessageL( R_MPX_DRM_RIGHTS_MISSING ); |
|
1915 } |
|
1916 |
|
1917 CleanupStack::PopAndDestroy(); // fileHandle64 |
|
1918 } |
|
1919 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
1920 else |
|
1921 { |
|
1922 DisplayErrorMessageL( R_MPX_DRM_RIGHTS_MISSING ); |
|
1923 } |
|
1924 |
|
1925 CleanupStack::PopAndDestroy(); // fileHandle |
|
1926 } |
|
1927 |
|
1928 HandleClosePlaybackViewL(); |
|
1929 } |
|
1930 |
|
1931 // ------------------------------------------------------------------------------------------------- |
|
1932 // CMPXVideoBasePlaybackView::IsMultiItemPlaylist() |
|
1933 // ------------------------------------------------------------------------------------------------- |
|
1934 // |
|
1935 TBool CMPXVideoBasePlaybackView::IsMultiItemPlaylist() |
|
1936 { |
|
1937 TInt numItems = 1; |
|
1938 MMPXSource* s = iPlaybackUtility->Source(); |
|
1939 |
|
1940 if ( s ) |
|
1941 { |
|
1942 CMPXCollectionPlaylist* playlist = NULL; |
|
1943 |
|
1944 MPX_TRAPD( err, playlist = s->PlaylistL() ); |
|
1945 |
|
1946 if ( err == KErrNone && playlist ) |
|
1947 { |
|
1948 numItems = playlist->Count(); |
|
1949 delete playlist; |
|
1950 } |
|
1951 } |
|
1952 |
|
1953 TBool retVal = ( numItems > 1 ); |
|
1954 |
|
1955 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::IsMultiItemPlaylist(%d)"), retVal); |
|
1956 |
|
1957 return retVal; |
|
1958 } |
|
1959 |
|
1960 // ------------------------------------------------------------------------------------------------- |
|
1961 // CMPXVideoBasePlaybackView::OpenDrmFileHandleL() |
|
1962 // ------------------------------------------------------------------------------------------------- |
|
1963 // |
|
1964 TInt CMPXVideoBasePlaybackView::OpenDrmFileHandleL( RFile& aFile ) |
|
1965 { |
|
1966 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::OpenDrmFileHandleL()")); |
|
1967 |
|
1968 TInt openError = KErrNotFound; |
|
1969 RFs& fs = iCoeEnv->FsSession(); |
|
1970 |
|
1971 if ( iPlaylistView && iClipName ) |
|
1972 { |
|
1973 openError = aFile.Open( fs, |
|
1974 iClipName->Des(), |
|
1975 EFileRead | EFileShareReadersOrWriters ); |
|
1976 } |
|
1977 else |
|
1978 { |
|
1979 MMPXSource* s = iPlaybackUtility->Source(); |
|
1980 |
|
1981 if ( s ) |
|
1982 { |
|
1983 RFile* tempFile = s->FileL(); |
|
1984 |
|
1985 if ( tempFile && tempFile->SubSessionHandle() ) |
|
1986 { |
|
1987 // |
|
1988 // File Handle from the framework is valid, use it |
|
1989 // |
|
1990 openError = aFile.Duplicate( *tempFile ); |
|
1991 } |
|
1992 else |
|
1993 { |
|
1994 // |
|
1995 // File Handle not valid, get URI and open file |
|
1996 // |
|
1997 HBufC* tempFileName = s->UriL(); |
|
1998 |
|
1999 if ( tempFileName ) |
|
2000 { |
|
2001 openError = aFile.Open( fs, |
|
2002 tempFileName->Des(), |
|
2003 EFileRead | EFileShareReadersOrWriters ); |
|
2004 |
|
2005 delete tempFileName; |
|
2006 } |
|
2007 } |
|
2008 } |
|
2009 } |
|
2010 |
|
2011 return openError; |
|
2012 } |
|
2013 |
|
2014 // ------------------------------------------------------------------------------------------------- |
|
2015 // CMPXVideoBasePlaybackView::LaunchDRMDetailsL() |
|
2016 // ------------------------------------------------------------------------------------------------- |
|
2017 // |
|
2018 void CMPXVideoBasePlaybackView::LaunchDRMDetailsL() |
|
2019 { |
|
2020 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::LaunchDRMDetailsL()")); |
|
2021 |
|
2022 TInt openError = KErrNotFound; |
|
2023 RFile fileHandle; |
|
2024 CleanupClosePushL( fileHandle ); |
|
2025 |
|
2026 MPX_TRAPD( err, openError = OpenDrmFileHandleL( fileHandle ) ); |
|
2027 |
|
2028 if ( err == KErrNone ) |
|
2029 { |
|
2030 DRM::CDrmUiHandling* drmUiHandling = DRM::CDrmUiHandling::NewL(); |
|
2031 CleanupStack::PushL( drmUiHandling ); |
|
2032 |
|
2033 if ( openError == KErrNone ) |
|
2034 { |
|
2035 MPX_TRAPD( err, drmUiHandling->ShowDetailsViewL( fileHandle ) ); |
|
2036 |
|
2037 if ( KLeaveExit == err ) |
|
2038 { |
|
2039 User::Leave( err ); |
|
2040 } |
|
2041 } |
|
2042 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
2043 else if ( openError == KErrTooBig ) |
|
2044 { |
|
2045 RFile64 fileHandle64; |
|
2046 CleanupClosePushL( fileHandle64 ); |
|
2047 MPX_TRAPD( err, openError = OpenDrmFileHandle64L( fileHandle64 ) ); |
|
2048 |
|
2049 if ( err == KErrNone && openError == KErrNone ) |
|
2050 { |
|
2051 MPX_TRAPD( err, drmUiHandling->ShowDetailsViewL( fileHandle64 ) ); |
|
2052 |
|
2053 if ( KLeaveExit == err ) |
|
2054 { |
|
2055 User::Leave( err ); |
|
2056 } |
|
2057 } |
|
2058 CleanupStack::PopAndDestroy(); // fileHandle64 |
|
2059 } |
|
2060 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
2061 |
|
2062 CleanupStack::PopAndDestroy( drmUiHandling ); |
|
2063 } |
|
2064 |
|
2065 CleanupStack::PopAndDestroy(); // fileHandle |
|
2066 |
|
2067 // |
|
2068 // User inputs should not be blocked when user close DRM details view |
|
2069 // |
|
2070 ResetPdlUserInputs(); |
|
2071 } |
|
2072 |
|
2073 // ------------------------------------------------------------------------------------------------- |
|
2074 // CMPXVideoBasePlaybackView::RetrieveBufferingPercentageL() |
|
2075 // ------------------------------------------------------------------------------------------------- |
|
2076 // |
|
2077 TInt |
|
2078 CMPXVideoBasePlaybackView::RetrieveBufferingPercentageL() |
|
2079 { |
|
2080 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::RetrieveBufferingPercentageL()")); |
|
2081 |
|
2082 // |
|
2083 // create command to pass to playback plugin |
|
2084 // |
|
2085 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
2086 CleanupStack::PushL( cmd ); |
|
2087 |
|
2088 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
2089 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
2090 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, |
|
2091 EPbCmdRetrieveBufferingPercentage ); |
|
2092 |
|
2093 iPlaybackUtility->CommandL( *cmd ); |
|
2094 |
|
2095 TInt buffPercentage = cmd->ValueTObjectL<TInt>( KMPXMediaVideoBufferingPercentage ); |
|
2096 |
|
2097 CleanupStack::PopAndDestroy( cmd ); |
|
2098 |
|
2099 return buffPercentage; |
|
2100 } |
|
2101 |
|
2102 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
2103 |
|
2104 // ------------------------------------------------------------------------------------------------- |
|
2105 // CMPXVideoBasePlaybackView::OpenDrmFileHandle64L() |
|
2106 // ------------------------------------------------------------------------------------------------- |
|
2107 // |
|
2108 TInt CMPXVideoBasePlaybackView::OpenDrmFileHandle64L( RFile64& aFile ) |
|
2109 { |
|
2110 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::OpenDrmFileHandle64L()")); |
|
2111 |
|
2112 TInt openError = KErrNotFound; |
|
2113 RFs& fs = iCoeEnv->FsSession(); |
|
2114 |
|
2115 if ( iPlaylistView && iClipName ) |
|
2116 { |
|
2117 openError = aFile.Open( fs, |
|
2118 iClipName->Des(), |
|
2119 EFileRead | EFileShareReadersOrWriters ); |
|
2120 } |
|
2121 else |
|
2122 { |
|
2123 MMPXSource* s = iPlaybackUtility->Source(); |
|
2124 |
|
2125 if ( s ) |
|
2126 { |
|
2127 |
|
2128 RFile64* tempFile = s->File64L(); |
|
2129 |
|
2130 if ( tempFile && tempFile->SubSessionHandle() ) |
|
2131 { |
|
2132 // |
|
2133 // File Handle from the framework is valid, use it |
|
2134 // |
|
2135 openError = aFile.Duplicate( *tempFile ); |
|
2136 } |
|
2137 else |
|
2138 { |
|
2139 // |
|
2140 // File Handle not valid, get URI and open file |
|
2141 // |
|
2142 HBufC* tempFileName = s->UriL(); |
|
2143 |
|
2144 if ( tempFileName ) |
|
2145 { |
|
2146 openError = aFile.Open( fs, |
|
2147 tempFileName->Des(), |
|
2148 EFileRead | EFileShareReadersOrWriters ); |
|
2149 |
|
2150 delete tempFileName; |
|
2151 } |
|
2152 } |
|
2153 } |
|
2154 } |
|
2155 |
|
2156 return openError; |
|
2157 } |
|
2158 |
|
2159 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
2160 |
|
2161 // ------------------------------------------------------------------------------------------------- |
|
2162 // CMPXVideoBasePlaybackView::HandleRealOneBitmapTimeoutL() |
|
2163 // ------------------------------------------------------------------------------------------------- |
|
2164 // |
|
2165 void CMPXVideoBasePlaybackView::HandleRealOneBitmapTimeoutL() |
|
2166 { |
|
2167 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleRealOneBitmapTimeoutL()")); |
|
2168 |
|
2169 // |
|
2170 // Check if this clip has video |
|
2171 // If video exists, setup the display window |
|
2172 // If the video is not enabled, redraw container to remove Real One Bitmap |
|
2173 // |
|
2174 if ( iFileDetails && iFileDetails->iVideoEnabled ) |
|
2175 { |
|
2176 if ( iDisplayHandler ) |
|
2177 { |
|
2178 iDisplayHandler->DoHandleRealOneBitmapTimeoutL(); |
|
2179 } |
|
2180 } |
|
2181 else |
|
2182 { |
|
2183 iContainer->DrawNow(); |
|
2184 } |
|
2185 |
|
2186 if ( iRealOneDelayedPlay ) |
|
2187 { |
|
2188 CreateGeneralPlaybackCommandL( EPbCmdPlay ); |
|
2189 iRealOneDelayedPlay = EFalse; |
|
2190 } |
|
2191 } |
|
2192 |
|
2193 // ------------------------------------------------------------------------------------------------- |
|
2194 // CMPXVideoBasePlaybackView::HandleWsEventL() |
|
2195 // ------------------------------------------------------------------------------------------------- |
|
2196 // |
|
2197 void CMPXVideoBasePlaybackView::HandleWsEventL( const TWsEvent& aEvent, |
|
2198 CCoeControl* /*aDestination*/ ) |
|
2199 { |
|
2200 // |
|
2201 // Fg/Bg events aren't received when the view has lost keyboard focus |
|
2202 // If we are sent to full background, sent a background command to the playback plugin |
|
2203 // |
|
2204 if ( ! iKeyboardInFocus && aEvent.Type() == EEventWindowVisibilityChanged ) |
|
2205 { |
|
2206 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleWsEventL() EEventWindowVisibilityChanged")); |
|
2207 |
|
2208 TUint visible = aEvent.VisibilityChanged()->iFlags; |
|
2209 |
|
2210 if ( visible & TWsVisibilityChangedEvent::ENotVisible ) |
|
2211 { |
|
2212 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleWsEventL() ENotVisible")); |
|
2213 SendWindowCommandL( EPbCmdHandleBackground ); |
|
2214 } |
|
2215 else if ( ! IsAppInFrontL() ) |
|
2216 { |
|
2217 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleWsEventL() App in Background")); |
|
2218 SendWindowCommandL( EPbCmdHandleBackground ); |
|
2219 } |
|
2220 } |
|
2221 } |
|
2222 |
|
2223 // ------------------------------------------------------------------------------------------------- |
|
2224 // CMPXVideoBasePlaybackView::SendWindowCommandL() |
|
2225 // ------------------------------------------------------------------------------------------------- |
|
2226 // |
|
2227 void CMPXVideoBasePlaybackView::SendWindowCommandL( TMPXVideoPlaybackCommand aCmd ) |
|
2228 { |
|
2229 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::SendWindowCommandL()"), |
|
2230 _L("aCmd = %d"), aCmd ); |
|
2231 |
|
2232 // |
|
2233 // create command to pass to playback plugin |
|
2234 // |
|
2235 CMPXCommand* cmd = CMPXCommand::NewL(); |
|
2236 CleanupStack::PushL( cmd ); |
|
2237 |
|
2238 cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue ); |
|
2239 cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback ); |
|
2240 cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, aCmd ); |
|
2241 cmd->SetTObjectValueL<TBool>( KMPXMediaVideoAppForeground, IsAppInFrontL() ); |
|
2242 |
|
2243 iPlaybackUtility->CommandL( *cmd ); |
|
2244 CleanupStack::PopAndDestroy( cmd ); |
|
2245 } |
|
2246 |
|
2247 // ------------------------------------------------------------------------------------------------- |
|
2248 // CMPXVideoBasePlaybackView::DoHandleInitializingStateL() |
|
2249 // ------------------------------------------------------------------------------------------------- |
|
2250 // |
|
2251 void CMPXVideoBasePlaybackView::DoHandleInitializingStateL( TMPXPlaybackState aLastState ) |
|
2252 { |
|
2253 MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DoHandleInitializingStateL()"), |
|
2254 _L("aLastState = %d"), aLastState ); |
|
2255 |
|
2256 if ( iContainer ) |
|
2257 { |
|
2258 // |
|
2259 // If transitioning from Not Initialized to Initialising there is |
|
2260 // no need to update the playback information that was gathered |
|
2261 // when the container was created |
|
2262 // |
|
2263 if ( aLastState != EPbStateNotInitialised ) |
|
2264 { |
|
2265 iMediaRequested = EFalse; |
|
2266 |
|
2267 // |
|
2268 // Refresh the screen by removing the surface and resetting the controls |
|
2269 // |
|
2270 iDisplayHandler->RemoveDisplayWindow(); |
|
2271 iContainer->HandleCommandL( EMPXPbvCmdResetControls ); |
|
2272 |
|
2273 if ( iFileDetails ) |
|
2274 { |
|
2275 if ( iFileDetailsDialog ) |
|
2276 { |
|
2277 iFileDetailsDialog->Close(); |
|
2278 } |
|
2279 |
|
2280 iFileDetails->ClearFileDetails(); |
|
2281 } |
|
2282 } |
|
2283 } |
|
2284 } |
|
2285 |
|
2286 // ------------------------------------------------------------------------------------------------- |
|
2287 // CMPXVideoBasePlaybackView::HandlePdlReloadComplete() |
|
2288 // ------------------------------------------------------------------------------------------------- |
|
2289 // |
|
2290 void CMPXVideoBasePlaybackView::HandlePdlReloadComplete() |
|
2291 { |
|
2292 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandlePdlReloadComplete()")); |
|
2293 } |
|
2294 |
|
2295 // ------------------------------------------------------------------------------------------------- |
|
2296 // CMPXVideoBasePlaybackView::ResetPdlUserInputs() |
|
2297 // ------------------------------------------------------------------------------------------------- |
|
2298 // |
|
2299 void CMPXVideoBasePlaybackView::ResetPdlUserInputs() |
|
2300 { |
|
2301 MPX_DEBUG(_L("CMPXVideoBasePlaybackView::ResetPdlUserInputs()")); |
|
2302 } |
|
2303 |
|
2304 // EOF |