mpx/playbackframework/playbackengine/src/mpxplaybackinitializer.cpp
branchRCL_3
changeset 10 d240f0a77280
parent 0 a2952bb97e68
equal deleted inserted replaced
9:05b0d2323768 10:d240f0a77280
   422         }
   422         }
   423     else
   423     else
   424         {
   424         {
   425         if ( iMedia )
   425         if ( iMedia )
   426             {
   426             {
   427             iEngine.RestorePlaybackPositionAndStateL( *iMedia );
   427             iEngine.RestorePlaybackPositionL( *iMedia );
       
   428             iEngine.RestorePlaybackStateL(); 
   428             }
   429             }
   429         //
   430         //
   430         // Set plug-in handler
   431         // Set plug-in handler
   431         //
   432         //
   432         if ( iHandler )
   433         if ( iHandler )
   618                     }
   619                     }
   619                 else
   620                 else
   620                     {
   621                     {
   621                     iHandler->SelectPlayersL(t);
   622                     iHandler->SelectPlayersL(t);
   622                     }
   623                     }
   623                 }
   624                 }           
   624             TInt accessPoint = 0;
   625             
   625             if ( aMedia.IsSupported(KMPXMediaGeneralExtAccessPoint) )
       
   626                 {
       
   627                 accessPoint = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralExtAccessPoint );
       
   628                 MPX_DEBUG2("CMPXPlaybackInitializer::InitL accessPoint %d", accessPoint );
       
   629                 }
       
   630             HBufC8* mimeType =
   626             HBufC8* mimeType =
   631                     MPXUser::Alloc8L(aMedia.ValueText(KMPXMediaGeneralMimeType));
   627                     MPXUser::Alloc8L(aMedia.ValueText(KMPXMediaGeneralMimeType));
   632             CleanupStack::PushL(mimeType);
   628             CleanupStack::PushL(mimeType);
   633             iHandler->SelectPlayerL(uri,*mimeType);
   629             iHandler->SelectPlayerL(uri,*mimeType);
   634             MPX_DEBUG2("CMPXPlaybackInitializer::InitL plugin=%08x",iHandler->Plugin());
   630             MPX_DEBUG2("CMPXPlaybackInitializer::InitL plugin=%08x",iHandler->Plugin());
   635             // Plugin handler guarantee to choose a plugin
   631             // Plugin handler guarantee to choose a plugin
   636             // In case there is file open in the audio controller
   632             // In case there is file open in the audio controller
   637             iHandler->Plugin()->CommandL(EPbCmdClose);
   633             iHandler->Plugin()->CommandL(EPbCmdClose);
   638             InitL(uri, *mimeType, accessPoint);
   634             InitL(uri, *mimeType); 
   639             CleanupStack::PopAndDestroy(mimeType);
   635             CleanupStack::PopAndDestroy(mimeType);
   640             }
   636             }
   641         else  // No URI
   637         else  // No URI
   642             {
   638             {
   643             iError=KErrNotFound;
   639             iError=KErrNotFound;
   838 // ----------------------------------------------------------------------------
   834 // ----------------------------------------------------------------------------
   839 // CMPXPlaybackInitializer::InitL
   835 // CMPXPlaybackInitializer::InitL
   840 // Initialize.
   836 // Initialize.
   841 // ----------------------------------------------------------------------------
   837 // ----------------------------------------------------------------------------
   842 //
   838 //
   843 void CMPXPlaybackInitializer::InitL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint)
   839 void CMPXPlaybackInitializer::InitL(const TDesC& aUri, const TDesC8& aType ) 
   844     {
   840     {
   845     MPX_FUNC("CMPXPlaybackInitializer::InitL");
   841     MPX_FUNC("CMPXPlaybackInitializer::InitL");
   846     CMPXPlaybackPlugin* p = iHandler->Plugin();
   842     CMPXPlaybackPlugin* p = iHandler->Plugin();
   847     if ( !p )
   843     if ( !p )
   848         {
   844         {
   866         CMPXPlaybackPluginVersion2* plugin = NULL;
   862         CMPXPlaybackPluginVersion2* plugin = NULL;
   867         plugin = static_cast<CMPXPlaybackPluginVersion2*>(p);
   863         plugin = static_cast<CMPXPlaybackPluginVersion2*>(p);
   868         
   864         
   869         // if cast was successful, then init streaming with access point
   865         // if cast was successful, then init streaming with access point
   870         if (plugin)
   866         if (plugin)
   871             {
   867             {            
   872             if ( aAccessPoint )
   868             TInt accessPoint = 0;
   873                 {
   869             if ( iMedia->IsSupported(KMPXMediaGeneralExtAccessPoint) ) 
   874                 plugin->InitStreamingL( aUri, aType, aAccessPoint );
   870                 {
       
   871                 accessPoint = iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralExtAccessPoint ); 
       
   872                 MPX_DEBUG2("CMPXPlaybackInitializer::InitL accessPoint %d", accessPoint );
       
   873                 }            
       
   874             
       
   875             TInt position = 0;            
       
   876             if (iMedia->IsSupported(KMPXMediaGeneralLastPlaybackPosition))
       
   877                 {
       
   878                 position = iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralLastPlaybackPosition );
       
   879                 MPX_DEBUG2("CMPXPlaybackInitializer::InitL position %d", position );
       
   880                 }
       
   881             
       
   882                         
       
   883             if ( accessPoint ) 
       
   884                 {
       
   885                 plugin->InitStreamingL( aUri, aType, accessPoint, position ); 
   875                 }
   886                 }
   876             else
   887             else
   877                 {
   888                 {
   878                 plugin->InitialiseL(aUri);
   889                 plugin->InitialiseWithPositionL(aUri, position); 
   879                 }
   890                 }
   880             }
   891             }
   881         else
   892         else
   882             {
   893             {
   883             MPX_DEBUG1("CMPXPlaybackInitializer::InitL(): *** Init failed -- failure to convert to expected interface");                
   894             MPX_DEBUG1("CMPXPlaybackInitializer::InitL(): *** Init failed -- failure to convert to expected interface");