videoplayback/videohelix/src/mpxvideoplaybackcontroller.cpp
changeset 38 ff53afa8ad05
parent 37 4eb2df7f7cbe
child 50 21fe8338c6bf
--- a/videoplayback/videohelix/src/mpxvideoplaybackcontroller.cpp	Fri Apr 30 09:52:11 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplaybackcontroller.cpp	Fri May 14 15:14:51 2010 +0300
@@ -16,7 +16,7 @@
 */
 
 
-// Version : %version: 58 %
+// Version : %version: 62 %
 
 
 //
@@ -168,6 +168,7 @@
     iDrmHelper = CMpxVideoDrmHelper::NewL();
 
     iSavedPosition = 0;
+    iViewActivated  = EFalse;
 }
 
 //  ----------------------------------------------------------------------------
@@ -264,7 +265,6 @@
 //
 CMPXVideoPlaybackController::CMPXVideoPlaybackController()
     : iAppInForeground(ETrue)
-    , iForegroundPause(EFalse)
     , iAllowAutoPlay(ETrue)
     , iHelixLoadingStarted(EFalse)
     , iLightStatus(CHWRMLight::ELightStatusUnknown)
@@ -371,6 +371,7 @@
 
 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
 
+    iViewActivated  = EFalse;
 }
 
 //  ----------------------------------------------------------------------------
@@ -540,6 +541,11 @@
 
                 break;
             }
+            case EPbCmdSetPosterFrame:
+            {
+                iState->HandleSetPosterFrame();
+                break;    
+            }
         }
     }
 }
@@ -879,26 +885,19 @@
             volume = aVolume;
         }
 
+        //
+        // Volume needs to have n number of steps.
+        // For example, if we get 26, we need to save it as 25 in 20 volume steps
+        // For example, if we get 77, we need to save it as 70 in 10 volume steps
+        //
+        volume -= volume % iVolumeNormalizer;
+ 
         MPX_DEBUG(
             _L("CMPXVideoPlaybackController::SetVolumeCenRepL(): Setting volume = %d"), volume );
 
-        if ( volume > 0 )
-        {
-            //
-            // Media player's CenRep volume range : 0 - number of volume steps
-            // MPX framework volume range : 0-100
-            //
-            iVolumeWatcher->SetValueL( volume / iVolumeNormalizer );
-            SetMuteCenRepL( EFalse );
-        }
-        else
-        {
-            //
-            // save both mute and current volume values in CenRep
-            //
-            iVolumeWatcher->SetValueL( 0 );
-            SetMuteCenRepL( ETrue );
-        }
+        iVolumeWatcher->SetValueL( volume );
+
+        SetMuteCenRepL( volume > 0? EFalse: ETrue );
     }
     else
     {
@@ -939,7 +938,8 @@
     TInt volume = iVolumeWatcher->CurrentValueL();
     TBool mute = iMuteWatcher->CurrentValueL();
 
-    MPX_DEBUG(_L("CMPXVideoPlaybackController::SetVolumeMMFL() volume = %d, mute = %d")
+    MPX_DEBUG(
+            _L("CMPXVideoPlaybackController::SetVolumeMMFL() volume = %d, mute = %d")
             , volume, mute );
 
     TInt newVolume = 0;
@@ -947,15 +947,14 @@
     if ( ! mute )
     {
         //
-        // If it was muted and previous volume level was 0, set the volume to 1
+        // If it was muted and previous volume level was KPbPlaybackVolumeLevelMin, set the volume to next level
         //
-        if ( volume == 0 )
+        if ( volume == KPbPlaybackVolumeLevelMin )
         {
-            volume++;
+            volume = KPbPlaybackVolumeLevelMin + iVolumeNormalizer;
         }
 
-        newVolume =
-            volume  * iVolumeNormalizer * iFileDetails->iMaxVolume / KPbPlaybackVolumeLevelMax;
+        newVolume = volume * iFileDetails->iMaxVolume / KPbPlaybackVolumeLevelMax;
     }
 
     MPX_DEBUG(_L("CMPXVideoPlaybackController::SetVolumeMMFL() new volume = %d"), newVolume );
@@ -1101,7 +1100,7 @@
 
             if ( ! iMuteWatcher->CurrentValueL() )
             {
-                volume = iVolumeWatcher->CurrentValueL() * iVolumeNormalizer;
+                volume = iVolumeWatcher->CurrentValueL();
             }
 
             value = volume;
@@ -1154,6 +1153,10 @@
 
     TInt retError = KErrNone;
 
+    iViewActivated = ETrue;
+
+    iPlayer->SendSurfaceCreatedCommand();
+
     RArray<TInt> suppIds;
     CleanupClosePushL( suppIds );
 
@@ -2307,10 +2310,6 @@
 
     //
     // MPX framework volume range : 0-100
-    // Media player volume range : 0-10
-    // MPX video player volume range : 0 - volume steps (defined in PlaybackHelper)
-    // For IAD, need to manipulate volume to save in cenrep
-    // MPX Framework volume / iVolumeNormalizer => CenRep
     //
     CDevSoundIf* devSoundIf = CDevSoundIf::NewL();
     TInt volumeSteps =  devSoundIf->GetNumberOfVolumeSteps();
@@ -2401,6 +2400,8 @@
     iHelixLoadingStarted = EFalse;
 
     iSavedPosition = 0;
+
+    iViewActivated  = EFalse;
 }
 
 //  ------------------------------------------------------------------------------------------------
@@ -2412,31 +2413,20 @@
     MPX_ENTER_EXIT( _L("CMPXVideoPlaybackController::HandleVolumeL()"),
                     _L("aIncrease = %d"), aIncrease );
 
-    //
-    // Media player's CenRep volume range : 0 - number of volume steps
-    // MPX framework volume range : 0-100
-    //
     TInt volume = iVolumeWatcher->CurrentValueL();
+    TInt diff = iVolumeNormalizer;
 
-    if ( aIncrease )
+    if ( ! aIncrease )
     {
-        //
-        // increase the current volume
-        //
-        volume++;
+        diff *= -1;
     }
-    else if ( volume > 0 )
-    {
-        //
-        // decrease the current volume
-        //
-        volume--;
-    }
+
+    volume += diff;
 
     //
     // save the current volume level in CenRep
     //
-    SetVolumeCenRepL( volume * iVolumeNormalizer );
+    SetVolumeCenRepL( volume );
 }
 
 //  ------------------------------------------------------------------------------------------------
@@ -2532,4 +2522,24 @@
 
 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
 
+//  ------------------------------------------------------------------------------------------------ 
+//    CMPXVideoPlaybackController::IsViewActivated() 
+//  ------------------------------------------------------------------------------------------------ 
+// 
+TBool CMPXVideoPlaybackController::IsViewActivated() 
+{ 
+    MPX_DEBUG(_L("CMPXVideoPlaybackController::IsViewActivated")); 
+    return iViewActivated; 
+} 
+
+//  ------------------------------------------------------------------------------------------------
+//    CMPXVideoPlaybackController::HandleFrameReady()
+//  ------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::HandleFrameReady(TInt aError)
+{
+    MPX_DEBUG(_L("CMPXVideoPlaybackController::HandleFrameReady"));
+    
+    iPlaybackMode->HandleFrameReady(aError);
+}
 // End of file