videoplayback/videohelix/src/mpxvideoplayerutility.cpp
branchRCL_3
changeset 12 7f2b2a65da29
parent 10 112a725ff2c2
child 15 8f0df5c82986
--- a/videoplayback/videohelix/src/mpxvideoplayerutility.cpp	Wed Apr 14 15:59:50 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplayerutility.cpp	Tue Apr 27 16:40:33 2010 +0300
@@ -15,7 +15,8 @@
 *
 */
 
-// Version : %version: e003sa33#19 %
+
+// Version : %version: 20 %
 
 
 #include <AudioPreference.h>
@@ -79,11 +80,7 @@
         iControllerEventMonitor = NULL;
     }
 
-    if ( ! iSurfaceId.IsNull() )
-    {
-        MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoRemoveDisplayWindow ) );
-        iSurfaceId = TSurfaceId::CreateNullId();
-    }
+    iSurfaceId = TSurfaceId::CreateNullId();
 
     iController.Close();
     iDirectScreenAccessAbort = EFalse;
@@ -280,21 +277,6 @@
     }
 }
 
-
-// -------------------------------------------------------------------------------------------------
-//   CMpxVideoPlayerUtility::SurfaceRemovedFromView()
-// -------------------------------------------------------------------------------------------------
-//
-void CMpxVideoPlayerUtility::SurfaceRemovedFromView()
-{
-    MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::SurfaceRemovedFromView()"));
-
-    if ( ! iSurfaceId.IsNull() )
-    {
-        iSurfaceId = TSurfaceId::CreateNullId();
-    }
-}
-
 TBool CMpxVideoPlayerUtility::AudioEnabledL() const
 {
     TBool enabled;
@@ -498,40 +480,35 @@
 {
     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::VideoSurfaceCreated()"));
 
-    TSurfaceId oldSurfaceId( iSurfaceId );
-    TBool replaceSurface = ! ( iSurfaceId.IsNull() );
-
-    TSurfaceId surfaceId;
-    TRect cropRect;
-    TVideoAspectRatio aspectRatio;
+    TInt error = KErrNone;
 
-    TInt error =
-        iVideoPlaySurfaceSupportCustomCommands.GetSurfaceParameters( surfaceId,
-                                                                     cropRect,
-                                                                     aspectRatio );
-
-    if ( error == KErrNone )
+    if ( iSurfaceId.IsNull() )
     {
-        //
-        //  Send data to the display handler to remove old surface and add new surface
-        //
-        MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceCreated,
-                                             surfaceId,
-                                             cropRect,
-                                             aspectRatio ) );
+        TSurfaceId surfaceId;
+        TRect cropRect;
+        TVideoAspectRatio aspectRatio;
 
-        iSurfaceId = surfaceId;
+        error = iVideoPlaySurfaceSupportCustomCommands.GetSurfaceParameters( surfaceId,
+                                                                             cropRect,
+                                                                             aspectRatio );
 
-        //
-        //  if surface already existed tell video adaptation it is no longer in use.
-        //  Video adaptation will remove the surface when it receives this call therefore
-        //  the following code must be done at the end of this function.
-        //
-        if ( replaceSurface )
+        if ( error == KErrNone )
         {
-            error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( oldSurfaceId );
+            //
+            //  Send data to the display handler to remove old surface and add new surface
+            //
+            MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceCreated,
+                                                 surfaceId,
+                                                 cropRect,
+                                                 aspectRatio ) );
+
+            iSurfaceId = surfaceId;
         }
     }
+    else
+    {
+        error = KErrAlreadyExists;
+    }
 
     return error;
 }
@@ -619,10 +596,10 @@
         CMPXMessage* msg = CMPXMessage::NewL();
         CleanupStack::PushL( msg );
 
-        msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplaySyncMessage );
+        msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplayMessage );
         msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd );
 
-        iVideoPlaybackController->iMPXPluginObs->HandlePlaybackSyncMessage( *msg );
+        iVideoPlaybackController->iMPXPluginObs->HandlePlaybackMessage( *msg );
 
         CleanupStack::PopAndDestroy( msg );
     }
@@ -645,13 +622,13 @@
         CMPXMessage* msg = CMPXMessage::NewL();
         CleanupStack::PushL( msg );
 
-        msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplaySyncMessage );
+        msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplayMessage );
         msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd );
         msg->SetTObjectValueL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId, aSurfaceId );
         msg->SetTObjectValueL<TRect>( KMPXMediaVideoDisplayCropRect, aCropRect );
         msg->SetTObjectValueL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio, aAspectRatio );
 
-        iVideoPlaybackController->iMPXPluginObs->HandlePlaybackSyncMessage( *msg );
+        iVideoPlaybackController->iMPXPluginObs->HandlePlaybackMessage( *msg );
 
         CleanupStack::PopAndDestroy( msg );
     }