QStringList S60FormatSupported::supportedPlayMimeTypesL() { RArray<TUid> mediaIds; //search for both audio and video RMMFControllerImplInfoArray iControllers; m_controllerparam = CMMFControllerPluginSelectionParameters::NewL(); m_playformatparam = CMMFFormatSelectionParameters::NewL(); mediaIds.Append(KUidMediaTypeAudio); mediaIds.Append(KUidMediaTypeVideo); m_controllerparam->SetMediaIdsL(mediaIds, CMMFPluginSelectionParameters::EAllowOtherMediaIds); m_controllerparam->SetRequiredPlayFormatSupportL(*m_playformatparam); m_controllerparam->ListImplementationsL(iControllers); CDesC8ArrayFlat* controllerArray = new (ELeave) CDesC8ArrayFlat(1); for (TInt i = 0; i < iControllers.Count(); i++) { for (TInt j = 0; j < (iControllers[i]->PlayFormats()).Count(); j++) { const CDesC8Array& iarr = (iControllers[i]->PlayFormats()[j]->SupportedMimeTypes()); TInt count = iarr.Count(); for (TInt k = 0; k < count; k++) { TPtrC8 ptr = iarr.MdcaPoint(k); HBufC8* n = HBufC8::NewL(ptr.Length()); TPtr8 ptr1 = n->Des(); ptr1.Copy((TUint8*) ptr.Ptr(), ptr.Length()); controllerArray->AppendL(ptr1); } } } // converting CDesC8Array to QStringList for (TInt x = 0; x < controllerArray->Count(); x++) { m_supportedplaymime.append(QString::fromUtf8( (const char*) (controllerArray->MdcaPoint(x).Ptr()), controllerArray->MdcaPoint(x).Length())); } // populating the list with only audio and controller mime types QStringList tempaudio = m_supportedplaymime.filter(QString("audio")); QStringList tempvideo = m_supportedplaymime.filter(QString("video")); m_supportedplaymime.clear(); m_supportedplaymime = tempaudio + tempvideo; mediaIds.Close(); delete controllerArray; iControllers.ResetAndDestroy(); return m_supportedplaymime; }
EXPORT_C void CMMFControllerPluginSelectionParameters::ListImplementationsL(RMMFControllerImplInfoArray& aImplementations) const { aImplementations.ResetAndDestroy(); RImplInfoPtrArray ecomArray; CleanupResetAndDestroyPushL(ecomArray); MmPluginUtils::FindImplementationsL(InterfaceUid(), ecomArray); TInt index; // Create Controller Implementation Information for each entry for (index=0; index<ecomArray.Count(); index++) { CMMFControllerImplementationInformation* c = NULL; if (ecomArray[index] == NULL) { User::Leave(KErrNoMemory); } TRAPD(error, c = CMMFControllerImplementationInformation::NewL(*(ecomArray[index]))); if (error == KErrNone) { CleanupStack::PushL(c); // If required, get the play and record formats for the controller. if (iRequiredPlayFormatSupport) { c->GetPlayFormatsL(); } if (iRequiredRecordFormatSupport) { c->GetRecordFormatsL(); } // Find out whether this controller matches the client's requirements... TBool suitable = EFalse; TInt arrayPos; suitable = CheckUriSupport(iRequiredPlayFormatSupport, c, c->PlayFormats()); if(suitable) { suitable = CheckUriSupport(iRequiredRecordFormatSupport, c, c->RecordFormats()); } if(suitable) { MatchImplementationToSelectParamsL(aImplementations, *c, arrayPos); } else { arrayPos = -1; } if (arrayPos >=0) { // This plugin is suitable - insert it into the array at the suggested position User::LeaveIfError(aImplementations.Insert(c, arrayPos)); CleanupStack::Pop(c); } else { // This plugin isn't suitable so just destroy it CleanupStack::PopAndDestroy(c); } } else if (error != KErrCorrupt) { // Ignore the plugin if it is corrupt. Otherwise, leave. // if error !=KErrNone, c hasn't been constructed so it is safe to leave User::Leave(error); } } CleanupStack::PopAndDestroy();//ecomArray }