videoplayback/videohelix/src/mpxvideoplayerutility.cpp
changeset 52 e3cecb93e76a
parent 24 7d93ee07fb27
equal deleted inserted replaced
47:45e72b57a2fd 52:e3cecb93e76a
    14 * Description:  This class is the interface between the playback plugin and RMMFController
    14 * Description:  This class is the interface between the playback plugin and RMMFController
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // Version : %version: 22 %
    19 // Version : %version: 23 %
    20 
    20 
    21 
    21 
    22 #include <AudioPreference.h>
    22 #include <AudioPreference.h>
    23 #include <mmf/server/mmffile.h>
    23 #include <mmf/server/mmffile.h>
    24 #include <caf/caftypes.h>
    24 #include <caf/caftypes.h>
    60 }
    60 }
    61 
    61 
    62 void CMpxVideoPlayerUtility::ConstructL()
    62 void CMpxVideoPlayerUtility::ConstructL()
    63 {
    63 {
    64     OpenControllerL();
    64     OpenControllerL();
    65         
    65 
    66     CActiveScheduler::Add( this );
    66     CActiveScheduler::Add( this );
    67 }
    67 }
    68 
    68 
    69 CMpxVideoPlayerUtility::~CMpxVideoPlayerUtility()
    69 CMpxVideoPlayerUtility::~CMpxVideoPlayerUtility()
    70 {
    70 {
    86 
    86 
    87     iSurfaceId = TSurfaceId::CreateNullId();
    87     iSurfaceId = TSurfaceId::CreateNullId();
    88 
    88 
    89     iController.Close();
    89     iController.Close();
    90     iDirectScreenAccessAbort = EFalse;
    90     iDirectScreenAccessAbort = EFalse;
    91     
    91 
    92     if ( IsActive() )
    92     if ( IsActive() )
    93     {
    93     {
    94         Cancel();
    94         Cancel();
    95         
    95 
    96         if ( iPosterFrameBitmap )
    96         if ( iPosterFrameBitmap )
    97         {
    97         {
    98             delete iPosterFrameBitmap;
    98             delete iPosterFrameBitmap;
    99             iPosterFrameBitmap = NULL;         
    99             iPosterFrameBitmap = NULL;
   100         }
   100         }
   101     }    
   101     }
   102 }
   102 }
   103 
   103 
   104 void CMpxVideoPlayerUtility::Reset()
   104 void CMpxVideoPlayerUtility::Reset()
   105 {
   105 {
   106     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::Reset()"));
   106     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::Reset()"));
   322 
   322 
   323     MPX_DEBUG(_L("CMpxVideoPlayerUtility::GetVideoLoadingProgressL(%d)"), aPercentageProgress );
   323     MPX_DEBUG(_L("CMpxVideoPlayerUtility::GetVideoLoadingProgressL(%d)"), aPercentageProgress );
   324 }
   324 }
   325 
   325 
   326 void CMpxVideoPlayerUtility::GetFrameL()
   326 void CMpxVideoPlayerUtility::GetFrameL()
   327 {    
   327 {
   328     MPX_DEBUG(_L("CMpxVideoPlayerUtility::GetFrameL"));
   328     MPX_DEBUG(_L("CMpxVideoPlayerUtility::GetFrameL"));
   329        
   329 
   330     // dont get another frame if a request is already pending
   330     // dont get another frame if a request is already pending
   331     //
   331     //
   332     if ( ! IsActive() )
   332     if ( ! IsActive() )
   333     {
   333     {
   334         iPosterFrameBitmap = new (ELeave) CFbsBitmap;
   334         iPosterFrameBitmap = new (ELeave) CFbsBitmap;
   335         User::LeaveIfError(iPosterFrameBitmap->Create(TSize(0,0), EColor16MU));  
   335         User::LeaveIfError(iPosterFrameBitmap->Create(TSize(0,0), EColor16MU));
   336                 
   336 
   337         iVideoPlayControllerCustomCommands.GetFrame( *iPosterFrameBitmap, iStatus );   
   337         iVideoPlayControllerCustomCommands.GetFrame( *iPosterFrameBitmap, iStatus );
   338         SetActive();    
   338         SetActive();
   339     }
   339     }
   340 
   340 
   341 }
   341 }
   342 
   342 
   343 void CMpxVideoPlayerUtility::RunL()
   343 void CMpxVideoPlayerUtility::RunL()
   344 {
   344 {
   345     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::RunL()"));
   345     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::RunL()"));
   346     
   346 
   347     if ( iStatus.Int() == KErrNone )
   347     if ( iStatus.Int() == KErrNone )
   348     {   
   348     {
   349         iVideoPlaybackController->HandleFrameReady( iStatus.Int() );        
   349         iVideoPlaybackController->HandleFrameReady( iStatus.Int() );
   350     }   
   350     }
   351     else
   351     else
   352     {
   352     {
   353         // Bitmap ownership will NOT be transferred to thumbnail manager so delete it    
   353         // Bitmap ownership will NOT be transferred to thumbnail manager so delete it
   354         delete iPosterFrameBitmap;
   354         delete iPosterFrameBitmap;
   355         iPosterFrameBitmap = NULL;        
   355         iPosterFrameBitmap = NULL;
   356     }        
   356     }
   357 }
   357 }
   358 
   358 
   359 void CMpxVideoPlayerUtility::DoCancel()
   359 void CMpxVideoPlayerUtility::DoCancel()
   360 {
   360 {
   361     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::DoCancel()"));
   361     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::DoCancel()"));
   362     
   362 
   363     // Bitmap ownership will NOT be transferred to thumbnail manager so delete it       
   363     // Bitmap ownership will NOT be transferred to thumbnail manager so delete it
   364     delete iPosterFrameBitmap;
   364     delete iPosterFrameBitmap;
   365     iPosterFrameBitmap = NULL;         
   365     iPosterFrameBitmap = NULL;
   366 }
   366 }
   367 
   367 
   368 CFbsBitmap& CMpxVideoPlayerUtility::GetBitmap()
   368 CFbsBitmap& CMpxVideoPlayerUtility::GetBitmap()
   369 {
   369 {
   370     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::GetBitmap()"));
   370     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::GetBitmap()"));
   371         
   371 
   372     return *iPosterFrameBitmap;
   372     return *iPosterFrameBitmap;
   373 }
   373 }
   374 
   374 
   375 void CMpxVideoPlayerUtility::PlayL()
   375 void CMpxVideoPlayerUtility::PlayL()
   376 {
   376 {
   626 
   626 
   627 // -------------------------------------------------------------------------------------------------
   627 // -------------------------------------------------------------------------------------------------
   628 //   CMpxVideoPlayerUtility::RemoveSurface()
   628 //   CMpxVideoPlayerUtility::RemoveSurface()
   629 // -------------------------------------------------------------------------------------------------
   629 // -------------------------------------------------------------------------------------------------
   630 //
   630 //
   631 TInt CMpxVideoPlayerUtility::RemoveSurface()
   631 void CMpxVideoPlayerUtility::RemoveSurface()
   632 {
   632 {
   633     TInt error = KErrNone;
   633     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::RemoveSurface()"));
   634 
   634 
   635     if ( !iSurfaceId.IsNull() )
   635     if ( ! iSurfaceId.IsNull() )
   636     {
   636     {
   637         //
   637         //
   638         //  Send command to view to remove the surface
   638         //  Send command to view to remove the surface
   639         //
   639         //
   640         MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceRemoved ) );
   640         MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceRemoved ) );
   641 
   641 
   642         error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( iSurfaceId );
       
   643 
       
   644         iSurfaceId = TSurfaceId::CreateNullId();
   642         iSurfaceId = TSurfaceId::CreateNullId();
   645     }
   643     }
       
   644 }
       
   645 
       
   646 // -------------------------------------------------------------------------------------------------
       
   647 //   CMpxVideoPlayerUtility::RemoveSurfaceFromHelix()
       
   648 // -------------------------------------------------------------------------------------------------
       
   649 //
       
   650 TInt CMpxVideoPlayerUtility::RemoveSurfaceFromHelix( TSurfaceId aSurfaceId )
       
   651 {
       
   652     MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::RemoveSurfaceFromHelix()"));
       
   653 
       
   654     TInt error = KErrNone;
       
   655 
       
   656     error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( aSurfaceId );
   646 
   657 
   647     return error;
   658     return error;
   648 }
   659 }
   649 
   660 
   650 // -------------------------------------------------------------------------------------------------
   661 // -------------------------------------------------------------------------------------------------