videoplayback/videoplaybackviews/src/mpxvideobaseplaybackview.cpp
branchRCL_3
changeset 6 7d91903f795f
parent 2 dec420019252
child 8 ce5ada96ab30
--- a/videoplayback/videoplaybackviews/src/mpxvideobaseplaybackview.cpp	Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videoplaybackviews/src/mpxvideobaseplaybackview.cpp	Fri Feb 19 22:52:52 2010 +0200
@@ -15,7 +15,7 @@
 *
 */
 
-// Version : %version: e003sa33#58 %
+// Version : %version: 61 %
 
 
 //  Include Files
@@ -133,18 +133,18 @@
         iCloseAO = NULL;
     }
 
+    if ( iFileDetails )
+    {
+        delete iFileDetails;
+        iFileDetails = NULL;
+    }
+
     if ( iDisplayHandler )
     {
         delete iDisplayHandler;
         iDisplayHandler = NULL;
     }
 
-    if ( iFileDetails )
-    {
-        delete iFileDetails;
-        iFileDetails = NULL;
-    }
-
     if ( iPlaybackUtility )
     {
         TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
@@ -223,6 +223,18 @@
         case EMPXPbvCmdClose:
         {
             MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdClose"));
+
+            //
+            //  The display window must be removed before closing the playback plugin
+            //
+            if ( iDisplayHandler )
+            {
+                //
+                //  Remove the display window so the surface can be released
+                //
+                iDisplayHandler->RemoveDisplayWindow();
+            }
+
             CreateGeneralPlaybackCommandL( EPbCmdClose );
             break;
         }
@@ -351,7 +363,19 @@
             LaunchDRMDetailsL();
             break;
         }
+        case EAknSoftkeyClose:
+        {
+            //
+            //  Close is in progress
+            //  Remove the display window so the surface can be released
+            //
+            if ( iDisplayHandler )
+            {
+                iDisplayHandler->RemoveDisplayWindow();
+            }
 
+            break;
+        }
     }
 }
 
@@ -402,6 +426,7 @@
     //
     iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault );
     iPlaybackUtility->AddObserverL( *this );
+    iPlaybackUtility->SetPrimaryClientL();
 
     //
     //  Initialize the playback state
@@ -473,10 +498,11 @@
     //
     //  Delete the display handler when the view is deactivated
     //
-    iDisplayHandler->RemoveDisplayWindow();
-
-    delete iDisplayHandler;
-    iDisplayHandler = NULL;
+    if ( iDisplayHandler )
+    {
+        delete iDisplayHandler;
+        iDisplayHandler = NULL;
+    }
 
     if ( iPlaybackUtility )
     {
@@ -737,23 +763,28 @@
     {
         HandleVideoPlaybackMessage( aMessage );
     }
-    else if ( KMPXMediaIdVideoDisplayMessage == id )
+    else if ( KMPXMediaIdVideoDisplaySyncMessage == id )
     {
         if ( iDisplayHandler )
         {
             TMPXVideoDisplayCommand cmdId = iDisplayHandler->HandleVideoDisplayMessageL( aMessage );
 
             if ( cmdId == EPbMsgVideoSurfaceCreated )
-			{
+            {
                 //
-            	//  Notify container that surface has been created to make window transparent
-            	//
+                //  Notify container that surface has been created to make window transparent
+                //
                 if ( iContainer )
                 {
                     iContainer->HandleCommandL( EMPXPbvSurfaceCreated );
                 }
-			}
+            }
         }
+
+        //
+        //  Signal Sync Message handling is complete
+        //
+        iPlaybackUtility->CommandL( EPbCmdSyncMsgComplete );
     }
 }
 
@@ -868,11 +899,18 @@
 //
 void CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()
 {
-    MPX_DEBUG(
-      _L("CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()") );
+    MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()"));
 
     if ( IsMultiItemPlaylist() )
     {
+        if ( iDisplayHandler )
+        {
+            //
+            //  Remove the display window so the surface can be released
+            //
+            iDisplayHandler->RemoveDisplayWindow();
+        }
+
         iPlaybackUtility->CommandL( EPbCmdNext );
     }
     else
@@ -1541,7 +1579,6 @@
 void CMPXVideoBasePlaybackView::DoClosePlayerL()
 {
     MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DoClosePlayerL()"));
-
     AppUi()->HandleCommandL( EAknSoftkeyBack );
 }
 
@@ -2018,6 +2055,7 @@
         if ( openError == KErrNone )
         {
             MPX_TRAPD( err, drmUiHandling->ShowDetailsViewL( fileHandle ) );
+
             if ( KLeaveExit == err )
             {
                 User::Leave( err );
@@ -2033,6 +2071,7 @@
             if ( err == KErrNone && openError == KErrNone )
             {
                 MPX_TRAPD( err, drmUiHandling->ShowDetailsViewL( fileHandle64 ) );
+
                 if ( KLeaveExit == err )
                 {
                     User::Leave( err );