|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <e32std.h> |
|
21 #include <mmf/common/mmffourcc.h> |
|
22 |
|
23 // User Includes |
|
24 #include "T_MMUtil.h" |
|
25 #include "DataWrapperBase.h" |
|
26 |
|
27 /*@{*/ |
|
28 _LIT(KPriority, "priority"); |
|
29 |
|
30 _LIT(KMdaPriorityMin, "EMdaPriorityMin"); |
|
31 _LIT(KMdaPriorityNormal, "EMdaPriorityNormal"); |
|
32 _LIT(KMdaPriorityMax, "EMdaPriorityMax"); |
|
33 |
|
34 _LIT(KPriorityPreference, "prioritypreference"); |
|
35 |
|
36 _LIT(KMdaPriorityPreferenceNone, "None"); |
|
37 _LIT(KMdaPriorityPreferenceTime, "Time"); |
|
38 _LIT(KMdaPriorityPreferenceQuality, "Quality"); |
|
39 _LIT(KMdaPriorityPreferenceTimeAndQuality, "TimeAndQuality"); |
|
40 |
|
41 _LIT(KThreadPriority, "threadpriority"); |
|
42 |
|
43 _LIT(KEPriorityNull, "EPriorityNull"); |
|
44 _LIT(KEPriorityMuchLess, "EPriorityMuchLess"); |
|
45 _LIT(KEPriorityLess, "EPriorityLess"); |
|
46 _LIT(KEPriorityNormal, "EPriorityNormal"); |
|
47 _LIT(KEPriorityMore, "EPriorityMore"); |
|
48 _LIT(KEPriorityMuchMore, "EPriorityMuchMore"); |
|
49 _LIT(KEPriorityRealTime, "EPriorityRealTime"); |
|
50 _LIT(KEPriorityAbsoluteVeryLow, "EPriorityAbsoluteVeryLow"); |
|
51 _LIT(KEPriorityAbsoluteLow, "EPriorityAbsoluteLow"); |
|
52 _LIT(KEPriorityAbsoluteBackground, "EPriorityAbsoluteBackground"); |
|
53 _LIT(KEPriorityAbsoluteForeground, "EPriorityAbsoluteForeground"); |
|
54 _LIT(KEPriorityAbsoluteHigh, "EPriorityAbsoluteHigh"); |
|
55 |
|
56 _LIT(KFourCC, "fourcc"); |
|
57 |
|
58 _LIT(KDesMMFFourCCCodePCM8, "KMMFFourCCCodePCM8"); |
|
59 _LIT(KDesMMFFourCCCodePCMU8, "KMMFFourCCCodePCMU8"); |
|
60 _LIT(KDesMMFFourCCCodePCM16, "KMMFFourCCCodePCM16"); |
|
61 _LIT(KDesMMFFourCCCodePCMU16, "KMMFFourCCCodePCMU16"); |
|
62 _LIT(KDesMMFFourCCCodePCM16B, "KMMFFourCCCodePCM16B"); |
|
63 _LIT(KDesMMFFourCCCodePCMU16B, "KMMFFourCCCodePCMU16B"); |
|
64 _LIT(KDesMMFFourCCCodeIMAD, "KMMFFourCCCodeIMAD"); |
|
65 _LIT(KDesMMFFourCCCodeIMAS, "KMMFFourCCCodeIMAS"); |
|
66 _LIT(KDesMMFFourCCCodeALAW, "KMMFFourCCCodeALAW"); |
|
67 _LIT(KDesMMFFourCCCodeMuLAW, "KMMFFourCCCodeMuLAW"); |
|
68 _LIT(KDesMMFFourCCCodeGSM610, "KMMFFourCCCodeGSM610"); |
|
69 _LIT(KDesFourCCCodeNULL, "KMMFFourCCCodeNULL"); |
|
70 _LIT(KDesMMFFourCCCodeAMR, "KMMFFourCCCodeAMR"); |
|
71 _LIT(KDesMMFFourCCCodeAAC, "KMMFFourCCCodeAAC"); |
|
72 _LIT(KDesMMFFourCCCodeAWB, "KMMFFourCCCodeAWB"); |
|
73 _LIT(KDesMMFFourCCCodeMP3, "KMMFFourCCCodeMP3"); |
|
74 _LIT(KDesMMFFourCCCodeATRAC3, "KMMFFourCCCodeATRAC3"); |
|
75 _LIT(KDesMMFFourCCCodeSBC, "KMMFFourCCCodeSBC"); |
|
76 _LIT(KDesMMFFourCCCodeAMRW, "KMMFFourCCCodeAMRW"); |
|
77 _LIT(KDesMMFFourCCCodeADTS, "KMMFFourCCCodeADTS"); |
|
78 _LIT(KDesMMFFourCCCodeUnknown, "KMMFFourCCCodeUnknown"); |
|
79 |
|
80 _LIT(KImageType, "imagetype"); |
|
81 |
|
82 _LIT(KImageTypeThumbnail, "EImageTypeThumbnail"); |
|
83 _LIT(KImageTypeMain, "EImageTypeMain"); |
|
84 |
|
85 _LIT(KIntent, "intent"); |
|
86 |
|
87 _LIT(KIntentPeek, "EPeek"); |
|
88 _LIT(KIntentPlay, "EPlay"); |
|
89 _LIT(KIntentView, "EView"); |
|
90 _LIT(KIntentExecute, "EExecute"); |
|
91 _LIT(KIntentPrint, "EPrint"); |
|
92 _LIT(KIntentPause, "EPause"); |
|
93 _LIT(KIntentContinue, "EContinue"); |
|
94 _LIT(KIntentStop, "EStop"); |
|
95 _LIT(KIntentUnknown, "EUnknown"); |
|
96 _LIT(KIntentInstall, "EInstall"); |
|
97 |
|
98 _LIT(KMidiStateClosedDisengaged, "EMidiStateClosedDisengaged"); |
|
99 _LIT(KMidiStateOpenDisengaged, "EMidiStateOpenDisengaged"); |
|
100 _LIT(KMidiStateOpenPlaying, "EMidiStateOpenPlaying"); |
|
101 _LIT(KMidiStateClosedEngaged, "EMidiStateClosedEngaged"); |
|
102 _LIT(KMidiStateOpenEngaged, "EMidiStateOpenEngaged"); |
|
103 |
|
104 _LIT(KSampleRateFixed, "SampleRateFixed"); |
|
105 _LIT(KSampleRateAnyInRange, "SampleRateAnyInRange"); |
|
106 _LIT(KSampleRate8000Hz, "SampleRate8000Hz"); |
|
107 _LIT(KSampleRate11025Hz, "SampleRate11025Hz"); |
|
108 _LIT(KSampleRate12000Hz, "SampleRate12000Hz"); |
|
109 _LIT(KSampleRate16000Hz, "SampleRate16000Hz"); |
|
110 _LIT(KSampleRate22050Hz, "SampleRate22050Hz"); |
|
111 _LIT(KSampleRate24000Hz, "SampleRate24000Hz"); |
|
112 _LIT(KSampleRate32000Hz, "SampleRate32000Hz"); |
|
113 _LIT(KSampleRate44100Hz, "SampleRate44100Hz"); |
|
114 _LIT(KSampleRate48000Hz, "SampleRate48000Hz"); |
|
115 _LIT(KSampleRate96000Hz, "SampleRate96000Hz"); |
|
116 _LIT(KSampleRate64000Hz, "SampleRate64000Hz"); |
|
117 _LIT(KChannelsMono, "ChannelsMono"); |
|
118 _LIT(KChannelsStereo, "ChannelsStereo"); |
|
119 _LIT(KRoutingControl, "RoutingControl"); |
|
120 _LIT(KRealTime, "RealTime"); |
|
121 |
|
122 _LIT(KNoLocalRouting, "NoLocalRouting"); |
|
123 _LIT(KNoNetworkRouting, "NoNetworkRouting"); |
|
124 |
|
125 _LIT(KOptionNone, "OptionNone"); |
|
126 _LIT(KOptionNoDither, "OptionNoDither"); |
|
127 _LIT(KOptionAlwaysThread, "OptionAlwaysThread"); |
|
128 _LIT(KOptionAllowZeroFrameOpen, "OptionAllowZeroFrameOpen"); |
|
129 _LIT(KAllowGeneratedMask, "AllowGeneratedMask"); |
|
130 |
|
131 _LIT(KAgentPropertyBufferSize, "AgentPropertyBufferSize"); |
|
132 _LIT(KAgentPropertyAgentUI, "AgentPropertyAgentUI"); |
|
133 _LIT(KAgentPropertyMultipleSequence, "AgentPropertyMultipleSequence"); |
|
134 |
|
135 _LIT(KCmdCapabilty, "capabilty%d"); |
|
136 _LIT(KCmdChannels, "channels"); |
|
137 _LIT(KCmdFlags, "flags"); |
|
138 _LIT(KCmdMaxVolume, "maxvolume"); |
|
139 _LIT(KCmdSampleRate, "samplerate"); |
|
140 _LIT(KCmdVolume, "volume"); |
|
141 |
|
142 _LIT(KDModeNone, "None"); |
|
143 _LIT(KDModeGray2, "Gray2"); |
|
144 _LIT(KDModeGray4, "Gray4"); |
|
145 _LIT(KDModeGray16, "Gray16"); |
|
146 _LIT(KDModeGray256, "Gray256"); |
|
147 _LIT(KDModeColor16, "Color16"); |
|
148 _LIT(KDModeColor256, "Color256"); |
|
149 _LIT(KDModeColor64K, "Color64K"); |
|
150 _LIT(KDModeColor16M, "Color16M"); |
|
151 _LIT(KDModeRgb, "Rgb"); |
|
152 _LIT(KDModeColor4K, "Color4K"); |
|
153 _LIT(KDModeColor16MU, "Color16MU"); |
|
154 _LIT(KDModeColor16MA, "Color16MA"); |
|
155 _LIT(KDModeColorLast, "ColorLast"); |
|
156 |
|
157 _LIT(KEVideoRotationNone, "None"); |
|
158 _LIT(KEVideoRotationClockwise90, "Clockwise90"); |
|
159 _LIT(KEVideoRotationClockwise180, "Clockwise180"); |
|
160 _LIT(KEVideoRotationClockwise270, "Clockwise270"); |
|
161 _LIT(KEVideoRotationUnknown, "Unknown"); |
|
162 |
|
163 |
|
164 |
|
165 _LIT(KCount, "count"); |
|
166 /*@}*/ |
|
167 |
|
168 TBool CT_MMUtil::ReadMdaPriority(CDataWrapper& aDataWrapper, const TDesC& aSection, TInt& aPriority) |
|
169 { |
|
170 TPtrC str; |
|
171 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KPriority(), str); |
|
172 if ( ret ) |
|
173 { |
|
174 if ( str==KMdaPriorityMin ) |
|
175 { |
|
176 aPriority=EMdaPriorityMin; |
|
177 } |
|
178 else if ( str==KMdaPriorityNormal ) |
|
179 { |
|
180 aPriority=EMdaPriorityNormal; |
|
181 } |
|
182 else if ( str==KMdaPriorityMax ) |
|
183 { |
|
184 aPriority=EMdaPriorityMax; |
|
185 } |
|
186 else |
|
187 { |
|
188 if ( !aDataWrapper.GetIntFromConfig(aSection, KPriority(), aPriority) ) |
|
189 { |
|
190 aDataWrapper.ERR_PRINTF2(_L("Illegal priority %S"), &KPriority()); |
|
191 aDataWrapper.SetBlockResult(EFail); |
|
192 } |
|
193 } |
|
194 } |
|
195 |
|
196 aDataWrapper.INFO_PRINTF3(_L("ReadMdaPriority %S = %d"), &KPriority(), ret); |
|
197 |
|
198 return ret; |
|
199 } |
|
200 |
|
201 TBool CT_MMUtil::ReadMdaPriorityPreference(CDataWrapper& aDataWrapper, const TDesC& aSection, TMdaPriorityPreference& aPreference) |
|
202 { |
|
203 TPtrC str; |
|
204 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KPriorityPreference(), str); |
|
205 if ( ret ) |
|
206 { |
|
207 if ( str==KMdaPriorityPreferenceNone ) |
|
208 { |
|
209 aPreference=EMdaPriorityPreferenceNone; |
|
210 } |
|
211 else if ( str==KMdaPriorityPreferenceTime ) |
|
212 { |
|
213 aPreference=EMdaPriorityPreferenceTime; |
|
214 } |
|
215 else if ( str==KMdaPriorityPreferenceQuality ) |
|
216 { |
|
217 aPreference=EMdaPriorityPreferenceQuality; |
|
218 } |
|
219 else if ( str==KMdaPriorityPreferenceTimeAndQuality ) |
|
220 { |
|
221 aPreference=EMdaPriorityPreferenceTimeAndQuality; |
|
222 } |
|
223 else |
|
224 { |
|
225 TInt intVal; |
|
226 if ( aDataWrapper.GetIntFromConfig(aSection, KPriorityPreference(), intVal) ) |
|
227 { |
|
228 aPreference=(TMdaPriorityPreference)intVal; |
|
229 } |
|
230 else |
|
231 { |
|
232 aDataWrapper.ERR_PRINTF2(_L("Illegal TMdaPriorityPreference %S"), &KPriorityPreference()); |
|
233 aDataWrapper.SetBlockResult(EFail); |
|
234 } |
|
235 } |
|
236 } |
|
237 |
|
238 aDataWrapper.INFO_PRINTF3(_L("ReadMdaPriorityPreference %S = %d"), &KPriorityPreference(), ret); |
|
239 |
|
240 return ret; |
|
241 } |
|
242 |
|
243 TBool CT_MMUtil::ReadThreadPriority(CDataWrapper& aDataWrapper, const TDesC& aSection, TThreadPriority& aPriority) |
|
244 { |
|
245 TPtrC str; |
|
246 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KThreadPriority(), str); |
|
247 if ( ret ) |
|
248 { |
|
249 if ( str==KEPriorityNull ) |
|
250 { |
|
251 aPriority = EPriorityNull; |
|
252 } |
|
253 else if ( str==KEPriorityMuchLess ) |
|
254 { |
|
255 aPriority = EPriorityMuchLess; |
|
256 } |
|
257 else if ( str==KEPriorityLess ) |
|
258 { |
|
259 aPriority = EPriorityLess; |
|
260 } |
|
261 else if ( str==KEPriorityNormal ) |
|
262 { |
|
263 aPriority = EPriorityNormal; |
|
264 } |
|
265 else if ( str==KEPriorityMore ) |
|
266 { |
|
267 aPriority = EPriorityMore; |
|
268 } |
|
269 else if ( str==KEPriorityMuchMore ) |
|
270 { |
|
271 aPriority = EPriorityMuchMore; |
|
272 } |
|
273 else if ( str==KEPriorityRealTime ) |
|
274 { |
|
275 aPriority = EPriorityRealTime; |
|
276 } |
|
277 else if ( str==KEPriorityAbsoluteVeryLow ) |
|
278 { |
|
279 aPriority = EPriorityAbsoluteVeryLow; |
|
280 } |
|
281 else if ( str==KEPriorityAbsoluteLow ) |
|
282 { |
|
283 aPriority = EPriorityAbsoluteLow; |
|
284 } |
|
285 else if ( str==KEPriorityAbsoluteBackground ) |
|
286 { |
|
287 aPriority = EPriorityAbsoluteBackground; |
|
288 } |
|
289 else if ( str==KEPriorityAbsoluteForeground ) |
|
290 { |
|
291 aPriority = EPriorityAbsoluteForeground; |
|
292 } |
|
293 else if ( str==KEPriorityAbsoluteHigh ) |
|
294 { |
|
295 aPriority = EPriorityAbsoluteHigh; |
|
296 } |
|
297 else |
|
298 { |
|
299 TInt intVal; |
|
300 if ( aDataWrapper.GetIntFromConfig(aSection, KThreadPriority(), intVal) ) |
|
301 { |
|
302 aPriority=(TThreadPriority)intVal; |
|
303 } |
|
304 else |
|
305 { |
|
306 aDataWrapper.ERR_PRINTF2(_L("Illegal TThreadPriority %S"), &KThreadPriority()); |
|
307 aDataWrapper.SetBlockResult(EFail); |
|
308 } |
|
309 } |
|
310 } |
|
311 |
|
312 aDataWrapper.INFO_PRINTF3(_L("ReadThreadPriority %S = %d"), &KThreadPriority(), ret); |
|
313 |
|
314 return ret; |
|
315 } |
|
316 |
|
317 TBool CT_MMUtil::ReadFourCC(CDataWrapper& aDataWrapper, const TDesC& aSection, TFourCC& aFourCC) |
|
318 { |
|
319 TPtrC str; |
|
320 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KFourCC(), str); |
|
321 |
|
322 if ( ret ) |
|
323 { |
|
324 if( str==KDesMMFFourCCCodePCM8 ) |
|
325 { |
|
326 aFourCC=KMMFFourCCCodePCM8; |
|
327 } |
|
328 else if( str==KDesMMFFourCCCodePCMU8 ) |
|
329 { |
|
330 aFourCC=KMMFFourCCCodePCMU8; |
|
331 } |
|
332 else if( str==KDesMMFFourCCCodePCM16 ) |
|
333 { |
|
334 aFourCC=KMMFFourCCCodePCM16; |
|
335 } |
|
336 else if( str==KDesMMFFourCCCodePCMU16 ) |
|
337 { |
|
338 aFourCC=KMMFFourCCCodePCMU16; |
|
339 } |
|
340 else if( str==KDesMMFFourCCCodePCM16B ) |
|
341 { |
|
342 aFourCC=KMMFFourCCCodePCM16B; |
|
343 } |
|
344 else if( str==KDesMMFFourCCCodePCMU16B ) |
|
345 { |
|
346 aFourCC=KMMFFourCCCodePCMU16B; |
|
347 } |
|
348 else if( str==KDesMMFFourCCCodeIMAD ) |
|
349 { |
|
350 aFourCC=KMMFFourCCCodeIMAD; |
|
351 } |
|
352 else if( str==KDesMMFFourCCCodeIMAS ) |
|
353 { |
|
354 aFourCC=KMMFFourCCCodeIMAS; |
|
355 } |
|
356 else if( str==KDesMMFFourCCCodeALAW ) |
|
357 { |
|
358 aFourCC=KMMFFourCCCodeALAW; |
|
359 } |
|
360 else if( str==KDesMMFFourCCCodeMuLAW ) |
|
361 { |
|
362 aFourCC=KMMFFourCCCodeMuLAW; |
|
363 } |
|
364 else if( str==KDesMMFFourCCCodeGSM610 ) |
|
365 { |
|
366 aFourCC=KMMFFourCCCodeGSM610; |
|
367 } |
|
368 else if( str==KDesFourCCCodeNULL ) |
|
369 { |
|
370 aFourCC=KMMFFourCCCodeNULL; |
|
371 } |
|
372 else if( str==KDesMMFFourCCCodeAMR ) |
|
373 { |
|
374 aFourCC=KMMFFourCCCodeAMR; |
|
375 } |
|
376 else if( str==KDesMMFFourCCCodeAAC ) |
|
377 { |
|
378 aFourCC=KMMFFourCCCodeAAC; |
|
379 } |
|
380 else if( str==KDesMMFFourCCCodeAWB ) |
|
381 { |
|
382 aFourCC=KMMFFourCCCodeAWB; |
|
383 } |
|
384 else if( str==KDesMMFFourCCCodeMP3 ) |
|
385 { |
|
386 aFourCC=KMMFFourCCCodeMP3; |
|
387 } |
|
388 else if( str==KDesMMFFourCCCodeATRAC3 ) |
|
389 { |
|
390 aFourCC=KMMFFourCCCodeATRAC3; |
|
391 } |
|
392 else if( str==KDesMMFFourCCCodeSBC ) |
|
393 { |
|
394 aFourCC=KMMFFourCCCodeSBC; |
|
395 } |
|
396 else if( str==KDesMMFFourCCCodeAMRW ) |
|
397 { |
|
398 aFourCC=KMMFFourCCCodeAMRW; |
|
399 } |
|
400 else if( str==KDesMMFFourCCCodeADTS ) |
|
401 { |
|
402 aFourCC=KMMFFourCCCodeADTS; |
|
403 } |
|
404 else |
|
405 { |
|
406 TInt intVal; |
|
407 if ( aDataWrapper.GetIntFromConfig(aSection, KFourCC(), intVal) ) |
|
408 { |
|
409 aFourCC=intVal; |
|
410 } |
|
411 else |
|
412 { |
|
413 aDataWrapper.ERR_PRINTF2(_L("Illegal TFourCC %S"), &KFourCC()); |
|
414 aDataWrapper.SetBlockResult(EFail); |
|
415 } |
|
416 } |
|
417 } |
|
418 |
|
419 return ret; |
|
420 } |
|
421 |
|
422 TBool CT_MMUtil::ReadImageType(CDataWrapper& aDataWrapper, const TDesC& aSection, CImageDecoder::TImageType& aImageType) |
|
423 { |
|
424 TPtrC str; |
|
425 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KImageType(), str); |
|
426 |
|
427 if ( ret ) |
|
428 { |
|
429 if ( str==KImageTypeThumbnail ) |
|
430 { |
|
431 aImageType=CImageDecoder::EImageTypeThumbnail; |
|
432 } |
|
433 else if ( str==KImageTypeMain ) |
|
434 { |
|
435 aImageType=CImageDecoder::EImageTypeMain; |
|
436 } |
|
437 else |
|
438 { |
|
439 TInt intVal; |
|
440 if ( aDataWrapper.GetIntFromConfig(aSection, KImageType(), intVal) ) |
|
441 { |
|
442 aImageType=(CImageDecoder::TImageType)intVal; |
|
443 } |
|
444 else |
|
445 { |
|
446 aDataWrapper.ERR_PRINTF2(_L("Illegal CImageDecoder::TImageType %S"), &KImageType()); |
|
447 aDataWrapper.SetBlockResult(EFail); |
|
448 } |
|
449 } |
|
450 } |
|
451 |
|
452 return ret; |
|
453 } |
|
454 |
|
455 TBool CT_MMUtil::ReadIntent(CDataWrapper& aDataWrapper, const TDesC& aSection, ContentAccess::TIntent& aIntent) |
|
456 { |
|
457 TPtrC str; |
|
458 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KIntent(), str); |
|
459 |
|
460 if ( ret ) |
|
461 { |
|
462 if ( str==KIntentPeek ) |
|
463 { |
|
464 aIntent=ContentAccess::EPeek; |
|
465 } |
|
466 else if ( str==KIntentPlay ) |
|
467 { |
|
468 aIntent=ContentAccess::EPlay; |
|
469 } |
|
470 else if ( str==KIntentView ) |
|
471 { |
|
472 aIntent=ContentAccess::EView; |
|
473 } |
|
474 else if ( str==KIntentExecute ) |
|
475 { |
|
476 aIntent=ContentAccess::EExecute; |
|
477 } |
|
478 else if ( str==KIntentPrint ) |
|
479 { |
|
480 aIntent=ContentAccess::EPrint; |
|
481 } |
|
482 else if ( str==KIntentPause ) |
|
483 { |
|
484 aIntent=ContentAccess::EPause; |
|
485 } |
|
486 else if ( str==KIntentContinue ) |
|
487 { |
|
488 aIntent=ContentAccess::EContinue; |
|
489 } |
|
490 else if ( str==KIntentStop ) |
|
491 { |
|
492 aIntent=ContentAccess::EStop; |
|
493 } |
|
494 else if ( str==KIntentUnknown ) |
|
495 { |
|
496 aIntent=ContentAccess::EUnknown; |
|
497 } |
|
498 else if ( str==KIntentInstall ) |
|
499 { |
|
500 aIntent=ContentAccess::EInstall; |
|
501 } |
|
502 else |
|
503 { |
|
504 TInt intVal; |
|
505 if ( aDataWrapper.GetIntFromConfig(aSection, KIntent(), intVal) ) |
|
506 { |
|
507 aIntent=(ContentAccess::TIntent)intVal; |
|
508 } |
|
509 else |
|
510 { |
|
511 aDataWrapper.ERR_PRINTF2(_L("Illegal ContentAccess::TIntent %S"), &KIntent()); |
|
512 aDataWrapper.SetBlockResult(EFail); |
|
513 } |
|
514 } |
|
515 } |
|
516 |
|
517 return ret; |
|
518 } |
|
519 |
|
520 TBool CT_MMUtil::ReadMidiState(CDataWrapper& aDataWrapper, const TDesC& aSection, const TDesC& aKeyName, TMidiState& aState) |
|
521 { |
|
522 TPtrC str; |
|
523 TBool ret=aDataWrapper.GetStringFromConfig(aSection, aKeyName, str); |
|
524 |
|
525 if ( ret ) |
|
526 { |
|
527 if ( str==KMidiStateClosedDisengaged ) |
|
528 { |
|
529 aState=EMidiStateClosedDisengaged; |
|
530 } |
|
531 else if ( str==KMidiStateOpenDisengaged ) |
|
532 { |
|
533 aState=EMidiStateOpenDisengaged; |
|
534 } |
|
535 else if ( str==KMidiStateOpenPlaying ) |
|
536 { |
|
537 aState=EMidiStateOpenPlaying; |
|
538 } |
|
539 else if ( str==KMidiStateClosedEngaged ) |
|
540 { |
|
541 aState=EMidiStateClosedEngaged; |
|
542 } |
|
543 else if ( str==KMidiStateOpenEngaged ) |
|
544 { |
|
545 aState=EMidiStateOpenEngaged; |
|
546 } |
|
547 else |
|
548 { |
|
549 TInt intVal; |
|
550 if ( aDataWrapper.GetIntFromConfig(aSection, aKeyName, intVal) ) |
|
551 { |
|
552 aState=(TMidiState)intVal; |
|
553 } |
|
554 else |
|
555 { |
|
556 ret=EFalse; |
|
557 aDataWrapper.ERR_PRINTF2(_L("Illegal TMidiState %S"), &aKeyName); |
|
558 aDataWrapper.SetBlockResult(EFail); |
|
559 } |
|
560 } |
|
561 } |
|
562 |
|
563 return ret; |
|
564 } |
|
565 |
|
566 TBool CT_MMUtil::ConvertToAudioCaps(const TDesC& aDesc, TMdaAudioDataSettings::TAudioCaps& aAudioCaps) |
|
567 { |
|
568 TBool ret=ETrue; |
|
569 |
|
570 if ( aDesc==KSampleRateFixed ) |
|
571 { |
|
572 aAudioCaps=TMdaAudioDataSettings::ESampleRateFixed; |
|
573 } |
|
574 else if ( aDesc==KSampleRateAnyInRange ) |
|
575 { |
|
576 aAudioCaps=TMdaAudioDataSettings::ESampleRateAnyInRange; |
|
577 } |
|
578 else if ( aDesc==KSampleRate8000Hz ) |
|
579 { |
|
580 aAudioCaps=TMdaAudioDataSettings::ESampleRate8000Hz; |
|
581 } |
|
582 else if ( aDesc==KSampleRate11025Hz ) |
|
583 { |
|
584 aAudioCaps=TMdaAudioDataSettings::ESampleRate11025Hz; |
|
585 } |
|
586 else if ( aDesc==KSampleRate12000Hz ) |
|
587 { |
|
588 aAudioCaps=TMdaAudioDataSettings::ESampleRate12000Hz; |
|
589 } |
|
590 else if ( aDesc==KSampleRate16000Hz ) |
|
591 { |
|
592 aAudioCaps=TMdaAudioDataSettings::ESampleRate16000Hz; |
|
593 } |
|
594 else if ( aDesc==KSampleRate22050Hz ) |
|
595 { |
|
596 aAudioCaps=TMdaAudioDataSettings::ESampleRate22050Hz; |
|
597 } |
|
598 else if ( aDesc==KSampleRate24000Hz ) |
|
599 { |
|
600 aAudioCaps=TMdaAudioDataSettings::ESampleRate24000Hz; |
|
601 } |
|
602 else if ( aDesc==KSampleRate32000Hz ) |
|
603 { |
|
604 aAudioCaps=TMdaAudioDataSettings::ESampleRate32000Hz; |
|
605 } |
|
606 else if ( aDesc==KSampleRate44100Hz ) |
|
607 { |
|
608 aAudioCaps=TMdaAudioDataSettings::ESampleRate44100Hz; |
|
609 } |
|
610 else if ( aDesc==KSampleRate48000Hz ) |
|
611 { |
|
612 aAudioCaps=TMdaAudioDataSettings::ESampleRate48000Hz; |
|
613 } |
|
614 else if ( aDesc==KSampleRate96000Hz ) |
|
615 { |
|
616 aAudioCaps=TMdaAudioDataSettings::ESampleRate96000Hz; |
|
617 } |
|
618 else if ( aDesc==KSampleRate64000Hz ) |
|
619 { |
|
620 aAudioCaps=TMdaAudioDataSettings::ESampleRate64000Hz; |
|
621 } |
|
622 else if ( aDesc==KChannelsMono ) |
|
623 { |
|
624 aAudioCaps=TMdaAudioDataSettings::EChannelsMono; |
|
625 } |
|
626 else if ( aDesc==KChannelsStereo ) |
|
627 { |
|
628 aAudioCaps=TMdaAudioDataSettings::EChannelsStereo; |
|
629 } |
|
630 else if ( aDesc==KRoutingControl ) |
|
631 { |
|
632 aAudioCaps=TMdaAudioDataSettings::ERoutingControl; |
|
633 } |
|
634 else if ( aDesc==KRealTime ) |
|
635 { |
|
636 aAudioCaps=TMdaAudioDataSettings::ERealTime; |
|
637 } |
|
638 else |
|
639 { |
|
640 ret=EFalse; |
|
641 } |
|
642 |
|
643 return ret; |
|
644 } |
|
645 |
|
646 TBool CT_MMUtil::ConvertToAudioFlags(const TDesC& aDesc, TMdaAudioDataSettings::TAudioFlags& aAudioFlags) |
|
647 { |
|
648 TBool ret=ETrue; |
|
649 |
|
650 if ( aDesc==KNoLocalRouting ) |
|
651 { |
|
652 aAudioFlags=TMdaAudioDataSettings::ENoLocalRouting; |
|
653 } |
|
654 else if ( aDesc==KNoNetworkRouting ) |
|
655 { |
|
656 aAudioFlags=TMdaAudioDataSettings::ENoNetworkRouting; |
|
657 } |
|
658 else |
|
659 { |
|
660 ret=EFalse; |
|
661 } |
|
662 |
|
663 return ret; |
|
664 } |
|
665 |
|
666 TBool CT_MMUtil::ConvertToOption(const TDesC& aDesc, CImageDecoder::TOptions& aOption) |
|
667 { |
|
668 TBool ret=ETrue; |
|
669 |
|
670 if ( aDesc==KOptionNone ) |
|
671 { |
|
672 aOption=CImageDecoder::EOptionNone; |
|
673 } |
|
674 else if ( aDesc==KOptionNoDither ) |
|
675 { |
|
676 aOption=CImageDecoder::EOptionNoDither; |
|
677 } |
|
678 else if ( aDesc==KOptionAlwaysThread ) |
|
679 { |
|
680 aOption=CImageDecoder::EOptionAlwaysThread; |
|
681 } |
|
682 else if ( aDesc==KOptionAllowZeroFrameOpen ) |
|
683 { |
|
684 aOption=CImageDecoder::EOptionAllowZeroFrameOpen; |
|
685 } |
|
686 else if ( aDesc==KAllowGeneratedMask ) |
|
687 { |
|
688 aOption=CImageDecoder::EAllowGeneratedMask; |
|
689 } |
|
690 else |
|
691 { |
|
692 ret=EFalse; |
|
693 } |
|
694 |
|
695 return ret; |
|
696 } |
|
697 |
|
698 TBool CT_MMUtil::ConvertToOption(const TDesC& aDesc, CImageEncoder::TOptions& aOption) |
|
699 { |
|
700 TBool ret=ETrue; |
|
701 |
|
702 if ( aDesc==KOptionNone ) |
|
703 { |
|
704 aOption=CImageEncoder::EOptionNone; |
|
705 } |
|
706 else if ( aDesc==KOptionAlwaysThread ) |
|
707 { |
|
708 aOption=CImageEncoder::EOptionAlwaysThread; |
|
709 } |
|
710 else |
|
711 { |
|
712 ret=EFalse; |
|
713 } |
|
714 |
|
715 return ret; |
|
716 } |
|
717 |
|
718 TBool CT_MMUtil::ConvertToAgentProperty(const TDesC& aDesc, ContentAccess::TAgentProperty& aAgentProperty) |
|
719 { |
|
720 TBool ret=ETrue; |
|
721 |
|
722 if ( aDesc==KAgentPropertyBufferSize ) |
|
723 { |
|
724 aAgentProperty=ContentAccess::EAgentPropertyBufferSize; |
|
725 } |
|
726 else if ( aDesc==KAgentPropertyAgentUI ) |
|
727 { |
|
728 aAgentProperty=ContentAccess::EAgentPropertyAgentUI; |
|
729 } |
|
730 else if ( aDesc==KAgentPropertyMultipleSequence ) |
|
731 { |
|
732 aAgentProperty=ContentAccess::EAgentPropertyMultipleSequence; |
|
733 } |
|
734 else |
|
735 { |
|
736 ret=EFalse; |
|
737 } |
|
738 |
|
739 return ret; |
|
740 } |
|
741 |
|
742 const TDesC& CT_MMUtil::GetFourCCString(TUint32 aValue) |
|
743 { |
|
744 switch(aValue) |
|
745 { |
|
746 case KMMFFourCCCodePCM8: |
|
747 return KDesMMFFourCCCodePCM8; |
|
748 case KMMFFourCCCodePCMU8: |
|
749 return KDesMMFFourCCCodePCMU8; |
|
750 case KMMFFourCCCodePCM16: |
|
751 return KDesMMFFourCCCodePCM16; |
|
752 case KMMFFourCCCodePCMU16: |
|
753 return KDesMMFFourCCCodePCMU16; |
|
754 case KMMFFourCCCodePCM16B: |
|
755 return KDesMMFFourCCCodePCM16B; |
|
756 case KMMFFourCCCodePCMU16B: |
|
757 return KDesMMFFourCCCodePCMU16B; |
|
758 case KMMFFourCCCodeIMAD: |
|
759 return KDesMMFFourCCCodeIMAD; |
|
760 case KMMFFourCCCodeIMAS: |
|
761 return KDesMMFFourCCCodeIMAS; |
|
762 case KMMFFourCCCodeALAW: |
|
763 return KDesMMFFourCCCodeALAW; |
|
764 case KMMFFourCCCodeMuLAW: |
|
765 return KDesMMFFourCCCodeMuLAW; |
|
766 case KMMFFourCCCodeGSM610: |
|
767 return KDesMMFFourCCCodeGSM610; |
|
768 case KMMFFourCCCodeNULL: |
|
769 return KDesFourCCCodeNULL; |
|
770 case KMMFFourCCCodeAMR: |
|
771 return KDesMMFFourCCCodeAMR; |
|
772 case KMMFFourCCCodeAAC: |
|
773 return KDesMMFFourCCCodeAAC; |
|
774 case KMMFFourCCCodeAWB: |
|
775 return KDesMMFFourCCCodeAWB; |
|
776 case KMMFFourCCCodeMP3: |
|
777 return KDesMMFFourCCCodeMP3; |
|
778 case KMMFFourCCCodeATRAC3: |
|
779 return KDesMMFFourCCCodeATRAC3; |
|
780 case KMMFFourCCCodeSBC: |
|
781 return KDesMMFFourCCCodeSBC; |
|
782 case KMMFFourCCCodeAMRW: |
|
783 return KDesMMFFourCCCodeAMRW; |
|
784 case KMMFFourCCCodeADTS: |
|
785 return KDesMMFFourCCCodeADTS; |
|
786 default: |
|
787 break; |
|
788 }; |
|
789 return KDesMMFFourCCCodeUnknown; |
|
790 } |
|
791 |
|
792 TBool CT_MMUtil::ReadAudioDataSettings(CDataWrapper& aDataWrapper, TMdaAudioDataSettings& aSettings, const TDesC& aSection) |
|
793 { |
|
794 TBool ret=EFalse; |
|
795 TBool callQuery=ETrue; |
|
796 |
|
797 // Read capabilities |
|
798 TInt index=0; |
|
799 TBool moreData=ETrue; |
|
800 TPtrC capabilityString; |
|
801 TInt capability=0; |
|
802 TBool hasCapabilty=EFalse; |
|
803 while ( moreData ) |
|
804 { |
|
805 TBuf<KMaxTestExecuteCommandLength> capabilityTemp; |
|
806 capabilityTemp.Format(KCmdCapabilty(), ++index); |
|
807 if ( aDataWrapper.GetStringFromConfig(aSection, capabilityTemp, capabilityString) ) |
|
808 { |
|
809 TMdaAudioDataSettings::TAudioCaps audioCap; |
|
810 if ( ConvertToAudioCaps(capabilityString, audioCap) ) |
|
811 { |
|
812 capability |= audioCap; |
|
813 hasCapabilty=ETrue; |
|
814 } |
|
815 else |
|
816 { |
|
817 aDataWrapper.ERR_PRINTF2(_L("Illegal capability %S"), &capabilityString); |
|
818 aDataWrapper.SetBlockResult(EFail); |
|
819 } |
|
820 } |
|
821 else |
|
822 { |
|
823 moreData=EFalse; |
|
824 } |
|
825 } |
|
826 if ( hasCapabilty ) |
|
827 { |
|
828 aSettings.iCaps=capability; |
|
829 ret=ETrue; |
|
830 } |
|
831 |
|
832 // Read channels |
|
833 TInt channels=0; |
|
834 if ( aDataWrapper.GetIntFromConfig(aSection, KCmdChannels(), channels) ) |
|
835 { |
|
836 aSettings.iChannels=channels; |
|
837 callQuery=EFalse; |
|
838 ret=ETrue; |
|
839 } |
|
840 |
|
841 // Read flags |
|
842 TMdaAudioDataSettings::TAudioFlags flags; |
|
843 TPtrC flagsString; |
|
844 if ( aDataWrapper.GetStringFromConfig(aSection, KCmdFlags(), flagsString) ) |
|
845 { |
|
846 if ( ConvertToAudioFlags(flagsString, flags) ) |
|
847 { |
|
848 aSettings.iFlags=flags; |
|
849 ret=ETrue; |
|
850 } |
|
851 else |
|
852 { |
|
853 aDataWrapper.ERR_PRINTF2(_L("Illegal flags %S"), &flagsString); |
|
854 aDataWrapper.SetBlockResult(EFail); |
|
855 } |
|
856 } |
|
857 |
|
858 // Read max volume |
|
859 TInt maxVolume=0; |
|
860 if ( aDataWrapper.GetIntFromConfig(aSection, KCmdMaxVolume(), maxVolume) ) |
|
861 { |
|
862 aSettings.iMaxVolume=maxVolume; |
|
863 ret=ETrue; |
|
864 } |
|
865 |
|
866 // Read sample rate |
|
867 TInt sampleRate=0; |
|
868 if ( aDataWrapper.GetIntFromConfig(aSection, KCmdSampleRate(), sampleRate) ) |
|
869 { |
|
870 aSettings.iSampleRate=sampleRate; |
|
871 callQuery=EFalse; |
|
872 ret=ETrue; |
|
873 } |
|
874 |
|
875 // Read volume |
|
876 TInt volume=0; |
|
877 if ( aDataWrapper.GetIntFromConfig(aSection, KCmdVolume(), volume) ) |
|
878 { |
|
879 aSettings.iVolume=volume; |
|
880 callQuery=EFalse; |
|
881 ret=ETrue; |
|
882 } |
|
883 |
|
884 if ( callQuery ) |
|
885 { |
|
886 aSettings.Query(); |
|
887 } |
|
888 |
|
889 return ret; |
|
890 } |
|
891 |
|
892 TBool CT_MMUtil::ConvertToDisplayMode(const TDesC& aDisplayModeStr, TDisplayMode& aDisplayMode) |
|
893 { |
|
894 TBool ret = ETrue; |
|
895 |
|
896 if (aDisplayModeStr == KDModeNone) |
|
897 { |
|
898 aDisplayMode = ENone; |
|
899 } |
|
900 else if (aDisplayModeStr == KDModeGray2) |
|
901 { |
|
902 aDisplayMode = EGray2; |
|
903 } |
|
904 else if (aDisplayModeStr == KDModeGray4) |
|
905 { |
|
906 aDisplayMode = EGray4; |
|
907 } |
|
908 else if (aDisplayModeStr == KDModeGray16) |
|
909 { |
|
910 aDisplayMode = EGray16; |
|
911 } |
|
912 else if (aDisplayModeStr == KDModeGray256) |
|
913 { |
|
914 aDisplayMode = EGray256; |
|
915 } |
|
916 else if (aDisplayModeStr == KDModeColor16) |
|
917 { |
|
918 aDisplayMode = EColor16; |
|
919 } |
|
920 else if (aDisplayModeStr == KDModeColor256) |
|
921 { |
|
922 aDisplayMode = EColor256; |
|
923 } |
|
924 else if (aDisplayModeStr == KDModeColor64K) |
|
925 { |
|
926 aDisplayMode = EColor64K; |
|
927 } |
|
928 else if (aDisplayModeStr == KDModeColor16M) |
|
929 { |
|
930 aDisplayMode = EColor16M; |
|
931 } |
|
932 else if (aDisplayModeStr == KDModeRgb) |
|
933 { |
|
934 aDisplayMode = ERgb; |
|
935 } |
|
936 else if (aDisplayModeStr == KDModeColor4K) |
|
937 { |
|
938 aDisplayMode = EColor4K; |
|
939 } |
|
940 else if (aDisplayModeStr == KDModeColor16MU) |
|
941 { |
|
942 aDisplayMode = EColor16MU; |
|
943 } |
|
944 else if (aDisplayModeStr == KDModeColor16MA) |
|
945 { |
|
946 aDisplayMode = EColor16MA; |
|
947 } |
|
948 else if (aDisplayModeStr == KDModeColorLast) |
|
949 { |
|
950 aDisplayMode = EColorLast; |
|
951 } |
|
952 else |
|
953 { |
|
954 ret = EFalse; |
|
955 } |
|
956 |
|
957 return ret; |
|
958 } |
|
959 |
|
960 TBool CT_MMUtil::ConvertToVideoRotation(const TDesC& aVideoRotationStr, TVideoRotation& aVideoRotation) |
|
961 { |
|
962 TBool ret = ETrue; |
|
963 |
|
964 if (aVideoRotationStr == KEVideoRotationNone) |
|
965 { |
|
966 aVideoRotation = EVideoRotationNone; |
|
967 } |
|
968 else if (aVideoRotationStr == KEVideoRotationClockwise90) |
|
969 { |
|
970 aVideoRotation = EVideoRotationClockwise90; |
|
971 } |
|
972 else if (aVideoRotationStr == KEVideoRotationClockwise180) |
|
973 { |
|
974 aVideoRotation = EVideoRotationClockwise180; |
|
975 } |
|
976 else if (aVideoRotationStr == KEVideoRotationClockwise270) |
|
977 { |
|
978 aVideoRotation = EVideoRotationClockwise270; |
|
979 } |
|
980 else |
|
981 { |
|
982 ret = EFalse; |
|
983 } |
|
984 |
|
985 return ret; |
|
986 } |
|
987 |
|
988 const TDesC& CT_MMUtil::GetVideoRotationString(TVideoRotation& aVideoRotation) |
|
989 { |
|
990 switch(aVideoRotation) |
|
991 { |
|
992 case EVideoRotationNone: |
|
993 return KEVideoRotationNone; |
|
994 case EVideoRotationClockwise90: |
|
995 return KEVideoRotationClockwise90; |
|
996 case EVideoRotationClockwise180: |
|
997 return KEVideoRotationClockwise180; |
|
998 case EVideoRotationClockwise270: |
|
999 return KEVideoRotationClockwise270; |
|
1000 default: |
|
1001 break; |
|
1002 }; |
|
1003 return KEVideoRotationUnknown; |
|
1004 } |
|
1005 |
|
1006 |
|
1007 void CT_MMUtil::VerifyMIMETypeArrayL(CDataWrapper& aDataWrapper, const TDesC& aSection, const RFileExtensionMIMETypeArray& aFileExtensionArray) |
|
1008 { |
|
1009 |
|
1010 |
|
1011 TInt count=aFileExtensionArray.Count(); |
|
1012 for ( TInt index=0; index<count; ++index ) |
|
1013 { |
|
1014 CFileExtensionMIMEType* data=aFileExtensionArray[index]; |
|
1015 const TDesC& displayName=data->DisplayName(); |
|
1016 const TDesC& fileExtension=data->FileExtension(); |
|
1017 TUid imageSubType=data->ImageSubType(); |
|
1018 TUid imageType=data->ImageType(); |
|
1019 TUid implementationUid=data->ImplementationUid(); |
|
1020 const TDesC8& mimeType8=data->MIMEType(); |
|
1021 HBufC* mimeType=HBufC::NewLC(mimeType8.Length()); |
|
1022 TPtr mimeDes=mimeType->Des(); |
|
1023 mimeDes.Copy(mimeType8); |
|
1024 aDataWrapper.INFO_PRINTF3(_L("DisplayName[%d] =%S"), index, &displayName); |
|
1025 aDataWrapper.INFO_PRINTF3(_L("FileExtension[%d] =%S"), index, &fileExtension); |
|
1026 aDataWrapper.INFO_PRINTF3(_L("ImageSubType[%d] =0x%X"), index, imageSubType.iUid); |
|
1027 aDataWrapper.INFO_PRINTF3(_L("ImageType[%d] =0x%X"), index, imageType.iUid); |
|
1028 aDataWrapper.INFO_PRINTF3(_L("ImplementationUid[%d]=0x%X"), index, implementationUid.iUid); |
|
1029 aDataWrapper.INFO_PRINTF3(_L("MIMEType[%d] =%S"), index, &mimeDes); |
|
1030 CleanupStack::PopAndDestroy(mimeType); |
|
1031 |
|
1032 // Verify that it is unique in the array |
|
1033 for ( TInt index2=index+1; index2<count; ++index2 ) |
|
1034 { |
|
1035 CFileExtensionMIMEType* data2=aFileExtensionArray[index2]; |
|
1036 if ( (fileExtension.Compare(data2->FileExtension())==0) && |
|
1037 (imageSubType==data2->ImageSubType()) && |
|
1038 (imageType==data2->ImageType()) && |
|
1039 (implementationUid==data2->ImplementationUid()) && |
|
1040 (mimeType8.Compare(data2->MIMEType())==0) |
|
1041 ) |
|
1042 { |
|
1043 aDataWrapper.ERR_PRINTF3(_L("Duplicate Types in entries %d and %d"), index, index2); |
|
1044 aDataWrapper.SetBlockResult(EFail); |
|
1045 } |
|
1046 } |
|
1047 } |
|
1048 TInt expectedCount=0; |
|
1049 if ( aDataWrapper.GetIntFromConfig(aSection, KCount(), expectedCount) ) |
|
1050 { |
|
1051 if ( count != expectedCount ) |
|
1052 { |
|
1053 aDataWrapper.ERR_PRINTF3(_L("count (%d) != expectedCount (%d)"), count, expectedCount); |
|
1054 aDataWrapper.SetBlockResult(EFail); |
|
1055 } |
|
1056 } |
|
1057 } |
|
1058 |
|
1059 void CT_MMUtil::GetControllerAndFormatUidL(CDataWrapper& aDataWrapper, const TDesC& aFileName, TUid aMediaId, TBool aRecord, TUid& aControllerUid, TUid& aFormatUid) |
|
1060 { |
|
1061 RFs fs; |
|
1062 User::LeaveIfError(fs.Connect()); |
|
1063 CleanupClosePushL(fs); |
|
1064 |
|
1065 TParse parse; |
|
1066 fs.Parse(aFileName, parse); |
|
1067 TPtrC extension=parse.Ext(); |
|
1068 |
|
1069 CMMFControllerPluginSelectionParameters* controllerSelection = CMMFControllerPluginSelectionParameters::NewLC(); |
|
1070 CMMFFormatSelectionParameters* formatSelection = CMMFFormatSelectionParameters::NewLC(); |
|
1071 |
|
1072 // Set the play and record format selection parameters to be blank. |
|
1073 // Format support is only retrieved if requested. |
|
1074 controllerSelection->SetRequiredPlayFormatSupportL(*formatSelection); |
|
1075 controllerSelection->SetRequiredRecordFormatSupportL(*formatSelection); |
|
1076 |
|
1077 // Set the media ids |
|
1078 RArray<TUid> mediaIds; |
|
1079 CleanupClosePushL(mediaIds); |
|
1080 User::LeaveIfError(mediaIds.Append(aMediaId)); |
|
1081 |
|
1082 // Get plugins that support at least audio |
|
1083 controllerSelection->SetMediaIdsL(mediaIds, CMMFPluginSelectionParameters::EAllowOtherMediaIds); |
|
1084 controllerSelection->SetPreferredSupplierL(KNullDesC, CMMFPluginSelectionParameters::EPreferredSupplierPluginsFirstInList); |
|
1085 |
|
1086 // Array to hold all the controllers support the match data |
|
1087 RMMFControllerImplInfoArray controllers; |
|
1088 CleanupResetAndDestroyPushL(controllers); |
|
1089 controllerSelection->ListImplementationsL(controllers); |
|
1090 |
|
1091 // Find the first controller with at least one record format available |
|
1092 aControllerUid=TUid::Null(); |
|
1093 aFormatUid=TUid::Null(); |
|
1094 |
|
1095 TBool set = EFalse; |
|
1096 TBool stillNull = ETrue; |
|
1097 for( TInt controllerIndex=0; (controllerIndex<controllers.Count()) && !set; ++controllerIndex ) |
|
1098 { |
|
1099 const CMMFControllerImplementationInformation* controller=controllers[controllerIndex]; |
|
1100 LogL(aDataWrapper, *controller); |
|
1101 |
|
1102 if ( aRecord ) |
|
1103 { |
|
1104 const RMMFFormatImplInfoArray& formats=controller->RecordFormats(); |
|
1105 |
|
1106 for( TInt formatIndex=0; (formatIndex<formats.Count()) && !set; ++formatIndex ) |
|
1107 { |
|
1108 CMMFFormatImplementationInformation* formatInfo=formats[formatIndex]; |
|
1109 const CDesC8Array& extensions=formatInfo->SupportedFileExtensions(); |
|
1110 |
|
1111 for ( TInt extensionsIndex=0; (extensionsIndex<extensions.Count()) && !set; ++extensionsIndex ) |
|
1112 { |
|
1113 HBufC* buffer=HBufC::NewLC(extensions[extensionsIndex].Length()); |
|
1114 TPtr bufferPtr=buffer->Des(); |
|
1115 bufferPtr.Copy(extensions[extensionsIndex]); // Create a 16 bit copy of the 8 bit original |
|
1116 |
|
1117 if ( stillNull ) |
|
1118 { |
|
1119 aControllerUid = controller->Uid(); |
|
1120 aFormatUid = formats[0]->Uid(); |
|
1121 stillNull = EFalse; |
|
1122 } |
|
1123 if ( bufferPtr == extension ) |
|
1124 { |
|
1125 aControllerUid = controller->Uid(); |
|
1126 aFormatUid = formats[0]->Uid(); |
|
1127 set = ETrue; |
|
1128 } |
|
1129 CleanupStack::PopAndDestroy(buffer); |
|
1130 } |
|
1131 } |
|
1132 } |
|
1133 else |
|
1134 { |
|
1135 const RMMFFormatImplInfoArray& formats=controller->PlayFormats(); |
|
1136 |
|
1137 for( TInt formatIndex=0; (formatIndex<formats.Count()) && !set; ++formatIndex ) |
|
1138 { |
|
1139 CMMFFormatImplementationInformation* formatInfo=formats[formatIndex]; |
|
1140 const CDesC8Array& extensions=formatInfo->SupportedFileExtensions(); |
|
1141 |
|
1142 for ( TInt extensionsIndex=0; (extensionsIndex<extensions.Count()) && !set; ++extensionsIndex ) |
|
1143 { |
|
1144 HBufC* buffer=HBufC::NewLC(extensions[extensionsIndex].Length()); |
|
1145 TPtr bufferPtr=buffer->Des(); |
|
1146 bufferPtr.Copy(extensions[extensionsIndex]); // Create a 16 bit copy of the 8 bit original |
|
1147 |
|
1148 if ( stillNull ) |
|
1149 { |
|
1150 aControllerUid = controller->Uid(); |
|
1151 aFormatUid = formats[0]->Uid(); |
|
1152 stillNull = EFalse; |
|
1153 } |
|
1154 if ( bufferPtr == extension ) |
|
1155 { |
|
1156 aControllerUid = controller->Uid(); |
|
1157 aFormatUid = formats[0]->Uid(); |
|
1158 set = ETrue; |
|
1159 } |
|
1160 CleanupStack::PopAndDestroy(buffer); |
|
1161 } |
|
1162 } |
|
1163 } |
|
1164 } |
|
1165 |
|
1166 CleanupStack::PopAndDestroy(5, &fs); |
|
1167 } |
|
1168 |
|
1169 void CT_MMUtil::LogL(CDataWrapper& aDataWrapper, const CMMFControllerImplementationInformation& aControllerInfo) |
|
1170 { |
|
1171 aDataWrapper.INFO_PRINTF2(_L("Controller DisplayName = %S"), &(aControllerInfo.DisplayName())); |
|
1172 aDataWrapper.INFO_PRINTF2(_L("Controller Supplier = %S"), &(aControllerInfo.Supplier())); |
|
1173 aDataWrapper.INFO_PRINTF2(_L("Controller Format Uid = 0x%X"), aControllerInfo.Uid().iUid); |
|
1174 |
|
1175 // Print out Play Formats information |
|
1176 TInt index; |
|
1177 |
|
1178 const RMMFFormatImplInfoArray& playFormatArray = aControllerInfo.PlayFormats(); |
|
1179 for ( index=0; index<playFormatArray.Count(); ++index ) |
|
1180 { |
|
1181 CMMFFormatImplementationInformation* formatInfo=playFormatArray[index]; |
|
1182 aDataWrapper.INFO_PRINTF2(_L("PlayFormat [%d]"), index); |
|
1183 LogL(aDataWrapper, *formatInfo); |
|
1184 } |
|
1185 |
|
1186 // Print out Record Formats information |
|
1187 const RMMFFormatImplInfoArray& recordFormatArray = aControllerInfo.RecordFormats(); |
|
1188 for ( index=0; index<recordFormatArray.Count(); ++index ) |
|
1189 { |
|
1190 CMMFFormatImplementationInformation* formatInfo=recordFormatArray[index]; |
|
1191 aDataWrapper.INFO_PRINTF2(_L("RecordFormat [%d]"), index); |
|
1192 LogL(aDataWrapper, *formatInfo); |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 void CT_MMUtil::LogL(CDataWrapper& aDataWrapper, const CMMFFormatImplementationInformation& aFormatInfo) |
|
1197 { |
|
1198 aDataWrapper.INFO_PRINTF2(_L(" DisplayName = %S"), &(aFormatInfo.DisplayName())); |
|
1199 aDataWrapper.INFO_PRINTF2(_L(" Supplier = %S"), &(aFormatInfo.Supplier())); |
|
1200 aDataWrapper.INFO_PRINTF2(_L(" Uid = 0x%X"), aFormatInfo.Uid().iUid); |
|
1201 |
|
1202 TInt index; |
|
1203 const CDesC8Array& fileext=aFormatInfo.SupportedFileExtensions(); |
|
1204 |
|
1205 for ( index=0; index<fileext.Count(); ++index ) |
|
1206 { |
|
1207 HBufC* buffer=HBufC::NewLC(fileext[index].Length()); |
|
1208 TPtr bufferPtr=buffer->Des(); |
|
1209 bufferPtr.Copy(fileext[index]); // Create a 16 bit copy of the 8 bit original |
|
1210 aDataWrapper.INFO_PRINTF3(_L(" Supported file extension [%d]: %S"), index, &bufferPtr); |
|
1211 CleanupStack::PopAndDestroy(buffer); |
|
1212 } |
|
1213 |
|
1214 const CDesC8Array& mimetypes=aFormatInfo.SupportedMimeTypes(); |
|
1215 for ( index=0; index<mimetypes.Count(); ++index ) |
|
1216 { |
|
1217 HBufC* buffer=HBufC::NewLC(mimetypes[index].Length()); |
|
1218 TPtr bufferPtr=buffer->Des(); |
|
1219 bufferPtr.Copy(mimetypes[index]); // Create a 16 bit copy of the 8 bit original |
|
1220 aDataWrapper.INFO_PRINTF3(_L(" Supported mime type [%d]: %S"), index, &bufferPtr); |
|
1221 CleanupStack::PopAndDestroy(buffer); |
|
1222 } |
|
1223 |
|
1224 const CDesC8Array& headerdata=aFormatInfo.SupportedHeaderData(); |
|
1225 for ( index=0; index<headerdata.Count(); ++index ) |
|
1226 { |
|
1227 HBufC* buffer=HBufC::NewLC(headerdata[index].Length()); |
|
1228 TPtr bufferPtr=buffer->Des(); |
|
1229 bufferPtr.Copy(headerdata[index]); // Create a 16 bit copy of the 8 bit original |
|
1230 aDataWrapper.INFO_PRINTF3(_L(" Supported header data [%d]: %S"), index, &bufferPtr); |
|
1231 CleanupStack::PopAndDestroy(buffer); |
|
1232 } |
|
1233 } |