videoplayback/videohelix/src/mpxvideoplayerutility.cpp
changeset 34 bbb98528c666
parent 30 4f111d64a341
child 35 3738fe97f027
--- a/videoplayback/videohelix/src/mpxvideoplayerutility.cpp	Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplayerutility.cpp	Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-// Version : %version: 15 %
+// Version : %version: 18 %
 
 
 #include <AudioPreference.h>
@@ -79,6 +79,12 @@
         iControllerEventMonitor = NULL;
     }
 
+    if ( ! iSurfaceId.IsNull() )
+    {
+        MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoRemoveDisplayWindow ) );
+        iSurfaceId = TSurfaceId::CreateNullId();
+    }
+
     iController.Close();
     iDirectScreenAccessAbort = EFalse;
 }
@@ -274,6 +280,21 @@
     }
 }
 
+
+// -------------------------------------------------------------------------------------------------
+//   CMpxVideoPlayerUtility::SurfaceRemovedFromView()
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerUtility::SurfaceRemovedFromView()
+{
+    MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::SurfaceRemovedFromView()"));
+
+    if ( ! iSurfaceId.IsNull() )
+    {
+        iSurfaceId = TSurfaceId::CreateNullId();
+    }
+}
+
 TBool CMpxVideoPlayerUtility::AudioEnabledL() const
 {
     TBool enabled;
@@ -569,19 +590,17 @@
 {
     TInt error = KErrNone;
 
-    if ( iSurfaceId.IsNull() )
+    if ( !iSurfaceId.IsNull() )
     {
-        error = KErrNotFound;
-    }
+        //
+        //  Send command to view to remove the surface
+        //
+        MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceRemoved ) );
 
-    //
-    //  Send command to view to remove the surface
-    //
-    MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceRemoved ) );
+        error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( iSurfaceId );
 
-    error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( iSurfaceId );
-
-    iSurfaceId = TSurfaceId::CreateNullId();
+        iSurfaceId = TSurfaceId::CreateNullId();
+    }
 
     return error;
 }