--- a/mmappcomponents/collectionhelper/inc/mpxcollectionuihelperimp.h Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappcomponents/collectionhelper/inc/mpxcollectionuihelperimp.h Mon Mar 15 12:42:31 2010 +0200
@@ -649,6 +649,16 @@
void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError);
/**
+ * From MMPXCollectionObserver
+ * Handles completion of a asynchronous command.
+ *
+ * @param aCommandResult result of the command, NULL if error
+ * @param aError error code
+ */
+ virtual void HandleCommandComplete(CMPXCommand* aCommandResult,
+ TInt aError);
+
+ /**
* From MMPXMoveItemObserver
* @param aErr, error for the operation
*/
--- a/mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappcomponents/collectionhelper/src/mpxcollectionuihelperimp.cpp Mon Mar 15 12:42:31 2010 +0200
@@ -1027,6 +1027,12 @@
// currently only used by incremental add
iTaskQueue->CancelRequests();
+ if( iTask == ETaskIncAddMedia || iTask == ETaskIncAppendMedia )
+ {
+ // complete task from scheduler
+ iTaskQueue->CompleteTask();
+ }
+
// clean up iInputMedia
if( iInputMedia )
{
@@ -1253,6 +1259,62 @@
ASSERT(0);
}
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionUiHelperImp::HandleCommandComplete(CMPXCommand* aCommandResult, TInt aError)
+ {
+ MPX_DEBUG3("CMPXCollectionUiHelperImp::HandleCommandComplete iTask=%d, aError=%d",
+ iTask, aError);
+
+ if( iTask == ETaskIncAddMedia && iInputMedia )
+ {
+ if ( iChunkNumber == 0 )
+ {
+ // save playlistId in input media & use it for subsequent appending operations
+ if( aCommandResult )
+ {
+ TMPXItemId playlistId =
+ aCommandResult->ValueTObjectL<TMPXItemId>(KMPXCommandColAddRtnId);
+
+ iInputMedia->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, playlistId);
+ }
+
+ iChunkNumber++; // move on to next chunk
+
+ CompleteTask(iTask, aError);
+ }
+ else if ( iChunkNumber == iTotalChunkNumber-1 ) // last chunk
+ {
+ CompleteTask(ETaskIncFinish, aError); // finish inc task
+ }
+ else // intermedia chunks
+ {
+ iChunkNumber++; // move on to next chunk
+
+ CompleteTask(iTask, aError);
+ }
+ }
+ else if( iTask == ETaskIncAppendMedia && iInputMedia )
+ {
+ // last chunk
+ // for the case that there is only one chunk (first & last chunk at the same
+ // time), Inc Add is not used
+ if( iChunkNumber == iTotalChunkNumber-1 )
+ {
+ // update input media as well
+ FillInPlaylistDetailsL(*iInputMedia);
+ CompleteTask(ETaskIncFinish, aError);
+ }
+ else // intermediate chunks, including first chunk
+ {
+ iChunkNumber++;
+ CompleteTask(iTask, aError);
+ }
+ }
+ }
+
// ----------------------------------------------------------------------------
// Handles completion of moving an object, just a proxy
// ----------------------------------------------------------------------------
@@ -1681,7 +1743,8 @@
void CMPXCollectionUiHelperImp::DoIncAddMediaL()
{
/***** include only aSize/iChunkSize number of songs *****/
-
+ MPX_DEBUG5("CMPXCollectionUiHelperImp::DoIncAddMediaL (%d, %d, %d, %d)",
+ iChunkNumber, iChunkSize, iTotalChunkNumber, iRemainder);
// copy media
CMPXMedia* media = CMPXMedia::CopyL(*iInputMedia);
CleanupStack::PushL(media);
@@ -1739,15 +1802,7 @@
CleanupStack::PopAndDestroy(playlistExtension);
- iMediator->AddItemL( media ); // this creates the new playlist
-
- // save playlistId in input media & use it for subsequent appending operations
- TMPXItemId playlistId = media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
- iInputMedia->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, playlistId);
-
- iChunkNumber++; // move on to next chunk
-
- CompleteTask(iTask, KErrNone);
+ iMediator->AddItemAsyncL( media ); // this creates the new playlist
}
else if ( iChunkNumber == iTotalChunkNumber-1 ) // last chunk
{
@@ -1759,9 +1814,7 @@
TMPXItemId playlistId = iInputMedia->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, playlistId);
- iMediator->AddItemL( media );
-
- CompleteTask(ETaskIncFinish, KErrNone); // finish inc task
+ iMediator->AddItemAsyncL( media );
}
else // intermedia chunks
{
@@ -1773,11 +1826,7 @@
TMPXItemId playlistId = iInputMedia->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, playlistId);
- iMediator->AddItemL( media );
-
- iChunkNumber++; // move on to next chunk
-
- CompleteTask(iTask, KErrNone);
+ iMediator->AddItemAsyncL( media );
}
CleanupStack::PopAndDestroy(cArray);
@@ -1830,23 +1879,8 @@
// update media then append to playlist
FillInPlaylistDetailsL(*media);
- iMediator->AddItemL( media );
+ iMediator->AddItemAsyncL( media );
- // last chunk
- // for the case that there is only one chunk (first & last chunk at the same
- // time), Inc Add is not used
- if( iChunkNumber == iTotalChunkNumber-1 )
- {
- // update input media as well
- FillInPlaylistDetailsL(*iInputMedia);
- CompleteTask(ETaskIncFinish, KErrNone);
- }
- else // intermediate chunks, including first chunk
- {
- iChunkNumber++;
- CompleteTask(iTask, KErrNone);
- }
-
CleanupStack::PopAndDestroy(cArray);
CleanupStack::PopAndDestroy(media);
}
--- a/mmappcomponents/harvester/collectionmediator/bwinscw/mpxcollectionmediatorU.DEF Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappcomponents/harvester/collectionmediator/bwinscw/mpxcollectionmediatorU.DEF Mon Mar 15 12:42:31 2010 +0200
@@ -15,4 +15,5 @@
?SetItemL@CMPXCollectionMediator@@QAEXAAPAVCMPXMedia@@@Z @ 14 NONAME ; void CMPXCollectionMediator::SetItemL(class CMPXMedia * &)
?SetItemL@CMPXCollectionMediator@@QAEXAAV?$TArray@PAVCMPXMedia@@@@AAVCMPXCollectionPath@@AAV?$RArray@H@@@Z @ 15 NONAME ; void CMPXCollectionMediator::SetItemL(class TArray<class CMPXMedia *> &, class CMPXCollectionPath &, class RArray<int> &)
?SetItemL@CMPXCollectionMediator@@QAEXAAVCMPXMediaArray@@@Z @ 16 NONAME ; void CMPXCollectionMediator::SetItemL(class CMPXMediaArray &)
+ ?AddItemAsyncL@CMPXCollectionMediator@@QAEXAAPAVCMPXMedia@@@Z @ 17 NONAME ; void CMPXCollectionMediator::AddItemAsyncL(class CMPXMedia * &)
--- a/mmappcomponents/harvester/collectionmediator/eabi/mpxcollectionmediatorU.DEF Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappcomponents/harvester/collectionmediator/eabi/mpxcollectionmediatorU.DEF Mon Mar 15 12:42:31 2010 +0200
@@ -19,4 +19,5 @@
_ZTI22CMPXCollectionMediator @ 18 NONAME ; #<TI>#
_ZTV18CMPXMoveItemHelper @ 19 NONAME ; #<VT>#
_ZTV22CMPXCollectionMediator @ 20 NONAME ; #<VT>#
+ _ZN22CMPXCollectionMediator13AddItemAsyncLERP9CMPXMedia @ 21 NONAME
--- a/mmappcomponents/harvester/collectionmediator/src/mpxcollectionmediator.cpp Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappcomponents/harvester/collectionmediator/src/mpxcollectionmediator.cpp Mon Mar 15 12:42:31 2010 +0200
@@ -226,6 +226,42 @@
}
// ---------------------------------------------------------------------------
+// CMPXCollectionMediator::AddItemAsyncL()
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCollectionMediator::AddItemAsyncL( CMPXMedia*& aMedia )
+ {
+ ASSERT( iColUtil );
+
+ // If this is a podcast, change the collection id
+ if( IsPodcastL( *aMedia ) )
+ {
+ UpdatePathToPodcastL( *aMedia );
+ }
+
+ // Add it to the collection
+ CMPXCommand* cmd = CMPXMedia::NewL();
+ CleanupStack::PushL( cmd );
+
+ cmd->SetTObjectValueL(KMPXCommandGeneralId, KMPXCommandIdCollectionAdd );
+ cmd->SetCObjectValueL(KMPXCommandColAddMedia, aMedia); // copied
+
+ if (aMedia->IsSupported(KMPXMediaGeneralCollectionId))
+ {
+ TUid collectionId = aMedia->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId);
+ cmd->SetTObjectValueL(KMPXCommandGeneralCollectionId, collectionId.iUid);
+ }
+ else
+ {
+ User::Leave( KErrArgument );
+ }
+
+ iColUtil->CommandL(*cmd);
+
+ CleanupStack::PopAndDestroy(cmd);
+ }
+
+// ---------------------------------------------------------------------------
// CMPXCollectionMediator::AddItemL()
// ---------------------------------------------------------------------------
//
Binary file mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpstub.pkg has changed
Binary file mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpupdate.pkg has changed
Binary file mmappcomponents/mmmtpdataprovider/install/rom/mmmtpdpupdatedebug.pkg has changed
--- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovider.cpp Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/abstractmediamtpdataprovider/src/cabstractmediamtpdataprovider.cpp Mon Mar 15 12:42:31 2010 +0200
@@ -238,12 +238,10 @@
iIsSessionOpen = EFalse;
TInt count = iActiveProcessors.Count();
PRINT1( _L( "MM MTP => CAbstractMediaMtpDataProvider::SessionClosedL, total processor count = %d" ), count );
- for ( TInt i = 0; i < count; i++ )
+ while ( count-- )
{
- MMmRequestProcessor* processor = iActiveProcessors[i];
+ MMmRequestProcessor* processor = iActiveProcessors[count];
- // replaced for the Request() is invalid sometimes
- // TUint32 sessionId( processor->Request().Uint32( TMTPTypeRequest::ERequestSessionID ) );
TUint32 sessionId = processor->SessionId();
if ( ( sessionId == aSession.iMTPId )
@@ -252,10 +250,11 @@
{
processor->UsbDisconnect(); // Rollback
- iActiveProcessors.Remove( i );
- if ( i == iActiveProcessor )
+ iActiveProcessors.Remove( count );
+ if ( count == iActiveProcessor )
{
iActiveProcessorRemoved = ETrue;
+ iActiveProcessor = -1; // update iActiveProcessor
}
else
{
--- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataproviderconst.h Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/inc/mediamtpdataproviderconst.h Mon Mar 15 12:42:31 2010 +0200
@@ -78,21 +78,21 @@
enum TMmMtpWidthRange
{
EMTPMinWidth = 0x000000b0, // 176 pixels
- EMTPMaxWidth = 0x00000140, // 320 pixels
+ EMTPMaxWidth = 0x00000500, // 1280 pixels
EMTPStepWidth = 0x00000001,
};
enum TMmMtpHeightRange
{
EMTPMinHeight = 0x00000090, // 144 pixels
- EMTPMaxHeight = 0x000000F0, // 240 pixels
+ EMTPMaxHeight = 0x000002D0, // 720 pixels
EMTPStepHeight = 0x00000001,
};
enum TMmMtpVideoBitRateRange
{
EMTPWMVMinBitrate = 0x00000000,
- EMTPWMVMaxBitrate = 0x0005dc00, // 384 kbps
+ EMTPWMVMaxBitrate = 0x01312D00, // 20 Mbps
EMTPVideoBitrateStep = 0x00000001
};
@@ -111,7 +111,7 @@
enum TMmMtpFramesPerThousandSecondsRange
{
EMTPMinFramesPerThousandSeconds = 0x00000000,
- EMTPMaxFramesPerThousandSeconds = 0x00003a98, // 15000 frame per ms
+ EMTPMaxFramesPerThousandSeconds = 0x00007530, // 30000 frame per thousand seconds (30 frame/s)
EMTPStepFramesPerThousandSeconds = 0x00000001
};
--- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovider.cpp Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataprovider.cpp Mon Mar 15 12:42:31 2010 +0200
@@ -241,9 +241,9 @@
iIsSessionOpen = EFalse;
TInt count = iActiveProcessors.Count();
PRINT1( _L( "MM MTP => CMediaMtpDataProvider::SessionClosedL, total processor count = %d" ), count );
- for( TInt i = 0; i < count; i++ )
+ while ( count-- )
{
- MMmRequestProcessor* processor = iActiveProcessors[i];
+ MMmRequestProcessor* processor = iActiveProcessors[count];
// replaced for the Request() is invalid sometimes
// TUint32 sessionId( processor->Request().Uint32( TMTPTypeRequest::ERequestSessionID ) );
@@ -255,10 +255,11 @@
{
processor->UsbDisconnect(); // Rollback
- iActiveProcessors.Remove( i );
- if ( i == iActiveProcessor )
+ iActiveProcessors.Remove( count );
+ if ( count == iActiveProcessor )
{
iActiveProcessorRemoved = ETrue;
+ iActiveProcessor = -1; // update iActiveProcessor
}
else
{
--- a/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderdescriptionutility.cpp Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappcomponents/mmmtpdataprovider/mmmtpdpplugins/mediamtpdataprovider/src/cmediamtpdataproviderdescriptionutility.cpp Mon Mar 15 12:42:31 2010 +0200
@@ -531,11 +531,16 @@
CMTPTypeObjectPropDescEnumerationForm* expectedForm =
CMTPTypeObjectPropDescEnumerationForm::NewLC( EMTPTypeString ); // + expectedForm
- CMTPTypeString* string = CMTPTypeString::NewLC( _L( "SP@LL" ) ); // + string
+ CMTPTypeString* string = CMTPTypeString::NewLC( _L("SP@LL") ); // + string
+ expectedForm->AppendSupportedValueL( *string );
+ string->SetL( _L("SP@ML") );
expectedForm->AppendSupportedValueL( *string );
- string->SetL( _L("SP@ML"));
+ string->SetL( _L("MP@LL") );
expectedForm->AppendSupportedValueL( *string );
- string->SetL( _L("MP@LL"));
+
+ string->SetL( _L("MP@ML") );
+ expectedForm->AppendSupportedValueL( *string );
+ string->SetL( _L("MP@HL") );
expectedForm->AppendSupportedValueL( *string );
CMTPTypeObjectPropDesc::TPropertyInfo propertyInfo;
--- a/mmappfw_plat/harvester_collection_mediator_api/inc/mpxcollectionmediator.h Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappfw_plat/harvester_collection_mediator_api/inc/mpxcollectionmediator.h Mon Mar 15 12:42:31 2010 +0200
@@ -89,6 +89,14 @@
IMPORT_C void AddItemL( CMPXMedia*& aMediaProp );
/**
+ * Add a media to the collection asynchronously.
+ *
+ * @param aMediaProp media item.
+ * @leave KErrArgument leave if not a supported media type
+ */
+ IMPORT_C void AddItemAsyncL( CMPXMedia*& aMediaProp );
+
+ /**
* Add a list of files to the collection db.
* @since S60 v3.2.3
* @param aArray list of media item.
--- a/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackpluginversion2.h Fri Mar 12 15:44:36 2010 +0200
+++ b/mmappfw_plat/mpx_playback_common_definition_api/inc/mpxplaybackpluginversion2.h Mon Mar 15 12:42:31 2010 +0200
@@ -39,8 +39,9 @@
* @param aUri URI of the item
* @param aType the mime type of the item
* @param aAccessPoint the access point
+ * @param aPosition the starting position
*/
- virtual void InitStreamingL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint) = 0;
+ virtual void InitStreamingL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint, TInt aPosition = 0) = 0;
/**
* Initializes a file handle for playback.
@@ -48,8 +49,9 @@
* @since S60 9.2
* @param aFile file handle of a file
* @param aAccessPoint the access point
+ * @param aPosition the starting position
*/
- virtual void InitStreamingL(RFile& aFile, TInt aAccessPoint) = 0;
+ virtual void InitStreamingL(RFile& aFile, TInt aAccessPoint, TInt aPosition = 0) = 0;
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
/**
@@ -58,17 +60,39 @@
* @since S60 9.2
* @param aFile 64 bit file handle of a file
* @param aAccessPoint the access point
+ * @param aPosition the starting position
*/
- virtual void InitStreaming64L(RFile64& aFile, TInt aAccessPoint) = 0;
+ virtual void InitStreaming64L(RFile64& aFile, TInt aAccessPoint, TInt aPosition = 0) = 0;
/**
* Initializes a song for playback.
*
* @since S60 9.2
* @param aFile 64 bit file handle of a song
+ * @param aPosition the starting position
*/
- virtual void Initialise64L(RFile64& aSong) = 0;
+ virtual void Initialise64L(RFile64& aSong, TInt aPosition = 0) = 0;
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+
+
+ /**
+ * Initializes a song for playback.
+ *
+ * @since S60 9.2
+ * @param aSong the song path
+ * @param aPosition the starting position
+ */
+ virtual void InitialiseWithPositionL(const TDesC& aSong, TInt aPosition = 0) = 0;
+
+ /**
+ * Initializes a song for playback.
+ *
+ * @since S60 9.2
+ * @param aFile file handle of a song
+ * @param aPosition the starting position
+ */
+ virtual void InitialiseWithPositionL(RFile& aSong, TInt aPosition = 0) = 0;
+
};
#endif // CMPXPLAYBACKPLUGINVERSION2_H
--- a/mpx/collectionframework/collectionengine/src/mpxcollectionclientcontext.cpp Fri Mar 12 15:44:36 2010 +0200
+++ b/mpx/collectionframework/collectionengine/src/mpxcollectionclientcontext.cpp Mon Mar 15 12:42:31 2010 +0200
@@ -2440,7 +2440,11 @@
// Check for open playlist only mode. If in that mode, do not return the media
// from the cache but call the plugin to open, as that will callback a
// different HandleOpenL() with the collection path instead.
- TMPXOpenMode mode( iBrowsePath->OpenNextMode() );
+ TMPXOpenMode mode = EMPXOpenDefault;
+ if(iBrowsePath)
+ {
+ mode = iBrowsePath->OpenNextMode();
+ }
CMPXCollectionPlugin* plugin = LoadedPlugin(EContextBrowse);
if ( !iFilter && mode != EMPXOpenPlaylistOnly )
{
--- a/mpx/commonframework/common/src/mpxclientlist.cpp Fri Mar 12 15:44:36 2010 +0200
+++ b/mpx/commonframework/common/src/mpxclientlist.cpp Mon Mar 15 12:42:31 2010 +0200
@@ -24,6 +24,41 @@
#include "mpxclientlist.h"
#include <mpxsubscription.h>
+// ============================ LOCAL FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Searches process id for target selector plugin.
+// When the player has been opened in a mode, which is bound to the same engine
+// than certain application's engine, then need to fetch its process id.
+// (As a reference for parameter aMode see MMPXPlaybackUtility modes.)
+// Otherwise target selector plugin is notified wrongly about registered client
+// and key events are not propagated to correct application.
+// ----------------------------------------------------------------------------
+//
+static void FindProcessIdForTsp( TInt aMode, TProcessId& aProcessId )
+ {
+ TBool processFound( EFalse );
+ TFindProcess processFinder;
+ TFullName processName;
+
+ while ( processFinder.Next( processName ) == KErrNone && !processFound )
+ {
+ RProcess process;
+ TInt err = process.Open( processFinder );
+ if( err == KErrNone )
+ {
+ if( process.SecureId().iId == aMode && process.ExitType() == EExitPending )
+ {
+ MPX_DEBUG4("FindProcessIdForTsp(): pid changed from %d to %d (mode 0x%x)",
+ TUint(aProcessId), TUint(process.Id()), aMode);
+ aProcessId = process.Id();
+ processFound = ETrue;
+ }
+ process.Close();
+ }
+ }
+ }
+
// ============================ MEMBER FUNCTIONS ==============================
// ----------------------------------------------------------------------------
@@ -109,6 +144,7 @@
iClientProcesses.AppendL(pid);
if (iObserver)
{
+ FindProcessIdForTsp(aMode, pid);
iObserver->HandleClientChange(pid, MMPXClientlistObserver::EAdd);
}
}
@@ -140,6 +176,7 @@
iClientProcesses.AppendL(pid);
if (iObserver)
{
+ FindProcessIdForTsp(aMode, pid);
iObserver->HandleClientChange(pid, MMPXClientlistObserver::EAdd);
}
}
@@ -176,7 +213,9 @@
{
if (iObserver)
{
- iObserver->HandleClientChange(id->iPid, MMPXClientlistObserver::ERemove);
+ TProcessId pid(id->iPid);
+ FindProcessIdForTsp(id->iMode, pid);
+ iObserver->HandleClientChange(pid, MMPXClientlistObserver::ERemove);
}
iClientProcesses.Remove(i);
}
@@ -493,8 +532,8 @@
: iTid(aTid),
iPid(aPid),
iMode(aMode),
- iMsgQueue(aMsgQueue),
- iCategory(aCategory)
+ iCategory(aCategory),
+ iMsgQueue(aMsgQueue)
{}
// -----------------------------------------------------------------------------
--- a/mpx/playbackframework/playbackengine/inc/mpxplaybackengine.h Fri Mar 12 15:44:36 2010 +0200
+++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackengine.h Mon Mar 15 12:42:31 2010 +0200
@@ -857,11 +857,16 @@
void SavePlaybackCompleteInfoL();
/**
- * Restore playback position and state if it was saved previously
+ * Restore playback position if it was saved previously
*/
- void RestorePlaybackPositionAndStateL( const CMPXMedia& aMedia );
+ void RestorePlaybackPositionL( const CMPXMedia& aMedia );
/**
+ * Restore playback state if it was saved previously
+ */
+ void RestorePlaybackStateL();
+
+ /**
* Sets the volume increment depending on accessory state
*/
void SetVolumeIncrement( TMPXPlaybackAccessoryMode aMode );
@@ -1031,6 +1036,9 @@
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
RFile64 iFile64;
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+
+ TInt iPositionFromMedia;
+
};
#include "mpxplaybackengine.inl"
--- a/mpx/playbackframework/playbackengine/inc/mpxplaybackinitializer.h Fri Mar 12 15:44:36 2010 +0200
+++ b/mpx/playbackframework/playbackengine/inc/mpxplaybackinitializer.h Mon Mar 15 12:42:31 2010 +0200
@@ -193,7 +193,7 @@
/**
* Initialize streaming
*/
- void InitL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint);
+ void InitL(const TDesC& aUri, const TDesC8& aType );
private:
/**
--- a/mpx/playbackframework/playbackengine/src/mpxplaybackengine.cpp Fri Mar 12 15:44:36 2010 +0200
+++ b/mpx/playbackframework/playbackengine/src/mpxplaybackengine.cpp Mon Mar 15 12:42:31 2010 +0200
@@ -109,6 +109,7 @@
iState(EPbStateNotInitialised),
iNextState(EPbStateNotInitialised),
iPluginState(EPbStateNotInitialised),
+ iCategory(EMPXCategoryUndefined),
iModeId(aModeId),
iObserver(aObserver),
iPreservedState( EPbStateNotInitialised ),
@@ -116,7 +117,8 @@
iSkipping(EFalse),
iPluginUid(KNullUid),
iLastActiveProcess(KNullProcessId),
- iLastInactiveProcess(KNullProcessId)
+ iLastInactiveProcess(KNullProcessId),
+ iPositionFromMedia( KErrNotFound )
{
iProperties[EPbPropertyVolumeRamp]=KPbFadeInDurationMicroSeconds;
}
@@ -140,6 +142,7 @@
iNextState(EPbStateNotInitialised),
iPluginState(EPbStateNotInitialised),
iModeId(aModeId),
+ iCategory(aCategory),
iObserver(aObserver),
iPreservedState( EPbStateNotInitialised ),
iPreservedPosition( KErrNotFound ),
@@ -147,7 +150,7 @@
iPluginUid(KNullUid),
iLastActiveProcess(KNullProcessId),
iLastInactiveProcess(KNullProcessId),
- iCategory(aCategory)
+ iPositionFromMedia( KErrNotFound )
{
iProperties[EPbPropertyVolumeRamp]=KPbFadeInDurationMicroSeconds;
}
@@ -180,16 +183,24 @@
iMediaHelper = CMPXPlaybackMediaHelper::NewL( *this );
iDummyMediaObserver = new(ELeave) CMPXPlaybackDummyMediaObserver();
- // Select local plugin by default if none selected
- iPluginHandler->SelectPlayersL( EPbLocal );
- iInitVolume = ETrue;
+ iInitVolume = EFalse;
+
+ if (iCategory != EMPXCategoryVideo)
+ {
+ // Select local plugin by default if none selected
+ iPluginHandler->SelectPlayersL( EPbLocal );
+ iInitVolume = ETrue;
+ iPluginHandler->Plugin()->PropertyL( EPbPropertyVolume );
+ }
+
#if defined(__HIGH_RESOLUTION_VOLUME)
iVolRoundedUp = EFalse;
#endif
- iPluginHandler->Plugin()->PropertyL( EPbPropertyVolume );
+
iSyncMsgTimer = CPeriodic::NewL( CActive::EPriorityIdle );
iSyncMsgWait = new (ELeave) CActiveSchedulerWait;
- }
+ iProperties[EPbPropertyPosition] = 0;
+ }
// ----------------------------------------------------------------------------
// Destructor
@@ -304,8 +315,11 @@
TMPXPlaybackMessage::EInitializeComplete,
0,
EFalse));
-
- iPluginUid = iPluginHandler->Plugin()->Uid();
+
+ if ( iPluginHandler->PlayerFound() )
+ {
+ iPluginUid = iPluginHandler->Plugin()->Uid();
+ }
RArray<TMPXAttribute> dummy;
CleanupClosePushL( dummy );
@@ -1464,10 +1478,6 @@
iProperties[EPbPropertyPosition] = 0;
}
- // Set position to restore saved position.
- TRAP_IGNORE( // uPnP leaves if set position in stop state
- PluginL()->SetL( EPbPropertyPosition, iProperties[EPbPropertyPosition] ));
-
iAutoResumeHandler->HandleOpenFileComplete();
// Check if playback should not be started automatically.
@@ -1995,6 +2005,18 @@
SetStateL( msg );
iProperties[EPbPropertyPosition]=0;
+ if ( KErrNotFound != iPreservedPosition )
+ {
+ iProperties[EPbPropertyPosition] = iPreservedPosition;
+ iPreservedPosition = KErrNotFound;
+ }
+ else if ( KErrNotFound != iPositionFromMedia )
+ {
+ iProperties[EPbPropertyPosition] = iPositionFromMedia;
+ iPositionFromMedia = KErrNotFound;
+ }
+ MPX_DEBUG2("CMPXPlaybackEngine::InitL iPropertyPosition %d", iProperties[EPbPropertyPosition] );
+
// make sure our interface is supported
CDesCArray* interfaces = iPluginHandler->SupportedInterfacesL( p->Uid() );
TBool version2InterfaceSupported = EFalse;
@@ -2018,22 +2040,22 @@
{
if (aSong && aType)
{
- plugin->InitStreamingL( *aSong, *aType, aAccessPoint );
+ plugin->InitStreamingL( *aSong, *aType, aAccessPoint, iProperties[EPbPropertyPosition] );
}
else if (aFile)
{
- plugin->InitStreamingL( *aFile, aAccessPoint );
+ plugin->InitStreamingL( *aFile, aAccessPoint, iProperties[EPbPropertyPosition] );
}
}
else
{
if (aSong && aType)
{
- plugin->InitialiseL( *aSong );
+ plugin->InitialiseWithPositionL( *aSong, iProperties[EPbPropertyPosition] );
}
else if (aFile)
{
- plugin->InitialiseL( *aFile );
+ plugin->InitialiseWithPositionL( *aFile, iProperties[EPbPropertyPosition] );
}
}
}
@@ -2256,6 +2278,7 @@
}
else
{
+ RestorePlaybackPositionL( aMedia );
TRAP( aError, InitL( iUri, mimeType, NULL, iAccessPoint) );
/*
// 20 steps fix
@@ -2284,7 +2307,7 @@
*/
if ( KErrNone == aError )
{
- RestorePlaybackPositionAndStateL( aMedia );
+ RestorePlaybackStateL();
}
else
{
@@ -3468,36 +3491,37 @@
// Restore playback position if it was saved previously
// ----------------------------------------------------------------------------
//
-void CMPXPlaybackEngine::RestorePlaybackPositionAndStateL(
+void CMPXPlaybackEngine::RestorePlaybackPositionL(
const CMPXMedia& aMedia )
{
- MPX_DEBUG1("CMPXPlaybackEngine::RestorePlaybackPositionAndStateL() entering");
+ MPX_FUNC("CMPXPlaybackEngine::RestorePlaybackPositionL() ");
// Restore Position
iProperties[EPbPropertyPosition] = 0;
- if ( KErrNotFound != iPreservedPosition )
- {
- iProperties[EPbPropertyPosition] = iPreservedPosition;
- iPreservedPosition = KErrNotFound;
- }
- else
- {
+
// Check media
if (aMedia.IsSupported(KMPXMediaGeneralLastPlaybackPosition))
{
- iProperties[EPbPropertyPosition] =
- aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralLastPlaybackPosition );
+ iPositionFromMedia =
+ aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralLastPlaybackPosition );
}
- }
+ MPX_DEBUG2("CMPXPlaybackEngine::RestorePlaybackPositionL iPositionFromMedia %d", iPositionFromMedia );
+ }
+
+// ----------------------------------------------------------------------------
+// Restore playback state if it was saved previously
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackEngine::RestorePlaybackStateL()
+ {
+ MPX_FUNC("CMPXPlaybackEngine::RestorePlaybackStateL() ");
// Restore State
if ( EPbStateNotInitialised != iPreservedState )
{
iNextState = iPreservedState;
iPreservedState = EPbStateNotInitialised;
- }
-
- MPX_DEBUG1("CMPXPlaybackEngine::RestorePlaybackPositionAndStateL() exiting");
+ }
}
// ----------------------------------------------------------------------------
@@ -3832,6 +3856,18 @@
SetStateL( msg );
iProperties[EPbPropertyPosition]=0;
+ if ( KErrNotFound != iPreservedPosition )
+ {
+ iProperties[EPbPropertyPosition] = iPreservedPosition;
+ iPreservedPosition = KErrNotFound;
+ }
+ else if ( KErrNotFound != iPositionFromMedia )
+ {
+ iProperties[EPbPropertyPosition] = iPositionFromMedia;
+ iPositionFromMedia = KErrNotFound;
+ }
+ MPX_DEBUG2("CMPXPlaybackEngine::InitL iPropertyPosition %d", iProperties[EPbPropertyPosition] );
+
// Check if version2 interface is supported.
CDesCArray* interfaces = iPluginHandler->SupportedInterfacesL( p->Uid() );
TBool version2InterfaceSupported = EFalse;
@@ -3853,11 +3889,11 @@
{
if ( iAccessPointSet )
{
- plugin->InitStreaming64L( *aFile, aAccessPoint );
+ plugin->InitStreaming64L( *aFile, aAccessPoint, iProperties[EPbPropertyPosition] );
}
else
{
- plugin->Initialise64L( *aFile );
+ plugin->Initialise64L( *aFile, iProperties[EPbPropertyPosition] );
}
}
else
--- a/mpx/playbackframework/playbackengine/src/mpxplaybackinitializer.cpp Fri Mar 12 15:44:36 2010 +0200
+++ b/mpx/playbackframework/playbackengine/src/mpxplaybackinitializer.cpp Mon Mar 15 12:42:31 2010 +0200
@@ -424,7 +424,8 @@
{
if ( iMedia )
{
- iEngine.RestorePlaybackPositionAndStateL( *iMedia );
+ iEngine.RestorePlaybackPositionL( *iMedia );
+ iEngine.RestorePlaybackStateL();
}
//
// Set plug-in handler
@@ -620,13 +621,8 @@
{
iHandler->SelectPlayersL(t);
}
- }
- TInt accessPoint = 0;
- if ( aMedia.IsSupported(KMPXMediaGeneralExtAccessPoint) )
- {
- accessPoint = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralExtAccessPoint );
- MPX_DEBUG2("CMPXPlaybackInitializer::InitL accessPoint %d", accessPoint );
- }
+ }
+
HBufC8* mimeType =
MPXUser::Alloc8L(aMedia.ValueText(KMPXMediaGeneralMimeType));
CleanupStack::PushL(mimeType);
@@ -635,7 +631,7 @@
// Plugin handler guarantee to choose a plugin
// In case there is file open in the audio controller
iHandler->Plugin()->CommandL(EPbCmdClose);
- InitL(uri, *mimeType, accessPoint);
+ InitL(uri, *mimeType);
CleanupStack::PopAndDestroy(mimeType);
}
else // No URI
@@ -840,7 +836,7 @@
// Initialize.
// ----------------------------------------------------------------------------
//
-void CMPXPlaybackInitializer::InitL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint)
+void CMPXPlaybackInitializer::InitL(const TDesC& aUri, const TDesC8& aType )
{
MPX_FUNC("CMPXPlaybackInitializer::InitL");
CMPXPlaybackPlugin* p = iHandler->Plugin();
@@ -868,14 +864,29 @@
// if cast was successful, then init streaming with access point
if (plugin)
- {
- if ( aAccessPoint )
+ {
+ TInt accessPoint = 0;
+ if ( iMedia->IsSupported(KMPXMediaGeneralExtAccessPoint) )
{
- plugin->InitStreamingL( aUri, aType, aAccessPoint );
+ accessPoint = iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralExtAccessPoint );
+ MPX_DEBUG2("CMPXPlaybackInitializer::InitL accessPoint %d", accessPoint );
+ }
+
+ TInt position = 0;
+ if (iMedia->IsSupported(KMPXMediaGeneralLastPlaybackPosition))
+ {
+ position = iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralLastPlaybackPosition );
+ MPX_DEBUG2("CMPXPlaybackInitializer::InitL position %d", position );
+ }
+
+
+ if ( accessPoint )
+ {
+ plugin->InitStreamingL( aUri, aType, accessPoint, position );
}
else
{
- plugin->InitialiseL(aUri);
+ plugin->InitialiseWithPositionL(aUri, position);
}
}
else
--- a/mpx/playbackframework/playbackserver/inc/mpxplaybackserver.h Fri Mar 12 15:44:36 2010 +0200
+++ b/mpx/playbackframework/playbackserver/inc/mpxplaybackserver.h Mon Mar 15 12:42:31 2010 +0200
@@ -151,6 +151,15 @@
*/
void ConstructL();
+ /**
+ * Process id finder.
+ *
+ * @param aEngine pointer to active engine
+ * @param aProcessId process id of owning process
+ */
+ void FindProcessIdForTsp(const CMPXPlaybackEngine* aEngine,
+ TProcessId& aProcessId );
+
private: // from base class
/**
* From MMPXPlaybackActiveEngineObserver
--- a/mpx/playbackframework/playbackserver/src/mpxplaybackserver.cpp Fri Mar 12 15:44:36 2010 +0200
+++ b/mpx/playbackframework/playbackserver/src/mpxplaybackserver.cpp Mon Mar 15 12:42:31 2010 +0200
@@ -129,6 +129,42 @@
}
// ----------------------------------------------------------------------------
+// Searches process id for target selector plugin.
+// When the player has been opened in a mode, which is bound to the same engine
+// than certain application's engine, then need to fetch its process id.
+// (As a reference for parameter aMode see MMPXPlaybackUtility modes.)
+// Otherwise target selector plugin is notified wrongly about client statuses
+// and key events are not propagated to correct application.
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackServer::FindProcessIdForTsp(
+ const CMPXPlaybackEngine* aEngine,
+ TProcessId& aProcessId )
+ {
+ TBool processFound( EFalse );
+ TFindProcess processFinder;
+ TFullName processName;
+
+ while ( processFinder.Next( processName ) == KErrNone && !processFound )
+ {
+ RProcess process;
+ TInt err = process.Open( processFinder );
+ if( err == KErrNone )
+ {
+ if( process.SecureId().iId == aEngine->ModeId().iUid &&
+ process.ExitType() == EExitPending )
+ {
+ MPX_DEBUG4("CMPXPlaybackServer::FindProcessIdForTsp(): pid changed from %d to %d (mode 0x%x)",
+ TUint(aProcessId), TUint(process.Id()), aEngine->ModeId().iUid);
+ aProcessId = process.Id();
+ processFound = ETrue;
+ }
+ process.Close();
+ }
+ }
+ }
+
+// ----------------------------------------------------------------------------
// Increments number of sessions this server holds
// ----------------------------------------------------------------------------
//
@@ -386,12 +422,13 @@
if (!aActive)
{
#ifdef RD_TSP_CLIENT_MAPPER
+ TProcessId lastPid( aEngine->LastActiveProcessId() );
+ FindProcessIdForTsp( aEngine, lastPid );
iClientMapper->SetTspTargetClientToOtherType(
CTspClientMapper::EStoppedClients,
- aEngine->LastActiveProcessId());
- MPX_DEBUG2("CMPXPlaybackServer::HandleActiveEngineL(): Adding to stopped client %d",
- TUint( aEngine->LastActiveProcessId()));
-
+ lastPid);
+ MPX_DEBUG2("CMPXPlaybackServer::HandleActiveEngineL(): Added as stopped client %d",
+ TUint( lastPid));
#endif
if (EPbStatePaused != aEngine->State())
{
@@ -406,11 +443,20 @@
else
{// else aEngine is active player
#ifdef RD_TSP_CLIENT_MAPPER
- iClientMapper->SetTspTargetClientToOtherType(
- CTspClientMapper::EPlayingClients,
- aEngine->LastActiveProcessId());
- MPX_DEBUG2("CMPXPlaybackServer::HandleActiveEngineL(): Adding to playing client %d",
- TUint( aEngine->LastActiveProcessId()));
+ TProcessId lastPid( aEngine->LastActiveProcessId() );
+ FindProcessIdForTsp( aEngine, lastPid );
+ TInt err = iClientMapper->SetTspTargetClientToOtherType(
+ CTspClientMapper::EPlayingClients, lastPid );
+ if ( err != KErrNone && (TUint)lastPid != KNullProcessId )
+ {
+ // Setting target type failed probably because client PID could not be found.
+ // As a fallback set client as new playing client.
+ MPX_DEBUG2("CMPXPlaybackServer::HandleActiveEngineL(): Adding to playing client %d",
+ (TUint)lastPid );
+ iClientMapper->SetTspTargetClient( CTspClientMapper::EPlayingClients, lastPid );
+ }
+ MPX_DEBUG2("CMPXPlaybackServer::HandleActiveEngineL(): Added as playing client %d",
+ (TUint)lastPid );
#endif
}
@@ -466,9 +512,9 @@
if (MMPXClientlistObserver::EAdd == aChangeType)
{
iClientMapper->SetTspTargetClient(
- CTspClientMapper::EPlayingClients,
+ CTspClientMapper::ERegisteredClients,
aPid);
- MPX_DEBUG2("CMPXPlaybackServer::HandleClientChange(): Adding to registered client %d",
+ MPX_DEBUG2("CMPXPlaybackServer::HandleClientChange(): Added as registered client %d",
TUint( aPid ));
}
else
@@ -476,7 +522,7 @@
iClientMapper->RemoveTspTargetClient(
CTspClientMapper::EPlayingClients,
aPid);
- MPX_DEBUG2("CMPXPlaybackServer::HandleClientChange(): Adding to EPlayingClients client %d",
+ MPX_DEBUG2("CMPXPlaybackServer::HandleClientChange(): Removed from EPlayingClients client %d",
TUint( aPid ));
}
#else