videoplayback/videohelix/src/mpxvideoplayerutility.cpp
changeset 17 69946d1824c4
parent 15 cf5481c2bc0b
child 24 7d93ee07fb27
--- a/videoplayback/videohelix/src/mpxvideoplayerutility.cpp	Fri Apr 16 14:59:52 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplayerutility.cpp	Mon May 03 12:32:50 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 );
     }