videoplayback/videoplaybackviews/src/mpxvideobaseplaybackview.cpp
branchRCL_3
changeset 6 7d91903f795f
parent 2 dec420019252
child 10 ce5ada96ab30
equal deleted inserted replaced
2:dec420019252 6:7d91903f795f
    13 *
    13 *
    14 * Description:   Implementation of Video base playback view
    14 * Description:   Implementation of Video base playback view
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // Version : %version: e003sa33#58 %
    18 // Version : %version: 61 %
    19 
    19 
    20 
    20 
    21 //  Include Files
    21 //  Include Files
    22 
    22 
    23 #include <aknViewAppUi.h>
    23 #include <aknViewAppUi.h>
   131     {
   131     {
   132         delete iCloseAO;
   132         delete iCloseAO;
   133         iCloseAO = NULL;
   133         iCloseAO = NULL;
   134     }
   134     }
   135 
   135 
       
   136     if ( iFileDetails )
       
   137     {
       
   138         delete iFileDetails;
       
   139         iFileDetails = NULL;
       
   140     }
       
   141 
   136     if ( iDisplayHandler )
   142     if ( iDisplayHandler )
   137     {
   143     {
   138         delete iDisplayHandler;
   144         delete iDisplayHandler;
   139         iDisplayHandler = NULL;
   145         iDisplayHandler = NULL;
   140     }
       
   141 
       
   142     if ( iFileDetails )
       
   143     {
       
   144         delete iFileDetails;
       
   145         iFileDetails = NULL;
       
   146     }
   146     }
   147 
   147 
   148     if ( iPlaybackUtility )
   148     if ( iPlaybackUtility )
   149     {
   149     {
   150         TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
   150         TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
   221             break;
   221             break;
   222         }
   222         }
   223         case EMPXPbvCmdClose:
   223         case EMPXPbvCmdClose:
   224         {
   224         {
   225             MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdClose"));
   225             MPX_DEBUG(_L("CMPXVideoBasePlaybackView::HandleCommandL() EMPXPbvCmdClose"));
       
   226 
       
   227             //
       
   228             //  The display window must be removed before closing the playback plugin
       
   229             //
       
   230             if ( iDisplayHandler )
       
   231             {
       
   232                 //
       
   233                 //  Remove the display window so the surface can be released
       
   234                 //
       
   235                 iDisplayHandler->RemoveDisplayWindow();
       
   236             }
       
   237 
   226             CreateGeneralPlaybackCommandL( EPbCmdClose );
   238             CreateGeneralPlaybackCommandL( EPbCmdClose );
   227             break;
   239             break;
   228         }
   240         }
   229         case EMPXPbvCmdSeekForward:
   241         case EMPXPbvCmdSeekForward:
   230         {
   242         {
   349         case EMPXPbvLaunchDRMDetails:
   361         case EMPXPbvLaunchDRMDetails:
   350         {
   362         {
   351             LaunchDRMDetailsL();
   363             LaunchDRMDetailsL();
   352             break;
   364             break;
   353         }
   365         }
   354 
   366         case EAknSoftkeyClose:
       
   367         {
       
   368             //
       
   369             //  Close is in progress
       
   370             //  Remove the display window so the surface can be released
       
   371             //
       
   372             if ( iDisplayHandler )
       
   373             {
       
   374                 iDisplayHandler->RemoveDisplayWindow();
       
   375             }
       
   376 
       
   377             break;
       
   378         }
   355     }
   379     }
   356 }
   380 }
   357 
   381 
   358 // -------------------------------------------------------------------------------------------------
   382 // -------------------------------------------------------------------------------------------------
   359 //   CMPXVideoBasePlaybackView::ProcessCommandL()
   383 //   CMPXVideoBasePlaybackView::ProcessCommandL()
   400     //
   424     //
   401     //  Get the playback utility instance from playback utility
   425     //  Get the playback utility instance from playback utility
   402     //
   426     //
   403     iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault );
   427     iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault );
   404     iPlaybackUtility->AddObserverL( *this );
   428     iPlaybackUtility->AddObserverL( *this );
       
   429     iPlaybackUtility->SetPrimaryClientL();
   405 
   430 
   406     //
   431     //
   407     //  Initialize the playback state
   432     //  Initialize the playback state
   408     //
   433     //
   409     iPlaybackState = iPlaybackUtility->StateL();
   434     iPlaybackState = iPlaybackUtility->StateL();
   471     MPX_TRAPD( err, HandleCommandL( EMPXPbvCmdClose ) );
   496     MPX_TRAPD( err, HandleCommandL( EMPXPbvCmdClose ) );
   472 
   497 
   473     //
   498     //
   474     //  Delete the display handler when the view is deactivated
   499     //  Delete the display handler when the view is deactivated
   475     //
   500     //
   476     iDisplayHandler->RemoveDisplayWindow();
   501     if ( iDisplayHandler )
   477 
   502     {
   478     delete iDisplayHandler;
   503         delete iDisplayHandler;
   479     iDisplayHandler = NULL;
   504         iDisplayHandler = NULL;
       
   505     }
   480 
   506 
   481     if ( iPlaybackUtility )
   507     if ( iPlaybackUtility )
   482     {
   508     {
   483         TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
   509         TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
   484         iPlaybackUtility->Close();
   510         iPlaybackUtility->Close();
   735     }
   761     }
   736     else if ( KMPXMediaIdVideoPlayback == id )
   762     else if ( KMPXMediaIdVideoPlayback == id )
   737     {
   763     {
   738         HandleVideoPlaybackMessage( aMessage );
   764         HandleVideoPlaybackMessage( aMessage );
   739     }
   765     }
   740     else if ( KMPXMediaIdVideoDisplayMessage == id )
   766     else if ( KMPXMediaIdVideoDisplaySyncMessage == id )
   741     {
   767     {
   742         if ( iDisplayHandler )
   768         if ( iDisplayHandler )
   743         {
   769         {
   744             TMPXVideoDisplayCommand cmdId = iDisplayHandler->HandleVideoDisplayMessageL( aMessage );
   770             TMPXVideoDisplayCommand cmdId = iDisplayHandler->HandleVideoDisplayMessageL( aMessage );
   745 
   771 
   746             if ( cmdId == EPbMsgVideoSurfaceCreated )
   772             if ( cmdId == EPbMsgVideoSurfaceCreated )
   747 			{
   773             {
   748                 //
   774                 //
   749             	//  Notify container that surface has been created to make window transparent
   775                 //  Notify container that surface has been created to make window transparent
   750             	//
   776                 //
   751                 if ( iContainer )
   777                 if ( iContainer )
   752                 {
   778                 {
   753                     iContainer->HandleCommandL( EMPXPbvSurfaceCreated );
   779                     iContainer->HandleCommandL( EMPXPbvSurfaceCreated );
   754                 }
   780                 }
   755 			}
   781             }
   756         }
   782         }
       
   783 
       
   784         //
       
   785         //  Signal Sync Message handling is complete
       
   786         //
       
   787         iPlaybackUtility->CommandL( EPbCmdSyncMsgComplete );
   757     }
   788     }
   758 }
   789 }
   759 
   790 
   760 // -------------------------------------------------------------------------------------------------
   791 // -------------------------------------------------------------------------------------------------
   761 //   CMPXVideoBasePlaybackView::HandleGeneralPlaybackMessageL()
   792 //   CMPXVideoBasePlaybackView::HandleGeneralPlaybackMessageL()
   866 //   CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()
   897 //   CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()
   867 // -------------------------------------------------------------------------------------------------
   898 // -------------------------------------------------------------------------------------------------
   868 //
   899 //
   869 void CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()
   900 void CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()
   870 {
   901 {
   871     MPX_DEBUG(
   902     MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()"));
   872       _L("CMPXVideoBasePlaybackView::HandleClosePlaybackViewL()") );
       
   873 
   903 
   874     if ( IsMultiItemPlaylist() )
   904     if ( IsMultiItemPlaylist() )
   875     {
   905     {
       
   906         if ( iDisplayHandler )
       
   907         {
       
   908             //
       
   909             //  Remove the display window so the surface can be released
       
   910             //
       
   911             iDisplayHandler->RemoveDisplayWindow();
       
   912         }
       
   913 
   876         iPlaybackUtility->CommandL( EPbCmdNext );
   914         iPlaybackUtility->CommandL( EPbCmdNext );
   877     }
   915     }
   878     else
   916     else
   879     {
   917     {
   880         ClosePlaybackViewL();
   918         ClosePlaybackViewL();
  1539 // -------------------------------------------------------------------------------------------------
  1577 // -------------------------------------------------------------------------------------------------
  1540 //
  1578 //
  1541 void CMPXVideoBasePlaybackView::DoClosePlayerL()
  1579 void CMPXVideoBasePlaybackView::DoClosePlayerL()
  1542 {
  1580 {
  1543     MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DoClosePlayerL()"));
  1581     MPX_ENTER_EXIT(_L("CMPXVideoBasePlaybackView::DoClosePlayerL()"));
  1544 
       
  1545     AppUi()->HandleCommandL( EAknSoftkeyBack );
  1582     AppUi()->HandleCommandL( EAknSoftkeyBack );
  1546 }
  1583 }
  1547 
  1584 
  1548 // -------------------------------------------------------------------------------------------------
  1585 // -------------------------------------------------------------------------------------------------
  1549 //   CMPXVideoBasePlaybackView::IssuePlayCommandL
  1586 //   CMPXVideoBasePlaybackView::IssuePlayCommandL
  2016         CleanupStack::PushL( drmUiHandling );
  2053         CleanupStack::PushL( drmUiHandling );
  2017 
  2054 
  2018         if ( openError == KErrNone )
  2055         if ( openError == KErrNone )
  2019         {
  2056         {
  2020             MPX_TRAPD( err, drmUiHandling->ShowDetailsViewL( fileHandle ) );
  2057             MPX_TRAPD( err, drmUiHandling->ShowDetailsViewL( fileHandle ) );
       
  2058 
  2021             if ( KLeaveExit == err )
  2059             if ( KLeaveExit == err )
  2022             {
  2060             {
  2023                 User::Leave( err );
  2061                 User::Leave( err );
  2024             }
  2062             }
  2025         }
  2063         }
  2031             MPX_TRAPD( err, openError = OpenDrmFileHandle64L( fileHandle64 ) );
  2069             MPX_TRAPD( err, openError = OpenDrmFileHandle64L( fileHandle64 ) );
  2032 
  2070 
  2033             if ( err == KErrNone && openError == KErrNone )
  2071             if ( err == KErrNone && openError == KErrNone )
  2034             {
  2072             {
  2035                 MPX_TRAPD( err, drmUiHandling->ShowDetailsViewL( fileHandle64 ) );
  2073                 MPX_TRAPD( err, drmUiHandling->ShowDetailsViewL( fileHandle64 ) );
       
  2074 
  2036                 if ( KLeaveExit == err )
  2075                 if ( KLeaveExit == err )
  2037                 {
  2076                 {
  2038                     User::Leave( err );
  2077                     User::Leave( err );
  2039                 }
  2078                 }
  2040             }
  2079             }