# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1284543922 -10800 # Node ID 91d5ad76f5c61d596faa1e8d3e2a0e8487a88cbe # Parent 666f9a5a90a92c8963ac9b82e566499792548d0f Revision: 201034 Kit: 201036 diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappcomponents/audiofetcher/inc/audiofetcher.h --- a/mmappcomponents/audiofetcher/inc/audiofetcher.h Tue Sep 14 22:17:30 2010 +0300 +++ b/mmappcomponents/audiofetcher/inc/audiofetcher.h Wed Sep 15 12:45:22 2010 +0300 @@ -182,6 +182,11 @@ * Verifier */ MMGFetchVerifier* iVerifier; + + /** + * Mime Type array + */ + const MDesCArray* iMimeTypeArray; }; #endif // AUDIOFETCHER_H diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappcomponents/audiofetcher/inc/audiofetcherdialog.h --- a/mmappcomponents/audiofetcher/inc/audiofetcherdialog.h Tue Sep 14 22:17:30 2010 +0300 +++ b/mmappcomponents/audiofetcher/inc/audiofetcherdialog.h Wed Sep 15 12:45:22 2010 +0300 @@ -59,7 +59,8 @@ MMGFetchVerifier* aVerifier, const TDesC& aTitle, TBool aMultiSelectionEnabled, - TMediaFileType aMediaType ); + TMediaFileType aMediaType, + const MDesCArray& aMimeTypeArray); /** * Destructor. @@ -78,7 +79,8 @@ */ CAudioFetcherDialog( CDesCArray& aSelectedFiles, MMGFetchVerifier* aVerifier, const TDesC& aTitle, - TBool aMultiSelectionEnabled, TMediaFileType aMediaType); + TBool aMultiSelectionEnabled, TMediaFileType aMediaType, + const MDesCArray& aMimeTypeArray); private: @@ -248,6 +250,9 @@ CAknInputBlock* iInputBlock; TMediaFileType iMediaType; + + // Mine Type array + const MDesCArray& iMimeTypeArray; }; #endif // AUDIOFETCHERDIALOG_H diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappcomponents/audiofetcher/inc/audiofetcherfilehandler.h --- a/mmappcomponents/audiofetcher/inc/audiofetcherfilehandler.h Tue Sep 14 22:17:30 2010 +0300 +++ b/mmappcomponents/audiofetcher/inc/audiofetcherfilehandler.h Wed Sep 15 12:45:22 2010 +0300 @@ -166,6 +166,7 @@ void SetObserver( MAudioFetcherFileHandlerObserver* aObserver ); void SetQueryId( TInt aId ); void EnableObserverCall( TBool aEnable ); + void SetMimeType( const MDesCArray& aMimeTypeArray ); public: TInt RomFileAttribute( TInt aIndex, TInt aAttr ); @@ -185,6 +186,7 @@ private: void ExcludeRomFilesL( CMdELogicCondition& aCondition ); + void MimeFilterL( CMdELogicCondition& aCondition ); private: void LeaveIfSessionClosedL(); @@ -227,6 +229,9 @@ // search result list - ui shows items from this list CSearchList* iSearchList; + + // Mime Type array + const MDesCArray* iMimeTypeArray; // metadata search text TBuf<128> iSearchText; diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappcomponents/audiofetcher/src/audiofetcher.cpp --- a/mmappcomponents/audiofetcher/src/audiofetcher.cpp Tue Sep 14 22:17:30 2010 +0300 +++ b/mmappcomponents/audiofetcher/src/audiofetcher.cpp Wed Sep 15 12:45:22 2010 +0300 @@ -101,10 +101,11 @@ // SetMimeTypesL // --------------------------------------------------------------------------- // -void CAudioFetcher::SetMimeTypesL( const MDesCArray& /*aMimeTypes*/ ) +void CAudioFetcher::SetMimeTypesL( const MDesCArray& aMimeTypes ) { - WLOG("CAudioFetcher::SetMimeTypesL (not supported)"); - // No implementation required (not supported) + WLOG("CAudioFetcher::SetMimeTypesL"); + + iMimeTypeArray = &aMimeTypes; } // --------------------------------------------------------------------------- @@ -197,7 +198,8 @@ // create the dialog first CAudioFetcherDialog* dialog = - CAudioFetcherDialog::NewL( aSelectedFiles, iVerifier, *iTitle, iIsMultiSelection, aMediaType ); + CAudioFetcherDialog::NewL( aSelectedFiles, iVerifier, *iTitle, + iIsMultiSelection, aMediaType, *iMimeTypeArray ); // Returns zero when Fetcher is cancelled by User. buttonId = dialog->ExecuteLD( R_MODAL_SINGLE_DIALOG ); diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappcomponents/audiofetcher/src/audiofetcherdialog.cpp --- a/mmappcomponents/audiofetcher/src/audiofetcherdialog.cpp Tue Sep 14 22:17:30 2010 +0300 +++ b/mmappcomponents/audiofetcher/src/audiofetcherdialog.cpp Wed Sep 15 12:45:22 2010 +0300 @@ -63,12 +63,14 @@ MMGFetchVerifier* aVerifier, const TDesC& aTitle, TBool aMultiSelectionEnabled, - TMediaFileType aMediaType) + TMediaFileType aMediaType, + const MDesCArray& aMimeTypeArray) : iSelectedFiles( aSelectedFiles ), iVerifier( aVerifier ), iTitle( aTitle ), iMultiSelectionEnabled(aMultiSelectionEnabled), - iMediaType(aMediaType) + iMediaType(aMediaType), + iMimeTypeArray( aMimeTypeArray ) { WLOG("CAudioFetcherDialog::CAudioFetcherDialog"); // No implementation required @@ -80,12 +82,12 @@ // CAudioFetcherDialog* CAudioFetcherDialog::NewL(CDesCArray& aSelectedFiles, MMGFetchVerifier* aVerifier, const TDesC& aTitle, TBool aMultiSelectionEnabled, - TMediaFileType aMediaType) + TMediaFileType aMediaType, const MDesCArray& aMimeTypeArray) { WLOG("CAudioFetcherDialog::NewL"); CAudioFetcherDialog* self= - new( ELeave ) CAudioFetcherDialog( - aSelectedFiles, aVerifier, aTitle, aMultiSelectionEnabled, aMediaType ); + new( ELeave ) CAudioFetcherDialog(aSelectedFiles, aVerifier, aTitle, + aMultiSelectionEnabled, aMediaType, aMimeTypeArray); CleanupStack::PushL( self ); self->ConstructL(); CleanupStack::Pop( self ); @@ -887,7 +889,7 @@ WLOG("CAudioFetcherDialog::QueryL: query in progress"); return; } - + iFileHandler->SetMimeType( iMimeTypeArray ); iFileHandler->EnableObserverCall( ETrue ); iFileHandler->SetQueryId( 0 ); iFileHandler->QueryAudioL(); diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappcomponents/audiofetcher/src/audiofetcherfilehandler.cpp --- a/mmappcomponents/audiofetcher/src/audiofetcherfilehandler.cpp Tue Sep 14 22:17:30 2010 +0300 +++ b/mmappcomponents/audiofetcher/src/audiofetcherfilehandler.cpp Wed Sep 15 12:45:22 2010 +0300 @@ -376,6 +376,7 @@ iQuery->AddPropertyFilterL( &fileTypePropertyDef ); CMdELogicCondition& conditions = iQuery->Conditions(); + MimeFilterL( conditions ); ExcludeRomFilesL( conditions ); iQuery->SetResultMode( EQueryResultModeItem ); @@ -414,6 +415,7 @@ iQuery->AddPropertyFilterL( &fileTypePropertyDef ); CMdELogicCondition& conditions = iQuery->Conditions(); + MimeFilterL( conditions ); ExcludeRomFilesL( conditions ); // define sort order @@ -455,6 +457,7 @@ iQuery->AddPropertyFilterL( &fileTypePropertyDef ); CMdELogicCondition& conditions = iQuery->Conditions(); + MimeFilterL( conditions ); ExcludeRomFilesL( conditions ); iQuery->SetResultMode( EQueryResultModeItem ); @@ -700,6 +703,45 @@ cond.SetNegate( ETrue ); } +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::MimeFilterL +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::MimeFilterL( CMdELogicCondition& aCondition ) + { + WLOG("CAudioFetcherFileHandler::MimeFilterL"); + + if( iMimeTypeArray ) + { + if ( iMimeTypeArray->MdcaCount() > 0 ) + { + CMdELogicCondition& cond = + aCondition.AddLogicConditionL( ELogicConditionOperatorOr ); + for ( TInt i = 0; i < iMimeTypeArray->MdcaCount(); i++ ) + { + TPtrC ptr = iMimeTypeArray->MdcaPoint(i); + + cond.AddPropertyConditionL( + iSession->GetDefaultNamespaceDefL().GetObjectDefL( + MdeConstants::Image::KImageObject ).GetPropertyDefL( + MdeConstants::Object::KItemTypeProperty ), + ETextPropertyConditionCompareEquals, ptr ); + } + } + } + } + +// ----------------------------------------------------------------------------- +// CAudioFetcherFileHandler::SetMimeType +// +// ----------------------------------------------------------------------------- +// +void CAudioFetcherFileHandler::SetMimeType( const MDesCArray& aMimeTypeArray ) + { + WLOG("CAudioFetcherFileHandler::SetMimeType"); + iMimeTypeArray = &aMimeTypeArray; + } // ------------------------------------------------------------------------------- // CAudioFetcherFileHandler::StrCopy diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatavideoaccess.cpp --- a/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatavideoaccess.cpp Tue Sep 14 22:17:30 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/src/cmmmtpdpmetadatavideoaccess.cpp Wed Sep 15 12:45:22 2010 +0300 @@ -40,7 +40,7 @@ #include "mmmtpvideodbdefs.h" #include "tobjectdescription.h" -const TInt KStorageRootMaxLength = 10; +_LIT( KMTPNoBackupFolder, "nobackup\\" ); #ifdef _DEBUG static const TInt KMtpMaxStringDescLength = KMtpMaxStringLength - 1; @@ -109,12 +109,17 @@ { PRINT( _L( "MM MTP => CMmMtpDpMetadataVideoAccess::OpenDatabase" ) ); - iRfs.CreatePrivatePath( iStoreNum ); - TInt err = iRfs.SetSessionToPrivate( iStoreNum ); + TFileName dbFileName; + TDriveUnit dbDrive( iStoreNum ); + iRfs.PrivatePath( dbFileName ); + dbFileName.Insert( 0, dbDrive.Name() ); + dbFileName.Append( KMTPNoBackupFolder ); + dbFileName.Append( KMtpVideoDb ); + TInt err = iRfs.MkDirAll( dbFileName ); - if ( err == KErrNone ) + if ( err == KErrNone || err == KErrAlreadyExists ) { - TRAP( err, iFileStore = CPermanentFileStore::OpenL( iRfs, KMtpVideoDb, EFileRead | EFileWrite ) ); + TRAP( err, iFileStore = CPermanentFileStore::OpenL( iRfs, dbFileName, EFileRead | EFileWrite ) ); if ( err == KErrNone ) TRAP( err, iFileStore->SetTypeL( iFileStore->Layout() ) ); @@ -127,8 +132,8 @@ if ( err != KErrNone ) { - iRfs.Delete( KMtpVideoDb ); // delete first before creating a new one - TRAP( err, iFileStore = CPermanentFileStore::CreateL( iRfs, KMtpVideoDb, EFileRead | EFileWrite ) ); + iRfs.Delete( dbFileName ); // delete first before creating a new one + TRAP( err, iFileStore = CPermanentFileStore::CreateL( iRfs, dbFileName, EFileRead | EFileWrite ) ); PRINT1( _L( "MM MTP <> OpenDatabase RDbNamedDatabase::CreateL, err = %d" ), err ); if ( err == KErrNone ) @@ -149,7 +154,7 @@ if ( KErrNone != err ) { iDatabase.Close(); - iRfs.Delete( KMtpVideoDb ); + iRfs.Delete( dbFileName ); } } } @@ -160,13 +165,7 @@ iDbOpened = ETrue; } - TBuf storeRoot; - if( PathInfo::GetRootPath( storeRoot, iStoreNum ) == KErrNone ) - { - iRfs.SetSessionPath( storeRoot ); - } - - PRINT( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::OpenDatabase" ) ); + PRINT1( _L( "MM MTP <= CMmMtpDpMetadataVideoAccess::OpenDatabase err = %d" ), err ); return err; } diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappfw_plat/mpx_playback_utility_api/tsrc/inc/testcollectionplugintype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/inc/testcollectionplugintype.h Wed Sep 15 12:45:22 2010 +0300 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: define collection collection plugin type enum +* +*/ + +#ifndef TESTCOLLECTIONPLUGINTYPE_H +#define TESTCOLLECTIONPLUGINTYPE_H + +#include "testcommonpluginuids.h" + +// Collection Plugin Test Types. +// +enum TCollectionTestPluginType + { + ECollectionTestPluginType = KCollectionTestPluginType, + ECollectionTestPluginType2 = KCollectionTestPluginType2, + ECollectionTestPluginType3 = KCollectionTestPluginType3 + }; + + +#endif // TESTCOLLECTIONPLUGINTYPE_H diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappfw_plat/mpx_playback_utility_api/tsrc/inc/testcommonpluginuids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/inc/testcommonpluginuids.h Wed Sep 15 12:45:22 2010 +0300 @@ -0,0 +1,75 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: define commonly used uids +* +*/ + +#ifndef TESTCOMMONPLUGINUIDS_H +#define TESTCOMMONPLUGINUIDS_H + +#define KCollectionTestPlugin 0xE0000101 // dll uid +#define KCollectionTestPluginImpId 0xE0000102 // implementation uid +#define KCollectionTestPluginType 0xE0000103 // refer TCollectionTestPluginType +#define KCollectionTestPlugin2 0xE0000111 // dll uid +#define KCollectionTestPluginImpId2 0xE0000112 // implementation uid +#define KCollectionTestPluginType2 0xE0000113 // refer TCollectionTestPluginType +#define KCollectionTestPlugin3 0xE0000121 // dll uid +#define KCollectionTestPluginImpId3 0xE0000122 // implementation uid +#define KCollectionTestPluginType3 0xE0000123 // refer TCollectionTestPluginType + +#define KPlaybackTestVideoPlugin 0xE0000201 // dll uid +#define KPlaybackTestVideoPluginImpId 0xE0000202 // implementation uid +#define KPlaybackTestPluginType 0xE0000203 // refer TPlaybackTestPluginType +#define KPlaybackTestPlugin2 0xE0000211 // dll uid +#define KPlaybackTestPluginImpId2 0xE0000212 // implementation uid +#define KPlaybackTestPluginType2 0xE0000213 // refer TPlaybackTestPluginType +#define KPlaybackTestPlugin3 0xE0000221 // dll uid +#define KPlaybackTestPluginImpId3 0xE0000222 // implementation uid +#define KPlaybackTestPluginType3 0xE0000223 // refer TPlaybackTestPluginType + +#define KViewTestPlugin 0xE0000301 // dll uid +#define KViewTestPluginImpId 0xE0000302 // implementation uid +#define KViewTestPluginType 0xE0000303 + +#define KViewTestPlugin2 0xE0000304 // dll uid +#define KViewTestPlugin2ImpId 0xE0000305 // implementation uid +#define KViewTestPluginType2 0xE0000306 + +#define KViewTestPlugin3 0xE0000307 // dll uid +#define KViewTestPlugin3ImpId 0xE0000308 // implementation uid +#define KViewTestPluginType3 0xE0000309 + +#define KViewTestPlugin4 0xE000030A // dll uid +#define KViewTestPlugin4ImpId 0xE000030B // implementation uid +#define KViewTestPluginType4 0xE000030C +#define KViewTestPlugin4BetterMatch 0xE000030D // dll uid +#define KViewTestPlugin4BetterMatchImpId 0xE000030E // implementation uid +#define KViewTestPlugin4BetterMatchCriteria 0xE000030F + +#define KViewTestPlugin5Low 0xE0000311 // dll uid +#define KViewTestPlugin5LowImpId 0xE0000312 // implementation uid +#define KViewTestPluginType5 0xE0000313 +#define KViewTestPlugin5High 0xE0000314 // dll uid +#define KViewTestPlugin5HighImpId 0xE0000315 // implementation uid + +#define KViewTestPlugin6 0xE0000317 // dll uid +#define KViewTestPlugin6ImpId 0xE0000318 // implementation uid +#define KViewTestPluginType6 0xE0000319 + + +#define KPlaylistTestPluginM3u 0xE000031A // dll uid +#define KPlaylistTestPluginM3uImpId 0xE000031B // implementation uid + +#endif // TESTCOMMONPLUGINUIDS_H + diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappfw_plat/mpx_playback_utility_api/tsrc/inc/testplaybackplugintype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/inc/testplaybackplugintype.h Wed Sep 15 12:45:22 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: define playback plugin type enum +* +*/ + +#ifndef TESTPLAYBACKPLUGINTYPE_H +#define TESTPLAYBACKPLUGINTYPE_H + +#include "testcommonpluginuids.h" + +// Collection Plugin Test Types. +// +enum TPlaybackTestPluginType + { + EPlaybackTestPluginType = KPlaybackTestPluginType, + EPlaybackTestPluginType2 = KPlaybackTestPluginType2, + EPlaybackTestPluginType3 = KPlaybackTestPluginType3 + }; + + +#endif // TESTPLAYBACKPLUGINTYPE_H + diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappfw_plat/mpx_playback_utility_api/tsrc/inc/testviewplugintype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/inc/testviewplugintype.h Wed Sep 15 12:45:22 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: define view plugin type enum +* +*/ + +#ifndef TESTVIEWPLUGINTYPE_H +#define TESTVIEWPLUGINTYPE_H + +#include "testcommonpluginuids.h" + +// View Plugin Test Types. +// +enum TViewTestPluginType + { + EViewPluginTypeTest = KViewPluginTypeTest, + EViewPluginTypeTest2 = KViewPluginTypeTest2, + EViewPluginTypeTest3 = KViewPluginTypeTest3, + EViewPluginTypeTest4 = KViewPluginTypeTest4, + EViewPluginTypeTest5 = KViewPluginTypeTest5, + EViewPluginTypeTest6 = KViewPluginTypeTest6 + }; + +enum TViewTestPluginMatchCriteria + { + EViewPluginMatchCriteria4 = KViewTestPlugin4BetterMatchCriteria + }; + +#endif // TESTVIEWPLUGINTYPE_H diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/data/e0000201.rss --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/data/e0000201.rss Wed Sep 15 12:45:22 2010 +0300 @@ -0,0 +1,74 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Resource file +* +*/ + +/* + * The opaque_data syntax is made up of three parts: + * a list of Uids for resolving the view plugin, feature flags, priority. + * + *

