videoplayback/videohelix/src/mpxvideoplaybackstate.cpp
changeset 62 0e1e938beb1a
parent 52 e3cecb93e76a
equal deleted inserted replaced
59:a76e86df7ccd 62:0e1e938beb1a
    14 * Description:  This class plays local video file
    14 * Description:  This class plays local video file
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // Version : %version: 48 %
    19 // Version : %version: 49 %
    20 
    20 
    21 
    21 
    22 //
    22 //
    23 //  INCLUDE FILES
    23 //  INCLUDE FILES
    24 //
    24 //
   790     {
   790     {
   791         iVideoPlaybackCtlr->iFileDetails->iSeekable &= iVideoPlaybackCtlr->iSeekable;
   791         iVideoPlaybackCtlr->iFileDetails->iSeekable &= iVideoPlaybackCtlr->iSeekable;
   792     }
   792     }
   793 }
   793 }
   794 
   794 
       
   795 //  ------------------------------------------------------------------------------------------------
       
   796 //    CMPXVideoPlaybackState::DoHandlePause()
       
   797 //  ------------------------------------------------------------------------------------------------
       
   798 void CMPXVideoPlaybackState::DoHandlePause()
       
   799 {
       
   800     MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::DoHandlePause()"));
       
   801 
       
   802     TInt err = iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
       
   803 
       
   804     if ( err != KErrNone )
       
   805     {
       
   806         MPX_TRAPD( err2, SendErrorToViewL( err ) );
       
   807     }
       
   808 }
       
   809 
   795 // *************************************************************************************************
   810 // *************************************************************************************************
   796 //
   811 //
   797 //                          STATE SUB-CLASSES
   812 //                          STATE SUB-CLASSES
   798 //
   813 //
   799 // *************************************************************************************************
   814 // *************************************************************************************************
   927 //  ------------------------------------------------------------------------------------------------
   942 //  ------------------------------------------------------------------------------------------------
   928 void CMPXNotInitialisedState::HandlePlay()
   943 void CMPXNotInitialisedState::HandlePlay()
   929 {
   944 {
   930     MPX_DEBUG(_L("CMPXNotInitialisedState::HandlePlay() Plugin error"));
   945     MPX_DEBUG(_L("CMPXNotInitialisedState::HandlePlay() Plugin error"));
   931 
   946 
   932      MPX_TRAPD( err, SendErrorToViewL( iVideoPlaybackCtlr->iPBPluginError ) );
   947     MPX_TRAPD( err, SendErrorToViewL( iVideoPlaybackCtlr->iPBPluginError ) );
   933 }
   948 }
   934 
   949 
   935 //  ------------------------------------------------------------------------------------------------
   950 //  ------------------------------------------------------------------------------------------------
   936 //    CMPXNotInitialisedState::UpdateSeekableL()
   951 //    CMPXNotInitialisedState::UpdateSeekableL()
   937 //  ------------------------------------------------------------------------------------------------
   952 //  ------------------------------------------------------------------------------------------------
  1205     {
  1220     {
  1206         IssuePlayCommand( EMPXVideoBuffering, MMPXPlaybackPluginObserver::EPBufferingStarted );
  1221         IssuePlayCommand( EMPXVideoBuffering, MMPXPlaybackPluginObserver::EPBufferingStarted );
  1207     }
  1222     }
  1208     else
  1223     else
  1209     {
  1224     {
  1210         iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
  1225         HandlePause();
  1211     }
  1226     }
  1212 
  1227 
  1213     iVideoPlaybackCtlr->iAllowAutoPlay = ETrue;
  1228     iVideoPlaybackCtlr->iAllowAutoPlay = ETrue;
  1214 }
  1229 }
  1215 
  1230 
  1280 //  ------------------------------------------------------------------------------------------------
  1295 //  ------------------------------------------------------------------------------------------------
  1281 void CMPXInitialisedState::HandlePause()
  1296 void CMPXInitialisedState::HandlePause()
  1282 {
  1297 {
  1283     MPX_ENTER_EXIT(_L("CMPXInitialisedState::HandlePause()"));
  1298     MPX_ENTER_EXIT(_L("CMPXInitialisedState::HandlePause()"));
  1284 
  1299 
  1285     iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
  1300     TInt err = iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
       
  1301 
       
  1302     if ( err != KErrNone )
       
  1303     {
       
  1304         MPX_DEBUG(_L("CMPXInitialisedState::HandlePause() err = %d"), err);
       
  1305 
       
  1306         //
       
  1307         //  For Initialized state, Helix will return an error of KErrNotReady since the DRM
       
  1308         //  rights consumption has not started.  Ignore the KErrNotReady error and transition
       
  1309         //  to the stopped state since no rights have been consumed.  This will free up
       
  1310         //  memory by closing the playback.
       
  1311         //
       
  1312         if ( err == KErrNotReady && iVideoPlaybackCtlr->iFileDetails->iDrmProtected )
       
  1313         {
       
  1314             HandleStop();
       
  1315         }
       
  1316         else
       
  1317         {
       
  1318             MPX_TRAPD( err2, SendErrorToViewL( err ) );
       
  1319         }
       
  1320     }
  1286 }
  1321 }
  1287 
  1322 
  1288 // *************************************************************************************************
  1323 // *************************************************************************************************
  1289 //
  1324 //
  1290 //                          CMPXPlayingState
  1325 //                          CMPXPlayingState
  1366 //  ------------------------------------------------------------------------------------------------
  1401 //  ------------------------------------------------------------------------------------------------
  1367 void CMPXPlayingState::HandlePause()
  1402 void CMPXPlayingState::HandlePause()
  1368 {
  1403 {
  1369     MPX_ENTER_EXIT(_L("CMPXPlayingState::HandlePause()"));
  1404     MPX_ENTER_EXIT(_L("CMPXPlayingState::HandlePause()"));
  1370 
  1405 
  1371     iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
  1406     DoHandlePause();
  1372 }
  1407 }
  1373 
  1408 
  1374 //  ------------------------------------------------------------------------------------------------
  1409 //  ------------------------------------------------------------------------------------------------
  1375 //    CMPXPlayingState::HandlePlayPause()
  1410 //    CMPXPlayingState::HandlePlayPause()
  1376 //
  1411 //
  1854         else
  1889         else
  1855         {
  1890         {
  1856             //
  1891             //
  1857             //  Delayed pause, background event was received while we were in buffering state
  1892             //  Delayed pause, background event was received while we were in buffering state
  1858             //
  1893             //
  1859             iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
  1894             HandlePause();
  1860         }
  1895         }
  1861     }
  1896     }
  1862     else
  1897     else
  1863     {
  1898     {
  1864         HandleClose();
  1899         HandleClose();
  1913     //
  1948     //
  1914     //  PDL must take action on the pause while buffering when the download is paused
  1949     //  PDL must take action on the pause while buffering when the download is paused
  1915     //
  1950     //
  1916     if ( iVideoPlaybackCtlr->iPlaybackMode->IsDownloadPaused() )
  1951     if ( iVideoPlaybackCtlr->iPlaybackMode->IsDownloadPaused() )
  1917     {
  1952     {
  1918         iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
  1953         DoHandlePause();
  1919     }
  1954     }
  1920 }
  1955 }
  1921 
  1956 
  1922 //  ------------------------------------------------------------------------------------------------
  1957 //  ------------------------------------------------------------------------------------------------
  1923 //  CMPXBufferingState::ResolveTimeoutError()
  1958 //  CMPXBufferingState::ResolveTimeoutError()
  1983     {
  2018     {
  1984         IssuePlayCommand( EMPXVideoPlaying, MMPXPlaybackPluginObserver::EPPlaying );
  2019         IssuePlayCommand( EMPXVideoPlaying, MMPXPlaybackPluginObserver::EPPlaying );
  1985     }
  2020     }
  1986     else
  2021     else
  1987     {
  2022     {
  1988         iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
  2023         HandlePause();
  1989     }
  2024     }
  1990 }
  2025 }
  1991 
  2026 
  1992 //  ------------------------------------------------------------------------------------------------
  2027 //  ------------------------------------------------------------------------------------------------
  1993 //    CMPXSeekingState::HandleBackground()
  2028 //    CMPXSeekingState::HandleBackground()
  2006 void CMPXSeekingState::HandlePause()
  2041 void CMPXSeekingState::HandlePause()
  2007 {
  2042 {
  2008     MPX_ENTER_EXIT(_L("CMPXSeekingState::HandlePause()"));
  2043     MPX_ENTER_EXIT(_L("CMPXSeekingState::HandlePause()"));
  2009 
  2044 
  2010     MPX_TRAPD( err, HandleStopSeekL() );
  2045     MPX_TRAPD( err, HandleStopSeekL() );
  2011     iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
  2046 
       
  2047     DoHandlePause();
  2012 }
  2048 }
  2013 
  2049 
  2014 //  ------------------------------------------------------------------------------------------------
  2050 //  ------------------------------------------------------------------------------------------------
  2015 //  CMPXSeekingState::HandleStopSeekL()
  2051 //  CMPXSeekingState::HandleStopSeekL()
  2016 //  ------------------------------------------------------------------------------------------------
  2052 //  ------------------------------------------------------------------------------------------------