|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <badesca.h> |
|
17 #include <utf.h> |
|
18 #include <uri8.h> |
|
19 #include <uriutils.h> |
|
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> |
|
26 |
|
27 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
28 #include <mmf/common/taggeddataparser.h> |
|
29 #endif |
|
30 |
|
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, "*<?>*"); |
|
45 _LIT8(KTagYes,"yes"); |
|
46 |
|
47 const TInt KTagLength = 3; |
|
48 |
|
49 const TInt KMaxExtLen = 5 ; |
|
50 const TInt KDesCArrayGranularity = 1; |
|
51 |
|
52 const TInt KUriPriorityHigh = 3; |
|
53 const TInt KUriPriorityMedium = 2; |
|
54 const TInt KUriPriorityLow = 1; |
|
55 const TInt KUriPriorityNone = 0; |
|
56 |
|
57 static const TUid KUidInterfaceFormatDecode = {KMmfUidPluginInterfaceFormatDecode}; |
|
58 static const TUid KUidInterfaceFormatEncode = {KMmfUidPluginInterfaceFormatEncode}; |
|
59 static const TUid KUidInterfaceMMFController = {KMmfUidPluginInterfaceController}; |
|
60 |
|
61 |
|
62 EXPORT_C CMMFFormatSelectionParameters* CMMFFormatSelectionParameters::NewL() |
|
63 { |
|
64 CMMFFormatSelectionParameters* s = CMMFFormatSelectionParameters::NewLC(); |
|
65 CleanupStack::Pop(s); |
|
66 return s; |
|
67 } |
|
68 |
|
69 EXPORT_C CMMFFormatSelectionParameters* CMMFFormatSelectionParameters::NewLC() |
|
70 { |
|
71 CMMFFormatSelectionParameters* s = new(ELeave) CMMFFormatSelectionParameters; |
|
72 CleanupStack::PushL(s); |
|
73 return s; |
|
74 } |
|
75 |
|
76 CMMFFormatSelectionParameters* CMMFFormatSelectionParameters::NewL(const CMMFFormatSelectionParameters& aParams) |
|
77 { |
|
78 CMMFFormatSelectionParameters* s = CMMFFormatSelectionParameters::NewLC(); |
|
79 s->ConstructL(aParams); |
|
80 CleanupStack::Pop(s); |
|
81 return s; |
|
82 } |
|
83 |
|
84 void CMMFFormatSelectionParameters::ConstructL(const CMMFFormatSelectionParameters& aParams) |
|
85 { |
|
86 iMatchReqData = CMatchData::CreateL(); |
|
87 iMatchReqData->SetMatchDataL(aParams.MatchData()); |
|
88 iMatchReqData->SetMatchUriSchemeL(aParams.MatchUriScheme()); |
|
89 iMatchDataType = aParams.MatchDataType(); |
|
90 } |
|
91 |
|
92 CMMFFormatSelectionParameters::~CMMFFormatSelectionParameters() |
|
93 { |
|
94 delete iMatchReqData; |
|
95 iMatchReqData= NULL; |
|
96 } |
|
97 |
|
98 CMMFFormatSelectionParameters::CMMFFormatSelectionParameters() |
|
99 { |
|
100 iMatchDataType = EMatchAny; |
|
101 } |
|
102 |
|
103 EXPORT_C void CMMFFormatSelectionParameters::SetMatchToFileNameL(const TDesC& aFileName) |
|
104 { |
|
105 delete iMatchReqData; |
|
106 iMatchReqData = NULL; |
|
107 iMatchDataType = EMatchAny; |
|
108 // Extract the extension from the data passed in |
|
109 |
|
110 // Parse the path and extract the extension |
|
111 _LIT( KDot, "." ) ; |
|
112 _LIT8( KDot8, "." ); |
|
113 |
|
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) ) |
|
116 { |
|
117 RBuf8 temp; |
|
118 CleanupClosePushL(temp); |
|
119 temp.CreateL(aFileName.Length()+1); |
|
120 User::LeaveIfError(CnvUtfConverter::ConvertFromUnicodeToUtf8(temp, aFileName)); |
|
121 temp.Insert(0,KDot8); |
|
122 |
|
123 iMatchReqData = CMatchData::CreateL(); |
|
124 iMatchReqData->SetMatchDataL(temp); |
|
125 |
|
126 CleanupStack::PopAndDestroy(&temp); |
|
127 |
|
128 } |
|
129 else if ( aFileName.Find( KDot ) == 0 ) // the first character is dot so assume extension only |
|
130 { |
|
131 RBuf8 temp; |
|
132 CleanupClosePushL(temp); |
|
133 temp.CreateL(aFileName.Length()); |
|
134 User::LeaveIfError(CnvUtfConverter::ConvertFromUnicodeToUtf8(temp, aFileName)); |
|
135 |
|
136 iMatchReqData = CMatchData::CreateL(); |
|
137 iMatchReqData->SetMatchDataL(temp); |
|
138 |
|
139 CleanupStack::PopAndDestroy(&temp); |
|
140 |
|
141 } |
|
142 else // We have been given the whole filename. Use TParse to extract the extension. |
|
143 { |
|
144 TParse parser ; |
|
145 parser.Set( aFileName, NULL, NULL ) ; |
|
146 if ( !( parser.NamePresent() ) ) |
|
147 User::Leave( KErrBadName ) ; |
|
148 if ( !( parser.PathPresent() ) ) |
|
149 { |
|
150 RFs fsSession ; |
|
151 User::LeaveIfError(fsSession.Connect()); |
|
152 TInt error = fsSession.Parse(aFileName, parser); |
|
153 fsSession.Close(); |
|
154 User::LeaveIfError(error); |
|
155 } |
|
156 // Parser should now have the full filename and path |
|
157 TPtrC extension = parser.Ext(); |
|
158 |
|
159 RBuf8 temp; |
|
160 CleanupClosePushL(temp); |
|
161 temp.CreateL(extension.Length()); |
|
162 User::LeaveIfError(CnvUtfConverter::ConvertFromUnicodeToUtf8(temp, extension)); |
|
163 |
|
164 iMatchReqData = CMatchData::CreateL(); |
|
165 iMatchReqData->SetMatchDataL(temp); |
|
166 |
|
167 CleanupStack::PopAndDestroy(&temp); |
|
168 |
|
169 } |
|
170 |
|
171 // If we're here, we must now have the file extension |
|
172 iMatchDataType = EMatchFileExtension; |
|
173 } |
|
174 |
|
175 EXPORT_C void CMMFFormatSelectionParameters::SetMatchToUriL(const TDesC& aUrl) |
|
176 { |
|
177 delete iMatchReqData; |
|
178 iMatchReqData = NULL; |
|
179 iMatchDataType = EMatchAny; |
|
180 |
|
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); |
|
184 |
|
185 // Now parse the file name |
|
186 TInt pos = path.LocateReverse('.'); |
|
187 |
|
188 if(pos != KErrNotFound) // if not found, then by default match data is NULL |
|
189 { |
|
190 TPtrC8 extension(path.Right(path.Length()-pos)); |
|
191 iMatchReqData = CMatchData::CreateL(); |
|
192 iMatchReqData->SetMatchDataL(extension); |
|
193 } |
|
194 CleanupStack::PopAndDestroy(uri); |
|
195 |
|
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; |
|
199 } |
|
200 |
|
201 /** |
|
202 @publishedPartner |
|
203 @prototype |
|
204 |
|
205 Sets this object to match to uri scheme and file extension specified by a URI. |
|
206 |
|
207 The Uri scheme and extension are saved in iMatchReqData. Further,iMatchData contains uri extension, |
|
208 iMatchUriScheme contains uri scheme. |
|
209 |
|
210 @param aUri |
|
211 The URI containing the scheme and uri extension to be matched. |
|
212 |
|
213 */ |
|
214 EXPORT_C void CMMFFormatSelectionParameters::SetMatchToUriSupportL(const TDesC& aUrl) |
|
215 { |
|
216 delete iMatchReqData; |
|
217 iMatchReqData = NULL; |
|
218 iMatchDataType = EMatchAny; |
|
219 |
|
220 CUri8* uri = UriUtils::CreateUriL(aUrl); //Converts the TDesC16 aUrl to TDesC8 type |
|
221 CleanupStack::PushL(uri); |
|
222 |
|
223 const TDesC8& scheme = uri->Uri().Extract(EUriScheme); //get the uri scheme |
|
224 iMatchReqData = CMatchData::CreateL(); |
|
225 iMatchReqData->SetMatchUriSchemeL(scheme); |
|
226 |
|
227 const TDesC8& path = uri->Uri().Extract(EUriPath); |
|
228 // Now parse the file name |
|
229 TInt pos = path.LocateReverse('.'); |
|
230 |
|
231 if(pos != KErrNotFound) // if not found, by default match data is NULL |
|
232 { |
|
233 TPtrC8 extension(path.Right(path.Length()-pos)); |
|
234 iMatchReqData->SetMatchDataL(extension); |
|
235 } |
|
236 |
|
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; |
|
241 } |
|
242 |
|
243 |
|
244 |
|
245 EXPORT_C void CMMFFormatSelectionParameters::SetMatchToMimeTypeL(const TDesC8& aMimeType) |
|
246 { |
|
247 delete iMatchReqData; |
|
248 iMatchReqData = NULL; |
|
249 iMatchDataType = EMatchAny; |
|
250 |
|
251 iMatchReqData = CMatchData::CreateL(); |
|
252 iMatchReqData->SetMatchDataL(aMimeType); |
|
253 iMatchDataType = EMatchMimeType; |
|
254 } |
|
255 |
|
256 EXPORT_C void CMMFFormatSelectionParameters::SetMatchToHeaderDataL(const TDesC8& aHeaderData) |
|
257 { |
|
258 delete iMatchReqData; |
|
259 iMatchReqData = NULL; |
|
260 iMatchDataType = EMatchAny; |
|
261 |
|
262 iMatchReqData = CMatchData::CreateL(); |
|
263 iMatchReqData->SetMatchDataL(aHeaderData); |
|
264 iMatchDataType = EMatchHeaderData; |
|
265 } |
|
266 |
|
267 EXPORT_C const TDesC8& CMMFFormatSelectionParameters::MatchData() const |
|
268 { |
|
269 if (iMatchReqData) |
|
270 { |
|
271 return iMatchReqData->MatchData(); |
|
272 } |
|
273 else |
|
274 { |
|
275 return KNullDesC8; |
|
276 } |
|
277 } |
|
278 |
|
279 /** |
|
280 @publishedPartner |
|
281 @prototype |
|
282 |
|
283 Returns the uri scheme used to perform the plugin match. |
|
284 |
|
285 @return The uri scheme. |
|
286 |
|
287 */ |
|
288 EXPORT_C const TDesC8& CMMFFormatSelectionParameters::MatchUriScheme() const |
|
289 { |
|
290 if (iMatchReqData) |
|
291 { |
|
292 return iMatchReqData->MatchUriScheme(); |
|
293 } |
|
294 else |
|
295 { |
|
296 return KNullDesC8; |
|
297 } |
|
298 } |
|
299 |
|
300 EXPORT_C CMMFFormatSelectionParameters::TMatchDataType CMMFFormatSelectionParameters::MatchDataType() const |
|
301 { |
|
302 return iMatchDataType; |
|
303 } |
|
304 |
|
305 CMMFPluginSelectionParameters::CMMFPluginSelectionParameters(TUid aPluginInterfaceUid) : |
|
306 iPluginInterfaceUid(aPluginInterfaceUid) |
|
307 { |
|
308 iPreferredSupplierMatchType = ENoPreferredSupplierMatch; |
|
309 iMediaIdMatchType = ENoMediaIdMatch; |
|
310 } |
|
311 |
|
312 CMMFPluginSelectionParameters::~CMMFPluginSelectionParameters() |
|
313 { |
|
314 delete iPreferredSupplier; |
|
315 iMediaIds.Reset(); |
|
316 iMediaIds.Close(); |
|
317 } |
|
318 |
|
319 EXPORT_C void CMMFPluginSelectionParameters::SetPreferredSupplierL(const TDesC& aPreferredSupplier, TPreferredSupplierMatchType aMatchType) |
|
320 { |
|
321 delete iPreferredSupplier; |
|
322 iPreferredSupplier = NULL; |
|
323 iPreferredSupplier = aPreferredSupplier.AllocL(); |
|
324 iPreferredSupplierMatchType = aMatchType; |
|
325 } |
|
326 |
|
327 EXPORT_C void CMMFPluginSelectionParameters::SetMediaIdsL(const RArray<TUid>& aMediaIds, TMediaIdMatchType aMatchType) |
|
328 { |
|
329 iMediaIds.Reset(); |
|
330 for (TInt i=0; i<aMediaIds.Count(); i++) |
|
331 { |
|
332 User::LeaveIfError(iMediaIds.Append(aMediaIds[i])); |
|
333 } |
|
334 iMediaIdMatchType = aMatchType; |
|
335 } |
|
336 |
|
337 EXPORT_C const TDesC& CMMFPluginSelectionParameters::PreferredSupplier() const |
|
338 { |
|
339 if (iPreferredSupplier) |
|
340 return *iPreferredSupplier; |
|
341 else |
|
342 return KNullDesC; |
|
343 } |
|
344 |
|
345 EXPORT_C CMMFPluginSelectionParameters::TPreferredSupplierMatchType CMMFPluginSelectionParameters::PreferredSupplierMatchType() const |
|
346 { |
|
347 return iPreferredSupplierMatchType; |
|
348 } |
|
349 |
|
350 EXPORT_C const RArray<TUid>& CMMFPluginSelectionParameters::MediaIds() const |
|
351 { |
|
352 return iMediaIds; |
|
353 } |
|
354 |
|
355 EXPORT_C CMMFPluginSelectionParameters::TMediaIdMatchType CMMFPluginSelectionParameters::MediaIdMatchType() const |
|
356 { |
|
357 return iMediaIdMatchType; |
|
358 } |
|
359 |
|
360 EXPORT_C TUid CMMFPluginSelectionParameters::InterfaceUid() const |
|
361 { |
|
362 return iPluginInterfaceUid; |
|
363 } |
|
364 |
|
365 |
|
366 TBool CMMFPluginSelectionParameters::CheckMediaIdSupportL(const CMMFPluginImplementationInformation& aPlugin) const |
|
367 { |
|
368 TBool ret = EFalse; |
|
369 switch (MediaIdMatchType()) |
|
370 { |
|
371 case CMMFPluginSelectionParameters::ENoMediaIdMatch: |
|
372 // No match required so suitable |
|
373 ret = ETrue; |
|
374 break; |
|
375 case CMMFPluginSelectionParameters::EAllowOtherMediaIds: |
|
376 // Just check that the requested media id is supported by the plugin |
|
377 { |
|
378 for (TInt i=0; i<MediaIds().Count(); i++) |
|
379 { |
|
380 if (aPlugin.SupportsMediaId(MediaIds()[i])) |
|
381 { |
|
382 ret = ETrue; |
|
383 break; |
|
384 } |
|
385 } |
|
386 break; |
|
387 } |
|
388 case CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds: |
|
389 // Check the media id counts are the same, and that all requested ones are present |
|
390 { |
|
391 TInt found=0; |
|
392 for (TInt i=0; i<MediaIds().Count(); i++) |
|
393 { |
|
394 if (aPlugin.SupportsMediaId(MediaIds()[i])) |
|
395 found++; |
|
396 } |
|
397 // Check all request mediaIds are present |
|
398 if ((found == MediaIds().Count()) && (found == aPlugin.SupportedMediaIds().Count())) |
|
399 ret = ETrue; |
|
400 break; |
|
401 } |
|
402 default: |
|
403 User::Leave(KErrNotSupported); |
|
404 break; |
|
405 } |
|
406 return ret; |
|
407 } |
|
408 |
|
409 |
|
410 |
|
411 EXPORT_C CMMFControllerPluginSelectionParameters* CMMFControllerPluginSelectionParameters::NewL() |
|
412 { |
|
413 CMMFControllerPluginSelectionParameters* s = CMMFControllerPluginSelectionParameters::NewLC(); |
|
414 CleanupStack::Pop(s); |
|
415 return s; |
|
416 } |
|
417 |
|
418 EXPORT_C CMMFControllerPluginSelectionParameters* CMMFControllerPluginSelectionParameters::NewLC() |
|
419 { |
|
420 CMMFControllerPluginSelectionParameters* s = new(ELeave) CMMFControllerPluginSelectionParameters; |
|
421 CleanupStack::PushL(s); |
|
422 return s; |
|
423 } |
|
424 |
|
425 CMMFControllerPluginSelectionParameters::CMMFControllerPluginSelectionParameters() : |
|
426 CMMFPluginSelectionParameters(KUidInterfaceMMFController) |
|
427 { |
|
428 } |
|
429 |
|
430 CMMFControllerPluginSelectionParameters::~CMMFControllerPluginSelectionParameters() |
|
431 { |
|
432 delete iRequiredPlayFormatSupport; |
|
433 delete iRequiredRecordFormatSupport; |
|
434 } |
|
435 |
|
436 EXPORT_C void CMMFControllerPluginSelectionParameters::SetRequiredPlayFormatSupportL(const CMMFFormatSelectionParameters& aRequiredSupport) |
|
437 { |
|
438 delete iRequiredPlayFormatSupport; |
|
439 iRequiredPlayFormatSupport = NULL; |
|
440 iRequiredPlayFormatSupport = CMMFFormatSelectionParameters::NewL(aRequiredSupport); |
|
441 } |
|
442 |
|
443 EXPORT_C void CMMFControllerPluginSelectionParameters::SetRequiredRecordFormatSupportL(const CMMFFormatSelectionParameters& aRequiredSupport) |
|
444 { |
|
445 delete iRequiredRecordFormatSupport; |
|
446 iRequiredRecordFormatSupport = NULL; |
|
447 iRequiredRecordFormatSupport = CMMFFormatSelectionParameters::NewL(aRequiredSupport); |
|
448 } |
|
449 |
|
450 EXPORT_C void CMMFControllerPluginSelectionParameters::ListImplementationsL(RMMFControllerImplInfoArray& aImplementations) const |
|
451 { |
|
452 aImplementations.ResetAndDestroy(); |
|
453 |
|
454 RImplInfoPtrArray ecomArray; |
|
455 CleanupResetAndDestroyPushL(ecomArray); |
|
456 |
|
457 MmPluginUtils::FindImplementationsL(InterfaceUid(), ecomArray); |
|
458 |
|
459 TInt index; |
|
460 // Create Controller Implementation Information for each entry |
|
461 for (index=0; index<ecomArray.Count(); index++) |
|
462 { |
|
463 CMMFControllerImplementationInformation* c = NULL; |
|
464 if (ecomArray[index] == NULL) |
|
465 { |
|
466 User::Leave(KErrNoMemory); |
|
467 } |
|
468 TRAPD(error, c = CMMFControllerImplementationInformation::NewL(*(ecomArray[index]))); |
|
469 |
|
470 if (error == KErrNone) |
|
471 { |
|
472 CleanupStack::PushL(c); |
|
473 |
|
474 // If required, get the play and record formats for the controller. |
|
475 if (iRequiredPlayFormatSupport) |
|
476 { |
|
477 c->GetPlayFormatsL(); |
|
478 } |
|
479 if (iRequiredRecordFormatSupport) |
|
480 { |
|
481 c->GetRecordFormatsL(); |
|
482 } |
|
483 |
|
484 // Find out whether this controller matches the client's requirements... |
|
485 TBool suitable = EFalse; |
|
486 TInt arrayPos; |
|
487 suitable = CheckUriSupport(iRequiredPlayFormatSupport, c, c->PlayFormats()); |
|
488 if(suitable) |
|
489 { |
|
490 suitable = CheckUriSupport(iRequiredRecordFormatSupport, c, c->RecordFormats()); |
|
491 } |
|
492 if(suitable) |
|
493 { |
|
494 MatchImplementationToSelectParamsL(aImplementations, *c, arrayPos); |
|
495 } |
|
496 else |
|
497 { |
|
498 arrayPos = -1; |
|
499 } |
|
500 |
|
501 if (arrayPos >=0) |
|
502 { |
|
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); |
|
506 } |
|
507 else |
|
508 { |
|
509 // This plugin isn't suitable so just destroy it |
|
510 CleanupStack::PopAndDestroy(c); |
|
511 } |
|
512 } |
|
513 else if (error != KErrCorrupt) |
|
514 { |
|
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 |
|
517 User::Leave(error); |
|
518 } |
|
519 } |
|
520 |
|
521 CleanupStack::PopAndDestroy();//ecomArray |
|
522 } |
|
523 |
|
524 void CMMFControllerPluginSelectionParameters::MatchImplementationToSelectParamsL(RMMFControllerImplInfoArray& aImplementations, const CMMFControllerImplementationInformation& aPlugin, TInt& aArrayPos) const |
|
525 { |
|
526 TBool suitable = EFalse; |
|
527 |
|
528 // First, check whether the plugin supports the required play formats |
|
529 suitable = CheckFormatSupportL(iRequiredPlayFormatSupport, aPlugin.PlayFormats()); |
|
530 |
|
531 // Next, check the record formats |
|
532 if (suitable) |
|
533 suitable = CheckFormatSupportL(iRequiredRecordFormatSupport, aPlugin.RecordFormats()); |
|
534 |
|
535 // Next, check for correct media id support |
|
536 if (suitable) |
|
537 suitable = CheckMediaIdSupportL(aPlugin); |
|
538 |
|
539 // Finally, calculate the position the plugin should take in aImplementations depending on the preferred supplier and version number. |
|
540 if (suitable) |
|
541 aArrayPos = CheckPreferredSupplierL(aImplementations, aPlugin); |
|
542 else |
|
543 aArrayPos = -1; |
|
544 } |
|
545 |
|
546 /** |
|
547 Checks the given Controller for uri support. Uri support may be there |
|
548 if either requiredscheme or extension matches with that given controller |
|
549 |
|
550 @param aSelectParams |
|
551 Describes the selection parameter which a controller needs to |
|
552 support in order to be selected |
|
553 |
|
554 @param aPlugin |
|
555 The controller plugin which is checked for uri support |
|
556 |
|
557 @param aFormats |
|
558 The play or record formats looked for extension match |
|
559 */ |
|
560 TBool CMMFControllerPluginSelectionParameters::CheckUriSupport(CMMFFormatSelectionParameters* aSelectParams, CMMFControllerImplementationInformation* aPlugin, const RMMFFormatImplInfoArray& aFormats) const |
|
561 { |
|
562 // If aSelectParams are NULL (ie none were set) then the plugin must be suitable! |
|
563 if (aSelectParams == NULL) |
|
564 return ETrue; |
|
565 |
|
566 //If EMatchUri not set then the plugin might be suitable! |
|
567 if(aSelectParams->MatchDataType() != CMMFFormatSelectionParameters::EMatchUri) |
|
568 { |
|
569 return ETrue; |
|
570 } |
|
571 |
|
572 TBool suitable = EFalse; |
|
573 TInt index; |
|
574 |
|
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()) |
|
578 { |
|
579 return EFalse; |
|
580 } |
|
581 |
|
582 //the uri scheme to be matched for |
|
583 if (aPlugin->SupportsUriScheme(aSelectParams->MatchUriScheme())) |
|
584 { |
|
585 aPlugin->SetUriPriority(KUriPriorityMedium); |
|
586 suitable = ETrue; |
|
587 } |
|
588 else |
|
589 { |
|
590 //if other uri scheme support declared, but not the required one, |
|
591 // even then controller not supported |
|
592 if(aPlugin->SupportedUriSchemes().Count() > 0) |
|
593 { |
|
594 return EFalse; |
|
595 } |
|
596 } |
|
597 |
|
598 |
|
599 //then match Uri extension. . |
|
600 |
|
601 //if ctrl has no network capability, then lowest priority given on matching file extension |
|
602 for (index=0;index<aFormats.Count();index++) |
|
603 { |
|
604 if (aFormats[index]-> SupportsFileExtension(aSelectParams->MatchData())) |
|
605 { |
|
606 if(!suitable) |
|
607 { |
|
608 aPlugin->SetUriPriority(KUriPriorityLow); |
|
609 } |
|
610 else |
|
611 { |
|
612 aPlugin->SetUriPriority(KUriPriorityHigh); |
|
613 } |
|
614 |
|
615 suitable = ETrue; |
|
616 break; |
|
617 } |
|
618 } |
|
619 |
|
620 return suitable; |
|
621 } |
|
622 |
|
623 TInt CMMFControllerPluginSelectionParameters::CheckPreferredSupplierL(RMMFControllerImplInfoArray& aImplementations, const CMMFControllerImplementationInformation& aPlugin) const |
|
624 { |
|
625 // Set the return value to indicated the plugin is not suitable. |
|
626 TBool pluginSuitable = EFalse; |
|
627 TBool needToPlaceInVersionOrder = EFalse; |
|
628 TBool needToPlaceInUriPriorityOrder = EFalse; |
|
629 |
|
630 if((iRequiredPlayFormatSupport && (iRequiredPlayFormatSupport->MatchDataType() == CMMFFormatSelectionParameters::EMatchUri)) |
|
631 || (iRequiredRecordFormatSupport && (iRequiredRecordFormatSupport->MatchDataType() == CMMFFormatSelectionParameters::EMatchUri))) |
|
632 { |
|
633 needToPlaceInUriPriorityOrder = ETrue; |
|
634 } |
|
635 |
|
636 switch (PreferredSupplierMatchType()) |
|
637 { |
|
638 case ENoPreferredSupplierMatch: |
|
639 // No match, so suitable. |
|
640 pluginSuitable = ETrue; |
|
641 break; |
|
642 case EPreferredSupplierPluginsFirstInList: |
|
643 pluginSuitable = ETrue; |
|
644 if (aPlugin.SupportsSupplier(PreferredSupplier())) |
|
645 needToPlaceInVersionOrder = ETrue; |
|
646 break; |
|
647 case EOnlyPreferredSupplierPluginsReturned: |
|
648 if (aPlugin.SupportsSupplier(PreferredSupplier())) |
|
649 { |
|
650 pluginSuitable = ETrue; |
|
651 needToPlaceInVersionOrder = ETrue; |
|
652 } |
|
653 break; |
|
654 default: |
|
655 User::Leave(KErrNotSupported); |
|
656 } |
|
657 |
|
658 TInt arrayPos; |
|
659 |
|
660 if (!pluginSuitable) |
|
661 { |
|
662 arrayPos = -1; |
|
663 } |
|
664 |
|
665 else |
|
666 { |
|
667 if(needToPlaceInUriPriorityOrder) |
|
668 { |
|
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++) |
|
672 { |
|
673 CMMFControllerImplementationInformation* c = aImplementations[i]; |
|
674 |
|
675 if(PreferredSupplierMatchType() == ENoPreferredSupplierMatch) //case 1 |
|
676 { |
|
677 /** |
|
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. |
|
681 */ |
|
682 if (c->UriPriority() < aPlugin.UriPriority()) |
|
683 { |
|
684 arrayPos = i;//plugin will be inserted before c in the array |
|
685 break; |
|
686 } |
|
687 } |
|
688 else |
|
689 { |
|
690 if(!needToPlaceInVersionOrder) //case 2 |
|
691 { |
|
692 /** |
|
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. |
|
697 */ |
|
698 if( (c->Supplier() != PreferredSupplier()) && (c->UriPriority() < aPlugin.UriPriority())) |
|
699 { |
|
700 arrayPos = i;//plugin will be inserted before c in the array |
|
701 break; |
|
702 } |
|
703 } |
|
704 else //case 3 |
|
705 { |
|
706 /** |
|
707 This reflects the case where |
|
708 Supplier matches and EPreferredSupplierPluginsFirstInList is specified. |
|
709 OR |
|
710 Supplier matches and EOnlyPreferredSupplierPluginsReturned is specified. |
|
711 */ |
|
712 if(c->Supplier() == PreferredSupplier()) |
|
713 { |
|
714 if(c->UriPriority() == aPlugin.UriPriority()) |
|
715 { |
|
716 if(c->Version() <= aPlugin.Version()) |
|
717 { |
|
718 arrayPos = i;//plugin will be inserted before c in the array |
|
719 break; |
|
720 } |
|
721 } |
|
722 else |
|
723 { |
|
724 if(c->UriPriority() < aPlugin.UriPriority()) |
|
725 { |
|
726 arrayPos = i;//plugin will be inserted before c in the array |
|
727 break; |
|
728 } |
|
729 } |
|
730 } |
|
731 else |
|
732 { |
|
733 /** |
|
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. |
|
737 */ |
|
738 arrayPos = i;//plugin will be inserted before c in the array |
|
739 break; |
|
740 } |
|
741 } |
|
742 } |
|
743 } |
|
744 } |
|
745 |
|
746 else |
|
747 { |
|
748 if (!needToPlaceInVersionOrder) |
|
749 { |
|
750 /** |
|
751 place it at the end. |
|
752 */ |
|
753 arrayPos = aImplementations.Count(); |
|
754 } |
|
755 else |
|
756 { |
|
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))) |
|
763 { |
|
764 // Put the plugin in version order at the beginning of the list |
|
765 |
|
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++) |
|
770 { |
|
771 CMMFControllerImplementationInformation* c = aImplementations[i]; |
|
772 if (c->Supplier() == aPlugin.Supplier()) |
|
773 { |
|
774 if (c->Version() <= aPlugin.Version()) |
|
775 { |
|
776 arrayPos = i;//plugin will be inserted before c in the array |
|
777 break; |
|
778 } |
|
779 } |
|
780 else |
|
781 { |
|
782 arrayPos = i; //c has wrong supplier so this plugin must go before c |
|
783 break; |
|
784 } |
|
785 } |
|
786 } |
|
787 else |
|
788 { |
|
789 // We can't use the version numbers meaningfully, so just put this plugin |
|
790 // at the top of the list. |
|
791 arrayPos = 0; |
|
792 } |
|
793 } |
|
794 } |
|
795 } |
|
796 |
|
797 return arrayPos; |
|
798 } |
|
799 |
|
800 TBool CMMFControllerPluginSelectionParameters::CheckFormatSupportL(CMMFFormatSelectionParameters* aSelectParams, const RMMFFormatImplInfoArray& aFormats) const |
|
801 { |
|
802 // If aSelectParams are NULL (ie none were set) then the plugin must be suitable! |
|
803 if (aSelectParams == NULL) |
|
804 return ETrue; |
|
805 |
|
806 TBool suitable = EFalse; |
|
807 |
|
808 // Check all the formats in aFormats. If any support the required data type, return ETrue. |
|
809 TInt index; |
|
810 switch (aSelectParams->MatchDataType()) |
|
811 { |
|
812 case CMMFFormatSelectionParameters::EMatchAny: |
|
813 // All plugins intrinsically match this! |
|
814 suitable = ETrue; |
|
815 break; |
|
816 case CMMFFormatSelectionParameters::EMatchFileExtension: |
|
817 for (index=0;index<aFormats.Count();index++) |
|
818 { |
|
819 if (aFormats[index]->SupportsFileExtension(aSelectParams->MatchData())) |
|
820 { |
|
821 suitable = ETrue; |
|
822 break; |
|
823 } |
|
824 } |
|
825 break; |
|
826 case CMMFFormatSelectionParameters::EMatchMimeType: |
|
827 for (index=0;index<aFormats.Count();index++) |
|
828 { |
|
829 if (aFormats[index]->SupportsMimeType(aSelectParams->MatchData())) |
|
830 { |
|
831 suitable = ETrue; |
|
832 break; |
|
833 } |
|
834 } |
|
835 break; |
|
836 case CMMFFormatSelectionParameters::EMatchHeaderData: |
|
837 for (index=0;index<aFormats.Count();index++) |
|
838 { |
|
839 if (aFormats[index]->SupportsHeaderDataL(aSelectParams->MatchData())) |
|
840 { |
|
841 suitable = ETrue; |
|
842 break; |
|
843 } |
|
844 } |
|
845 break; |
|
846 |
|
847 case CMMFFormatSelectionParameters::EMatchUri: |
|
848 { |
|
849 suitable = ETrue; //if uri match specifically looked , then that has been already matched in a CheckUriSupport() |
|
850 break; |
|
851 } |
|
852 |
|
853 |
|
854 default: |
|
855 User::Leave(KErrNotSupported); |
|
856 }; |
|
857 |
|
858 return suitable; |
|
859 } |
|
860 |
|
861 |
|
862 |
|
863 EXPORT_C CMMFControllerSecureDrmPluginSelectionParameters* CMMFControllerSecureDrmPluginSelectionParameters::NewL() |
|
864 { |
|
865 CMMFControllerSecureDrmPluginSelectionParameters* s = CMMFControllerSecureDrmPluginSelectionParameters::NewLC(); |
|
866 CleanupStack::Pop(s); |
|
867 return s; |
|
868 } |
|
869 |
|
870 EXPORT_C CMMFControllerSecureDrmPluginSelectionParameters* CMMFControllerSecureDrmPluginSelectionParameters::NewLC() |
|
871 { |
|
872 CMMFControllerSecureDrmPluginSelectionParameters* s = new(ELeave) CMMFControllerSecureDrmPluginSelectionParameters; |
|
873 CleanupStack::PushL(s); |
|
874 return s; |
|
875 } |
|
876 |
|
877 CMMFControllerSecureDrmPluginSelectionParameters::CMMFControllerSecureDrmPluginSelectionParameters() : |
|
878 CMMFControllerPluginSelectionParameters() |
|
879 { |
|
880 } |
|
881 |
|
882 EXPORT_C void CMMFControllerSecureDrmPluginSelectionParameters::ListImplementationsL(RMMFControllerImplInfoArray& aImplementations) const |
|
883 { |
|
884 CMMFControllerPluginSelectionParameters::ListImplementationsL(aImplementations); |
|
885 TInt pluginsCount = aImplementations.Count(); |
|
886 for (TInt i = pluginsCount - 1; i >= 0; i--) |
|
887 { |
|
888 CMMFControllerImplementationInformation* c = aImplementations[i]; |
|
889 if (!c->SupportsSecureDRMProcessMode()) |
|
890 { |
|
891 aImplementations.Remove(i); |
|
892 delete c; |
|
893 } |
|
894 } |
|
895 aImplementations.Compress(); |
|
896 } |
|
897 |
|
898 |
|
899 |
|
900 CMMFFormatPluginSelectionParameters::CMMFFormatPluginSelectionParameters(TUid aInterfaceUid) : |
|
901 CMMFPluginSelectionParameters(aInterfaceUid) |
|
902 { |
|
903 } |
|
904 |
|
905 CMMFFormatPluginSelectionParameters::~CMMFFormatPluginSelectionParameters() |
|
906 { |
|
907 delete iRequiredFormatSupport; |
|
908 } |
|
909 |
|
910 EXPORT_C void CMMFFormatPluginSelectionParameters::SetRequiredFormatSupportL(const CMMFFormatSelectionParameters& aRequiredSupport) |
|
911 { |
|
912 delete iRequiredFormatSupport; |
|
913 iRequiredFormatSupport = NULL; |
|
914 iRequiredFormatSupport = CMMFFormatSelectionParameters::NewL(aRequiredSupport); |
|
915 } |
|
916 |
|
917 EXPORT_C void CMMFFormatPluginSelectionParameters::ListImplementationsL(RMMFFormatImplInfoArray& aImplementations) const |
|
918 { |
|
919 aImplementations.ResetAndDestroy(); |
|
920 |
|
921 RImplInfoPtrArray ecomArray; |
|
922 CleanupResetAndDestroyPushL(ecomArray); |
|
923 |
|
924 MmPluginUtils::FindImplementationsL(InterfaceUid(), ecomArray); |
|
925 |
|
926 |
|
927 TInt index; |
|
928 // Create Format Implementation Information for each entry |
|
929 for (index=0; index<ecomArray.Count(); index++) |
|
930 { |
|
931 CMMFFormatImplementationInformation* c = NULL; |
|
932 TRAPD(error, c = CMMFFormatImplementationInformation::NewL(*(ecomArray[index]))); |
|
933 |
|
934 if (error == KErrNone) |
|
935 { |
|
936 CleanupStack::PushL(c); |
|
937 // Find out whether this format matches the client's requirements... |
|
938 TInt arrayPos; |
|
939 MatchImplementationToSelectParamsL(aImplementations, *c, arrayPos); |
|
940 if (arrayPos >=0) |
|
941 { |
|
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); |
|
945 } |
|
946 else |
|
947 { |
|
948 // This plugin isn't suitable so just destroy it |
|
949 CleanupStack::PopAndDestroy(c); |
|
950 } |
|
951 } |
|
952 else if (error != KErrCorrupt) |
|
953 { |
|
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 |
|
956 User::Leave(error); |
|
957 } |
|
958 } |
|
959 |
|
960 CleanupStack::PopAndDestroy();//ecomArray |
|
961 } |
|
962 |
|
963 void CMMFFormatPluginSelectionParameters::MatchImplementationToSelectParamsL(RMMFFormatImplInfoArray& aImplementations, const CMMFFormatImplementationInformation& aPlugin, TInt& aArrayPos) const |
|
964 { |
|
965 TBool suitable = EFalse; |
|
966 |
|
967 // First, check whether the plugin supports the required play formats |
|
968 suitable = CheckFormatSupportL(aPlugin); |
|
969 |
|
970 // Next, check for correct media id support |
|
971 if (suitable) |
|
972 suitable = CheckMediaIdSupportL(aPlugin); |
|
973 |
|
974 // Finally, calculate the position the plugin should take in aImplementations depending on the preferred supplier and version number. |
|
975 if (suitable) |
|
976 aArrayPos = CheckPreferredSupplierL(aImplementations, aPlugin); |
|
977 else |
|
978 aArrayPos = -1; |
|
979 } |
|
980 |
|
981 TInt CMMFFormatPluginSelectionParameters::CheckPreferredSupplierL(RMMFFormatImplInfoArray& aImplementations, const CMMFFormatImplementationInformation& aPlugin) const |
|
982 { |
|
983 // Set the return value to indicated the plugin is not suitable. |
|
984 TBool pluginSuitable = EFalse; |
|
985 TBool needToPlaceInVersionOrder = EFalse; |
|
986 |
|
987 switch (PreferredSupplierMatchType()) |
|
988 { |
|
989 case ENoPreferredSupplierMatch: |
|
990 // No match, so suitable. |
|
991 pluginSuitable = ETrue; |
|
992 break; |
|
993 case EPreferredSupplierPluginsFirstInList: |
|
994 pluginSuitable = ETrue; |
|
995 if (aPlugin.SupportsSupplier(PreferredSupplier())) |
|
996 needToPlaceInVersionOrder = ETrue; |
|
997 break; |
|
998 case EOnlyPreferredSupplierPluginsReturned: |
|
999 if (aPlugin.SupportsSupplier(PreferredSupplier())) |
|
1000 { |
|
1001 pluginSuitable = ETrue; |
|
1002 needToPlaceInVersionOrder = ETrue; |
|
1003 } |
|
1004 break; |
|
1005 default: |
|
1006 User::Leave(KErrNotSupported); |
|
1007 } |
|
1008 |
|
1009 |
|
1010 TInt arrayPos; |
|
1011 |
|
1012 if (!pluginSuitable) |
|
1013 { |
|
1014 arrayPos = -1; |
|
1015 } |
|
1016 else |
|
1017 { |
|
1018 if (!needToPlaceInVersionOrder) |
|
1019 { |
|
1020 arrayPos = aImplementations.Count(); |
|
1021 } |
|
1022 else |
|
1023 { |
|
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)) |
|
1029 { |
|
1030 // Put the plugin in version order at the beginning of the list |
|
1031 |
|
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++) |
|
1036 { |
|
1037 CMMFFormatImplementationInformation* c = aImplementations[i]; |
|
1038 if ((c->Supplier() == aPlugin.Supplier()) |
|
1039 && (c->Version() <= aPlugin.Version())) |
|
1040 { |
|
1041 arrayPos = i;//plugin will be inserted before c in the array |
|
1042 break; |
|
1043 } |
|
1044 } |
|
1045 } |
|
1046 else |
|
1047 { |
|
1048 // We can't use the version numbers meaningfully, so just put this plugin |
|
1049 // at the top of the list. |
|
1050 arrayPos = 0; |
|
1051 } |
|
1052 } |
|
1053 } |
|
1054 return arrayPos; |
|
1055 } |
|
1056 |
|
1057 TBool CMMFFormatPluginSelectionParameters::CheckFormatSupportL(const CMMFFormatImplementationInformation& aPlugin) const |
|
1058 { |
|
1059 // If iRequiredFormatSupport is NULL (ie no requirements set) then the plugin must be suitable! |
|
1060 if (iRequiredFormatSupport == NULL) |
|
1061 return ETrue; |
|
1062 |
|
1063 TBool suitable = EFalse; |
|
1064 |
|
1065 switch (iRequiredFormatSupport->MatchDataType()) |
|
1066 { |
|
1067 case CMMFFormatSelectionParameters::EMatchAny: |
|
1068 suitable = ETrue; |
|
1069 break; |
|
1070 case CMMFFormatSelectionParameters::EMatchFileExtension: |
|
1071 if (aPlugin.SupportsFileExtension(iRequiredFormatSupport->MatchData())) |
|
1072 suitable = ETrue; |
|
1073 break; |
|
1074 case CMMFFormatSelectionParameters::EMatchMimeType: |
|
1075 if (aPlugin.SupportsMimeType(iRequiredFormatSupport->MatchData())) |
|
1076 suitable = ETrue; |
|
1077 break; |
|
1078 case CMMFFormatSelectionParameters::EMatchHeaderData: |
|
1079 if (aPlugin.SupportsHeaderDataL(iRequiredFormatSupport->MatchData())) |
|
1080 suitable = ETrue; |
|
1081 break; |
|
1082 default: |
|
1083 User::Leave(KErrNotSupported); |
|
1084 }; |
|
1085 |
|
1086 return suitable; |
|
1087 } |
|
1088 |
|
1089 |
|
1090 EXPORT_C CMMFFormatEncodePluginSelectionParameters* CMMFFormatEncodePluginSelectionParameters::NewL() |
|
1091 { |
|
1092 CMMFFormatEncodePluginSelectionParameters* s = CMMFFormatEncodePluginSelectionParameters::NewLC(); |
|
1093 CleanupStack::Pop(s); |
|
1094 return s; |
|
1095 } |
|
1096 |
|
1097 EXPORT_C CMMFFormatEncodePluginSelectionParameters* CMMFFormatEncodePluginSelectionParameters::NewLC() |
|
1098 { |
|
1099 CMMFFormatEncodePluginSelectionParameters* s = new(ELeave) CMMFFormatEncodePluginSelectionParameters; |
|
1100 CleanupStack::PushL(s); |
|
1101 return s; |
|
1102 } |
|
1103 |
|
1104 CMMFFormatEncodePluginSelectionParameters::CMMFFormatEncodePluginSelectionParameters() : |
|
1105 CMMFFormatPluginSelectionParameters(KUidInterfaceFormatEncode) |
|
1106 { |
|
1107 } |
|
1108 |
|
1109 |
|
1110 EXPORT_C CMMFFormatDecodePluginSelectionParameters* CMMFFormatDecodePluginSelectionParameters::NewL() |
|
1111 { |
|
1112 CMMFFormatDecodePluginSelectionParameters* s = CMMFFormatDecodePluginSelectionParameters::NewLC(); |
|
1113 CleanupStack::Pop(s); |
|
1114 return s; |
|
1115 } |
|
1116 |
|
1117 EXPORT_C CMMFFormatDecodePluginSelectionParameters* CMMFFormatDecodePluginSelectionParameters::NewLC() |
|
1118 { |
|
1119 CMMFFormatDecodePluginSelectionParameters* s = new(ELeave) CMMFFormatDecodePluginSelectionParameters; |
|
1120 CleanupStack::PushL(s); |
|
1121 return s; |
|
1122 } |
|
1123 |
|
1124 CMMFFormatDecodePluginSelectionParameters::CMMFFormatDecodePluginSelectionParameters() : |
|
1125 CMMFFormatPluginSelectionParameters(KUidInterfaceFormatDecode) |
|
1126 { |
|
1127 } |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 void TaggedDataParser::ParseTaggedDataL(const TDesC8& aData, MTaggedDataParserClient& aClient) |
|
1134 { |
|
1135 TPtrC8 data(aData); |
|
1136 TInt readPosition = 0; |
|
1137 TBool moreData = data.Length() ? ETrue : EFalse; |
|
1138 while (moreData) |
|
1139 { |
|
1140 // Assumes that this segment will begin with a tag |
|
1141 TPtrC8 restOfData = data.Mid(readPosition); |
|
1142 |
|
1143 TInt endPos = restOfData.MatchF(KTagMatch); |
|
1144 if (endPos == KErrNotFound) |
|
1145 User::Leave(KErrCorrupt); |
|
1146 |
|
1147 // extract the tag |
|
1148 TPtrC8 tag = restOfData.Left(KTagLength); |
|
1149 |
|
1150 |
|
1151 readPosition += KTagLength; |
|
1152 |
|
1153 // Find the next tag |
|
1154 restOfData.Set(data.Mid(readPosition)); |
|
1155 endPos = restOfData.MatchF(KTagMatch); |
|
1156 |
|
1157 TPtrC8 tagData; |
|
1158 if (endPos == KErrNotFound) |
|
1159 { |
|
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(); |
|
1163 moreData = EFalse; |
|
1164 } |
|
1165 else |
|
1166 { |
|
1167 tagData.Set(restOfData.Left(endPos)); |
|
1168 readPosition += endPos; |
|
1169 } |
|
1170 |
|
1171 aClient.ProcessTaggedDataL(tag, tagData); |
|
1172 } |
|
1173 } |
|
1174 |
|
1175 void TaggedDataParser::ConvertTextToUidL(const TDesC8& aData, TUid& aUid) |
|
1176 { |
|
1177 // Make sure aData is in the correct format - "0x12345678" |
|
1178 _LIT8(K0x, "0x"); |
|
1179 _LIT8(K0X, "0X"); |
|
1180 if ((aData.Length() == 10) && ((aData.FindF(K0x) == 0) || (aData.FindF(K0X) == 0))) |
|
1181 { |
|
1182 // only take the right 8 characters (ie discard the "0x") |
|
1183 TLex8 lex(aData.Right(8)); |
|
1184 TUint32 value = 0; |
|
1185 User::LeaveIfError(lex.Val(value, EHex)); |
|
1186 aUid.iUid = value; |
|
1187 } |
|
1188 else |
|
1189 User::Leave(KErrCorrupt); |
|
1190 } |
|
1191 |
|
1192 |
|
1193 void TaggedDataParser::ConvertTextToTUintL(const TDesC8& aData, TUint& aUint) |
|
1194 { |
|
1195 // Determine whether hex or decimal then parse as such |
|
1196 _LIT8(K0x, "0x"); |
|
1197 _LIT8(K0X, "0X"); |
|
1198 if (((aData.FindF(K0x) == 0) || (aData.FindF(K0X) == 0)) && (aData.Length() >= 3)) |
|
1199 { |
|
1200 // only take the characters after "0x" |
|
1201 TLex8 lex(aData.Right(aData.Length()-2)); |
|
1202 TUint32 value = 0; |
|
1203 User::LeaveIfError(lex.Val(value, EHex)); |
|
1204 aUint = value; |
|
1205 } |
|
1206 else if (aData.Length() > 0) |
|
1207 { |
|
1208 TLex8 lex(aData.Right(aData.Length())); |
|
1209 TUint32 value = 0; |
|
1210 User::LeaveIfError(lex.Val(value, EDecimal)); |
|
1211 aUint = value; |
|
1212 } |
|
1213 else |
|
1214 User::Leave(KErrCorrupt); |
|
1215 } |
|
1216 |
|
1217 |
|
1218 EXPORT_C TBool CMMFPluginImplementationInformation::SupportsSupplier(const TDesC& aSupplier) const |
|
1219 { |
|
1220 if (iSupplier) |
|
1221 { |
|
1222 if (aSupplier.CompareF(*iSupplier) == KErrNone) |
|
1223 return ETrue; |
|
1224 } |
|
1225 return EFalse; |
|
1226 } |
|
1227 |
|
1228 EXPORT_C TBool CMMFPluginImplementationInformation::SupportsMediaId(TUid aMediaId) const |
|
1229 { |
|
1230 TInt location = iMediaIds.Find(aMediaId); |
|
1231 return (location != KErrNotFound); |
|
1232 } |
|
1233 |
|
1234 EXPORT_C TUid CMMFPluginImplementationInformation::Uid() const |
|
1235 { |
|
1236 return iUid; |
|
1237 } |
|
1238 |
|
1239 EXPORT_C const TDesC& CMMFPluginImplementationInformation::DisplayName() const |
|
1240 { |
|
1241 if (iDisplayName) |
|
1242 return *iDisplayName; |
|
1243 else |
|
1244 return KNullDesC; |
|
1245 } |
|
1246 |
|
1247 EXPORT_C const TDesC& CMMFPluginImplementationInformation::Supplier() const |
|
1248 { |
|
1249 if (iSupplier) |
|
1250 return *iSupplier; |
|
1251 else |
|
1252 return KNullDesC; |
|
1253 } |
|
1254 |
|
1255 EXPORT_C TInt CMMFPluginImplementationInformation::Version() const |
|
1256 { |
|
1257 return iVersion; |
|
1258 } |
|
1259 |
|
1260 EXPORT_C const RArray<TUid>& CMMFPluginImplementationInformation::SupportedMediaIds() const |
|
1261 { |
|
1262 return iMediaIds; |
|
1263 } |
|
1264 |
|
1265 CMMFPluginImplementationInformation::~CMMFPluginImplementationInformation() |
|
1266 { |
|
1267 delete iDisplayName; |
|
1268 delete iSupplier; |
|
1269 iMediaIds.Close(); |
|
1270 } |
|
1271 |
|
1272 |
|
1273 CMMFPluginImplementationInformation::CMMFPluginImplementationInformation() |
|
1274 { |
|
1275 } |
|
1276 |
|
1277 void CMMFPluginImplementationInformation::SetSupplierL(const TDesC8& aData) |
|
1278 { |
|
1279 delete iSupplier; |
|
1280 iSupplier = NULL; |
|
1281 // Convert aData to unicode... |
|
1282 iSupplier = HBufC::NewL(aData.Length()); |
|
1283 TPtr ptr = iSupplier->Des(); |
|
1284 User::LeaveIfError(CnvUtfConverter::ConvertToUnicodeFromUtf8(ptr, aData)); |
|
1285 } |
|
1286 |
|
1287 void CMMFPluginImplementationInformation::AddMediaIdL(const TDesC8& aData) |
|
1288 { |
|
1289 TUid mediaId; |
|
1290 TaggedDataParser::ConvertTextToUidL(aData, mediaId); |
|
1291 User::LeaveIfError(iMediaIds.Append(mediaId)); |
|
1292 } |
|
1293 |
|
1294 CMMFControllerImplementationInformation* CMMFControllerImplementationInformation::NewL(const CImplementationInformation& aImplInfo) |
|
1295 { |
|
1296 CMMFControllerImplementationInformation* s = CMMFControllerImplementationInformation::NewLC(aImplInfo); |
|
1297 CleanupStack::Pop(s); |
|
1298 return s; |
|
1299 } |
|
1300 |
|
1301 CMMFControllerImplementationInformation* CMMFControllerImplementationInformation::NewLC(const CImplementationInformation& aImplInfo) |
|
1302 { |
|
1303 CMMFControllerImplementationInformation* s = new(ELeave) CMMFControllerImplementationInformation; |
|
1304 CleanupStack::PushL(s); |
|
1305 s->ConstructL(aImplInfo); |
|
1306 return s; |
|
1307 } |
|
1308 |
|
1309 EXPORT_C CMMFControllerImplementationInformation* CMMFControllerImplementationInformation::NewL(TUid aUid) |
|
1310 { |
|
1311 RImplInfoPtrArray ecomArray; |
|
1312 CleanupResetAndDestroyPushL(ecomArray); |
|
1313 |
|
1314 MmPluginUtils::FindImplementationsL(KUidInterfaceMMFController, ecomArray); |
|
1315 |
|
1316 TInt index; |
|
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++) |
|
1320 { |
|
1321 if (ecomArray[index] == NULL) |
|
1322 { |
|
1323 User::Leave(KErrNoMemory); |
|
1324 } |
|
1325 |
|
1326 if (ecomArray[index]->ImplementationUid()==aUid) |
|
1327 { |
|
1328 // Create the impl info object, and get the play and record formats supported by the plugin |
|
1329 controller = CMMFControllerImplementationInformation::NewL(*(ecomArray[index])); |
|
1330 |
|
1331 CleanupStack::PushL(controller); // INC023207 - Placed controller on CleanupStack |
|
1332 controller->GetPlayFormatsL(); |
|
1333 controller->GetRecordFormatsL(); // INC023207 |
|
1334 CleanupStack::Pop(); |
|
1335 } |
|
1336 } |
|
1337 |
|
1338 if (controller == NULL) |
|
1339 { |
|
1340 User::Leave(KErrNotFound); |
|
1341 } |
|
1342 |
|
1343 CleanupStack::PopAndDestroy(); // ecomArray |
|
1344 return controller; |
|
1345 } |
|
1346 |
|
1347 EXPORT_C const RMMFFormatImplInfoArray& CMMFControllerImplementationInformation::PlayFormats() const |
|
1348 { |
|
1349 return iPlayFormats; |
|
1350 } |
|
1351 |
|
1352 EXPORT_C const RMMFFormatImplInfoArray& CMMFControllerImplementationInformation::RecordFormats() const |
|
1353 { |
|
1354 return iRecordFormats; |
|
1355 } |
|
1356 |
|
1357 |
|
1358 EXPORT_C TUint CMMFControllerImplementationInformation::HeapSpaceRequired() const |
|
1359 { |
|
1360 return iHeapSpaceRequired; |
|
1361 } |
|
1362 |
|
1363 EXPORT_C TUint CMMFControllerImplementationInformation::StackSize() const |
|
1364 { |
|
1365 return iStackSize; |
|
1366 } |
|
1367 /** |
|
1368 @publishedPartner |
|
1369 @prototype |
|
1370 |
|
1371 Returns the uri schemes of this plugin. |
|
1372 |
|
1373 @return The array of uri schemes. |
|
1374 */ |
|
1375 EXPORT_C const CDesC8Array& CMMFControllerImplementationInformation::SupportedUriSchemes() const |
|
1376 { |
|
1377 return *iUriSchemes; |
|
1378 } |
|
1379 |
|
1380 /** |
|
1381 @publishedPartner |
|
1382 @prototype |
|
1383 |
|
1384 Tests whether the plugin supports aUriScheme. |
|
1385 |
|
1386 @param aUriScheme |
|
1387 The required Uri Scheme. |
|
1388 |
|
1389 @return A boolean indicating if the plugin supports aUriScheme. ETrue if this plugin supports aUriScheme, EFalse if not. |
|
1390 */ |
|
1391 EXPORT_C TBool CMMFControllerImplementationInformation::SupportsUriScheme(const TDesC8& aUriScheme) const |
|
1392 { |
|
1393 TInt position; |
|
1394 TInt error = iUriSchemes->FindIsq(aUriScheme, position, ECmpFolded); |
|
1395 return (error==KErrNone); |
|
1396 } |
|
1397 |
|
1398 /** |
|
1399 @publishedPartner |
|
1400 @prototype |
|
1401 |
|
1402 Sets the uri priority of this controller |
|
1403 |
|
1404 @param aUriPriority |
|
1405 The Uri priority to be assigned. |
|
1406 */ |
|
1407 EXPORT_C void CMMFControllerImplementationInformation::SetUriPriority(TInt aUriPriority) |
|
1408 { |
|
1409 iUriPriority = aUriPriority; |
|
1410 } |
|
1411 |
|
1412 /** |
|
1413 @publishedPartner |
|
1414 @prototype |
|
1415 |
|
1416 Retrieves the uri priority of this controller |
|
1417 |
|
1418 @return The assigned Uri priority. |
|
1419 */ |
|
1420 EXPORT_C TInt CMMFControllerImplementationInformation::UriPriority() const |
|
1421 { |
|
1422 return iUriPriority; |
|
1423 } |
|
1424 |
|
1425 /** |
|
1426 @publishedPartner |
|
1427 @prototype |
|
1428 |
|
1429 Tests whether the controller plugin supports url |
|
1430 |
|
1431 @return A boolean indicating if the plugin supports url. ETrue for uri supporting controller, EFalse if not. |
|
1432 */ |
|
1433 EXPORT_C TBool CMMFControllerImplementationInformation::SupportsNetworkCapability() const |
|
1434 { |
|
1435 return iIsNetworkCtrl; |
|
1436 } |
|
1437 |
|
1438 /** |
|
1439 @publishedPartner |
|
1440 @prototype |
|
1441 |
|
1442 Check whether the controller plugin supports secure DRM process mode |
|
1443 |
|
1444 @return A boolean indicating if the plugin supports secure DRM process mode. |
|
1445 */ |
|
1446 EXPORT_C TBool CMMFControllerImplementationInformation::SupportsSecureDRMProcessMode() const |
|
1447 { |
|
1448 return iSupportsSecureDRMProcessMode; |
|
1449 } |
|
1450 |
|
1451 CMMFControllerImplementationInformation::CMMFControllerImplementationInformation() |
|
1452 { |
|
1453 iUriPriority = KUriPriorityNone; |
|
1454 iIsNetworkCtrl = ETrue; |
|
1455 iPlayFormatCollectionUid = KNullUid; |
|
1456 iRecordFormatCollectionUid = KNullUid; |
|
1457 iHeapSpaceRequired = KMMFDefaultControllerThreadHeapSize; |
|
1458 iSupportsSecureDRMProcessMode = EFalse; |
|
1459 iStackSize = KDefaultStackSize; |
|
1460 } |
|
1461 |
|
1462 void CMMFControllerImplementationInformation::ConstructL(const CImplementationInformation& aImplInfo) |
|
1463 { |
|
1464 iUriSchemes = new(ELeave) CDesC8ArrayFlat(KDesCArrayGranularity); |
|
1465 iUid = aImplInfo.ImplementationUid(); |
|
1466 iDisplayName = aImplInfo.DisplayName().AllocL(); |
|
1467 iVersion = aImplInfo.Version(); |
|
1468 |
|
1469 // Parse the opaque data... |
|
1470 TaggedDataParser::ParseTaggedDataL(aImplInfo.OpaqueData(), *this); |
|
1471 } |
|
1472 |
|
1473 void CMMFControllerImplementationInformation::ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aData) |
|
1474 { |
|
1475 if (aTag==KSupplier) |
|
1476 { |
|
1477 SetSupplierL(aData); |
|
1478 } |
|
1479 else if (aTag==KMediaId) |
|
1480 { |
|
1481 AddMediaIdL(aData); |
|
1482 } |
|
1483 else if (aTag==KUriScheme) |
|
1484 { |
|
1485 SetUriSchemeL(aData); |
|
1486 } |
|
1487 else if (aTag==KNonNetwork) |
|
1488 { |
|
1489 SetNetworkCapabilityL(aData); |
|
1490 } |
|
1491 else if (aTag==KPlayFormatCollectionUid) |
|
1492 { |
|
1493 SetPlayFormatCollectionUidL(aData); |
|
1494 } |
|
1495 else if (aTag==KRecordFormatCollectionUid) |
|
1496 { |
|
1497 SetRecordFormatCollectionUidL(aData); |
|
1498 } |
|
1499 else if(aTag==KHeapSize) |
|
1500 { |
|
1501 SetHeapSizeL(aData); |
|
1502 } |
|
1503 else if (aTag==KSecureDRMProcessMode) |
|
1504 { |
|
1505 iSupportsSecureDRMProcessMode = ETrue; |
|
1506 } |
|
1507 else if (aTag==KStackSize) |
|
1508 { |
|
1509 SetStackSizeL(aData); |
|
1510 } |
|
1511 else |
|
1512 { |
|
1513 User::Leave(KErrCorrupt); |
|
1514 } |
|
1515 } |
|
1516 |
|
1517 |
|
1518 CMMFControllerImplementationInformation::~CMMFControllerImplementationInformation() |
|
1519 { |
|
1520 iPlayFormats.ResetAndDestroy(); |
|
1521 iRecordFormats.ResetAndDestroy(); |
|
1522 delete iUriSchemes; |
|
1523 } |
|
1524 |
|
1525 |
|
1526 void CMMFControllerImplementationInformation::SetPlayFormatCollectionUidL(const TDesC8& aData) |
|
1527 { |
|
1528 TaggedDataParser::ConvertTextToUidL(aData, iPlayFormatCollectionUid); |
|
1529 } |
|
1530 |
|
1531 void CMMFControllerImplementationInformation::SetRecordFormatCollectionUidL(const TDesC8& aData) |
|
1532 { |
|
1533 TaggedDataParser::ConvertTextToUidL(aData, iRecordFormatCollectionUid); |
|
1534 } |
|
1535 |
|
1536 void CMMFControllerImplementationInformation::SetHeapSizeL(const TDesC8& aData) |
|
1537 { |
|
1538 TaggedDataParser::ConvertTextToTUintL(aData, iHeapSpaceRequired); |
|
1539 } |
|
1540 |
|
1541 void CMMFControllerImplementationInformation::SetStackSizeL(const TDesC8& aData) |
|
1542 { |
|
1543 TaggedDataParser::ConvertTextToTUintL(aData, iStackSize); |
|
1544 } |
|
1545 |
|
1546 |
|
1547 void CMMFControllerImplementationInformation::AddFormatsSwallowCorruptL(RImplInfoPtrArray& aEcomArray, RMMFFormatImplInfoArray& aFormatArray) |
|
1548 { |
|
1549 for (TInt index=0; index<aEcomArray.Count(); index++) |
|
1550 { |
|
1551 CMMFFormatImplementationInformation* c = NULL; |
|
1552 TRAPD(error, c = CMMFFormatImplementationInformation::NewL(*(aEcomArray[index]))); |
|
1553 if (error==KErrNone) |
|
1554 { |
|
1555 CleanupStack::PushL(c); |
|
1556 User::LeaveIfError(aFormatArray.Append(c)); |
|
1557 CleanupStack::Pop(c); |
|
1558 } |
|
1559 else if (error != KErrCorrupt)// make sure we don't leave because of a corrupt resource file |
|
1560 User::Leave(error); |
|
1561 } |
|
1562 } |
|
1563 |
|
1564 |
|
1565 void CMMFControllerImplementationInformation::GetFormatsL(TUid aFormatCollectionUid, TUid aFormatPluginCollectionUid, RMMFFormatImplInfoArray& aFormatArray) |
|
1566 { |
|
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) |
|
1571 { |
|
1572 MmPluginUtils::FindImplementationsL(aFormatCollectionUid, ecomArray); |
|
1573 // Create format implementation information for each entry |
|
1574 AddFormatsSwallowCorruptL(ecomArray, aFormatArray); |
|
1575 } |
|
1576 |
|
1577 // Now get all the format plugins attached to this controller |
|
1578 |
|
1579 // Create a descriptor and fill it with the uid of this controller plugin |
|
1580 TBuf8<10> controllerUid; |
|
1581 _LIT8(K0x, "0x"); |
|
1582 controllerUid.Append(K0x); |
|
1583 controllerUid.AppendNumFixedWidth(iUid.iUid, EHex, 8); |
|
1584 |
|
1585 MmPluginUtils::FindImplementationsL(aFormatPluginCollectionUid, ecomArray, controllerUid); |
|
1586 // Create format implementation information for each entry |
|
1587 AddFormatsSwallowCorruptL(ecomArray, aFormatArray); |
|
1588 |
|
1589 CleanupStack::PopAndDestroy();//ecomArray |
|
1590 } |
|
1591 |
|
1592 void CMMFControllerImplementationInformation::GetPlayFormatsL() |
|
1593 { |
|
1594 GetFormatsL(iPlayFormatCollectionUid, KUidInterfaceFormatDecode, iPlayFormats); |
|
1595 } |
|
1596 |
|
1597 void CMMFControllerImplementationInformation::GetRecordFormatsL() |
|
1598 { |
|
1599 GetFormatsL(iRecordFormatCollectionUid, KUidInterfaceFormatEncode, iRecordFormats); |
|
1600 } |
|
1601 |
|
1602 /** |
|
1603 Sets the Uri Scheme found in opaque data |
|
1604 |
|
1605 @param aUriScheme |
|
1606 Gives the uri scheme supported by the controller |
|
1607 */ |
|
1608 void CMMFControllerImplementationInformation::SetUriSchemeL(const TDesC8& aUriScheme) |
|
1609 { |
|
1610 //If No uri support already declared in the resource file, |
|
1611 //then mentioning a particular schema support is illegal |
|
1612 if(!iIsNetworkCtrl) |
|
1613 { |
|
1614 User::Leave(KErrArgument); |
|
1615 } |
|
1616 |
|
1617 // Insert the new uri scheme into the array |
|
1618 iUriSchemes->InsertIsqL(aUriScheme, ECmpFolded);//ensures there are no repeated entries |
|
1619 } |
|
1620 |
|
1621 /** |
|
1622 Sets the Network capability found in opaque data |
|
1623 |
|
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 |
|
1627 */ |
|
1628 void CMMFControllerImplementationInformation::SetNetworkCapabilityL(const TDesC8& aNetworkCapable) |
|
1629 { |
|
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) |
|
1633 { |
|
1634 User::Leave(KErrArgument); |
|
1635 } |
|
1636 |
|
1637 if (aNetworkCapable.CompareF(KTagYes) == KErrNone) |
|
1638 { |
|
1639 iIsNetworkCtrl = EFalse; |
|
1640 } |
|
1641 else |
|
1642 { |
|
1643 User::Leave(KErrBadName); // will leave if aNetworkCapable is anything other than 'yes'. |
|
1644 } |
|
1645 } |
|
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 CMMFFormatImplementationInformation* CMMFFormatImplementationInformation::NewL(const CImplementationInformation& aImplInfo) |
|
1651 { |
|
1652 CMMFFormatImplementationInformation* s = CMMFFormatImplementationInformation::NewLC(aImplInfo); |
|
1653 CleanupStack::Pop(s); |
|
1654 return s; |
|
1655 } |
|
1656 |
|
1657 CMMFFormatImplementationInformation* CMMFFormatImplementationInformation::NewLC(const CImplementationInformation& aImplInfo) |
|
1658 { |
|
1659 CMMFFormatImplementationInformation* s = new(ELeave) CMMFFormatImplementationInformation(); |
|
1660 CleanupStack::PushL(s); |
|
1661 s->ConstructL(aImplInfo); |
|
1662 return s; |
|
1663 } |
|
1664 |
|
1665 CMMFFormatImplementationInformation::CMMFFormatImplementationInformation() |
|
1666 { |
|
1667 } |
|
1668 |
|
1669 void CMMFFormatImplementationInformation::ConstructL(const CImplementationInformation& aImplInfo) |
|
1670 { |
|
1671 iUid = aImplInfo.ImplementationUid(); |
|
1672 iDisplayName = aImplInfo.DisplayName().AllocL(); |
|
1673 |
|
1674 iBody = CMMFFormatImplementationInformation::CBody::NewL(); |
|
1675 |
|
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); |
|
1679 } |
|
1680 |
|
1681 void CMMFFormatImplementationInformation::ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aTagData) |
|
1682 { |
|
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); |
|
1695 else |
|
1696 User::Leave(KErrCorrupt); |
|
1697 } |
|
1698 |
|
1699 void CMMFFormatImplementationInformation::AddFileExtensionL(const TDesC8& aData) |
|
1700 { |
|
1701 iBody->AddFileExtensionL(aData); |
|
1702 } |
|
1703 |
|
1704 void CMMFFormatImplementationInformation::AddMimeTypeL(const TDesC8& aData) |
|
1705 { |
|
1706 iBody->AddMimeTypeL(aData); |
|
1707 } |
|
1708 |
|
1709 void CMMFFormatImplementationInformation::AddHeaderDataL(const TDesC8& aData) |
|
1710 { |
|
1711 iBody->AddHeaderDataL(aData); |
|
1712 } |
|
1713 |
|
1714 CMMFFormatImplementationInformation::~CMMFFormatImplementationInformation() |
|
1715 { |
|
1716 delete iBody; |
|
1717 } |
|
1718 |
|
1719 EXPORT_C const CDesC8Array& CMMFFormatImplementationInformation::SupportedFileExtensions() const |
|
1720 { |
|
1721 return iBody->SupportedFileExtensions(); |
|
1722 } |
|
1723 |
|
1724 EXPORT_C const CDesC8Array& CMMFFormatImplementationInformation::SupportedMimeTypes() const |
|
1725 { |
|
1726 return iBody->SupportedMimeTypes(); |
|
1727 } |
|
1728 |
|
1729 EXPORT_C const CDesC8Array& CMMFFormatImplementationInformation::SupportedHeaderData() const |
|
1730 { |
|
1731 return iBody->SupportedHeaderData(); |
|
1732 } |
|
1733 |
|
1734 |
|
1735 EXPORT_C TBool CMMFFormatImplementationInformation::SupportsFileExtension(const TDesC8& aFileExtension) const |
|
1736 { |
|
1737 return iBody->SupportsFileExtension(aFileExtension); |
|
1738 } |
|
1739 |
|
1740 EXPORT_C TBool CMMFFormatImplementationInformation::SupportsMimeType(const TDesC8& aMimeType) const |
|
1741 { |
|
1742 return iBody->SupportsMimeType(aMimeType); |
|
1743 } |
|
1744 |
|
1745 EXPORT_C TBool CMMFFormatImplementationInformation::SupportsHeaderDataL(const TDesC8& aHeaderData) const |
|
1746 { |
|
1747 return iBody->SupportsHeaderDataL(aHeaderData); |
|
1748 } |
|
1749 |
|
1750 EXPORT_C TBool CMMFFormatImplementationInformation::SupportsCustomInterfaces() const |
|
1751 { |
|
1752 return iBody->SupportsCustomInterfaces(); |
|
1753 } |
|
1754 |
|
1755 CMatchData* CMatchData::CreateL() |
|
1756 { |
|
1757 return new (ELeave) CMatchData(); |
|
1758 } |
|
1759 |
|
1760 void CMatchData::SetMatchDataL(const TDesC8& aMatchData) |
|
1761 { |
|
1762 delete iMatchData; |
|
1763 iMatchData = NULL; |
|
1764 |
|
1765 iMatchData = aMatchData.AllocL(); |
|
1766 } |
|
1767 |
|
1768 void CMatchData::SetMatchUriSchemeL(const TDesC8& aMatchUriScheme) |
|
1769 { |
|
1770 delete iMatchUriScheme; |
|
1771 iMatchUriScheme = NULL; |
|
1772 |
|
1773 iMatchUriScheme = aMatchUriScheme.AllocL(); |
|
1774 } |
|
1775 |
|
1776 const TDesC8& CMatchData::MatchData() const |
|
1777 { |
|
1778 if (iMatchData ) |
|
1779 { |
|
1780 return *iMatchData; |
|
1781 } |
|
1782 else |
|
1783 { |
|
1784 return KNullDesC8; |
|
1785 } |
|
1786 } |
|
1787 |
|
1788 const TDesC8& CMatchData::MatchUriScheme() const |
|
1789 { |
|
1790 if (iMatchUriScheme ) |
|
1791 { |
|
1792 return *iMatchUriScheme; |
|
1793 } |
|
1794 else |
|
1795 { |
|
1796 return KNullDesC8; |
|
1797 } |
|
1798 } |
|
1799 |
|
1800 CMatchData::~CMatchData() |
|
1801 { |
|
1802 delete iMatchData; |
|
1803 delete iMatchUriScheme; |
|
1804 } |
|
1805 |