180 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::HandleVideoDisplaySyncMessageL()")); |
180 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::HandleVideoDisplaySyncMessageL()")); |
181 |
181 |
182 TMPXVideoDisplayCommand message = |
182 TMPXVideoDisplayCommand message = |
183 ( *(aMessage->Value<TMPXVideoDisplayCommand>(KMPXMediaVideoDisplayCommand)) ); |
183 ( *(aMessage->Value<TMPXVideoDisplayCommand>(KMPXMediaVideoDisplayCommand)) ); |
184 |
184 |
185 MPX_DEBUG( |
|
186 _L("CMPXVideoPlaybackDisplayHandler::HandleVideoDisplaySyncMessageL() message = %d"), message ); |
|
187 |
|
188 switch ( message ) |
185 switch ( message ) |
189 { |
186 { |
190 #ifdef SYMBIAN_BUILD_GCE |
187 #ifdef SYMBIAN_BUILD_GCE |
191 case EPbMsgVideoSurfaceCreated: |
188 case EPbMsgVideoSurfaceCreated: |
192 { |
189 { |
|
190 MPX_DEBUG(_L(" message = EPbMsgVideoSurfaceCreated")); |
193 SurfaceCreatedL( aMessage ); |
191 SurfaceCreatedL( aMessage ); |
194 break; |
192 break; |
195 } |
193 } |
196 case EPbMsgVideoSurfaceChanged: |
194 case EPbMsgVideoSurfaceChanged: |
197 { |
195 { |
|
196 MPX_DEBUG(_L(" message = EPbMsgVideoSurfaceChanged")); |
198 SurfaceChangedL( aMessage ); |
197 SurfaceChangedL( aMessage ); |
199 break; |
198 break; |
200 } |
199 } |
201 case EPbMsgVideoSurfaceRemoved: |
200 case EPbMsgVideoSurfaceRemoved: |
202 { |
201 { |
|
202 MPX_DEBUG(_L(" message = EPbMsgVideoSurfaceRemoved")); |
203 SurfaceRemoved(); |
203 SurfaceRemoved(); |
204 break; |
204 break; |
205 } |
205 } |
206 case EPbMsgVideoRemoveDisplayWindow: |
206 case EPbMsgVideoRemoveDisplayWindow: |
207 { |
207 { |
|
208 MPX_DEBUG(_L(" message = EPbMsgVideoRemoveDisplayWindow")); |
208 RemoveDisplayWindow( EFalse ); |
209 RemoveDisplayWindow( EFalse ); |
209 break; |
210 break; |
210 } |
211 } |
211 #endif |
212 #endif |
212 } |
213 } |
247 // ------------------------------------------------------------------------------------------------- |
248 // ------------------------------------------------------------------------------------------------- |
248 // CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL |
249 // CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL |
249 // ------------------------------------------------------------------------------------------------- |
250 // ------------------------------------------------------------------------------------------------- |
250 // |
251 // |
251 TInt CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL( |
252 TInt CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL( |
252 CMPXVideoPlaybackViewFileDetails* aFileDetails, |
253 CMPXVideoPlaybackViewFileDetails* aFileDetails ) |
253 TReal aDisplayAspectRatio ) |
|
254 { |
254 { |
255 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL()")); |
255 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL()")); |
|
256 |
|
257 TRect displayRect = iContainer->Rect(); |
|
258 TReal displayAspectRatio = (TReal32)displayRect.Width() / (TReal32)displayRect.Height(); |
256 |
259 |
257 TInt newAspectRatio = EMMFNatural; |
260 TInt newAspectRatio = EMMFNatural; |
258 |
261 |
259 if ( aFileDetails->iVideoHeight > 0 && aFileDetails->iVideoWidth > 0 ) |
262 if ( aFileDetails->iVideoHeight > 0 && aFileDetails->iVideoWidth > 0 ) |
260 { |
263 { |
270 // check whether dat file has the information about (videoRatio + screenRatio) |
273 // check whether dat file has the information about (videoRatio + screenRatio) |
271 // |
274 // |
272 for ( ; i < cnt ; i++ ) |
275 for ( ; i < cnt ; i++ ) |
273 { |
276 { |
274 if ( iAspectRatioArray[i].videoRatio == videoAspectRatio && |
277 if ( iAspectRatioArray[i].videoRatio == videoAspectRatio && |
275 iAspectRatioArray[i].screenRatio == aDisplayAspectRatio && |
278 iAspectRatioArray[i].screenRatio == displayAspectRatio && |
276 ( scalingType = iAspectRatioArray[i].scalingType ) > 0 ) |
279 ( scalingType = iAspectRatioArray[i].scalingType ) > 0 ) |
277 { |
280 { |
278 break; |
281 break; |
279 } |
282 } |
280 } |
283 } |
286 // videoAspectRatio - aDisplayAspectRatio < 0.1 ==> stretch |
289 // videoAspectRatio - aDisplayAspectRatio < 0.1 ==> stretch |
287 // videoAspectRatio = aDisplayAspectRatio ==> natural |
290 // videoAspectRatio = aDisplayAspectRatio ==> natural |
288 // |
291 // |
289 if ( i == cnt ) |
292 if ( i == cnt ) |
290 { |
293 { |
291 if ( videoAspectRatio - aDisplayAspectRatio > 0.1 ) |
294 if ( videoAspectRatio - displayAspectRatio > 0.1 ) |
292 { |
295 { |
293 scalingType = EMMFZoom; |
296 scalingType = EMMFZoom; |
294 } |
297 } |
295 else if ( videoAspectRatio != aDisplayAspectRatio ) |
298 else if ( videoAspectRatio != displayAspectRatio ) |
296 { |
299 { |
297 scalingType = EMMFStretch; |
300 scalingType = EMMFStretch; |
298 } |
301 } |
299 |
302 |
300 TMPXAspectRatio ratio; |
303 TMPXAspectRatio ratio; |
301 |
304 |
302 ratio.videoRatio = videoAspectRatio; |
305 ratio.videoRatio = videoAspectRatio; |
303 ratio.screenRatio = aDisplayAspectRatio; |
306 ratio.screenRatio = displayAspectRatio; |
304 ratio.scalingType = scalingType; |
307 ratio.scalingType = scalingType; |
305 |
308 |
306 iAspectRatioArray.Append( ratio ); |
309 iAspectRatioArray.Append( ratio ); |
307 } |
310 } |
308 |
311 |
361 |
364 |
362 MPX_TRAP( err, |
365 MPX_TRAP( err, |
363 { |
366 { |
364 for ( TInt i = 0 ; i < cnt ; i++ ) |
367 for ( TInt i = 0 ; i < cnt ; i++ ) |
365 { |
368 { |
366 //Save (videoRatio + screenRatio + scalingType) |
369 // |
|
370 // Save (videoRatio + screenRatio + scalingType) |
|
371 // |
367 out.WriteReal32L( iAspectRatioArray[i].videoRatio ); |
372 out.WriteReal32L( iAspectRatioArray[i].videoRatio ); |
368 out.WriteReal32L( iAspectRatioArray[i].screenRatio ); |
373 out.WriteReal32L( iAspectRatioArray[i].screenRatio ); |
369 out.WriteInt8L( iAspectRatioArray[i].scalingType ); |
374 out.WriteInt8L( iAspectRatioArray[i].scalingType ); |
370 } |
375 } |
371 } ); |
376 } ); |
461 MPX_DEBUG(_L("CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL() Display Added")); |
466 MPX_DEBUG(_L("CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL() Display Added")); |
462 |
467 |
463 // |
468 // |
464 // Check if surface was created before window was ready |
469 // Check if surface was created before window was ready |
465 // |
470 // |
466 if ( iSurfaceCached ) |
471 if ( iSurfaceCached && ! iContainer->IsRealOneBitmapTimerActive() ) |
467 { |
472 { |
468 iVideoDisplay->SurfaceCreated( iSurfaceId, iCropRect, iAspectRatio, iCropRect ); |
473 iVideoDisplay->SurfaceCreated( iSurfaceId, iCropRect, iAspectRatio, iCropRect ); |
469 |
474 |
470 if ( iContainer ) |
475 if ( iContainer ) |
471 { |
476 { |
491 // |
496 // |
492 iSurfaceId = aMessage->ValueTObjectL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId ); |
497 iSurfaceId = aMessage->ValueTObjectL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId ); |
493 iCropRect = aMessage->ValueTObjectL<TRect>( KMPXMediaVideoDisplayCropRect ); |
498 iCropRect = aMessage->ValueTObjectL<TRect>( KMPXMediaVideoDisplayCropRect ); |
494 iAspectRatio = aMessage->ValueTObjectL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio ); |
499 iAspectRatio = aMessage->ValueTObjectL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio ); |
495 |
500 |
496 if ( iVideoDisplay ) |
501 // |
|
502 // Add the surface unless the video display hasn't been created or |
|
503 // the Real One bitmap is being shown. |
|
504 // |
|
505 if ( iVideoDisplay && ! iContainer->IsRealOneBitmapTimerActive() ) |
497 { |
506 { |
498 // |
507 // |
499 // Remove old surface if one exists |
508 // Remove old surface if one exists |
500 // |
509 // |
501 if ( ! oldSurfaceId.IsNull() ) |
510 if ( ! oldSurfaceId.IsNull() ) |
536 // |
544 // |
537 iSurfaceId = aMessage->ValueTObjectL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId ); |
545 iSurfaceId = aMessage->ValueTObjectL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId ); |
538 iCropRect = aMessage->ValueTObjectL<TRect>( KMPXMediaVideoDisplayCropRect ); |
546 iCropRect = aMessage->ValueTObjectL<TRect>( KMPXMediaVideoDisplayCropRect ); |
539 iAspectRatio = aMessage->ValueTObjectL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio ); |
547 iAspectRatio = aMessage->ValueTObjectL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio ); |
540 |
548 |
541 if ( iVideoDisplay ) |
549 // |
|
550 // Check if the surface has been cached |
|
551 // If surface has been cached, exit since the surface parameters have been saved |
|
552 // |
|
553 if ( ! iSurfaceCached && iVideoDisplay ) |
542 { |
554 { |
543 // |
555 // |
544 // Add new surface |
556 // Add new surface |
545 // |
557 // |
546 iVideoDisplay->SurfaceParametersChanged( iSurfaceId, iCropRect, iAspectRatio ); |
558 iVideoDisplay->SurfaceParametersChanged( iSurfaceId, iCropRect, iAspectRatio ); |
613 return aspectRatio; |
625 return aspectRatio; |
614 } |
626 } |
615 |
627 |
616 #endif |
628 #endif |
617 |
629 |
|
630 // ------------------------------------------------------------------------------------------------- |
|
631 // CMPXVideoPlaybackDisplayHandler::DoHandleRealOneBitmapTimeoutL() |
|
632 // ------------------------------------------------------------------------------------------------- |
|
633 // |
|
634 void CMPXVideoPlaybackDisplayHandler::DoHandleRealOneBitmapTimeoutL() |
|
635 { |
|
636 MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::DoHandleRealOneBitmapTimeoutL()")); |
|
637 |
|
638 // |
|
639 // Check if surface was created before window was ready |
|
640 // |
|
641 if ( iSurfaceCached && iVideoDisplay ) |
|
642 { |
|
643 iVideoDisplay->SurfaceCreated( iSurfaceId, iCropRect, iAspectRatio, iCropRect ); |
|
644 |
|
645 if ( iContainer ) |
|
646 { |
|
647 iContainer->HandleCommandL( EMPXPbvSurfaceCreated ); |
|
648 } |
|
649 |
|
650 iSurfaceCached = EFalse; |
|
651 } |
|
652 } |
|
653 |
|
654 |
618 // End of File |
655 // End of File |