videoplayback/videohelix/src/mpxvideoplaybackmode.cpp
branchRCL_3
changeset 15 8f0df5c82986
parent 14 55fa1ec415c6
child 16 67eb01668b0e
--- a/videoplayback/videohelix/src/mpxvideoplaybackmode.cpp	Tue May 11 16:15:40 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplaybackmode.cpp	Tue May 25 12:44:54 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 
-// Version : %version: 25 %
+// Version : %version: 29 %
 
 
 //
@@ -35,6 +35,7 @@
 #include "mpxvideofiledetails.h"
 #include <mpxvideoplaybackdefs.h>
 #include "mpxvideodrmhelper.h"
+#include "mpxvideoposterframesetter.h"
 
 // Constants
 const TUid KUidInterfaceMMFHelixController = {0x101F855D};
@@ -69,6 +70,12 @@
 CMPXVideoPlaybackMode::~CMPXVideoPlaybackMode()
 {
     MPX_DEBUG(_L("CMPXVideoPlaybackMode::~CMPXVideoPlaybackMode()"));
+    
+    if ( iPosterFrameSetter )
+    {
+        delete iPosterFrameSetter;
+        iPosterFrameSetter = NULL;
+    }
 }
 
 //  ----------------------------------------------------------------------------
@@ -177,31 +184,26 @@
 {
     MPX_DEBUG(_L("CMPXVideoPlaybackMode::HandleBackground()"));
 
-    //
-    //  Pause in all cases to remove the different behavior based on the decoder
-    //
-    iVideoPlaybackCtlr->iState->HandlePause();
-
     if ( iVideoPlaybackCtlr->iAppInForeground )
     {
         if ( iVideoPlaybackCtlr->IsAlarm() )
         {
-            iVideoPlaybackCtlr->iForegroundPause = ETrue;
+            iVideoPlaybackCtlr->iState->HandlePause();
         }
         else if ( iVideoPlaybackCtlr->IsKeyLocked() &&
                   iVideoPlaybackCtlr->iFileDetails->iVideoEnabled )
         {
-            iVideoPlaybackCtlr->iForegroundPause = ETrue;
-            iVideoPlaybackCtlr->SendHideControlsEventL();
+            iVideoPlaybackCtlr->iState->HandlePause();
+            TRAP_IGNORE( iVideoPlaybackCtlr->SendHideControlsEventL() );
         }
         else if ( iVideoPlaybackCtlr->IsPhoneCall() || iVideoPlaybackCtlr->IsVideoCall() )
         {
-            iVideoPlaybackCtlr->iForegroundPause = EFalse;
+            iVideoPlaybackCtlr->iState->HandlePause();
         }
     }
     else
     {
-        iVideoPlaybackCtlr->iForegroundPause = EFalse;
+         iVideoPlaybackCtlr->iState->HandlePause();
     }
 }
 
@@ -221,11 +223,6 @@
             MPX_TRAPD( err,
                 iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoCallOngoingError ) );
         }
-        else if ( iVideoPlaybackCtlr->IsKeyLocked() &&
-                  iVideoPlaybackCtlr->iFileDetails->iVideoEnabled )
-        {
-            iVideoPlaybackCtlr->iForegroundPause = ETrue;
-        }
         else
         {
             playAllowed = ETrue;
@@ -276,6 +273,22 @@
     return networkMode2g;
 }
 
+
+//  ------------------------------------------------------------------------------------------------
+//    CMPXVideoPlaybackMode::HandleSetPosterFrame()
+//  ------------------------------------------------------------------------------------------------
+void CMPXVideoPlaybackMode::HandleSetPosterFrame()
+{
+    MPX_DEBUG(_L("CMPXVideoPlaybackMode::HandleSetPosterFrame()"));
+}
+
+//  ------------------------------------------------------------------------------------------------
+//    CMPXVideoPlaybackMode::HandleSetPosterFrame()
+//  ------------------------------------------------------------------------------------------------
+void CMPXVideoPlaybackMode::HandleFrameReady(TInt /*aError*/)
+{
+    MPX_DEBUG(_L("CMPXLocalPlaybackMode::HandleFrameReady()"));        
+}
 //************************************************************************************************//
 //          CMPXLocalPlaybackMode
 //************************************************************************************************//
@@ -295,6 +308,30 @@
     MPX_DEBUG(_L("CMPXLocalPlaybackMode::~CMPXLocalPlaybackMode()"));
 }
 
+void CMPXLocalPlaybackMode::HandleSetPosterFrame()
+{
+    MPX_DEBUG(_L("CMPXLocalPlaybackMode::HandleSetPosterFrame()"));
+         
+    // create poster frame setter if it does not already exist
+    if ( ! iPosterFrameSetter )
+    {
+        TRAP_IGNORE(iPosterFrameSetter = CMPXVideoPosterFrameSetter::NewL( iVideoPlaybackCtlr ));
+    }
+
+    if ( iPosterFrameSetter )
+    {
+        iPosterFrameSetter->RequestPosterFrame();
+    }    
+}
+
+void CMPXLocalPlaybackMode::HandleFrameReady(TInt aError)
+{
+    MPX_DEBUG(_L("CMPXLocalPlaybackMode::HandleFrameReady()"));      
+    
+    iPosterFrameSetter->HandlePosterFrameReady(aError);
+}
+
+
 //************************************************************************************************//
 //          CMPXStreamingPlaybackMode
 //************************************************************************************************//
@@ -386,10 +423,6 @@
             MPX_TRAPD(err,
                       iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoCallOngoingError ));
         }
-        else if ( iVideoPlaybackCtlr->IsKeyLocked() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled )
-        {
-          //exit for live streaming
-        }
         else
         {
             MPX_TRAPD( err,
@@ -489,10 +522,20 @@
 {
     MPX_DEBUG(_L("CMPXLiveStreamingPlaybackMode::HandleBackground()"));
 
-    //
-    //  Pause in all cases to remove the different behavior based on the decoder
-    //
-    iVideoPlaybackCtlr->iState->HandlePause();
+    if ( iVideoPlaybackCtlr->iAppInForeground )
+    {
+        if ( iVideoPlaybackCtlr->IsPhoneCall() ||
+             iVideoPlaybackCtlr->IsVideoCall() ||
+             ( iVideoPlaybackCtlr->IsKeyLocked() &&
+               iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) )
+        {
+            iVideoPlaybackCtlr->iState->HandlePause();
+        }
+    }
+    else
+    {
+        iVideoPlaybackCtlr->iState->HandlePause();
+    }
 }
 
 //************************************************************************************************//