Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
20 #include <mmf/plugin/mmfplugininterfaceuids.hrh>
21 #include <mmf/common/mmfcontrollerpluginresolver.h>
22 #include "mmfmatchdata.h"
23 #include <mmf/server/mmfdatasourcesink.hrh>
24 #include "MMFFormatImplementationInformationBody.h"
25 #include <mm/mmpluginutils.h>
27 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
28 #include <mmf/common/taggeddataparser.h>
31 _LIT8(KSupplier, "<s>");
32 _LIT8(KMediaId, "<i>");
33 _LIT8(KUriScheme,"<u>");
34 _LIT8(KNonNetwork,"<n>");
35 _LIT8(KPlayFormatCollectionUid, "<p>");
36 _LIT8(KRecordFormatCollectionUid, "<r>");
37 _LIT8(KFormatFileExtension, "<e>");
38 _LIT8(KFormatMimeType, "<m>");
39 _LIT8(KFormatHeaderData, "<h>");
40 _LIT8(KHeapSize, "<a>");
41 _LIT8(KCustomInterfaceSupport, "<c>");
42 _LIT8(KSecureDRMProcessMode, "<d>");
43 _LIT8(KStackSize, "<t>");
44 _LIT8(KTagMatch, "*<?>*");
47 const TInt KTagLength = 3;
49 const TInt KMaxExtLen = 5 ;
50 const TInt KDesCArrayGranularity = 1;
52 const TInt KUriPriorityHigh = 3;
53 const TInt KUriPriorityMedium = 2;
54 const TInt KUriPriorityLow = 1;
55 const TInt KUriPriorityNone = 0;
57 static const TUid KUidInterfaceFormatDecode = {KMmfUidPluginInterfaceFormatDecode};
58 static const TUid KUidInterfaceFormatEncode = {KMmfUidPluginInterfaceFormatEncode};
59 static const TUid KUidInterfaceMMFController = {KMmfUidPluginInterfaceController};
62 EXPORT_C CMMFFormatSelectionParameters* CMMFFormatSelectionParameters::NewL()
64 CMMFFormatSelectionParameters* s = CMMFFormatSelectionParameters::NewLC();
69 EXPORT_C CMMFFormatSelectionParameters* CMMFFormatSelectionParameters::NewLC()
71 CMMFFormatSelectionParameters* s = new(ELeave) CMMFFormatSelectionParameters;
72 CleanupStack::PushL(s);
76 CMMFFormatSelectionParameters* CMMFFormatSelectionParameters::NewL(const CMMFFormatSelectionParameters& aParams)
78 CMMFFormatSelectionParameters* s = CMMFFormatSelectionParameters::NewLC();
79 s->ConstructL(aParams);
84 void CMMFFormatSelectionParameters::ConstructL(const CMMFFormatSelectionParameters& aParams)
86 iMatchReqData = CMatchData::CreateL();
87 iMatchReqData->SetMatchDataL(aParams.MatchData());
88 iMatchReqData->SetMatchUriSchemeL(aParams.MatchUriScheme());
89 iMatchDataType = aParams.MatchDataType();
92 CMMFFormatSelectionParameters::~CMMFFormatSelectionParameters()
98 CMMFFormatSelectionParameters::CMMFFormatSelectionParameters()
100 iMatchDataType = EMatchAny;
103 EXPORT_C void CMMFFormatSelectionParameters::SetMatchToFileNameL(const TDesC& aFileName)
105 delete iMatchReqData;
106 iMatchReqData = NULL;
107 iMatchDataType = EMatchAny;
108 // Extract the extension from the data passed in
110 // Parse the path and extract the extension
114 // If there is no dot "." in aFileName then assume that we have been passed the extension only (if KMaxExtLen or less)
115 if ( (aFileName.Length() <= KMaxExtLen) && (aFileName.Find( KDot ) == KErrNotFound) )
118 CleanupClosePushL(temp);
119 temp.CreateL(aFileName.Length()+1);
120 User::LeaveIfError(CnvUtfConverter::ConvertFromUnicodeToUtf8(temp, aFileName));
121 temp.Insert(0,KDot8);
123 iMatchReqData = CMatchData::CreateL();
124 iMatchReqData->SetMatchDataL(temp);
126 CleanupStack::PopAndDestroy(&temp);
129 else if ( aFileName.Find( KDot ) == 0 ) // the first character is dot so assume extension only
132 CleanupClosePushL(temp);
133 temp.CreateL(aFileName.Length());
134 User::LeaveIfError(CnvUtfConverter::ConvertFromUnicodeToUtf8(temp, aFileName));
136 iMatchReqData = CMatchData::CreateL();
137 iMatchReqData->SetMatchDataL(temp);
139 CleanupStack::PopAndDestroy(&temp);
142 else // We have been given the whole filename. Use TParse to extract the extension.
145 parser.Set( aFileName, NULL, NULL ) ;
146 if ( !( parser.NamePresent() ) )
147 User::Leave( KErrBadName ) ;
148 if ( !( parser.PathPresent() ) )
151 User::LeaveIfError(fsSession.Connect());
152 TInt error = fsSession.Parse(aFileName, parser);
154 User::LeaveIfError(error);
156 // Parser should now have the full filename and path
157 TPtrC extension = parser.Ext();
160 CleanupClosePushL(temp);
161 temp.CreateL(extension.Length());
162 User::LeaveIfError(CnvUtfConverter::ConvertFromUnicodeToUtf8(temp, extension));
164 iMatchReqData = CMatchData::CreateL();
165 iMatchReqData->SetMatchDataL(temp);
167 CleanupStack::PopAndDestroy(&temp);
171 // If we're here, we must now have the file extension
172 iMatchDataType = EMatchFileExtension;
175 EXPORT_C void CMMFFormatSelectionParameters::SetMatchToUriL(const TDesC& aUrl)
177 delete iMatchReqData;
178 iMatchReqData = NULL;
179 iMatchDataType = EMatchAny;
181 CUri8* uri = UriUtils::CreateUriL(aUrl); //Converts the TDesC16 aUrl to TDesC8 type
182 CleanupStack::PushL(uri);
183 const TDesC8& path = uri->Uri().Extract(EUriPath);
185 // Now parse the file name
186 TInt pos = path.LocateReverse('.');
188 if(pos != KErrNotFound) // if not found, then by default match data is NULL
190 TPtrC8 extension(path.Right(path.Length()-pos));
191 iMatchReqData = CMatchData::CreateL();
192 iMatchReqData->SetMatchDataL(extension);
194 CleanupStack::PopAndDestroy(uri);
196 // If we're here, we must now have the file extension
197 // Use match file extension, because we are matching to the file extension of the file specified by the URI
198 iMatchDataType = EMatchFileExtension;
205 Sets this object to match to uri scheme and file extension specified by a URI.
207 The Uri scheme and extension are saved in iMatchReqData. Further,iMatchData contains uri extension,
208 iMatchUriScheme contains uri scheme.
211 The URI containing the scheme and uri extension to be matched.
214 EXPORT_C void CMMFFormatSelectionParameters::SetMatchToUriSupportL(const TDesC& aUrl)
216 delete iMatchReqData;
217 iMatchReqData = NULL;
218 iMatchDataType = EMatchAny;
220 CUri8* uri = UriUtils::CreateUriL(aUrl); //Converts the TDesC16 aUrl to TDesC8 type
221 CleanupStack::PushL(uri);
223 const TDesC8& scheme = uri->Uri().Extract(EUriScheme); //get the uri scheme
224 iMatchReqData = CMatchData::CreateL();
225 iMatchReqData->SetMatchUriSchemeL(scheme);
227 const TDesC8& path = uri->Uri().Extract(EUriPath);
228 // Now parse the file name
229 TInt pos = path.LocateReverse('.');
231 if(pos != KErrNotFound) // if not found, by default match data is NULL
233 TPtrC8 extension(path.Right(path.Length()-pos));
234 iMatchReqData->SetMatchDataL(extension);
237 CleanupStack::PopAndDestroy(uri);
238 // If we're here, we must now have the uri saved in iMatchData. Now, set match type
239 // to EMatchUri for checking schema and uri extension
240 iMatchDataType = EMatchUri;
245 EXPORT_C void CMMFFormatSelectionParameters::SetMatchToMimeTypeL(const TDesC8& aMimeType)
247 delete iMatchReqData;
248 iMatchReqData = NULL;
249 iMatchDataType = EMatchAny;
251 iMatchReqData = CMatchData::CreateL();
252 iMatchReqData->SetMatchDataL(aMimeType);
253 iMatchDataType = EMatchMimeType;
256 EXPORT_C void CMMFFormatSelectionParameters::SetMatchToHeaderDataL(const TDesC8& aHeaderData)
258 delete iMatchReqData;
259 iMatchReqData = NULL;
260 iMatchDataType = EMatchAny;
262 iMatchReqData = CMatchData::CreateL();
263 iMatchReqData->SetMatchDataL(aHeaderData);
264 iMatchDataType = EMatchHeaderData;
267 EXPORT_C const TDesC8& CMMFFormatSelectionParameters::MatchData() const
271 return iMatchReqData->MatchData();
283 Returns the uri scheme used to perform the plugin match.
285 @return The uri scheme.
288 EXPORT_C const TDesC8& CMMFFormatSelectionParameters::MatchUriScheme() const
292 return iMatchReqData->MatchUriScheme();
300 EXPORT_C CMMFFormatSelectionParameters::TMatchDataType CMMFFormatSelectionParameters::MatchDataType() const
302 return iMatchDataType;
305 CMMFPluginSelectionParameters::CMMFPluginSelectionParameters(TUid aPluginInterfaceUid) :
306 iPluginInterfaceUid(aPluginInterfaceUid)
308 iPreferredSupplierMatchType = ENoPreferredSupplierMatch;
309 iMediaIdMatchType = ENoMediaIdMatch;
312 CMMFPluginSelectionParameters::~CMMFPluginSelectionParameters()
314 delete iPreferredSupplier;
319 EXPORT_C void CMMFPluginSelectionParameters::SetPreferredSupplierL(const TDesC& aPreferredSupplier, TPreferredSupplierMatchType aMatchType)
321 delete iPreferredSupplier;
322 iPreferredSupplier = NULL;
323 iPreferredSupplier = aPreferredSupplier.AllocL();
324 iPreferredSupplierMatchType = aMatchType;
327 EXPORT_C void CMMFPluginSelectionParameters::SetMediaIdsL(const RArray<TUid>& aMediaIds, TMediaIdMatchType aMatchType)
330 for (TInt i=0; i<aMediaIds.Count(); i++)
332 User::LeaveIfError(iMediaIds.Append(aMediaIds[i]));
334 iMediaIdMatchType = aMatchType;
337 EXPORT_C const TDesC& CMMFPluginSelectionParameters::PreferredSupplier() const
339 if (iPreferredSupplier)
340 return *iPreferredSupplier;
345 EXPORT_C CMMFPluginSelectionParameters::TPreferredSupplierMatchType CMMFPluginSelectionParameters::PreferredSupplierMatchType() const
347 return iPreferredSupplierMatchType;
350 EXPORT_C const RArray<TUid>& CMMFPluginSelectionParameters::MediaIds() const
355 EXPORT_C CMMFPluginSelectionParameters::TMediaIdMatchType CMMFPluginSelectionParameters::MediaIdMatchType() const
357 return iMediaIdMatchType;
360 EXPORT_C TUid CMMFPluginSelectionParameters::InterfaceUid() const
362 return iPluginInterfaceUid;
366 TBool CMMFPluginSelectionParameters::CheckMediaIdSupportL(const CMMFPluginImplementationInformation& aPlugin) const
369 switch (MediaIdMatchType())
371 case CMMFPluginSelectionParameters::ENoMediaIdMatch:
372 // No match required so suitable
375 case CMMFPluginSelectionParameters::EAllowOtherMediaIds:
376 // Just check that the requested media id is supported by the plugin
378 for (TInt i=0; i<MediaIds().Count(); i++)
380 if (aPlugin.SupportsMediaId(MediaIds()[i]))
388 case CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds:
389 // Check the media id counts are the same, and that all requested ones are present
392 for (TInt i=0; i<MediaIds().Count(); i++)
394 if (aPlugin.SupportsMediaId(MediaIds()[i]))
397 // Check all request mediaIds are present
398 if ((found == MediaIds().Count()) && (found == aPlugin.SupportedMediaIds().Count()))
403 User::Leave(KErrNotSupported);
411 EXPORT_C CMMFControllerPluginSelectionParameters* CMMFControllerPluginSelectionParameters::NewL()
413 CMMFControllerPluginSelectionParameters* s = CMMFControllerPluginSelectionParameters::NewLC();
414 CleanupStack::Pop(s);
418 EXPORT_C CMMFControllerPluginSelectionParameters* CMMFControllerPluginSelectionParameters::NewLC()
420 CMMFControllerPluginSelectionParameters* s = new(ELeave) CMMFControllerPluginSelectionParameters;
421 CleanupStack::PushL(s);
425 CMMFControllerPluginSelectionParameters::CMMFControllerPluginSelectionParameters() :
426 CMMFPluginSelectionParameters(KUidInterfaceMMFController)
430 CMMFControllerPluginSelectionParameters::~CMMFControllerPluginSelectionParameters()
432 delete iRequiredPlayFormatSupport;
433 delete iRequiredRecordFormatSupport;
436 EXPORT_C void CMMFControllerPluginSelectionParameters::SetRequiredPlayFormatSupportL(const CMMFFormatSelectionParameters& aRequiredSupport)
438 delete iRequiredPlayFormatSupport;
439 iRequiredPlayFormatSupport = NULL;
440 iRequiredPlayFormatSupport = CMMFFormatSelectionParameters::NewL(aRequiredSupport);
443 EXPORT_C void CMMFControllerPluginSelectionParameters::SetRequiredRecordFormatSupportL(const CMMFFormatSelectionParameters& aRequiredSupport)
445 delete iRequiredRecordFormatSupport;
446 iRequiredRecordFormatSupport = NULL;
447 iRequiredRecordFormatSupport = CMMFFormatSelectionParameters::NewL(aRequiredSupport);
450 EXPORT_C void CMMFControllerPluginSelectionParameters::ListImplementationsL(RMMFControllerImplInfoArray& aImplementations) const
452 aImplementations.ResetAndDestroy();
454 RImplInfoPtrArray ecomArray;
455 CleanupResetAndDestroyPushL(ecomArray);
457 MmPluginUtils::FindImplementationsL(InterfaceUid(), ecomArray);
460 // Create Controller Implementation Information for each entry
461 for (index=0; index<ecomArray.Count(); index++)
463 CMMFControllerImplementationInformation* c = NULL;
464 if (ecomArray[index] == NULL)
466 User::Leave(KErrNoMemory);
468 TRAPD(error, c = CMMFControllerImplementationInformation::NewL(*(ecomArray[index])));
470 if (error == KErrNone)
472 CleanupStack::PushL(c);
474 // If required, get the play and record formats for the controller.
475 if (iRequiredPlayFormatSupport)
477 c->GetPlayFormatsL();
479 if (iRequiredRecordFormatSupport)
481 c->GetRecordFormatsL();
484 // Find out whether this controller matches the client's requirements...
485 TBool suitable = EFalse;
487 suitable = CheckUriSupport(iRequiredPlayFormatSupport, c, c->PlayFormats());
490 suitable = CheckUriSupport(iRequiredRecordFormatSupport, c, c->RecordFormats());
494 MatchImplementationToSelectParamsL(aImplementations, *c, arrayPos);
503 // This plugin is suitable - insert it into the array at the suggested position
504 User::LeaveIfError(aImplementations.Insert(c, arrayPos));
505 CleanupStack::Pop(c);
509 // This plugin isn't suitable so just destroy it
510 CleanupStack::PopAndDestroy(c);
513 else if (error != KErrCorrupt)
515 // Ignore the plugin if it is corrupt. Otherwise, leave.
516 // if error !=KErrNone, c hasn't been constructed so it is safe to leave
521 CleanupStack::PopAndDestroy();//ecomArray
524 void CMMFControllerPluginSelectionParameters::MatchImplementationToSelectParamsL(RMMFControllerImplInfoArray& aImplementations, const CMMFControllerImplementationInformation& aPlugin, TInt& aArrayPos) const
526 TBool suitable = EFalse;
528 // First, check whether the plugin supports the required play formats
529 suitable = CheckFormatSupportL(iRequiredPlayFormatSupport, aPlugin.PlayFormats());
531 // Next, check the record formats
533 suitable = CheckFormatSupportL(iRequiredRecordFormatSupport, aPlugin.RecordFormats());
535 // Next, check for correct media id support
537 suitable = CheckMediaIdSupportL(aPlugin);
539 // Finally, calculate the position the plugin should take in aImplementations depending on the preferred supplier and version number.
541 aArrayPos = CheckPreferredSupplierL(aImplementations, aPlugin);
547 Checks the given Controller for uri support. Uri support may be there
548 if either requiredscheme or extension matches with that given controller
551 Describes the selection parameter which a controller needs to
552 support in order to be selected
555 The controller plugin which is checked for uri support
558 The play or record formats looked for extension match
560 TBool CMMFControllerPluginSelectionParameters::CheckUriSupport(CMMFFormatSelectionParameters* aSelectParams, CMMFControllerImplementationInformation* aPlugin, const RMMFFormatImplInfoArray& aFormats) const
562 // If aSelectParams are NULL (ie none were set) then the plugin must be suitable!
563 if (aSelectParams == NULL)
566 //If EMatchUri not set then the plugin might be suitable!
567 if(aSelectParams->MatchDataType() != CMMFFormatSelectionParameters::EMatchUri)
572 TBool suitable = EFalse;
575 //If <n>yes is there in the aPlugin's opaque data,
576 //URI support not assumed. So, don't load the controller
577 if(!aPlugin->SupportsNetworkCapability())
582 //the uri scheme to be matched for
583 if (aPlugin->SupportsUriScheme(aSelectParams->MatchUriScheme()))
585 aPlugin->SetUriPriority(KUriPriorityMedium);
590 //if other uri scheme support declared, but not the required one,
591 // even then controller not supported
592 if(aPlugin->SupportedUriSchemes().Count() > 0)
599 //then match Uri extension. .
601 //if ctrl has no network capability, then lowest priority given on matching file extension
602 for (index=0;index<aFormats.Count();index++)
604 if (aFormats[index]-> SupportsFileExtension(aSelectParams->MatchData()))
608 aPlugin->SetUriPriority(KUriPriorityLow);
612 aPlugin->SetUriPriority(KUriPriorityHigh);
623 TInt CMMFControllerPluginSelectionParameters::CheckPreferredSupplierL(RMMFControllerImplInfoArray& aImplementations, const CMMFControllerImplementationInformation& aPlugin) const
625 // Set the return value to indicated the plugin is not suitable.
626 TBool pluginSuitable = EFalse;
627 TBool needToPlaceInVersionOrder = EFalse;
628 TBool needToPlaceInUriPriorityOrder = EFalse;
630 if((iRequiredPlayFormatSupport && (iRequiredPlayFormatSupport->MatchDataType() == CMMFFormatSelectionParameters::EMatchUri))
631 || (iRequiredRecordFormatSupport && (iRequiredRecordFormatSupport->MatchDataType() == CMMFFormatSelectionParameters::EMatchUri)))
633 needToPlaceInUriPriorityOrder = ETrue;
636 switch (PreferredSupplierMatchType())
638 case ENoPreferredSupplierMatch:
639 // No match, so suitable.
640 pluginSuitable = ETrue;
642 case EPreferredSupplierPluginsFirstInList:
643 pluginSuitable = ETrue;
644 if (aPlugin.SupportsSupplier(PreferredSupplier()))
645 needToPlaceInVersionOrder = ETrue;
647 case EOnlyPreferredSupplierPluginsReturned:
648 if (aPlugin.SupportsSupplier(PreferredSupplier()))
650 pluginSuitable = ETrue;
651 needToPlaceInVersionOrder = ETrue;
655 User::Leave(KErrNotSupported);
667 if(needToPlaceInUriPriorityOrder)
669 arrayPos = aImplementations.Count();
670 // Cycle through aImplementations to find the first plugin with a uri priority LOWER than aPlugin's
671 for (TInt i=0; i<aImplementations.Count(); i++)
673 CMMFControllerImplementationInformation* c = aImplementations[i];
675 if(PreferredSupplierMatchType() == ENoPreferredSupplierMatch) //case 1
678 Place the plugin based on its Uri priority.
679 Arrange the plugins in Decreasing order of their priority. In case if two or more plugins
680 have similar priority, append the next one at the end.
682 if (c->UriPriority() < aPlugin.UriPriority())
684 arrayPos = i;//plugin will be inserted before c in the array
690 if(!needToPlaceInVersionOrder) //case 2
693 This reflects the case EPreferredSupplierPluginsFirstInList and
694 aPlugin supplier not matching.
695 Place the plugin based on its Uri Priority after the required suppliers plugin.
696 If priority is equal, new plugin will be placed last.
698 if( (c->Supplier() != PreferredSupplier()) && (c->UriPriority() < aPlugin.UriPriority()))
700 arrayPos = i;//plugin will be inserted before c in the array
707 This reflects the case where
708 Supplier matches and EPreferredSupplierPluginsFirstInList is specified.
710 Supplier matches and EOnlyPreferredSupplierPluginsReturned is specified.
712 if(c->Supplier() == PreferredSupplier())
714 if(c->UriPriority() == aPlugin.UriPriority())
716 if(c->Version() <= aPlugin.Version())
718 arrayPos = i;//plugin will be inserted before c in the array
724 if(c->UriPriority() < aPlugin.UriPriority())
726 arrayPos = i;//plugin will be inserted before c in the array
734 This is a case of aImplementations now having unpreferred suppliers
735 when EPreferredSupplierPluginsFirstInList is specified and aPlugin is
736 of preferred supplier but least priority.
738 arrayPos = i;//plugin will be inserted before c in the array
748 if (!needToPlaceInVersionOrder)
753 arrayPos = aImplementations.Count();
757 // Insert the plugin at the beginning of the array, in version order if possible.
758 // Make an assumption: if we've been asked for format support, then only plugins
759 // that support the same format will be in the array - so ordering them by version
760 // will be meaningful. Otherwise, there's no point.
761 if ((iRequiredPlayFormatSupport && (iRequiredPlayFormatSupport->MatchDataType() != CMMFFormatSelectionParameters::EMatchAny))
762 || (iRequiredRecordFormatSupport && (iRequiredRecordFormatSupport->MatchDataType() != CMMFFormatSelectionParameters::EMatchAny)))
764 // Put the plugin in version order at the beginning of the list
766 // Set aArrayPos to the end of the array in case this plugin has the lowest version number
767 arrayPos = aImplementations.Count();
768 // Cycle through aImplementations to find the first plugin with a version number LOWER than aPlugin
769 for (TInt i=0; i<aImplementations.Count(); i++)
771 CMMFControllerImplementationInformation* c = aImplementations[i];
772 if (c->Supplier() == aPlugin.Supplier())
774 if (c->Version() <= aPlugin.Version())
776 arrayPos = i;//plugin will be inserted before c in the array
782 arrayPos = i; //c has wrong supplier so this plugin must go before c
789 // We can't use the version numbers meaningfully, so just put this plugin
790 // at the top of the list.
800 TBool CMMFControllerPluginSelectionParameters::CheckFormatSupportL(CMMFFormatSelectionParameters* aSelectParams, const RMMFFormatImplInfoArray& aFormats) const
802 // If aSelectParams are NULL (ie none were set) then the plugin must be suitable!
803 if (aSelectParams == NULL)
806 TBool suitable = EFalse;
808 // Check all the formats in aFormats. If any support the required data type, return ETrue.
810 switch (aSelectParams->MatchDataType())
812 case CMMFFormatSelectionParameters::EMatchAny:
813 // All plugins intrinsically match this!
816 case CMMFFormatSelectionParameters::EMatchFileExtension:
817 for (index=0;index<aFormats.Count();index++)
819 if (aFormats[index]->SupportsFileExtension(aSelectParams->MatchData()))
826 case CMMFFormatSelectionParameters::EMatchMimeType:
827 for (index=0;index<aFormats.Count();index++)
829 if (aFormats[index]->SupportsMimeType(aSelectParams->MatchData()))
836 case CMMFFormatSelectionParameters::EMatchHeaderData:
837 for (index=0;index<aFormats.Count();index++)
839 if (aFormats[index]->SupportsHeaderDataL(aSelectParams->MatchData()))
847 case CMMFFormatSelectionParameters::EMatchUri:
849 suitable = ETrue; //if uri match specifically looked , then that has been already matched in a CheckUriSupport()
855 User::Leave(KErrNotSupported);
863 EXPORT_C CMMFControllerSecureDrmPluginSelectionParameters* CMMFControllerSecureDrmPluginSelectionParameters::NewL()
865 CMMFControllerSecureDrmPluginSelectionParameters* s = CMMFControllerSecureDrmPluginSelectionParameters::NewLC();
866 CleanupStack::Pop(s);
870 EXPORT_C CMMFControllerSecureDrmPluginSelectionParameters* CMMFControllerSecureDrmPluginSelectionParameters::NewLC()
872 CMMFControllerSecureDrmPluginSelectionParameters* s = new(ELeave) CMMFControllerSecureDrmPluginSelectionParameters;
873 CleanupStack::PushL(s);
877 CMMFControllerSecureDrmPluginSelectionParameters::CMMFControllerSecureDrmPluginSelectionParameters() :
878 CMMFControllerPluginSelectionParameters()
882 EXPORT_C void CMMFControllerSecureDrmPluginSelectionParameters::ListImplementationsL(RMMFControllerImplInfoArray& aImplementations) const
884 CMMFControllerPluginSelectionParameters::ListImplementationsL(aImplementations);
885 TInt pluginsCount = aImplementations.Count();
886 for (TInt i = pluginsCount - 1; i >= 0; i--)
888 CMMFControllerImplementationInformation* c = aImplementations[i];
889 if (!c->SupportsSecureDRMProcessMode())
891 aImplementations.Remove(i);
895 aImplementations.Compress();
900 CMMFFormatPluginSelectionParameters::CMMFFormatPluginSelectionParameters(TUid aInterfaceUid) :
901 CMMFPluginSelectionParameters(aInterfaceUid)
905 CMMFFormatPluginSelectionParameters::~CMMFFormatPluginSelectionParameters()
907 delete iRequiredFormatSupport;
910 EXPORT_C void CMMFFormatPluginSelectionParameters::SetRequiredFormatSupportL(const CMMFFormatSelectionParameters& aRequiredSupport)
912 delete iRequiredFormatSupport;
913 iRequiredFormatSupport = NULL;
914 iRequiredFormatSupport = CMMFFormatSelectionParameters::NewL(aRequiredSupport);
917 EXPORT_C void CMMFFormatPluginSelectionParameters::ListImplementationsL(RMMFFormatImplInfoArray& aImplementations) const
919 aImplementations.ResetAndDestroy();
921 RImplInfoPtrArray ecomArray;
922 CleanupResetAndDestroyPushL(ecomArray);
924 MmPluginUtils::FindImplementationsL(InterfaceUid(), ecomArray);
928 // Create Format Implementation Information for each entry
929 for (index=0; index<ecomArray.Count(); index++)
931 CMMFFormatImplementationInformation* c = NULL;
932 TRAPD(error, c = CMMFFormatImplementationInformation::NewL(*(ecomArray[index])));
934 if (error == KErrNone)
936 CleanupStack::PushL(c);
937 // Find out whether this format matches the client's requirements...
939 MatchImplementationToSelectParamsL(aImplementations, *c, arrayPos);
942 // This plugin is suitable - insert it into the array at the suggested position
943 User::LeaveIfError(aImplementations.Insert(c, arrayPos));
944 CleanupStack::Pop(c);
948 // This plugin isn't suitable so just destroy it
949 CleanupStack::PopAndDestroy(c);
952 else if (error != KErrCorrupt)
954 // Ignore the plugin if it is corrupt. Otherwise, leave.
955 // if error !=KErrNone, c hasn't been constructed so it is safe to leave
960 CleanupStack::PopAndDestroy();//ecomArray
963 void CMMFFormatPluginSelectionParameters::MatchImplementationToSelectParamsL(RMMFFormatImplInfoArray& aImplementations, const CMMFFormatImplementationInformation& aPlugin, TInt& aArrayPos) const
965 TBool suitable = EFalse;
967 // First, check whether the plugin supports the required play formats
968 suitable = CheckFormatSupportL(aPlugin);
970 // Next, check for correct media id support
972 suitable = CheckMediaIdSupportL(aPlugin);
974 // Finally, calculate the position the plugin should take in aImplementations depending on the preferred supplier and version number.
976 aArrayPos = CheckPreferredSupplierL(aImplementations, aPlugin);
981 TInt CMMFFormatPluginSelectionParameters::CheckPreferredSupplierL(RMMFFormatImplInfoArray& aImplementations, const CMMFFormatImplementationInformation& aPlugin) const
983 // Set the return value to indicated the plugin is not suitable.
984 TBool pluginSuitable = EFalse;
985 TBool needToPlaceInVersionOrder = EFalse;
987 switch (PreferredSupplierMatchType())
989 case ENoPreferredSupplierMatch:
990 // No match, so suitable.
991 pluginSuitable = ETrue;
993 case EPreferredSupplierPluginsFirstInList:
994 pluginSuitable = ETrue;
995 if (aPlugin.SupportsSupplier(PreferredSupplier()))
996 needToPlaceInVersionOrder = ETrue;
998 case EOnlyPreferredSupplierPluginsReturned:
999 if (aPlugin.SupportsSupplier(PreferredSupplier()))
1001 pluginSuitable = ETrue;
1002 needToPlaceInVersionOrder = ETrue;
1006 User::Leave(KErrNotSupported);
1012 if (!pluginSuitable)
1018 if (!needToPlaceInVersionOrder)
1020 arrayPos = aImplementations.Count();
1024 // Insert the plugin at the beginning of the array, in version order if possible.
1025 // Make an assumption: if we've been asked for format support, then only plugins
1026 // that support the same format will be in the array - so ordering them by version
1027 // will be meaningful. Otherwise, there's no point.
1028 if (iRequiredFormatSupport && (iRequiredFormatSupport->MatchDataType() != CMMFFormatSelectionParameters::EMatchAny))
1030 // Put the plugin in version order at the beginning of the list
1032 // Set aArrayPos to the end of the array in case this plugin has the lowest version number
1033 arrayPos = aImplementations.Count();
1034 // Cycle through aImplementations to find the first plugin with a version number LOWER than aPlugin
1035 for (TInt i=0; i<aImplementations.Count(); i++)
1037 CMMFFormatImplementationInformation* c = aImplementations[i];
1038 if ((c->Supplier() == aPlugin.Supplier())
1039 && (c->Version() <= aPlugin.Version()))
1041 arrayPos = i;//plugin will be inserted before c in the array
1048 // We can't use the version numbers meaningfully, so just put this plugin
1049 // at the top of the list.
1057 TBool CMMFFormatPluginSelectionParameters::CheckFormatSupportL(const CMMFFormatImplementationInformation& aPlugin) const
1059 // If iRequiredFormatSupport is NULL (ie no requirements set) then the plugin must be suitable!
1060 if (iRequiredFormatSupport == NULL)
1063 TBool suitable = EFalse;
1065 switch (iRequiredFormatSupport->MatchDataType())
1067 case CMMFFormatSelectionParameters::EMatchAny:
1070 case CMMFFormatSelectionParameters::EMatchFileExtension:
1071 if (aPlugin.SupportsFileExtension(iRequiredFormatSupport->MatchData()))
1074 case CMMFFormatSelectionParameters::EMatchMimeType:
1075 if (aPlugin.SupportsMimeType(iRequiredFormatSupport->MatchData()))
1078 case CMMFFormatSelectionParameters::EMatchHeaderData:
1079 if (aPlugin.SupportsHeaderDataL(iRequiredFormatSupport->MatchData()))
1083 User::Leave(KErrNotSupported);
1090 EXPORT_C CMMFFormatEncodePluginSelectionParameters* CMMFFormatEncodePluginSelectionParameters::NewL()
1092 CMMFFormatEncodePluginSelectionParameters* s = CMMFFormatEncodePluginSelectionParameters::NewLC();
1093 CleanupStack::Pop(s);
1097 EXPORT_C CMMFFormatEncodePluginSelectionParameters* CMMFFormatEncodePluginSelectionParameters::NewLC()
1099 CMMFFormatEncodePluginSelectionParameters* s = new(ELeave) CMMFFormatEncodePluginSelectionParameters;
1100 CleanupStack::PushL(s);
1104 CMMFFormatEncodePluginSelectionParameters::CMMFFormatEncodePluginSelectionParameters() :
1105 CMMFFormatPluginSelectionParameters(KUidInterfaceFormatEncode)
1110 EXPORT_C CMMFFormatDecodePluginSelectionParameters* CMMFFormatDecodePluginSelectionParameters::NewL()
1112 CMMFFormatDecodePluginSelectionParameters* s = CMMFFormatDecodePluginSelectionParameters::NewLC();
1113 CleanupStack::Pop(s);
1117 EXPORT_C CMMFFormatDecodePluginSelectionParameters* CMMFFormatDecodePluginSelectionParameters::NewLC()
1119 CMMFFormatDecodePluginSelectionParameters* s = new(ELeave) CMMFFormatDecodePluginSelectionParameters;
1120 CleanupStack::PushL(s);
1124 CMMFFormatDecodePluginSelectionParameters::CMMFFormatDecodePluginSelectionParameters() :
1125 CMMFFormatPluginSelectionParameters(KUidInterfaceFormatDecode)
1133 void TaggedDataParser::ParseTaggedDataL(const TDesC8& aData, MTaggedDataParserClient& aClient)
1136 TInt readPosition = 0;
1137 TBool moreData = data.Length() ? ETrue : EFalse;
1140 // Assumes that this segment will begin with a tag
1141 TPtrC8 restOfData = data.Mid(readPosition);
1143 TInt endPos = restOfData.MatchF(KTagMatch);
1144 if (endPos == KErrNotFound)
1145 User::Leave(KErrCorrupt);
1148 TPtrC8 tag = restOfData.Left(KTagLength);
1151 readPosition += KTagLength;
1153 // Find the next tag
1154 restOfData.Set(data.Mid(readPosition));
1155 endPos = restOfData.MatchF(KTagMatch);
1158 if (endPos == KErrNotFound)
1160 // If we didn't find a tag, we must be at the end of the data
1161 tagData.Set(restOfData);
1162 readPosition = restOfData.Length();
1167 tagData.Set(restOfData.Left(endPos));
1168 readPosition += endPos;
1171 aClient.ProcessTaggedDataL(tag, tagData);
1175 void TaggedDataParser::ConvertTextToUidL(const TDesC8& aData, TUid& aUid)
1177 // Make sure aData is in the correct format - "0x12345678"
1180 if ((aData.Length() == 10) && ((aData.FindF(K0x) == 0) || (aData.FindF(K0X) == 0)))
1182 // only take the right 8 characters (ie discard the "0x")
1183 TLex8 lex(aData.Right(8));
1185 User::LeaveIfError(lex.Val(value, EHex));
1189 User::Leave(KErrCorrupt);
1193 void TaggedDataParser::ConvertTextToTUintL(const TDesC8& aData, TUint& aUint)
1195 // Determine whether hex or decimal then parse as such
1198 if (((aData.FindF(K0x) == 0) || (aData.FindF(K0X) == 0)) && (aData.Length() >= 3))
1200 // only take the characters after "0x"
1201 TLex8 lex(aData.Right(aData.Length()-2));
1203 User::LeaveIfError(lex.Val(value, EHex));
1206 else if (aData.Length() > 0)
1208 TLex8 lex(aData.Right(aData.Length()));
1210 User::LeaveIfError(lex.Val(value, EDecimal));
1214 User::Leave(KErrCorrupt);
1218 EXPORT_C TBool CMMFPluginImplementationInformation::SupportsSupplier(const TDesC& aSupplier) const
1222 if (aSupplier.CompareF(*iSupplier) == KErrNone)
1228 EXPORT_C TBool CMMFPluginImplementationInformation::SupportsMediaId(TUid aMediaId) const
1230 TInt location = iMediaIds.Find(aMediaId);
1231 return (location != KErrNotFound);
1234 EXPORT_C TUid CMMFPluginImplementationInformation::Uid() const
1239 EXPORT_C const TDesC& CMMFPluginImplementationInformation::DisplayName() const
1242 return *iDisplayName;
1247 EXPORT_C const TDesC& CMMFPluginImplementationInformation::Supplier() const
1255 EXPORT_C TInt CMMFPluginImplementationInformation::Version() const
1260 EXPORT_C const RArray<TUid>& CMMFPluginImplementationInformation::SupportedMediaIds() const
1265 CMMFPluginImplementationInformation::~CMMFPluginImplementationInformation()
1267 delete iDisplayName;
1273 CMMFPluginImplementationInformation::CMMFPluginImplementationInformation()
1277 void CMMFPluginImplementationInformation::SetSupplierL(const TDesC8& aData)
1281 // Convert aData to unicode...
1282 iSupplier = HBufC::NewL(aData.Length());
1283 TPtr ptr = iSupplier->Des();
1284 User::LeaveIfError(CnvUtfConverter::ConvertToUnicodeFromUtf8(ptr, aData));
1287 void CMMFPluginImplementationInformation::AddMediaIdL(const TDesC8& aData)
1290 TaggedDataParser::ConvertTextToUidL(aData, mediaId);
1291 User::LeaveIfError(iMediaIds.Append(mediaId));
1294 CMMFControllerImplementationInformation* CMMFControllerImplementationInformation::NewL(const CImplementationInformation& aImplInfo)
1296 CMMFControllerImplementationInformation* s = CMMFControllerImplementationInformation::NewLC(aImplInfo);
1297 CleanupStack::Pop(s);
1301 CMMFControllerImplementationInformation* CMMFControllerImplementationInformation::NewLC(const CImplementationInformation& aImplInfo)
1303 CMMFControllerImplementationInformation* s = new(ELeave) CMMFControllerImplementationInformation;
1304 CleanupStack::PushL(s);
1305 s->ConstructL(aImplInfo);
1309 EXPORT_C CMMFControllerImplementationInformation* CMMFControllerImplementationInformation::NewL(TUid aUid)
1311 RImplInfoPtrArray ecomArray;
1312 CleanupResetAndDestroyPushL(ecomArray);
1314 MmPluginUtils::FindImplementationsL(KUidInterfaceMMFController, ecomArray);
1317 CMMFControllerImplementationInformation* controller = NULL;
1318 // Create Controller Implementation Information for the entry with the requested UID
1319 for (index=0; index<ecomArray.Count() && (controller==NULL); index++)
1321 if (ecomArray[index] == NULL)
1323 User::Leave(KErrNoMemory);
1326 if (ecomArray[index]->ImplementationUid()==aUid)
1328 // Create the impl info object, and get the play and record formats supported by the plugin
1329 controller = CMMFControllerImplementationInformation::NewL(*(ecomArray[index]));
1331 CleanupStack::PushL(controller); // INC023207 - Placed controller on CleanupStack
1332 controller->GetPlayFormatsL();
1333 controller->GetRecordFormatsL(); // INC023207
1334 CleanupStack::Pop();
1338 if (controller == NULL)
1340 User::Leave(KErrNotFound);
1343 CleanupStack::PopAndDestroy(); // ecomArray
1347 EXPORT_C const RMMFFormatImplInfoArray& CMMFControllerImplementationInformation::PlayFormats() const
1349 return iPlayFormats;
1352 EXPORT_C const RMMFFormatImplInfoArray& CMMFControllerImplementationInformation::RecordFormats() const
1354 return iRecordFormats;
1358 EXPORT_C TUint CMMFControllerImplementationInformation::HeapSpaceRequired() const
1360 return iHeapSpaceRequired;
1363 EXPORT_C TUint CMMFControllerImplementationInformation::StackSize() const
1371 Returns the uri schemes of this plugin.
1373 @return The array of uri schemes.
1375 EXPORT_C const CDesC8Array& CMMFControllerImplementationInformation::SupportedUriSchemes() const
1377 return *iUriSchemes;
1384 Tests whether the plugin supports aUriScheme.
1387 The required Uri Scheme.
1389 @return A boolean indicating if the plugin supports aUriScheme. ETrue if this plugin supports aUriScheme, EFalse if not.
1391 EXPORT_C TBool CMMFControllerImplementationInformation::SupportsUriScheme(const TDesC8& aUriScheme) const
1394 TInt error = iUriSchemes->FindIsq(aUriScheme, position, ECmpFolded);
1395 return (error==KErrNone);
1402 Sets the uri priority of this controller
1405 The Uri priority to be assigned.
1407 EXPORT_C void CMMFControllerImplementationInformation::SetUriPriority(TInt aUriPriority)
1409 iUriPriority = aUriPriority;
1416 Retrieves the uri priority of this controller
1418 @return The assigned Uri priority.
1420 EXPORT_C TInt CMMFControllerImplementationInformation::UriPriority() const
1422 return iUriPriority;
1429 Tests whether the controller plugin supports url
1431 @return A boolean indicating if the plugin supports url. ETrue for uri supporting controller, EFalse if not.
1433 EXPORT_C TBool CMMFControllerImplementationInformation::SupportsNetworkCapability() const
1435 return iIsNetworkCtrl;
1442 Check whether the controller plugin supports secure DRM process mode
1444 @return A boolean indicating if the plugin supports secure DRM process mode.
1446 EXPORT_C TBool CMMFControllerImplementationInformation::SupportsSecureDRMProcessMode() const
1448 return iSupportsSecureDRMProcessMode;
1451 CMMFControllerImplementationInformation::CMMFControllerImplementationInformation()
1453 iUriPriority = KUriPriorityNone;
1454 iIsNetworkCtrl = ETrue;
1455 iPlayFormatCollectionUid = KNullUid;
1456 iRecordFormatCollectionUid = KNullUid;
1457 iHeapSpaceRequired = KMMFDefaultControllerThreadHeapSize;
1458 iSupportsSecureDRMProcessMode = EFalse;
1459 iStackSize = KDefaultStackSize;
1462 void CMMFControllerImplementationInformation::ConstructL(const CImplementationInformation& aImplInfo)
1464 iUriSchemes = new(ELeave) CDesC8ArrayFlat(KDesCArrayGranularity);
1465 iUid = aImplInfo.ImplementationUid();
1466 iDisplayName = aImplInfo.DisplayName().AllocL();
1467 iVersion = aImplInfo.Version();
1469 // Parse the opaque data...
1470 TaggedDataParser::ParseTaggedDataL(aImplInfo.OpaqueData(), *this);
1473 void CMMFControllerImplementationInformation::ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aData)
1475 if (aTag==KSupplier)
1477 SetSupplierL(aData);
1479 else if (aTag==KMediaId)
1483 else if (aTag==KUriScheme)
1485 SetUriSchemeL(aData);
1487 else if (aTag==KNonNetwork)
1489 SetNetworkCapabilityL(aData);
1491 else if (aTag==KPlayFormatCollectionUid)
1493 SetPlayFormatCollectionUidL(aData);
1495 else if (aTag==KRecordFormatCollectionUid)
1497 SetRecordFormatCollectionUidL(aData);
1499 else if(aTag==KHeapSize)
1501 SetHeapSizeL(aData);
1503 else if (aTag==KSecureDRMProcessMode)
1505 iSupportsSecureDRMProcessMode = ETrue;
1507 else if (aTag==KStackSize)
1509 SetStackSizeL(aData);
1513 User::Leave(KErrCorrupt);
1518 CMMFControllerImplementationInformation::~CMMFControllerImplementationInformation()
1520 iPlayFormats.ResetAndDestroy();
1521 iRecordFormats.ResetAndDestroy();
1526 void CMMFControllerImplementationInformation::SetPlayFormatCollectionUidL(const TDesC8& aData)
1528 TaggedDataParser::ConvertTextToUidL(aData, iPlayFormatCollectionUid);
1531 void CMMFControllerImplementationInformation::SetRecordFormatCollectionUidL(const TDesC8& aData)
1533 TaggedDataParser::ConvertTextToUidL(aData, iRecordFormatCollectionUid);
1536 void CMMFControllerImplementationInformation::SetHeapSizeL(const TDesC8& aData)
1538 TaggedDataParser::ConvertTextToTUintL(aData, iHeapSpaceRequired);
1541 void CMMFControllerImplementationInformation::SetStackSizeL(const TDesC8& aData)
1543 TaggedDataParser::ConvertTextToTUintL(aData, iStackSize);
1547 void CMMFControllerImplementationInformation::AddFormatsSwallowCorruptL(RImplInfoPtrArray& aEcomArray, RMMFFormatImplInfoArray& aFormatArray)
1549 for (TInt index=0; index<aEcomArray.Count(); index++)
1551 CMMFFormatImplementationInformation* c = NULL;
1552 TRAPD(error, c = CMMFFormatImplementationInformation::NewL(*(aEcomArray[index])));
1553 if (error==KErrNone)
1555 CleanupStack::PushL(c);
1556 User::LeaveIfError(aFormatArray.Append(c));
1557 CleanupStack::Pop(c);
1559 else if (error != KErrCorrupt)// make sure we don't leave because of a corrupt resource file
1565 void CMMFControllerImplementationInformation::GetFormatsL(TUid aFormatCollectionUid, TUid aFormatPluginCollectionUid, RMMFFormatImplInfoArray& aFormatArray)
1567 RImplInfoPtrArray ecomArray;
1568 CleanupResetAndDestroyPushL(ecomArray);
1569 // If we have a valid play format collection uid, get the play formats defined by this plugin
1570 if (aFormatCollectionUid != KNullUid)
1572 MmPluginUtils::FindImplementationsL(aFormatCollectionUid, ecomArray);
1573 // Create format implementation information for each entry
1574 AddFormatsSwallowCorruptL(ecomArray, aFormatArray);
1577 // Now get all the format plugins attached to this controller
1579 // Create a descriptor and fill it with the uid of this controller plugin
1580 TBuf8<10> controllerUid;
1582 controllerUid.Append(K0x);
1583 controllerUid.AppendNumFixedWidth(iUid.iUid, EHex, 8);
1585 MmPluginUtils::FindImplementationsL(aFormatPluginCollectionUid, ecomArray, controllerUid);
1586 // Create format implementation information for each entry
1587 AddFormatsSwallowCorruptL(ecomArray, aFormatArray);
1589 CleanupStack::PopAndDestroy();//ecomArray
1592 void CMMFControllerImplementationInformation::GetPlayFormatsL()
1594 GetFormatsL(iPlayFormatCollectionUid, KUidInterfaceFormatDecode, iPlayFormats);
1597 void CMMFControllerImplementationInformation::GetRecordFormatsL()
1599 GetFormatsL(iRecordFormatCollectionUid, KUidInterfaceFormatEncode, iRecordFormats);
1603 Sets the Uri Scheme found in opaque data
1606 Gives the uri scheme supported by the controller
1608 void CMMFControllerImplementationInformation::SetUriSchemeL(const TDesC8& aUriScheme)
1610 //If No uri support already declared in the resource file,
1611 //then mentioning a particular schema support is illegal
1614 User::Leave(KErrArgument);
1617 // Insert the new uri scheme into the array
1618 iUriSchemes->InsertIsqL(aUriScheme, ECmpFolded);//ensures there are no repeated entries
1622 Sets the Network capability found in opaque data
1624 @param aNetworkCapable
1625 Declares the incapability to support uri if matches to 'yes'.
1626 If this is the case, iIsNetworkCtrl is set to EFalse
1628 void CMMFControllerImplementationInformation::SetNetworkCapabilityL(const TDesC8& aNetworkCapable)
1630 //If a uri scheme is already declared in the resource file,
1631 //then mentioning no url support is illegal
1632 if(iUriSchemes->Count() > 0)
1634 User::Leave(KErrArgument);
1637 if (aNetworkCapable.CompareF(KTagYes) == KErrNone)
1639 iIsNetworkCtrl = EFalse;
1643 User::Leave(KErrBadName); // will leave if aNetworkCapable is anything other than 'yes'.
1650 CMMFFormatImplementationInformation* CMMFFormatImplementationInformation::NewL(const CImplementationInformation& aImplInfo)
1652 CMMFFormatImplementationInformation* s = CMMFFormatImplementationInformation::NewLC(aImplInfo);
1653 CleanupStack::Pop(s);
1657 CMMFFormatImplementationInformation* CMMFFormatImplementationInformation::NewLC(const CImplementationInformation& aImplInfo)
1659 CMMFFormatImplementationInformation* s = new(ELeave) CMMFFormatImplementationInformation();
1660 CleanupStack::PushL(s);
1661 s->ConstructL(aImplInfo);
1665 CMMFFormatImplementationInformation::CMMFFormatImplementationInformation()
1669 void CMMFFormatImplementationInformation::ConstructL(const CImplementationInformation& aImplInfo)
1671 iUid = aImplInfo.ImplementationUid();
1672 iDisplayName = aImplInfo.DisplayName().AllocL();
1674 iBody = CMMFFormatImplementationInformation::CBody::NewL();
1676 // Extract the rest of the data from the opaque data field of aImplInfo...
1677 // Parse the opaque data...
1678 TaggedDataParser::ParseTaggedDataL(aImplInfo.OpaqueData(), *this);
1681 void CMMFFormatImplementationInformation::ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aTagData)
1683 if (aTag == KSupplier)
1684 SetSupplierL(aTagData);
1685 else if (aTag == KMediaId)
1686 AddMediaIdL(aTagData);
1687 else if (aTag == KFormatFileExtension)
1688 AddFileExtensionL(aTagData);
1689 else if (aTag == KFormatMimeType)
1690 AddMimeTypeL(aTagData);
1691 else if (aTag == KFormatHeaderData)
1692 AddHeaderDataL(aTagData);
1693 else if ((aTag == KCustomInterfaceSupport) && (aTagData.CompareF(KTagYes) == 0))
1694 iBody->SetSupportsCustomInterfaces(ETrue);
1696 User::Leave(KErrCorrupt);
1699 void CMMFFormatImplementationInformation::AddFileExtensionL(const TDesC8& aData)
1701 iBody->AddFileExtensionL(aData);
1704 void CMMFFormatImplementationInformation::AddMimeTypeL(const TDesC8& aData)
1706 iBody->AddMimeTypeL(aData);
1709 void CMMFFormatImplementationInformation::AddHeaderDataL(const TDesC8& aData)
1711 iBody->AddHeaderDataL(aData);
1714 CMMFFormatImplementationInformation::~CMMFFormatImplementationInformation()
1719 EXPORT_C const CDesC8Array& CMMFFormatImplementationInformation::SupportedFileExtensions() const
1721 return iBody->SupportedFileExtensions();
1724 EXPORT_C const CDesC8Array& CMMFFormatImplementationInformation::SupportedMimeTypes() const
1726 return iBody->SupportedMimeTypes();
1729 EXPORT_C const CDesC8Array& CMMFFormatImplementationInformation::SupportedHeaderData() const
1731 return iBody->SupportedHeaderData();
1735 EXPORT_C TBool CMMFFormatImplementationInformation::SupportsFileExtension(const TDesC8& aFileExtension) const
1737 return iBody->SupportsFileExtension(aFileExtension);
1740 EXPORT_C TBool CMMFFormatImplementationInformation::SupportsMimeType(const TDesC8& aMimeType) const
1742 return iBody->SupportsMimeType(aMimeType);
1745 EXPORT_C TBool CMMFFormatImplementationInformation::SupportsHeaderDataL(const TDesC8& aHeaderData) const
1747 return iBody->SupportsHeaderDataL(aHeaderData);
1750 EXPORT_C TBool CMMFFormatImplementationInformation::SupportsCustomInterfaces() const
1752 return iBody->SupportsCustomInterfaces();
1755 CMatchData* CMatchData::CreateL()
1757 return new (ELeave) CMatchData();
1760 void CMatchData::SetMatchDataL(const TDesC8& aMatchData)
1765 iMatchData = aMatchData.AllocL();
1768 void CMatchData::SetMatchUriSchemeL(const TDesC8& aMatchUriScheme)
1770 delete iMatchUriScheme;
1771 iMatchUriScheme = NULL;
1773 iMatchUriScheme = aMatchUriScheme.AllocL();
1776 const TDesC8& CMatchData::MatchData() const
1788 const TDesC8& CMatchData::MatchUriScheme() const
1790 if (iMatchUriScheme )
1792 return *iMatchUriScheme;
1800 CMatchData::~CMatchData()
1803 delete iMatchUriScheme;