mpengine/src/mpmpxplaybackframeworkwrapper_p.cpp
changeset 32 c163ef0b758d
parent 29 8192e5b5c935
child 43 0f32e550d9d8
child 48 af3740e3753f
equal deleted inserted replaced
29:8192e5b5c935 32:c163ef0b758d
    62 MpMpxPlaybackFrameworkWrapperPrivate::~MpMpxPlaybackFrameworkWrapperPrivate()
    62 MpMpxPlaybackFrameworkWrapperPrivate::~MpMpxPlaybackFrameworkWrapperPrivate()
    63 {
    63 {
    64     TX_ENTRY
    64     TX_ENTRY
    65 
    65 
    66     if ( iPlaybackUtility ) {
    66     if ( iPlaybackUtility ) {
    67         ForceStopL();
    67         TRAP_IGNORE( ForceStopL() );
    68         iPlaybackUtility->RemoveObserverL(*this);
    68         TRAP_IGNORE( iPlaybackUtility->RemoveObserverL(*this) );
    69         iPlaybackUtility->Close();
    69         iPlaybackUtility->Close();
    70     }
    70     }
    71 
    71 
    72     delete iMedia;
    72     delete iMedia;
    73     delete iPlaybackData;
    73     delete iPlaybackData;
   377             QString::fromUtf16(
   377             QString::fromUtf16(
   378                 aProperties.ValueText( KMPXMediaMusicArtist ).Ptr(),
   378                 aProperties.ValueText( KMPXMediaMusicArtist ).Ptr(),
   379                 aProperties.ValueText( KMPXMediaMusicArtist ).Length() ) );
   379                 aProperties.ValueText( KMPXMediaMusicArtist ).Length() ) );
   380     }
   380     }
   381     else {
   381     else {
   382             changed |= iPlaybackData->setArtist(hbTrId("txt_mus_other_unknown3"));
   382             changed |= iPlaybackData->setArtist(QString());
   383     }
   383     }
   384     if ( aProperties.IsSupported( KMPXMediaMusicAlbum ) ) {
   384     if ( aProperties.IsSupported( KMPXMediaMusicAlbum ) ) {
   385         changed |= iPlaybackData->setAlbum(
   385         changed |= iPlaybackData->setAlbum(
   386             QString::fromUtf16(
   386             QString::fromUtf16(
   387                 aProperties.ValueText( KMPXMediaMusicAlbum ).Ptr(),
   387                 aProperties.ValueText( KMPXMediaMusicAlbum ).Ptr(),
   388                 aProperties.ValueText( KMPXMediaMusicAlbum ).Length() ) );
   388                 aProperties.ValueText( KMPXMediaMusicAlbum ).Length() ) );
   389     }
   389     }
   390     else {
   390     else {
   391             changed |= iPlaybackData->setAlbum(hbTrId("txt_mus_other_unknown4"));
   391             changed |= iPlaybackData->setAlbum(QString());
   392     }
   392     }
   393     if (aProperties.IsSupported(TMPXAttribute(KMPXMediaGeneralMimeType))) {
   393     if (aProperties.IsSupported(TMPXAttribute(KMPXMediaGeneralMimeType))) {
   394         
   394         
   395             const TDesC& mimeType = aProperties.ValueText ( KMPXMediaGeneralMimeType );
   395             const TDesC& mimeType = aProperties.ValueText ( KMPXMediaGeneralMimeType );
   396             
   396             
   478     RFile xqfile;
   478     RFile xqfile;
   479     bool ok = file.getHandle( xqfile );
   479     bool ok = file.getHandle( xqfile );
   480     if ( ok ) {
   480     if ( ok ) {
   481         iPlaybackUtility->InitL( xqfile );
   481         iPlaybackUtility->InitL( xqfile );
   482     }
   482     }
   483 	else {
   483     else {
   484 		TX_LOG_ARGS("Error: " << ok << "; should never get here.");
   484         TX_LOG_ARGS("Error: " << ok << "; should never get here.");
   485 	}
   485     }
   486     
   486     TX_EXIT
   487     
   487 }
   488     TX_EXIT
   488 
   489 }
       
   490 /*!
   489 /*!
   491  \internal
   490  \internal
   492  */
   491  */
   493 void MpMpxPlaybackFrameworkWrapperPrivate::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
   492 void MpMpxPlaybackFrameworkWrapperPrivate::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
   494 {
   493 {
   563         cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdStop );
   562         cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdStop );
   564         cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
   563         cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
   565         cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
   564         cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
   566         iPlaybackUtility->CommandL( *cmd );
   565         iPlaybackUtility->CommandL( *cmd );
   567         CleanupStack::PopAndDestroy( cmd );
   566         CleanupStack::PopAndDestroy( cmd );
   568 
       
   569        // iPlaybackUtility->RemoveObserverL(*this);
       
   570     }
   567     }
   571     TX_EXIT
   568     TX_EXIT
   572 }
   569 }
   573 
   570 
   574 /*!
   571 /*!
   577 void MpMpxPlaybackFrameworkWrapperPrivate::UpdateStateL()
   574 void MpMpxPlaybackFrameworkWrapperPrivate::UpdateStateL()
   578 {
   575 {
   579     TX_ENTRY
   576     TX_ENTRY
   580     if ( !iPlaybackUtility->Source() ) {
   577     if ( !iPlaybackUtility->Source() ) {
   581         TX_LOG_ARGS("There is no source")
   578         TX_LOG_ARGS("There is no source")
   582         iPlaybackData->setPlaybackState( MpPlaybackData::NotPlaying );
   579         //this to prevent mutiple calls to state change.
       
   580         if ( iPlaybackData->playbackState() != MpPlaybackData::NotPlaying ) {
       
   581             iPlaybackData->setPlaybackState( MpPlaybackData::NotPlaying );
       
   582             iPlaybackData->resetData();
       
   583         }
   583     }
   584     }
   584     else {
   585     else {
   585         switch ( iPlaybackUtility->StateL() ) {
   586         switch ( iPlaybackUtility->StateL() ) {
   586             case EPbStatePlaying:
   587             case EPbStatePlaying:
   587                 TX_LOG_ARGS("EPbStatePlaying")
   588                 TX_LOG_ARGS("EPbStatePlaying")