videoplayback/hbvideoplaybackview/viewsrc/mpxvideoviewwrapper.cpp
changeset 35 3738fe97f027
parent 30 4f111d64a341
child 36 8aed59de29f9
equal deleted inserted replaced
34:bbb98528c666 35:3738fe97f027
    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: da1mmcf#22 %
    18 // Version : %version: da1mmcf#24 %
    19 
    19 
    20 
    20 
    21 
    21 
    22 //  Include Files
    22 //  Include Files
    23 
    23 
    58 // -------------------------------------------------------------------------------------------------
    58 // -------------------------------------------------------------------------------------------------
    59 //
    59 //
    60 CMPXVideoViewWrapper::CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView )
    60 CMPXVideoViewWrapper::CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView )
    61     : iView( aView )
    61     : iView( aView )
    62     , iControlsController( NULL )
    62     , iControlsController( NULL )
       
    63     , iMediaRequested( false )
       
    64     , iPlaylistView( false )
    63 {
    65 {
    64 }
    66 }
    65 
    67 
    66 // -------------------------------------------------------------------------------------------------
    68 // -------------------------------------------------------------------------------------------------
    67 // CMPXVideoViewWrapper::NewL()
    69 // CMPXVideoViewWrapper::NewL()
    95 
    97 
    96     //
    98     //
    97     //  Create Active Object for closing player
    99     //  Create Active Object for closing player
    98     //
   100     //
    99     iCloseAO = CIdle::NewL( CActive::EPriorityStandard );   
   101     iCloseAO = CIdle::NewL( CActive::EPriorityStandard );   
   100         
   102                 
   101     iPlaylistView = EFalse;
       
   102     
       
   103     // Get playlist information
       
   104     MMPXSource* s = iPlaybackUtility->Source();
       
   105 
       
   106     if ( s )
       
   107     {
       
   108         CMPXCollectionPlaylist* playlist = s->PlaylistL();
       
   109         iPlaylistView = (playlist) ? ETrue : EFalse;
       
   110         delete playlist;
       
   111     }
       
   112 
       
   113     //
   103     //
   114     //  Create Video Playback Display Handler
   104     //  Create Video Playback Display Handler
   115     //
   105     //
   116     iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, this );
   106     iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, this );
   117 
   107 
   349             iView->retrievePdlInformation();
   339             iView->retrievePdlInformation();
   350             break;
   340             break;
   351         }
   341         }
   352         case EMPXPbvCmdNextListItem:
   342         case EMPXPbvCmdNextListItem:
   353         {
   343         {
   354             if ( iPlaylistView && IsMultiItemPlaylist() )
   344             if ( iPlaylistView && iFileDetails->mMultiItemPlaylist )
   355             {
   345             {
   356                 iPlaybackUtility->CommandL( EPbCmdNext );
   346                 iPlaybackUtility->CommandL( EPbCmdNext );
   357             }
   347             }
   358             break;
   348             break;
   359         }
   349         }
   360         case EMPXPbvCmdPreviousListItem:  
   350         case EMPXPbvCmdPreviousListItem:  
   361         {
   351         {
   362             if ( iPlaylistView && IsMultiItemPlaylist() )
   352             if ( iPlaylistView && iFileDetails->mMultiItemPlaylist )
   363             {
   353             {
   364 			    //
   354 			    //
   365 			    // the command is being sent twice on purpose
   355 			    // the command is being sent twice on purpose
   366                 // one EMPXPbvCmdPreviousListItem command only sets the position to 0  
   356                 // one EMPXPbvCmdPreviousListItem command only sets the position to 0  
   367                 // the second cmd actually goes to the previous item in the list
   357                 // the second cmd actually goes to the previous item in the list
  1381 
  1371 
  1382     TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) );    
  1372     TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) );    
  1383     const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() );
  1373     const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() );
  1384     iFileDetails->mMimeType = qMimeType;
  1374     iFileDetails->mMimeType = qMimeType;
  1385 
  1375 
  1386     iFileDetails->mMultiItemPlaylist = IsMultiItemPlaylist();
  1376     //
  1387 
  1377     // get playlist information and set mMultiItemPlaylist flag
       
  1378     //
       
  1379     TInt numItems = 1;    
       
  1380     MMPXSource* s = iPlaybackUtility->Source();
       
  1381 
       
  1382     if ( s )
       
  1383     {
       
  1384         CMPXCollectionPlaylist* playlist = NULL;
       
  1385 
       
  1386         MPX_TRAPD( err, playlist = s->PlaylistL() );
       
  1387         
       
  1388         if ( err == KErrNone && playlist )
       
  1389         {
       
  1390             iPlaylistView = ETrue;
       
  1391             numItems = playlist->Count();
       
  1392             delete playlist;
       
  1393         }
       
  1394     }
       
  1395 
       
  1396     iFileDetails->mMultiItemPlaylist = ( numItems > 1 );
       
  1397     
  1388     CleanupStack::PopAndDestroy( cmd );
  1398     CleanupStack::PopAndDestroy( cmd );
  1389 
  1399 
  1390     if ( iControlsController )
  1400     if ( iControlsController )
  1391     {
  1401     {
  1392         delete iControlsController;
  1402         delete iControlsController;
  1400 //   CMPXVideoViewWrapper::IsMultiItemPlaylist()
  1410 //   CMPXVideoViewWrapper::IsMultiItemPlaylist()
  1401 // -------------------------------------------------------------------------------------------------
  1411 // -------------------------------------------------------------------------------------------------
  1402 //
  1412 //
  1403 TBool CMPXVideoViewWrapper::IsMultiItemPlaylist()
  1413 TBool CMPXVideoViewWrapper::IsMultiItemPlaylist()
  1404 {
  1414 {
  1405     TInt numItems = 1;
  1415     
  1406     MMPXSource* s = iPlaybackUtility->Source();
  1416     bool multiLinks( false );
  1407 
  1417     
  1408     if ( s )
  1418     if ( iFileDetails )
  1409     {
  1419     {
  1410         CMPXCollectionPlaylist* playlist = NULL;
  1420         MPX_DEBUG(_L("CMPXVideoViewWrapper::IsMultiItemPlaylist(%d)"), 
  1411 
  1421             iFileDetails->mMultiItemPlaylist );
  1412         MPX_TRAPD( err, playlist = s->PlaylistL() );
  1422         multiLinks = iFileDetails->mMultiItemPlaylist;
  1413 
  1423     }
  1414         if ( err == KErrNone && playlist )
  1424     
  1415         {
  1425     return multiLinks;
  1416             numItems = playlist->Count();
       
  1417             delete playlist;
       
  1418         }
       
  1419     }
       
  1420 
       
  1421     TBool retVal = ( numItems > 1 );
       
  1422 
       
  1423     MPX_DEBUG(_L("CMPXVideoViewWrapper::IsMultiItemPlaylist(%d)"), retVal);
       
  1424 
       
  1425     return retVal;
       
  1426 }
  1426 }
  1427 
  1427 
  1428 // -------------------------------------------------------------------------------------------------
  1428 // -------------------------------------------------------------------------------------------------
  1429 //   CMPXVideoViewWrapper::UpdateVideoRect()
  1429 //   CMPXVideoViewWrapper::UpdateVideoRect()
  1430 // -------------------------------------------------------------------------------------------------
  1430 // -------------------------------------------------------------------------------------------------