diff -r 5294c000a26d -r 112a725ff2c2 videoplayback/videoplaybackviews/src/mpxvideoplaybackdisplayhandler.cpp --- a/videoplayback/videoplaybackviews/src/mpxvideoplaybackdisplayhandler.cpp Mon Mar 15 12:40:47 2010 +0200 +++ b/videoplayback/videoplaybackviews/src/mpxvideoplaybackdisplayhandler.cpp Wed Mar 31 21:34:36 2010 +0300 @@ -16,7 +16,7 @@ */ -// Version : %version: 11 % +// Version : %version: 12 % #include @@ -182,29 +182,30 @@ TMPXVideoDisplayCommand message = ( *(aMessage->Value(KMPXMediaVideoDisplayCommand)) ); - MPX_DEBUG( - _L("CMPXVideoPlaybackDisplayHandler::HandleVideoDisplaySyncMessageL() message = %d"), message ); - switch ( message ) { #ifdef SYMBIAN_BUILD_GCE case EPbMsgVideoSurfaceCreated: { + MPX_DEBUG(_L(" message = EPbMsgVideoSurfaceCreated")); SurfaceCreatedL( aMessage ); break; } case EPbMsgVideoSurfaceChanged: { + MPX_DEBUG(_L(" message = EPbMsgVideoSurfaceChanged")); SurfaceChangedL( aMessage ); break; } case EPbMsgVideoSurfaceRemoved: { + MPX_DEBUG(_L(" message = EPbMsgVideoSurfaceRemoved")); SurfaceRemoved(); break; } case EPbMsgVideoRemoveDisplayWindow: { + MPX_DEBUG(_L(" message = EPbMsgVideoRemoveDisplayWindow")); RemoveDisplayWindow( EFalse ); break; } @@ -249,11 +250,13 @@ // ------------------------------------------------------------------------------------------------- // TInt CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL( - CMPXVideoPlaybackViewFileDetails* aFileDetails, - TReal aDisplayAspectRatio ) + CMPXVideoPlaybackViewFileDetails* aFileDetails ) { MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL()")); + TRect displayRect = iContainer->Rect(); + TReal displayAspectRatio = (TReal32)displayRect.Width() / (TReal32)displayRect.Height(); + TInt newAspectRatio = EMMFNatural; if ( aFileDetails->iVideoHeight > 0 && aFileDetails->iVideoWidth > 0 ) @@ -272,7 +275,7 @@ for ( ; i < cnt ; i++ ) { if ( iAspectRatioArray[i].videoRatio == videoAspectRatio && - iAspectRatioArray[i].screenRatio == aDisplayAspectRatio && + iAspectRatioArray[i].screenRatio == displayAspectRatio && ( scalingType = iAspectRatioArray[i].scalingType ) > 0 ) { break; @@ -288,11 +291,11 @@ // if ( i == cnt ) { - if ( videoAspectRatio - aDisplayAspectRatio > 0.1 ) + if ( videoAspectRatio - displayAspectRatio > 0.1 ) { scalingType = EMMFZoom; } - else if ( videoAspectRatio != aDisplayAspectRatio ) + else if ( videoAspectRatio != displayAspectRatio ) { scalingType = EMMFStretch; } @@ -300,7 +303,7 @@ TMPXAspectRatio ratio; ratio.videoRatio = videoAspectRatio; - ratio.screenRatio = aDisplayAspectRatio; + ratio.screenRatio = displayAspectRatio; ratio.scalingType = scalingType; iAspectRatioArray.Append( ratio ); @@ -363,7 +366,9 @@ { for ( TInt i = 0 ; i < cnt ; i++ ) { - //Save (videoRatio + screenRatio + scalingType) + // + // Save (videoRatio + screenRatio + scalingType) + // out.WriteReal32L( iAspectRatioArray[i].videoRatio ); out.WriteReal32L( iAspectRatioArray[i].screenRatio ); out.WriteInt8L( iAspectRatioArray[i].scalingType ); @@ -463,7 +468,7 @@ // // Check if surface was created before window was ready // - if ( iSurfaceCached ) + if ( iSurfaceCached && ! iContainer->IsRealOneBitmapTimerActive() ) { iVideoDisplay->SurfaceCreated( iSurfaceId, iCropRect, iAspectRatio, iCropRect ); @@ -493,7 +498,11 @@ iCropRect = aMessage->ValueTObjectL( KMPXMediaVideoDisplayCropRect ); iAspectRatio = aMessage->ValueTObjectL( KMPXMediaVideoDisplayAspectRatio ); - if ( iVideoDisplay ) + // + // Add the surface unless the video display hasn't been created or + // the Real One bitmap is being shown. + // + if ( iVideoDisplay && ! iContainer->IsRealOneBitmapTimerActive() ) { // // Remove old surface if one exists @@ -516,8 +525,7 @@ else { // - // Video display has not been created yet, save surface information to create - // the surface when the display is created + // Save the surface information to add it when the display is ready // iSurfaceCached = ETrue; } @@ -538,7 +546,11 @@ iCropRect = aMessage->ValueTObjectL( KMPXMediaVideoDisplayCropRect ); iAspectRatio = aMessage->ValueTObjectL( KMPXMediaVideoDisplayAspectRatio ); - if ( iVideoDisplay ) + // + // Check if the surface has been cached + // If surface has been cached, exit since the surface parameters have been saved + // + if ( ! iSurfaceCached && iVideoDisplay ) { // // Add new surface @@ -615,4 +627,29 @@ #endif +// ------------------------------------------------------------------------------------------------- +// CMPXVideoPlaybackDisplayHandler::DoHandleRealOneBitmapTimeoutL() +// ------------------------------------------------------------------------------------------------- +// +void CMPXVideoPlaybackDisplayHandler::DoHandleRealOneBitmapTimeoutL() +{ + MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::DoHandleRealOneBitmapTimeoutL()")); + + // + // Check if surface was created before window was ready + // + if ( iSurfaceCached && iVideoDisplay ) + { + iVideoDisplay->SurfaceCreated( iSurfaceId, iCropRect, iAspectRatio, iCropRect ); + + if ( iContainer ) + { + iContainer->HandleCommandL( EMPXPbvSurfaceCreated ); + } + + iSurfaceCached = EFalse; + } +} + + // End of File