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 |
626 { |
627 |
627 accessPoint = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralExtAccessPoint ); |
|
628 MPX_DEBUG2("CMPXPlaybackInitializer::InitL accessPoint %d", accessPoint ); |
|
629 } |
|
630 HBufC8* mimeType = |
628 HBufC8* mimeType = |
631 MPXUser::Alloc8L(aMedia.ValueText(KMPXMediaGeneralMimeType)); |
629 MPXUser::Alloc8L(aMedia.ValueText(KMPXMediaGeneralMimeType)); |
632 CleanupStack::PushL(mimeType); |
630 CleanupStack::PushL(mimeType); |
633 iHandler->SelectPlayerL(uri,*mimeType); |
631 iHandler->SelectPlayerL(uri,*mimeType); |
634 MPX_DEBUG2("CMPXPlaybackInitializer::InitL plugin=%08x",iHandler->Plugin()); |
632 MPX_DEBUG2("CMPXPlaybackInitializer::InitL plugin=%08x",iHandler->Plugin()); |
635 // Plugin handler guarantee to choose a plugin |
633 // Plugin handler guarantee to choose a plugin |
636 // In case there is file open in the audio controller |
634 // In case there is file open in the audio controller |
637 iHandler->Plugin()->CommandL(EPbCmdClose); |
635 iHandler->Plugin()->CommandL(EPbCmdClose); |
638 InitL(uri, *mimeType, accessPoint); |
636 InitL(uri, *mimeType); |
639 CleanupStack::PopAndDestroy(mimeType); |
637 CleanupStack::PopAndDestroy(mimeType); |
640 } |
638 } |
641 else // No URI |
639 else // No URI |
642 { |
640 { |
643 iError=KErrNotFound; |
641 iError=KErrNotFound; |
838 // ---------------------------------------------------------------------------- |
836 // ---------------------------------------------------------------------------- |
839 // CMPXPlaybackInitializer::InitL |
837 // CMPXPlaybackInitializer::InitL |
840 // Initialize. |
838 // Initialize. |
841 // ---------------------------------------------------------------------------- |
839 // ---------------------------------------------------------------------------- |
842 // |
840 // |
843 void CMPXPlaybackInitializer::InitL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint) |
841 void CMPXPlaybackInitializer::InitL(const TDesC& aUri, const TDesC8& aType ) |
844 { |
842 { |
845 MPX_FUNC("CMPXPlaybackInitializer::InitL"); |
843 MPX_FUNC("CMPXPlaybackInitializer::InitL"); |
846 CMPXPlaybackPlugin* p = iHandler->Plugin(); |
844 CMPXPlaybackPlugin* p = iHandler->Plugin(); |
847 if ( !p ) |
845 if ( !p ) |
848 { |
846 { |
867 plugin = static_cast<CMPXPlaybackPluginVersion2*>(p); |
865 plugin = static_cast<CMPXPlaybackPluginVersion2*>(p); |
868 |
866 |
869 // if cast was successful, then init streaming with access point |
867 // if cast was successful, then init streaming with access point |
870 if (plugin) |
868 if (plugin) |
871 { |
869 { |
872 if ( aAccessPoint ) |
870 |
873 { |
871 TInt accessPoint = 0; |
874 plugin->InitStreamingL( aUri, aType, aAccessPoint ); |
872 if ( iMedia->IsSupported(KMPXMediaGeneralExtAccessPoint) ) |
|
873 { |
|
874 accessPoint = iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralExtAccessPoint ); |
|
875 MPX_DEBUG2("CMPXPlaybackInitializer::InitL accessPoint %d", accessPoint ); |
|
876 } |
|
877 |
|
878 TInt position = 0; |
|
879 if (iMedia->IsSupported(KMPXMediaGeneralLastPlaybackPosition)) |
|
880 { |
|
881 position = iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralLastPlaybackPosition ); |
|
882 MPX_DEBUG2("CMPXPlaybackInitializer::InitL position %d", position ); |
|
883 } |
|
884 |
|
885 |
|
886 if ( accessPoint ) |
|
887 { |
|
888 plugin->InitStreamingL( aUri, aType, accessPoint, position ); |
875 } |
889 } |
876 else |
890 else |
877 { |
891 { |
878 plugin->InitialiseL(aUri); |
892 plugin->InitialiseWithPositionL(aUri, position); |
879 } |
893 } |
880 } |
894 } |
881 else |
895 else |
882 { |
896 { |
883 MPX_DEBUG1("CMPXPlaybackInitializer::InitL(): *** Init failed -- failure to convert to expected interface"); |
897 MPX_DEBUG1("CMPXPlaybackInitializer::InitL(): *** Init failed -- failure to convert to expected interface"); |