videoplayback/videohelix/src/mpxvideoplaybackstate.cpp
branchRCL_3
changeset 11 8970fbd719ec
parent 10 112a725ff2c2
child 12 7f2b2a65da29
--- a/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp	Wed Mar 31 21:34:36 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp	Wed Apr 14 15:59:50 2010 +0300
@@ -15,7 +15,7 @@
 *
 */
 
-// Version : %version: e003sa33#36 %
+// Version : %version: 37 %
 
 
 //
@@ -116,8 +116,6 @@
 
 //  ------------------------------------------------------------------------------------------------
 //    CMPXVideoPlaybackState::HandlePause()
-//
-//   @@FP for now we are assuming that Pause is only valid for Playing state
 //  ------------------------------------------------------------------------------------------------
 void CMPXVideoPlaybackState::HandlePause()
 {
@@ -187,8 +185,6 @@
 void CMPXVideoPlaybackState::HandleBackground()
 {
     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::HandleBackground()"));
-
-    // Just pause the plackback
     HandlePause();
 }
 
@@ -526,7 +522,7 @@
             TMPXAttribute( KMPXMediaVideoDrmProtected ),
             iVideoPlaybackCtlr->iFileDetails->iDrmProtected );
     }
-    
+
     //
     //  Description
     //
@@ -537,7 +533,7 @@
             TMPXAttribute( KMPXMediaVideoDescription ),
             *( iVideoPlaybackCtlr->iFileDetails->iDescription ) );
     }
-    
+
     //
     //  Location
     //
@@ -548,7 +544,7 @@
             TMPXAttribute( KMPXMediaVideoLocation ),
             *( iVideoPlaybackCtlr->iFileDetails->iLocation ) );
     }
-    
+
     //
     //  Copyright
     //
@@ -559,7 +555,7 @@
             TMPXAttribute( KMPXMediaVideoCopyright ),
             *( iVideoPlaybackCtlr->iFileDetails->iCopyright ) );
     }
- 
+
     //
     //  Language
     //
@@ -570,7 +566,7 @@
             TMPXAttribute( KMPXMediaVideoLanguage ),
             *( iVideoPlaybackCtlr->iFileDetails->iLanguage ) );
     }
-     
+
     //
     //  Keywords
     //
@@ -580,7 +576,7 @@
         aMedia->SetTextValueL(
             TMPXAttribute( KMPXMediaVideoKeywords ),
             *( iVideoPlaybackCtlr->iFileDetails->iKeywords ) );
-    }        
+    }
 }
 
 //  ------------------------------------------------------------------------------------------------
@@ -673,6 +669,13 @@
 {
     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::CommandHandleBackground()"));
 
+    //
+    //  Block playback in the following cases:
+    //  -  App is not in foreground
+    //  -  Alarm
+    //  -  Phone call
+    //  -  Video call
+    //
     if ( !iVideoPlaybackCtlr->iAppInForeground ||
          iVideoPlaybackCtlr->IsAlarm() ||
          iVideoPlaybackCtlr->IsPhoneCall() ||
@@ -689,7 +692,7 @@
 {
     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::CommandHandleForeground()"));
 
-    if ( !iVideoPlaybackCtlr->IsActivePhoneCall() )
+    if ( ! iVideoPlaybackCtlr->IsActivePhoneCall() )
     {
         iVideoPlaybackCtlr->iAllowAutoPlay = ETrue;
     }
@@ -979,20 +982,20 @@
     if ( aError == KErrNone )
     {
         iVideoPlaybackCtlr->iPlaybackMode->HandleOpenComplete();
-		
+
         //
-		//  call setposition with converted value saved in openfile
+        //  call setposition with converted value saved in openfile
         //
-		if ( iVideoPlaybackCtlr->iSavedPosition > 0 )
-        {    
+        if ( iVideoPlaybackCtlr->iSavedPosition > 0 )
+        {
             MPX_DEBUG(_L("CMPXInitialisingState::HandleOpenComplete()  iSavedPosition %d"), iVideoPlaybackCtlr->iSavedPosition );
-                
+
             TInt64 pos( iVideoPlaybackCtlr->iSavedPosition );
             pos *= KPbMilliMultiplier;
-            
+
             MPX_TRAPD( err, iVideoPlaybackCtlr->iPlayer->SetPositionL( pos ) );
         }
-               
+
         MPX_DEBUG(_L("CMPXInitialisingState::HandleOpenComplete()  Sending Prepare()"));
 
         iVideoPlaybackCtlr->iPlayer->Prepare();
@@ -1747,8 +1750,9 @@
         }
         else
         {
-            //  delayed pause :
-            //  background event was received while we were in buffering state
+            //
+            //  Delayed pause, background event was received while we were in buffering state
+            //
             iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
         }
     }
@@ -1775,14 +1779,11 @@
 }
 
 //  ------------------------------------------------------------------------------------------------
-//  CMPXBufferingState::HandleBackground()
+//    CMPXBufferingState::HandleBackground()
 //  ------------------------------------------------------------------------------------------------
 void CMPXBufferingState::HandleBackground()
 {
     MPX_DEBUG(_L("CMPXBufferingState::HandleBackground()"));
-
-    // we are in buffering state and received a background event
-    // we cannot pause now but need to pause when buffering is complete
     iVideoPlaybackCtlr->iPlaybackMode->HandleBackground();
 }
 
@@ -1793,8 +1794,10 @@
 {
     MPX_DEBUG(_L("CMPXBufferingState::HandleForeground()"));
 
-    // we are in buffering state and received a background event
-    // we cannot pause now but need to pause when buffering is complete
+    //
+    //  We are in buffering state and received a background and foreground event
+    //  playback will continue when buffering is complete
+    //
 }
 
 //  ------------------------------------------------------------------------------------------------
@@ -1888,7 +1891,8 @@
 //  ------------------------------------------------------------------------------------------------
 void CMPXSeekingState::HandleBackground()
 {
-    MPX_DEBUG(_L("CMPXSeekingState::HandleBackground()"));
+    MPX_ENTER_EXIT(_L("CMPXSeekingState::HandleBackground()"));
+
     MPX_TRAPD( err, HandleStopSeekL() );
     iVideoPlaybackCtlr->iPlaybackMode->HandleBackground();
 }
@@ -1898,7 +1902,8 @@
 //  ------------------------------------------------------------------------------------------------
 void CMPXSeekingState::HandlePause()
 {
-    MPX_DEBUG(_L("CMPXSeekingState::HandlePause()"));
+    MPX_ENTER_EXIT(_L("CMPXSeekingState::HandlePause()"));
+
     MPX_TRAPD( err, HandleStopSeekL() );
     iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
 }