videoplayback/videoplaybackcontrols/src/mpxvideoplaybackcontrolscontroller.cpp
branchRCL_3
changeset 9 5294c000a26d
parent 6 7d91903f795f
child 10 112a725ff2c2
--- a/videoplayback/videoplaybackcontrols/src/mpxvideoplaybackcontrolscontroller.cpp	Fri Mar 12 15:43:00 2010 +0200
+++ b/videoplayback/videoplaybackcontrols/src/mpxvideoplaybackcontrolscontroller.cpp	Mon Mar 15 12:40:47 2010 +0200
@@ -15,7 +15,8 @@
 *
 */
 
-// Version : %version: 27 %
+
+// Version : %version: e003sa33#30 %
 
 
 // INCLUDE FILES
@@ -66,6 +67,7 @@
 const TInt KMPXControlsTimeOut = 4000000;
 
 const TInt KMP4LayoutSet = 6;
+
 // ================= MEMBER FUNCTIONS ==============================================================
 
 // -------------------------------------------------------------------------------------------------
@@ -77,8 +79,8 @@
     CMPXVideoPlaybackContainer* aContainer, TRect aRect )
     : iControls( EMPXControlsCount ),
       iRect( aRect ),
-      iContainer( aContainer ),
-      iSurfaceCreated(EFalse)
+      iSurfaceCreated( EFalse ),
+      iContainer( aContainer )
 {
 }
 
@@ -115,12 +117,7 @@
     iFileDetails = aDetails;
     iTvOutConnected = iFileDetails->iTvOutConnected;
 
-    iFileDetails->iRNFormat = IsRealFormatL( iFileDetails->iClipName->Des() );
-
-    if ( iFileDetails->iRNFormat )
-    {
-    	CreateRealOneBitmapL();
-    }
+    iRNFormat = IsRealFormatL( iFileDetails->iClipName->Des() );
 
     iControlsPolicy = CMPXVideoPlaybackControlPolicy::NewL();
     iControlsConfig = CMPXVideoPlaybackControlConfiguration::NewL( this );
@@ -167,9 +164,8 @@
 
     iFs.Close();
 
-
 #ifdef RD_TACTILE_FEEDBACK
-    if (iFeedback)
+    if ( iFeedback )
     {
         iFeedback->RemoveFeedbackForControl( iContainer );
     }
@@ -225,8 +221,6 @@
 
     iFileDetails = aDetails;
 
-    iFileDetails->iRNFormat = IsRealFormatL( iFileDetails->iClipName->Des() );
-
     iControlsConfig->UpdateControlsWithFileDetailsL();
 
     ControlsListUpdatedL();
@@ -377,14 +371,16 @@
             break;
         }
         case EMPXControlCmdSurfaceCreated:
-		{
-			//
-			//  When surface is created, remove the Real One Bitmap
-			//
-			iSurfaceCreated = ETrue;
-			SetRealOneBitmapVisibility( EFalse );
-			break;
-		}
+        {
+            iSurfaceCreated = ETrue;
+            SetRealOneBitmapVisibility( EFalse );
+            break;
+        }
+        case EMPXControlCmdSurfaceRemoved:
+        {
+            iSurfaceCreated = EFalse;
+            break;
+        }
     }
 }
 
@@ -402,8 +398,8 @@
     //
     if ( aNewState != iState )
     {
-    	TBool hideControls( EFalse );
-    	
+        TBool hideControls( EFalse );
+
         iState = aNewState;
 
         switch ( aNewState )
@@ -416,8 +412,10 @@
                 if ( iFileDetails->iPlaybackMode == EMPXVideoStreaming ||
                      iFileDetails->iPlaybackMode == EMPXVideoLiveStreaming )
                 {
-                    iControlsConfig->UpdateControlListL( EMPXControlCmdPluginInitialized );
-                    ControlsListUpdatedL();
+                    TRAP_IGNORE(
+                        iControlsConfig->UpdateControlListL( EMPXControlCmdPluginInitialized );
+                        ControlsListUpdatedL();
+                        );
                 }
 
                 break;
@@ -453,7 +451,7 @@
                 }
                 else
                 {
-                	UpdateControlsVisibility();
+                    UpdateControlsVisibility();
                 }
 
                 break;
