|
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: This class plays local video file |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: 17 % |
|
19 |
|
20 |
|
21 |
|
22 // |
|
23 // INCLUDE FILES |
|
24 // |
|
25 #include <mmf/server/mmffile.h> |
|
26 #include <MMFROPCustomCommandConstants.h> |
|
27 #include <mpxplaybackpluginobserver.h> |
|
28 |
|
29 #include <etel.h> // 3G |
|
30 #include <etelmm.h> |
|
31 #include <mmtsy_names.h> |
|
32 |
|
33 #include "mpxvideoplaybackcontroller.h" |
|
34 #include "mpxvideoplaybackmode.h" |
|
35 #include "mpxvideofiledetails.h" |
|
36 #include <mpxvideoplaybackdefs.h> |
|
37 #include "mpxvideodrmhelper.h" |
|
38 |
|
39 // Constants |
|
40 const TUid KUidInterfaceMMFHelixController = {0x101F855D}; |
|
41 |
|
42 _LIT8(KMMFAccessPoint,"AccessPoint:Integer = \"%d\";"); |
|
43 |
|
44 // ============================ MEMBER FUNCTIONS =============================== |
|
45 |
|
46 // ------------------------------------------------------------------------------------------------ |
|
47 // Symbian 2nd phase constructor can leave. |
|
48 // ------------------------------------------------------------------------------------------------ |
|
49 // |
|
50 void CMPXVideoPlaybackMode::ConstructL( CMPXVideoPlaybackController* aVideoPlaybackCtlr ) |
|
51 { |
|
52 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackMode::ConstructL()")); |
|
53 |
|
54 iVideoPlaybackCtlr = aVideoPlaybackCtlr; |
|
55 } |
|
56 |
|
57 // ------------------------------------------------------------------------------------------------ |
|
58 // C++ constructor |
|
59 // ------------------------------------------------------------------------------------------------ |
|
60 // |
|
61 CMPXVideoPlaybackMode::CMPXVideoPlaybackMode() |
|
62 { |
|
63 } |
|
64 |
|
65 // ------------------------------------------------------------------------------------------------ |
|
66 // Destructor |
|
67 // ------------------------------------------------------------------------------------------------ |
|
68 // |
|
69 CMPXVideoPlaybackMode::~CMPXVideoPlaybackMode() |
|
70 { |
|
71 MPX_DEBUG(_L("CMPXVideoPlaybackMode::~CMPXVideoPlaybackMode()")); |
|
72 } |
|
73 |
|
74 // ---------------------------------------------------------------------------- |
|
75 // CMPXVideoPlaybackMode::OpenFileL() |
|
76 // ---------------------------------------------------------------------------- |
|
77 void CMPXVideoPlaybackMode::OpenFileL( const TDesC& aMediaFile ) |
|
78 { |
|
79 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackMode::OpenFileL()"), |
|
80 _L("file = %S"), &aMediaFile ); |
|
81 |
|
82 iVideoPlaybackCtlr->iPlayer->OpenFileL( aMediaFile ); |
|
83 } |
|
84 |
|
85 // ---------------------------------------------------------------------------- |
|
86 // CMPXVideoPlaybackMode::OpenFileL() |
|
87 // ---------------------------------------------------------------------------- |
|
88 void CMPXVideoPlaybackMode::OpenFileL( const RFile& aMediaFile ) |
|
89 { |
|
90 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackMode::OpenFileL()")); |
|
91 |
|
92 iVideoPlaybackCtlr->iPlayer->OpenFileL( aMediaFile ); |
|
93 } |
|
94 |
|
95 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
96 |
|
97 // ---------------------------------------------------------------------------- |
|
98 // CMPXVideoPlaybackMode::OpenFile64L() |
|
99 // ---------------------------------------------------------------------------- |
|
100 void CMPXVideoPlaybackMode::OpenFile64L( const RFile64& aMediaFile ) |
|
101 { |
|
102 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackMode::OpenFile64L( RFile64 )")); |
|
103 |
|
104 iVideoPlaybackCtlr->iPlayer->OpenFile64L( aMediaFile ); |
|
105 } |
|
106 |
|
107 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
108 |
|
109 // ------------------------------------------------------------------------------------------------ |
|
110 // CMPXVideoPlaybackMode::ConnectToDownloadL() |
|
111 // ------------------------------------------------------------------------------------------------ |
|
112 // |
|
113 void CMPXVideoPlaybackMode::ConnectToDownloadL( CMPXCommand& /*aCmd*/ ) |
|
114 { |
|
115 MPX_DEBUG(_L("CMPXVideoPlaybackMode::ConnectToDownloadL()")); |
|
116 } |
|
117 |
|
118 // ------------------------------------------------------------------------------------------------ |
|
119 // CMPXVideoPlaybackMode::GetPdlStatusL() |
|
120 // ------------------------------------------------------------------------------------------------ |
|
121 // |
|
122 void CMPXVideoPlaybackMode::GetPdlStatusL( CMPXCommand& /*aCmd*/ ) |
|
123 { |
|
124 MPX_DEBUG(_L("CMPXVideoPlaybackMode::GetPdlStatusL()")); |
|
125 } |
|
126 |
|
127 // ------------------------------------------------------------------------------------------------ |
|
128 // CMPXVideoPlaybackMode::HandleOpenComplete() |
|
129 // ------------------------------------------------------------------------------------------------ |
|
130 // |
|
131 void CMPXVideoPlaybackMode::HandleOpenComplete() |
|
132 { |
|
133 MPX_DEBUG(_L("CMPXVideoPlaybackMode::HandleOpenComplete()")); |
|
134 } |
|
135 |
|
136 // ------------------------------------------------------------------------------------------------ |
|
137 // CMPXVideoPlaybackMode::UpdateSeekPosition() |
|
138 // ------------------------------------------------------------------------------------------------ |
|
139 // |
|
140 void CMPXVideoPlaybackMode::UpdateSeekPosition( TInt64& aPosition ) |
|
141 { |
|
142 MPX_DEBUG(_L("CMPXVideoPlaybackMode::UpdateSeekPosition()")); |
|
143 |
|
144 iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( |
|
145 MMPXPlaybackPluginObserver::EPPositionChanged, |
|
146 aPosition / KPbMilliMultiplier, |
|
147 KErrNone ); |
|
148 } |
|
149 |
|
150 // ------------------------------------------------------------------------------------------------ |
|
151 // CMPXVideoPlaybackMode::HandlePause() |
|
152 // ------------------------------------------------------------------------------------------------ |
|
153 void CMPXVideoPlaybackMode::HandlePause() |
|
154 { |
|
155 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackMode::HandlePause()")); |
|
156 |
|
157 MPX_TRAPD( err, iVideoPlaybackCtlr->iPlayer->PauseL() ); |
|
158 |
|
159 if ( err == KErrNone ) |
|
160 { |
|
161 iVideoPlaybackCtlr->ChangeState( EMPXVideoPaused ); |
|
162 |
|
163 iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused, |
|
164 0, |
|
165 err ); |
|
166 } |
|
167 else |
|
168 { |
|
169 TRAP_IGNORE( iVideoPlaybackCtlr->iState->SendErrorToViewL( err ) ); |
|
170 } |
|
171 } |
|
172 |
|
173 // ------------------------------------------------------------------------------------------------ |
|
174 // CMPXVideoPlaybackMode::HandleBackground() |
|
175 // ------------------------------------------------------------------------------------------------ |
|
176 void CMPXVideoPlaybackMode::HandleBackground() |
|
177 { |
|
178 MPX_DEBUG(_L("CMPXVideoPlaybackMode::HandleBackground()")); |
|
179 |
|
180 if ( iVideoPlaybackCtlr->iAppInForeground ) |
|
181 { |
|
182 if ( iVideoPlaybackCtlr->IsAlarm() || |
|
183 ( iVideoPlaybackCtlr->IsDisplayOff() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) ) |
|
184 { |
|
185 iVideoPlaybackCtlr->iForegroundPause = ETrue; |
|
186 iVideoPlaybackCtlr->iState->HandlePause(); |
|
187 } |
|
188 else if ( iVideoPlaybackCtlr->IsPhoneCall() || iVideoPlaybackCtlr->IsVideoCall() ) |
|
189 { |
|
190 iVideoPlaybackCtlr->iForegroundPause = EFalse; |
|
191 iVideoPlaybackCtlr->iState->HandlePause(); |
|
192 } |
|
193 } |
|
194 else |
|
195 { |
|
196 iVideoPlaybackCtlr->iForegroundPause = EFalse; |
|
197 iVideoPlaybackCtlr->iState->HandlePause(); |
|
198 } |
|
199 } |
|
200 |
|
201 // ------------------------------------------------------------------------------------------------ |
|
202 // CMPXVideoPlaybackMode::CanPlayNow |
|
203 // ------------------------------------------------------------------------------------------------ |
|
204 TBool CMPXVideoPlaybackMode::CanPlayNow() |
|
205 { |
|
206 MPX_DEBUG(_L("CMPXVideoPlaybackMode::CanPlayNow")); |
|
207 TBool playAllowed = EFalse; |
|
208 |
|
209 if ( iVideoPlaybackCtlr->iAppInForeground && iVideoPlaybackCtlr->iAllowAutoPlay ) |
|
210 { |
|
211 if ( iVideoPlaybackCtlr->IsVideoCall() ) |
|
212 { |
|
213 MPX_TRAPD( err, |
|
214 iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoCallOngoingError ) ); |
|
215 } |
|
216 else if ( iVideoPlaybackCtlr->IsDisplayOff() && |
|
217 iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) |
|
218 { |
|
219 iVideoPlaybackCtlr->iForegroundPause = ETrue; |
|
220 } |
|
221 else if ( ! iVideoPlaybackCtlr->iAccessoryMonitor->IsTvOutPlaybackAllowed() ) |
|
222 { |
|
223 MPX_TRAPD( err, |
|
224 iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoTvOutPlaybackNotAllowed ) ); |
|
225 } |
|
226 else |
|
227 { |
|
228 playAllowed = ETrue; |
|
229 } |
|
230 } |
|
231 return playAllowed; |
|
232 } |
|
233 |
|
234 // ------------------------------------------------------------------------------------------------ |
|
235 // CMPXVideoPlaybackMode::IsNetworkMode2GL |
|
236 // ------------------------------------------------------------------------------------------------ |
|
237 TBool CMPXVideoPlaybackMode::IsNetworkMode2GL() |
|
238 { |
|
239 TBool networkMode2g( EFalse ); |
|
240 RMobilePhone mobilePhone; |
|
241 RTelServer telServer; // 3G |
|
242 |
|
243 RTelServer::TPhoneInfo phoneInfo; |
|
244 RMobilePhone::TMobilePhoneNetworkMode networkMode; |
|
245 |
|
246 User::LeaveIfError( telServer.Connect() ); |
|
247 User::LeaveIfError( telServer.LoadPhoneModule( KMmTsyModuleName ) ); |
|
248 |
|
249 TInt numPhones; |
|
250 User::LeaveIfError(telServer.EnumeratePhones( numPhones ) ); |
|
251 |
|
252 if ( numPhones <= 0 ) |
|
253 { |
|
254 User::Leave( KErrCorrupt ); |
|
255 } |
|
256 |
|
257 User::LeaveIfError( telServer.GetPhoneInfo( 0, phoneInfo ) ); |
|
258 User::LeaveIfError( mobilePhone.Open( telServer, phoneInfo.iName ) ); |
|
259 User::LeaveIfError( mobilePhone.Initialise() ); |
|
260 |
|
261 User::LeaveIfError( mobilePhone.GetCurrentMode( networkMode ) ); |
|
262 |
|
263 if ( networkMode == RMobilePhone::ENetworkModeGsm) |
|
264 { |
|
265 networkMode2g = ETrue; |
|
266 } |
|
267 |
|
268 mobilePhone.Close(); |
|
269 telServer.Close(); |
|
270 |
|
271 MPX_DEBUG(_L("CMPXVideoPlaybackMode::IsNetworkMode2GL(%d)"), networkMode2g); |
|
272 |
|
273 return networkMode2g; |
|
274 } |
|
275 |
|
276 |
|
277 // ------------------------------------------------------------------------------------------------ |
|
278 // CMPXVideoPlaybackMode::IsTvOutAllowedL() |
|
279 // ------------------------------------------------------------------------------------------------ |
|
280 TBool CMPXVideoPlaybackMode::IsTvOutAllowedL() |
|
281 { |
|
282 MPX_DEBUG(_L("CMPXVideoPlaybackMode::IsTvOutAllowedL()")); |
|
283 |
|
284 TBool allowTvOut = |
|
285 iVideoPlaybackCtlr->iDrmHelper->IsTvOutAllowedL( iVideoPlaybackCtlr->iFileHandle ); |
|
286 |
|
287 MPX_DEBUG(_L("CMPXVideoPlaybackMode::IsTvOutAllowedL(%d)"), allowTvOut); |
|
288 |
|
289 return allowTvOut; |
|
290 } |
|
291 |
|
292 //************************************************************************************************// |
|
293 // CMPXLocalPlaybackMode |
|
294 //************************************************************************************************// |
|
295 CMPXVideoPlaybackMode* |
|
296 CMPXLocalPlaybackMode::NewL( CMPXVideoPlaybackController* aVideoPlaybackCtlr ) |
|
297 { |
|
298 MPX_ENTER_EXIT(_L("CMPXLocalPlaybackMode::NewL()")); |
|
299 CMPXLocalPlaybackMode* self = new( ELeave ) CMPXLocalPlaybackMode(); |
|
300 CleanupStack::PushL( self ); |
|
301 self->ConstructL(aVideoPlaybackCtlr); |
|
302 CleanupStack::Pop(); |
|
303 return self; |
|
304 } |
|
305 |
|
306 CMPXLocalPlaybackMode::~CMPXLocalPlaybackMode() |
|
307 { |
|
308 MPX_DEBUG(_L("CMPXLocalPlaybackMode::~CMPXLocalPlaybackMode()")); |
|
309 } |
|
310 |
|
311 //************************************************************************************************// |
|
312 // CMPXStreamingPlaybackMode |
|
313 //************************************************************************************************// |
|
314 CMPXVideoPlaybackMode* |
|
315 CMPXStreamingPlaybackMode::NewL( CMPXVideoPlaybackController* aVideoPlaybackCtlr ) |
|
316 { |
|
317 MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::NewL()")); |
|
318 |
|
319 CMPXStreamingPlaybackMode* self = new( ELeave ) CMPXStreamingPlaybackMode(); |
|
320 CleanupStack::PushL( self ); |
|
321 self->ConstructL(aVideoPlaybackCtlr); |
|
322 CleanupStack::Pop(); |
|
323 return self; |
|
324 } |
|
325 |
|
326 CMPXStreamingPlaybackMode::~CMPXStreamingPlaybackMode() |
|
327 { |
|
328 MPX_DEBUG(_L("CMPXStreamingPlaybackMode::~CMPXStreamingPlaybackMode()")); |
|
329 } |
|
330 |
|
331 // ---------------------------------------------------------------------------- |
|
332 // CMPXStreamingPlaybackMode::OpenFileL() |
|
333 // ---------------------------------------------------------------------------- |
|
334 void CMPXStreamingPlaybackMode::OpenFileL( const TDesC& aMediaFile ) |
|
335 { |
|
336 MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::OpenFileL()"), _L("file = %S"), &aMediaFile ); |
|
337 |
|
338 iVideoPlaybackCtlr->iPlayer->OpenUrlL( aMediaFile, iVideoPlaybackCtlr->iAccessPointId ); |
|
339 } |
|
340 |
|
341 // ------------------------------------------------------------------------------------------------ |
|
342 // CMPXStreamingPlaybackMode::HandleOpenComplete() |
|
343 // ------------------------------------------------------------------------------------------------ |
|
344 // |
|
345 void CMPXStreamingPlaybackMode::HandleOpenComplete() |
|
346 { |
|
347 MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::HandleOpenComplete()")); |
|
348 |
|
349 // since SDP files are opened as KMmfUidFileSource type, we need to set |
|
350 // the access point for SDP files before Prepare is called on Helix |
|
351 // |
|
352 // for RAM files and URLs - access point is already been set |
|
353 // at the point of adding data source |
|
354 |
|
355 if ( iVideoPlaybackCtlr->iMediaType == CMediaRecognizer::ELocalSdpFile ) |
|
356 { |
|
357 const TMMFMessageDestinationPckg destinationPckg(KUidInterfaceMMFHelixController); |
|
358 const TPckgBuf<TBool> savePckg( EFalse ); |
|
359 |
|
360 HBufC8* tempBuf = NULL; |
|
361 TInt apMaxLen = 3; |
|
362 |
|
363 HBufC8* accessPoint = HBufC8::NewLC( KMMFAccessPoint().Length() + apMaxLen ); |
|
364 accessPoint->Des().Format( KMMFAccessPoint, iVideoPlaybackCtlr->iAccessPointId ); |
|
365 |
|
366 tempBuf = HBufC8::NewLC( accessPoint->Length() ); |
|
367 tempBuf->Des().Copy( accessPoint->Des() ); |
|
368 |
|
369 if ( tempBuf ) |
|
370 { |
|
371 iVideoPlaybackCtlr->iPlayer->CustomCommandSync( destinationPckg, |
|
372 EMMFROPControllerSetApplicationConfig, |
|
373 tempBuf->Des(), |
|
374 savePckg ); |
|
375 } |
|
376 |
|
377 CleanupStack::PopAndDestroy(2); // accessPoint, tempBuf |
|
378 } |
|
379 } |
|
380 |
|
381 // ------------------------------------------------------------------------------------------------ |
|
382 // CMPXStreamingPlaybackMode::CanPlayNow |
|
383 // ------------------------------------------------------------------------------------------------ |
|
384 TBool CMPXStreamingPlaybackMode::CanPlayNow() |
|
385 { |
|
386 MPX_DEBUG(_L("CMPXStreamingPlaybackMode::CanPlayNow")); |
|
387 TBool playAllowed = EFalse; |
|
388 |
|
389 if ( iVideoPlaybackCtlr->iAppInForeground && iVideoPlaybackCtlr->iAllowAutoPlay ) |
|
390 { |
|
391 if ( iVideoPlaybackCtlr->IsVideoCall() ) |
|
392 { |
|
393 MPX_TRAPD(err, |
|
394 iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoCallOngoingError )); |
|
395 } |
|
396 else if ( iVideoPlaybackCtlr->IsDisplayOff() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) |
|
397 { |
|
398 //exit for live streaming |
|
399 } |
|
400 else |
|
401 { |
|
402 playAllowed = !( iVideoPlaybackCtlr->IsVoiceCall() && IsNetworkMode2GL() ); |
|
403 |
|
404 if ( !playAllowed ) |
|
405 { |
|
406 MPX_TRAPD( err, |
|
407 iVideoPlaybackCtlr->iState->SendErrorToViewL( |
|
408 KMPXVideoPlayOver2GDuringVoiceCallError ) ); |
|
409 } |
|
410 } |
|
411 } |
|
412 |
|
413 return playAllowed; |
|
414 } |
|
415 |
|
416 // ------------------------------------------------------------------------------------------------ |
|
417 // CMPXStreamingPlaybackMode::IsTvOutAllowedL() |
|
418 // ------------------------------------------------------------------------------------------------ |
|
419 TBool CMPXStreamingPlaybackMode::IsTvOutAllowedL() |
|
420 { |
|
421 MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::IsTvOutAllowedL(1)")); |
|
422 return ETrue; |
|
423 } |
|
424 // ------------------------------------------------------------------------------------------------ |
|
425 // CMPXStreamingPlaybackMode::HandlePause() |
|
426 // ------------------------------------------------------------------------------------------------ |
|
427 void CMPXStreamingPlaybackMode::HandlePause() |
|
428 { |
|
429 MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::HandlePause()")); |
|
430 |
|
431 if ( iVideoPlaybackCtlr->iFileDetails->iPausableStream ) |
|
432 { |
|
433 MPX_TRAPD( err, iVideoPlaybackCtlr->iPlayer->PauseL() ); |
|
434 |
|
435 if ( err == KErrNone ) |
|
436 { |
|
437 iVideoPlaybackCtlr->ChangeState( EMPXVideoPaused ); |
|
438 |
|
439 iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused, |
|
440 0, |
|
441 err ); |
|
442 } |
|
443 else |
|
444 { |
|
445 TRAP_IGNORE( iVideoPlaybackCtlr->iState->SendErrorToViewL( err ) ); |
|
446 } |
|
447 } |
|
448 else |
|
449 { |
|
450 iVideoPlaybackCtlr->iPlayer->Stop(); |
|
451 |
|
452 iVideoPlaybackCtlr->ChangeState( EMPXVideoStopped ); |
|
453 |
|
454 iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPStopped, |
|
455 0, |
|
456 KErrNone ); |
|
457 } |
|
458 } |
|
459 |
|
460 //************************************************************************************************// |
|
461 // CMPXLiveStreamingPlaybackMode |
|
462 //************************************************************************************************// |
|
463 CMPXVideoPlaybackMode* |
|
464 CMPXLiveStreamingPlaybackMode::NewL( CMPXVideoPlaybackController* aVideoPlaybackCtlr ) |
|
465 { |
|
466 MPX_ENTER_EXIT(_L("CMPXLiveStreamingPlaybackMode::NewL()")); |
|
467 |
|
468 CMPXLiveStreamingPlaybackMode* self = |
|
469 new( ELeave ) CMPXLiveStreamingPlaybackMode(); |
|
470 CleanupStack::PushL( self ); |
|
471 self->ConstructL(aVideoPlaybackCtlr); |
|
472 CleanupStack::Pop(); |
|
473 return self; |
|
474 } |
|
475 |
|
476 CMPXLiveStreamingPlaybackMode::~CMPXLiveStreamingPlaybackMode() |
|
477 { |
|
478 MPX_DEBUG(_L("CMPXLiveStreamingPlaybackMode::~CMPXLiveStreamingPlaybackMode")); |
|
479 } |
|
480 |
|
481 // ------------------------------------------------------------------------------------------------ |
|
482 // CMPXLiveStreamingPlaybackMode::HandlePause() |
|
483 // ------------------------------------------------------------------------------------------------ |
|
484 void CMPXLiveStreamingPlaybackMode::HandlePause() |
|
485 { |
|
486 MPX_ENTER_EXIT(_L("CMPXLiveStreamingPlaybackMode::HandlePause()")); |
|
487 |
|
488 iVideoPlaybackCtlr->iPlayer->Stop(); |
|
489 |
|
490 iVideoPlaybackCtlr->ChangeState( EMPXVideoStopped ); |
|
491 |
|
492 iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPStopped, |
|
493 0, |
|
494 KErrNone ); |
|
495 } |
|
496 |
|
497 // ------------------------------------------------------------------------------------------------ |
|
498 // CMPXLiveStreamingPlaybackMode::HandleBackground() |
|
499 // ------------------------------------------------------------------------------------------------ |
|
500 void CMPXLiveStreamingPlaybackMode::HandleBackground() |
|
501 { |
|
502 MPX_DEBUG(_L("CMPXLiveStreamingPlaybackMode::HandleBackground()")); |
|
503 |
|
504 if ( iVideoPlaybackCtlr->iAppInForeground ) |
|
505 { |
|
506 if ( iVideoPlaybackCtlr->IsPhoneCall() || |
|
507 iVideoPlaybackCtlr->IsVideoCall() || |
|
508 ( iVideoPlaybackCtlr->IsDisplayOff() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled )) |
|
509 { |
|
510 iVideoPlaybackCtlr->iState->HandlePause(); |
|
511 } |
|
512 } |
|
513 else |
|
514 { |
|
515 iVideoPlaybackCtlr->iState->HandlePause(); |
|
516 } |
|
517 } |
|
518 |
|
519 //************************************************************************************************// |
|
520 // CMPXProgressiveDLPlaybackMode |
|
521 //************************************************************************************************// |
|
522 CMPXVideoPlaybackMode* |
|
523 CMPXProgressiveDLPlaybackMode::NewL( CMPXVideoPlaybackController* aVideoPlaybackCtlr ) |
|
524 { |
|
525 MPX_ENTER_EXIT(_L("CMPXProgressiveDLPlaybackMode::NewL()")); |
|
526 |
|
527 CMPXProgressiveDLPlaybackMode* self = new( ELeave ) CMPXProgressiveDLPlaybackMode(); |
|
528 CleanupStack::PushL( self ); |
|
529 self->ConstructL( aVideoPlaybackCtlr ); |
|
530 CleanupStack::Pop(); |
|
531 return self; |
|
532 } |
|
533 |
|
534 void CMPXProgressiveDLPlaybackMode::ConstructL( CMPXVideoPlaybackController* aVideoPlaybackCtlr ) |
|
535 { |
|
536 iVideoPlaybackCtlr = aVideoPlaybackCtlr; |
|
537 |
|
538 // |
|
539 // Create the Download Mgr Interface |
|
540 // |
|
541 iDlMgrIf = CMPXVideoDlMgrIf::NewL( iVideoPlaybackCtlr ); |
|
542 } |
|
543 |
|
544 CMPXProgressiveDLPlaybackMode::~CMPXProgressiveDLPlaybackMode() |
|
545 { |
|
546 MPX_DEBUG(_L("CMPXProgressiveDLPlaybackMode::~CMPXProgressiveDLPlaybackMode()")); |
|
547 |
|
548 if ( iDlMgrIf ) |
|
549 { |
|
550 delete iDlMgrIf; |
|
551 iDlMgrIf = NULL; |
|
552 } |
|
553 } |
|
554 |
|
555 // ------------------------------------------------------------------------------------------------ |
|
556 // CMPXProgressiveDLPlaybackMode::ConnectToDownloadL() |
|
557 // ------------------------------------------------------------------------------------------------ |
|
558 // |
|
559 void CMPXProgressiveDLPlaybackMode::ConnectToDownloadL( CMPXCommand& aCmd ) |
|
560 { |
|
561 MPX_ENTER_EXIT(_L("CMPXProgressiveDLPlaybackMode::ConnectToDownloadL()")); |
|
562 |
|
563 iDlMgrIf->ConnectToDownloadL( aCmd ); |
|
564 } |
|
565 |
|
566 // ------------------------------------------------------------------------------------------------ |
|
567 // CMPXProgressiveDLPlaybackMode::HandleOpenComplete() |
|
568 // ------------------------------------------------------------------------------------------------ |
|
569 // |
|
570 void CMPXProgressiveDLPlaybackMode::HandleOpenComplete() |
|
571 { |
|
572 MPX_ENTER_EXIT(_L("CMPXProgressiveDLPlaybackMode::HandleOpenComplete()")); |
|
573 |
|
574 // |
|
575 // Helix needs the download id before the prepare command has been sent |
|
576 // to enable PDL |
|
577 // |
|
578 iDlMgrIf->DoHandleOpenComplete(); |
|
579 } |
|
580 |
|
581 // ------------------------------------------------------------------------------------------------ |
|
582 // CMPXProgressiveDLPlaybackMode::GetPdlStatusL() |
|
583 // ------------------------------------------------------------------------------------------------ |
|
584 // |
|
585 void CMPXProgressiveDLPlaybackMode::GetPdlStatusL( CMPXCommand& aCmd ) |
|
586 { |
|
587 MPX_DEBUG(_L("CMPXProgressiveDLPlaybackMode::GetPdlStatusL()")); |
|
588 |
|
589 iDlMgrIf->GetPdlStatusL( aCmd ); |
|
590 } |
|
591 |
|
592 // ------------------------------------------------------------------------------------------------ |
|
593 // CMPXProgressiveDLPlaybackMode::UpdateSeekPosition() |
|
594 // ------------------------------------------------------------------------------------------------ |
|
595 // |
|
596 void CMPXProgressiveDLPlaybackMode::UpdateSeekPosition( TInt64& aPosition ) |
|
597 { |
|
598 MPX_DEBUG(_L("CMPXProgressiveDLPlaybackMode::UpdateSeekPosition()")); |
|
599 |
|
600 TReal duration = (TReal)iVideoPlaybackCtlr->iFileDetails->iDuration.Int64(); |
|
601 TReal playbackRatio = (TReal)aPosition / duration; |
|
602 TReal downloadRatio = iDlMgrIf->GetDownloadRatio(); |
|
603 |
|
604 // |
|
605 // Limit the seek position to the downloaded part of the file |
|
606 // |
|
607 if ( playbackRatio > downloadRatio ) |
|
608 { |
|
609 aPosition = downloadRatio * duration; |
|
610 } |
|
611 |
|
612 iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( |
|
613 MMPXPlaybackPluginObserver::EPPositionChanged, |
|
614 aPosition / KPbMilliMultiplier, |
|
615 KErrNone ); |
|
616 } |
|
617 |
|
618 // End of file |