uid1;uid2;uid3

+ * uid*: Supported plugin types. + * E.g. if podcast plugin may support music plugin as well, + * KMPXColPluginMusic + * + * uid + * uid: plugin type uid. + * E.g. for music plugin will be: 0x101FFCDA + * + * flags [optional] + * flags: sum of the required feature flags, not used now + * + * priority [optional] + * priority: a value of type TMPXCollectionPluginPriorities. This value + * determines the returning order when several plugins can + * support the same set of Uids. + * Default value of this field is EMPXCollectionPluginPriorityNormal. + */ + +#include +#include +#include "testcommonpluginuids.h" +#include "testplaybackplugintype.h" + +RESOURCE REGISTRY_INFO theInfo +{ + dll_uid = KPlaybackTestVideoPlugin; + + interfaces = + { + INTERFACE_INFO + { + interface_uid = KMPXPlaybackPluginInterfaceUid; + implementations = + { + IMPLEMENTATION_INFO + { + implementation_uid = KPlaybackTestVideoPluginImpId; + version_no = 1; + display_name = "TestVideoPlaybackPlugin"; + default_data = ""; + opaque_data = + "" + ""EPbUnknown"" + ""EMPXPlaybackPluginPriorityHighest"" + ""MPXPlaybackPluginVersion2""; + } + }; + } + }; +} + + diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/group/bld.inf Wed Sep 15 12:45:22 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file for Playback test plugin +* +*/ + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +PRJ_TESTMMPFILES +testvideoplaybackplugin.mmp + +PRJ_MMPFILES + +// End of File + diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/group/testvideoplaybackplugin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/group/testvideoplaybackplugin.mmp Wed Sep 15 12:45:22 2010 +0300 @@ -0,0 +1,57 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Playback test plugin project specification +* +*/ + +#include +#include +#include + +#include "../../inc/testcommonpluginuids.h" + +TARGET testvideoplaybackplugin.dll +TARGETTYPE PLUGIN +UID 0x10009D8D KPlaybackTestVideoPlugin + +VENDORID VID_DEFAULT +CAPABILITY CAP_ECOM_PLUGIN + +SOURCEPATH ../src +SOURCE testvideoplaybackplugin.cpp + +SOURCEPATH ../data +START RESOURCE e0000201.RSS +TARGET testvideoplaybackplugin.rsc +END + +USERINCLUDE ../inc +USERINCLUDE ../../inc +USERINCLUDE ../../mpxplaybackutilitytest/inc + + +APP_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY ecom.lib +LIBRARY efsrv.lib +LIBRARY estor.lib +LIBRARY BAFL.lib +LIBRARY flogger.lib +LIBRARY mpxcommon.lib + +SOURCEPATH ../src +SOURCE testvideoplaybackpluginproxy.cpp + +//end of file \ No newline at end of file diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/inc/testvideoplaybackplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/inc/testvideoplaybackplugin.h Wed Sep 15 12:45:22 2010 +0300 @@ -0,0 +1,268 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of testvideoplaybackplugin interface +* +*/ + +#ifndef _CTESTVIDEOPLAYBACKPLUGIN_H_ +#define _CTESTVIDEOPLAYBACKPLUGIN_H_ + +// +// INCLUDES +// +#include + +#include +#include +#include +#include + +#include "mpxplaybackutilitytest.h" + + + + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include "mpxmediavideodefs.h" + +typedef struct +{ + TInt iEvent; + TInt iData; + TInt iError; +} TTestVideoPlaybackCallbackEvent; + +typedef CArrayPtrFlat CCallbackArray; + +// +// CLASS DECLARATION +// + +/* + * CTestVideoPlaybackPlugin class + * + */ + +NONSHARABLE_CLASS( CTestVideoPlaybackPlugin ) : public CMPXPlaybackPluginVersion2 + +{ + public: + // + // Constructors and destructor + // + + /* + * Two-phased constructor. + * @param aInitParams, initialization parameter + * @return a pointer to the created instance + */ + static CTestVideoPlaybackPlugin* NewL(TAny* aInitParams); + + /* + * Destructor + * Destroy the object and release all memory objects + */ + ~CTestVideoPlaybackPlugin(); + + /* + * Returns the current file handle iFile + */ + RFile GetFileHandle(); + + /** + * Initializes a file for playback. + * + * @since S60 9.2 + * @param aUri URI of the item + * @param aType the mime type of the item + * @param aAccessPoint the access point + */ + void InitStreamingL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint, TInt aPosition); + + /** + * Initializes a file handle for playback. + * + * @since S60 9.2 + * @param aFile file handle of a file + * @param aAccessPoint the access point + */ + void InitStreamingL(RFile& aFile, TInt aAccessPoint, TInt aPosition); + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + /** + * Initializes a file handle for playback. + * + * @since S60 9.2 + * @param aFile 64 bit file handle of a file + * @param aAccessPoint the access point + */ + void InitStreaming64L(RFile64& aFile, TInt aAccessPoint, TInt aPosition); + + /** + * Initializes a song for playback. + * + * @since S60 9.2 + * @param aFile 64 bit file handle of a song + */ + void Initialise64L(RFile64& aFile, TInt aPosition); +#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 ); + + /** + * 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); + + //runl for active object + void RunL(); + + void DoCancel(); + + private: + // + // CMPXPlaybackPlugin Implementation + // + + /* + * Set observer + * + * @param aObs observer + */ + void SetObserver( MMPXPlaybackPluginObserver& aObs ); + + /* + * Initializes a clip for playback + * @param aSong the song path + */ + void InitialiseL( const TDesC& aSong ); + + /* + * Initializes a song for playback + * @param aFile file handle of a song + */ + void InitialiseL( RFile& aFile ); + + /* + * Executes a command on the selected song + * @param aCmd a command + * @param aData, data + */ + void CommandL( CMPXCommand& aCmd ); + + // Supposedly being deprecated + // We're forced to implement this as its declared as a + // pure virtual function by the MPX framework + void CommandL(TMPXPlaybackCommand aCmd, TInt aData=0); + + /* + * Sets a property of the plugin + * @param aProperty a property + * @param aValue the value of the setting + */ + void SetL( TMPXPlaybackProperty aProperty , TInt aValue ); + + /* + * Gets a property of the plugin (async) + * @param aProperty a property + */ + void PropertyL( TMPXPlaybackProperty aProperty ) const; + + /* + * Gets a list of sub players + * @return a list of names of sub players + */ + void SubPlayerNamesL(); + + /* + * Select a sub player + * @param aIndex index to the sub player + */ + void SelectSubPlayerL( TInt aIndex ); + + /* + * Returns current sub player name + * @return friendly name of the current the sub player + */ + const TDesC& SubPlayerName(); + + /* + * Current sub player index + * @return index to the sub player + */ + TInt SubPlayerIndex() const; + + /* + * Media properties of the current file (async) + * @param aAttrs attributes requested + */ + void MediaL( const TArray& aAttrs ); + + /* + * Cancel async request + */ + void CancelRequest(); + + private: + /* + * C++ default constructor + */ + CTestVideoPlaybackPlugin(); + + /* + * the second phase constructor ConstructL to safely construct things + * that can leave + */ + void ConstructL(); + + void AddCallbackEvent( TTestVideoPlaybackCallbackEvent* event ); + static TInt SendEvent( TAny* aPtr ); + void DoSendEvent(); + + private: + + HBufC* iClipName; + RFs iFs; + RFile iFile; + CIdle* iCallback; //active object + CCallbackArray* iEventArray; +}; + +#endif diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/src/testvideoplaybackplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/src/testvideoplaybackplugin.cpp Wed Sep 15 12:45:22 2010 +0300 @@ -0,0 +1,793 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CTestVideoPlaybackPlugin implementation +* +*/ + +// +// INCLUDE FILES +// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "testvideoplaybackplugin.h" +#include "mpxplaybackutilitytestdefs.h" +#include "mpxplaybackutilitytest.h" + + +// +// CONSTANTS +// +const TUid KLocalPlaybackUid = { 0x10282556 }; + + +// ============================ MEMBER FUNCTIONS =============================== + +// ---------------------------------------------------------------------------- +// Two-phased constructor. +// ---------------------------------------------------------------------------- +// +CTestVideoPlaybackPlugin* CTestVideoPlaybackPlugin::NewL( TAny* /*aInitParams*/ ) +{ + + CTestVideoPlaybackPlugin* p = new (ELeave) CTestVideoPlaybackPlugin(); + CleanupStack::PushL(p); + p->ConstructL(); + CleanupStack::Pop(p); + return p; +} + +// ---------------------------------------------------------------------------- +// Symbian 2nd phase constructor can leave. +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::ConstructL() +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::ConstructL()"); + User::LeaveIfError( iFs.Connect() ); + iFs.ShareProtected(); + + iEventArray = new (ELeave) CArrayPtrFlat( 1 ); + iCallback = CIdle::NewL( CActive::EPriorityLow ); +} + +// ---------------------------------------------------------------------------- +// C++ constructor +// ---------------------------------------------------------------------------- +// +CTestVideoPlaybackPlugin::CTestVideoPlaybackPlugin() + +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::CTestVideoPlaybackPlugin()"); +} + +// ---------------------------------------------------------------------------- +// Destructor +// ---------------------------------------------------------------------------- +// +CTestVideoPlaybackPlugin::~CTestVideoPlaybackPlugin() +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::~CTestVideoPlaybackPlugin()"); + iFile.Close(); + iFs.Close(); + + if ( iCallback->IsActive() ) + { + iCallback->Cancel(); + } + + delete iCallback; + + iEventArray->ResetAndDestroy(); +} + +// ---------------------------------------------------------------------------- +// Set observer +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::SetObserver( MMPXPlaybackPluginObserver& aObs ) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::SetObserver( MMPXPlaybackPluginObserver& aObs )"); + iObs = &aObs; +} + +// ---------------------------------------------------------------------------- +// Initializes a clip for playback from a file name +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::InitialiseL( const TDesC& aSong ) +{ + + MPX_FUNC_EX("CTestVideoPlaybackPlugin::InitialiseL( const TDesc& aSong)"); + + delete iClipName; + iClipName = NULL; + iClipName = aSong.AllocL(); + + iFile.Close(); + + TInt err = iFile.Open( iFs, aSong, EFileRead | EFileShareReadersOrWriters ); + + // + // Remap KErrNotReady to KErrNotFound, because it is referencing a drive + // that is not existent + // + if ( KErrNotReady == err ) + { + err = KErrNotFound; + } + + // if aSong is an streaming link and contains one of the streaming schemas + // eg. rtsp:// , http:// etc. then a file handle can not be opened + // ignore KErrBadName + if (err != KErrBadName) + { + User::LeaveIfError( err ); + } + + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPInitialised; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPBufferingStarted; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); +} + +// ---------------------------------------------------------------------------- +// Initializes a clip for playback from a file handle +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::InitialiseL( RFile& aSong ) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::InitialiseL( RFile& aSong )"); + + delete iClipName; + iClipName = NULL; + iClipName = HBufC::NewL( KMaxFileName ); + TPtr ptr = iClipName->Des(); + aSong.FullName( ptr ); + + iFile.Close(); + User::LeaveIfError( iFile.Duplicate( aSong )); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPInitialised; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPBufferingStarted; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); +} + +/** +* Initializes a file for playback. +* +* @since S60 9.2 +* @param aUri URI of the item +* @param aType the mime type of the item +* @param aAccessPoint the access point +*/ +void CTestVideoPlaybackPlugin::InitStreamingL(const TDesC& /*aUri*/, + const TDesC8& /*aType*/, TInt /*aAccessPoint*/, TInt /*aPosition*/) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::InitStreamingL(const TDesC& /*aUri*/, const TDesC8& /*aType*/, TInt /*aAccessPoint*/, TInt /*aPosition*/)"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPInitialised; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPBufferingStarted; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); +} + +/** +* Initializes a file handle for playback. +* +* @since S60 9.2 +* @param aFile file handle of a file +* @param aAccessPoint the access point +*/ +void CTestVideoPlaybackPlugin::InitStreamingL(RFile& /*aFile*/, TInt /*aAccessPoint*/, TInt /*aPosition*/) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::InitStreamingL(RFile& /*aFile*/, TInt /*aAccessPoint*/, TInt /*aPosition*/)"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPInitialised; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPBufferingStarted; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); +} + +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API +/** +* Initializes a file handle for playback. +* +* @since S60 9.2 +* @param aFile 64 bit file handle of a file +* @param aAccessPoint the access point +*/ +void CTestVideoPlaybackPlugin::InitStreaming64L(RFile64& /*aFile*/, TInt /*aAccessPoint*/, TInt /*aPosition*/) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::InitStreaming64L(RFile64& /*aFile*/, TInt /*aAccessPoint*/, TInt /*aPosition*/)"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPInitialised; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPBufferingStarted; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); +} + +/** +* Initializes a song for playback. +* +* @since S60 9.2 +* @param aFile 64 bit file handle of a song +*/ +void CTestVideoPlaybackPlugin::Initialise64L(RFile64& /*aSong*/, TInt /*aPosition*/) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::Initialise64L(RFile64& /*aSong*/, TInt /*aPosition*/)"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPInitialised; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPBufferingStarted; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); +} +#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API + +// ---------------------------------------------------------------------------- +// Executes a command on the selected song +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::CommandL( CMPXCommand& aCmd ) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::CommandL( CMPXCommand& aCmd )"); + + if ( aCmd.IsSupported( KMPXStifPlaybackCommand ) ) + { + TMPXStifCommand cmd = static_cast(aCmd.ValueTObjectL(KMPXStifPlaybackCommand)); + TMPXPlaybackState state = static_cast(aCmd.ValueTObjectL(KMPXCommandPlaybackGeneralData)); + + MPX_DEBUG3("CTestVideoPlaybackPlugin::CommandL cmd = %d, state = %d ", cmd, state); + + switch ( cmd ) + { + case EPbStifPlayComplete: + { + MPX_DEBUG1("CTestVideoPlaybackPlugin::CommandL aCmd is EPbStifPlaybackComplete"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPPlayComplete; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + break; + } + case EPbStifSeekForward: + { + MPX_DEBUG1("CTestVideoPlaybackPlugin::CommandL aCmd is EPbStifSeekForward"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPPluginSeeking; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPPositionChanged; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + if ( state == EPbStatePlaying ) + { + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPPlaying; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + } + else if ( state == EPbStatePaused ) + { + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPPaused; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + } + break; + } + + case EPbStifSeekBackward: + { + MPX_DEBUG1("CTestVideoPlaybackPlugin::CommandL aCmd is EPbStifSeekBackward"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPPluginSeeking; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPPositionChanged; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + if ( state == EPbStatePlaying ) + { + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPPlaying; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + } + else if ( state == EPbStatePaused ) + { + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPPaused; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + } + break; + } + + default: + { + MPX_DEBUG1("CTestVideoPlaybackPlugin::CommandL aCmd default"); + break; + } + } + } +} + + +// ---------------------------------------------------------------------------- +// Executes a command on the selected song +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::CommandL(TMPXPlaybackCommand aCmd, TInt /*aData*/) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::CommandL(TMPXPlaybackCommand aCmd, TInt /*aData*/)"); + + MPX_DEBUG2("CTestVideoPlaybackPlugin::CommandL aCmd = %d", aCmd); + + switch (aCmd) + { + case EPbCmdPlay: + { + MPX_DEBUG1("CTestVideoPlaybackPlugin::CommandL aCmd is EPbCmdPlay"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPPlaying; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + break; + } + + case EPbCmdClose: + { + MPX_DEBUG1("CTestVideoPlaybackPlugin::CommandL aCmd is EPbCmdClose"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPClosed; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + break; + } + + case EPbCmdStop: + { + MPX_DEBUG1("CTestVideoPlaybackPlugin::CommandL aCmd is EPbCmdStop"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPStopped; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + break; + } + + case EPbCmdPause: + { + MPX_DEBUG1("CTestVideoPlaybackPlugin::CommandL aCmd is EPbCmdPause"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPPaused; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + break; + } + + case EPbCmdStartSeekForward: + { + MPX_DEBUG1("CTestVideoPlaybackPlugin::CommandL aCmd is EPbCmdStartSeekForward"); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPPluginSeeking; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPPositionChanged; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPPlaying; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + break; + } + + default: + { + MPX_DEBUG1("CTestVideoPlaybackPlugin::CommandL aCmd default"); + break; + } + } +} + + +// ---------------------------------------------------------------------------- +// Sets a property of the plugin +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::SetL( TMPXPlaybackProperty aProperty, TInt aValue ) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::SetL( TMPXPlaybackProperty /*aProperty*/, TInt /*aValue*/ )"); + MPX_DEBUG3("CTestVideoPlaybackPlugin::SetL aProperty = %d, aValue = %d", aProperty, aValue); + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPSetComplete; + event->iData = aProperty; + event->iError = KErrNone; + + AddCallbackEvent( event ); +} + +// ---------------------------------------------------------------------------- +// Gets a property of the plugin (async) +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::PropertyL( TMPXPlaybackProperty /*aProperty*/ ) const +{ + +} + +// ---------------------------------------------------------------------------- +// Gets a list of sub players, UPnP only +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::SubPlayerNamesL() +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::SubPlayerNamesL()"); + + iObs->HandleSubPlayerNames( KLocalPlaybackUid, NULL, ETrue, KErrNone ); +} + +// ---------------------------------------------------------------------------- +// Select a sub player +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::SelectSubPlayerL( TInt /*aIndex*/ ) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::SelectSubPlayerL( TInt aIndex )"); + + User::Leave( KErrNotSupported ); +} + +// ---------------------------------------------------------------------------- +// Returns current sub player name +// ---------------------------------------------------------------------------- +// +const TDesC& CTestVideoPlaybackPlugin::SubPlayerName() +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::SubPlayerName()"); + + return KNullDesC; +} + +// ---------------------------------------------------------------------------- +// Current sub player index +// ---------------------------------------------------------------------------- +// +TInt CTestVideoPlaybackPlugin::SubPlayerIndex() const +{ + + return KErrNotFound; +} + +// ---------------------------------------------------------------------------- +// Gets media properties +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::MediaL( const TArray& /*aAttrs*/ ) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::MediaL( const TArray TMPXAttribute )"); +} + +// ---------------------------------------------------------------------------- +// Cancel request +// ---------------------------------------------------------------------------- +// +void CTestVideoPlaybackPlugin::CancelRequest() +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::CancelRequest()"); +} + +// ---------------------------------------------------------------------------- +// CTestVideoPlaybackPlugin::GetFileHandle() +// ---------------------------------------------------------------------------- +// +RFile CTestVideoPlaybackPlugin::GetFileHandle() +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::GetFileHandle()"); + + return iFile; +} + +/** +* Initializes a song for playback. +* +* @since S60 9.2 +* @param aSong the song path +* @param aPosition the starting position +*/ +void CTestVideoPlaybackPlugin::InitialiseWithPositionL(const TDesC& aSong, TInt aPosition) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::InitialiseWithPositionL(const TDesC& /*aSong*/, TInt /*aPosition*/)"); + + delete iClipName; + iClipName = NULL; + iClipName = aSong.AllocL(); + + iFile.Close(); + + TInt err = iFile.Open( iFs, aSong, EFileRead | EFileShareReadersOrWriters ); + + // + // Remap KErrNotReady to KErrNotFound, because it is referencing a drive + // that is not existent + // + if ( KErrNotReady == err ) + { + err = KErrNotFound; + } + + // if aSong is an streaming link and contains one of the streaming schemas + // eg. rtsp:// , http:// etc. then a file handle can not be opened + // ignore KErrBadName + if (err != KErrBadName) + { + User::LeaveIfError( err ); + } + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPInitialised; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPBufferingStarted; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); +} + +/** +* Initializes a song for playback. +* +* @since S60 9.2 +* @param aFile file handle of a song +* @param aPosition the starting position +*/ +void CTestVideoPlaybackPlugin::InitialiseWithPositionL(RFile& aSong, TInt aPosition) +{ + MPX_FUNC_EX("CTestVideoPlaybackPlugin::InitialiseWithPositionL(RFile& aSong, TInt aPosition)"); + + delete iClipName; + iClipName = NULL; + iClipName = HBufC::NewL( KMaxFileName ); + TPtr ptr = iClipName->Des(); + aSong.FullName( ptr ); + + iFile.Close(); + User::LeaveIfError( iFile.Duplicate( aSong )); + + + TTestVideoPlaybackCallbackEvent* event = new (ELeave) TTestVideoPlaybackCallbackEvent; + + event->iEvent = MMPXPlaybackPluginObserver::EPInitialised; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); + + event = new TTestVideoPlaybackCallbackEvent; + event->iEvent = MMPXPlaybackPluginObserver::EPBufferingStarted; + event->iData = 0; + event->iError = KErrNone; + + AddCallbackEvent( event ); +} + + +void CTestVideoPlaybackPlugin::RunL() +{ + MPX_FUNC_EX("CTestVideoPaybackPlugin::RunL"); +} + +void CTestVideoPlaybackPlugin::DoCancel() +{ + MPX_FUNC_EX("CTestVideoPaybackPlugin::DoCancel"); +} + +void CTestVideoPlaybackPlugin::AddCallbackEvent( TTestVideoPlaybackCallbackEvent* event ) +{ + MPX_DEBUG1("CTestVideoPlaybackPlugin::AddCallbackEvent"); + + iEventArray->AppendL( event ); + + if ( ! iCallback->IsActive() ) + { + iCallback->Start( TCallBack( CTestVideoPlaybackPlugin::SendEvent, this ) ); + } +} + +TInt CTestVideoPlaybackPlugin::SendEvent (TAny* aPtr ) +{ + MPX_DEBUG1("CTestVideoPlaybackPlugin::SendEvent"); + + static_cast(aPtr)->DoSendEvent(); + + return KErrNone; +} + +void CTestVideoPlaybackPlugin::DoSendEvent() +{ + MPX_DEBUG1("-->CTestVideoPlaybackPlugin::DoSendEvent"); + + TInt count = iEventArray->Count(); + + if ( count > 0 ) + { + TTestVideoPlaybackCallbackEvent* event = (*iEventArray)[0]; + + MMPXPlaybackPluginObserver::TEvent myevent = static_cast(event->iEvent); + + iObs->HandlePluginEvent( myevent, event->iData, event->iError); + + if ( count > 1 ) + { + // + // More events exist, start another callback + // + MPX_DEBUG1("CTestVideoPlaybackPlugin::DoSendEvent - there are more events, start another callback"); + iCallback->Start( TCallBack( CTestVideoPlaybackPlugin::SendEvent, this ) ); + } + + iEventArray->Delete( 0 ); + } + MPX_DEBUG1("<--CTestVideoPlaybackPlugin::DoSendEvent"); +} + +// End of file diff -r 666f9a5a90a9 -r 91d5ad76f5c6 mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/src/testvideoplaybackpluginproxy.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/src/testvideoplaybackpluginproxy.cpp Wed Sep 15 12:45:22 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Standard proxy of the ECOM plugin +* +*/ + +#include +#include "testcommonpluginuids.h" +#include "testvideoplaybackplugin.h" + +#if ( ! defined IMPLEMENTATION_PROXY_ENTRY ) +typedef TAny* TProxyNewLPtr; +#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) \ + { {aUid}, (TProxyNewLPtr)(aFuncPtr) } +#endif + +// ---------------------------------------------------------------------------- +// The list of implementations +// ---------------------------------------------------------------------------- +// +const TImplementationProxy ImplementationTable[] = + { IMPLEMENTATION_PROXY_ENTRY( KPlaybackTestVideoPluginImpId, + CTestVideoPlaybackPlugin::NewL ) }; + +// ---------------------------------------------------------------------------- +// The proxy of implementations +// ---------------------------------------------------------------------------- +// +EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) +{ + aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); + return ImplementationTable; +} + +// End of File