@@ -497,7 +495,6 @@
 {
     MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::CreateRealOneBitmapL()"));
 
-
     TFileName iconsPath;
     LocateBitmapFileL( iconsPath );
 
@@ -880,7 +877,7 @@
             CMPXVideoPlaybackBrandingAnimation* brandingAnimation =
                 CMPXVideoPlaybackBrandingAnimation::NewL( this,
                                                           brandingLogoRect,
-                                                          iFileDetails->iRNFormat );
+                                                          iRNFormat );
 
             CleanupStack::PushL( brandingAnimation );
 
@@ -1084,7 +1081,7 @@
             label->SetAlignment( EHRightVBottom );
         }
     }
-    
+
     skRect = label->Rect();
 
     // Enlarge the button region to make it easy to be touched.
@@ -1583,13 +1580,18 @@
     _LIT(KMPXReal, "real" );
     _LIT(KMPXRN, "rn" );
 
-    if (iFileDetails->iMimeType)
+    if ( iFileDetails->iMimeType )
     {
         iFileDetails->iMimeType->Des().LowerCase();
 
         if ( iFileDetails->iMimeType->Find( KMPXReal ) >= 0 ||
              iFileDetails->iMimeType->Find( KMPXRN ) >= 0 )
         {
+            //
+            // RN clip and local mode, add RN logo bitmap to show while initializing
+            //
+            CreateRealOneBitmapL();
+            SetRealOneBitmapVisibility( ETrue );
             realFormat = ETrue;
         }
     }
@@ -1719,7 +1721,7 @@
 
     if ( iRealOneBitmap )
     {
-    	iRealOneBitmap->MakeVisible( aVisible );
+        iRealOneBitmap->MakeVisible( aVisible );
     }
 }
 
@@ -1744,10 +1746,6 @@
 
             break;
         }
-        default :
-        {
-            break;
-        }
     }
 }
 
@@ -1925,13 +1923,46 @@
     }
 }
 
+// -------------------------------------------------------------------------------------------------
+//   CMPXVideoPlaybackControlsController::SetBackgroundBlack
+// -------------------------------------------------------------------------------------------------
+//
 TBool CMPXVideoPlaybackControlsController::SetBackgroundBlack()
 {
-    TBool backgroundBlack = iSurfaceCreated && !iTvOutConnected;
+    TBool backgroundBlack = iSurfaceCreated && ! iTvOutConnected;
 
     MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::SetBackgroundBlack(%d)"), backgroundBlack);
     return backgroundBlack;
 }
 
+// -------------------------------------------------------------------------------------------------
+//   CMPXVideoPlaybackControlsController::IsSameAspectRatio
+// -------------------------------------------------------------------------------------------------
+//
+TBool CMPXVideoPlaybackControlsController::IsSameAspectRatio()
+{
+	MPX_ENTER_EXIT( _L( "CMPXVideoPlaybackControlsController::IsSameAspectRatio()" ) );
+	
+    TBool retVal = EFalse;
+
+    if ( iFileDetails->iVideoEnabled &&
+    	 iFileDetails->iVideoHeight > 0 &&
+  	     iFileDetails->iVideoWidth > 0 )
+    {
+        TRect displayRect = iContainer->Rect();
+        TReal displayAspectRatio = ( TReal32 )displayRect.Width() / ( TReal32 )displayRect.Height();
+        TReal videoAspectRatio = ( TReal32 )iFileDetails->iVideoWidth / 
+        		                 ( TReal32 )iFileDetails->iVideoHeight;
+
+        if ( displayAspectRatio == videoAspectRatio )
+        {
+            retVal = ETrue;
+        }
+    }
+
+    MPX_DEBUG( _L( "CMPXVideoPlaybackControlsController::IsSameAspectRatio(%d)" ), retVal );
+    
+    return retVal;
+}
 
 // End of File