Update contrib.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
21 #include <mmf/common/mmffourcc.h>
25 #include "DataWrapperBase.h"
28 _LIT(KPriority, "priority");
30 _LIT(KMdaPriorityMin, "EMdaPriorityMin");
31 _LIT(KMdaPriorityNormal, "EMdaPriorityNormal");
32 _LIT(KMdaPriorityMax, "EMdaPriorityMax");
34 _LIT(KPriorityPreference, "prioritypreference");
36 _LIT(KMdaPriorityPreferenceNone, "None");
37 _LIT(KMdaPriorityPreferenceTime, "Time");
38 _LIT(KMdaPriorityPreferenceQuality, "Quality");
39 _LIT(KMdaPriorityPreferenceTimeAndQuality, "TimeAndQuality");
41 _LIT(KThreadPriority, "threadpriority");
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");
56 _LIT(KFourCC, "fourcc");
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");
80 _LIT(KImageType, "imagetype");
82 _LIT(KImageTypeThumbnail, "EImageTypeThumbnail");
83 _LIT(KImageTypeMain, "EImageTypeMain");
85 _LIT(KIntent, "intent");
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");
98 _LIT(KMidiStateClosedDisengaged, "EMidiStateClosedDisengaged");
99 _LIT(KMidiStateOpenDisengaged, "EMidiStateOpenDisengaged");
100 _LIT(KMidiStateOpenPlaying, "EMidiStateOpenPlaying");
101 _LIT(KMidiStateClosedEngaged, "EMidiStateClosedEngaged");
102 _LIT(KMidiStateOpenEngaged, "EMidiStateOpenEngaged");
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");
122 _LIT(KNoLocalRouting, "NoLocalRouting");
123 _LIT(KNoNetworkRouting, "NoNetworkRouting");
125 _LIT(KOptionNone, "OptionNone");
126 _LIT(KOptionNoDither, "OptionNoDither");
127 _LIT(KOptionAlwaysThread, "OptionAlwaysThread");
128 _LIT(KOptionAllowZeroFrameOpen, "OptionAllowZeroFrameOpen");
129 _LIT(KAllowGeneratedMask, "AllowGeneratedMask");
131 _LIT(KAgentPropertyBufferSize, "AgentPropertyBufferSize");
132 _LIT(KAgentPropertyAgentUI, "AgentPropertyAgentUI");
133 _LIT(KAgentPropertyMultipleSequence, "AgentPropertyMultipleSequence");
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");
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");
157 _LIT(KEVideoRotationNone, "None");
158 _LIT(KEVideoRotationClockwise90, "Clockwise90");
159 _LIT(KEVideoRotationClockwise180, "Clockwise180");
160 _LIT(KEVideoRotationClockwise270, "Clockwise270");
161 _LIT(KEVideoRotationUnknown, "Unknown");
165 _LIT(KCount, "count");
168 TBool CT_MMUtil::ReadMdaPriority(CDataWrapper& aDataWrapper, const TDesC& aSection, TInt& aPriority)
171 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KPriority(), str);
174 if ( str==KMdaPriorityMin )
176 aPriority=EMdaPriorityMin;
178 else if ( str==KMdaPriorityNormal )
180 aPriority=EMdaPriorityNormal;
182 else if ( str==KMdaPriorityMax )
184 aPriority=EMdaPriorityMax;
188 if ( !aDataWrapper.GetIntFromConfig(aSection, KPriority(), aPriority) )
190 aDataWrapper.ERR_PRINTF2(_L("Illegal priority %S"), &KPriority());
191 aDataWrapper.SetBlockResult(EFail);
196 aDataWrapper.INFO_PRINTF3(_L("ReadMdaPriority %S = %d"), &KPriority(), ret);
201 TBool CT_MMUtil::ReadMdaPriorityPreference(CDataWrapper& aDataWrapper, const TDesC& aSection, TMdaPriorityPreference& aPreference)
204 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KPriorityPreference(), str);
207 if ( str==KMdaPriorityPreferenceNone )
209 aPreference=EMdaPriorityPreferenceNone;
211 else if ( str==KMdaPriorityPreferenceTime )
213 aPreference=EMdaPriorityPreferenceTime;
215 else if ( str==KMdaPriorityPreferenceQuality )
217 aPreference=EMdaPriorityPreferenceQuality;
219 else if ( str==KMdaPriorityPreferenceTimeAndQuality )
221 aPreference=EMdaPriorityPreferenceTimeAndQuality;
226 if ( aDataWrapper.GetIntFromConfig(aSection, KPriorityPreference(), intVal) )
228 aPreference=(TMdaPriorityPreference)intVal;
232 aDataWrapper.ERR_PRINTF2(_L("Illegal TMdaPriorityPreference %S"), &KPriorityPreference());
233 aDataWrapper.SetBlockResult(EFail);
238 aDataWrapper.INFO_PRINTF3(_L("ReadMdaPriorityPreference %S = %d"), &KPriorityPreference(), ret);
243 TBool CT_MMUtil::ReadThreadPriority(CDataWrapper& aDataWrapper, const TDesC& aSection, TThreadPriority& aPriority)
246 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KThreadPriority(), str);
249 if ( str==KEPriorityNull )
251 aPriority = EPriorityNull;
253 else if ( str==KEPriorityMuchLess )
255 aPriority = EPriorityMuchLess;
257 else if ( str==KEPriorityLess )
259 aPriority = EPriorityLess;
261 else if ( str==KEPriorityNormal )
263 aPriority = EPriorityNormal;
265 else if ( str==KEPriorityMore )
267 aPriority = EPriorityMore;
269 else if ( str==KEPriorityMuchMore )
271 aPriority = EPriorityMuchMore;
273 else if ( str==KEPriorityRealTime )
275 aPriority = EPriorityRealTime;
277 else if ( str==KEPriorityAbsoluteVeryLow )
279 aPriority = EPriorityAbsoluteVeryLow;
281 else if ( str==KEPriorityAbsoluteLow )
283 aPriority = EPriorityAbsoluteLow;
285 else if ( str==KEPriorityAbsoluteBackground )
287 aPriority = EPriorityAbsoluteBackground;
289 else if ( str==KEPriorityAbsoluteForeground )
291 aPriority = EPriorityAbsoluteForeground;
293 else if ( str==KEPriorityAbsoluteHigh )
295 aPriority = EPriorityAbsoluteHigh;
300 if ( aDataWrapper.GetIntFromConfig(aSection, KThreadPriority(), intVal) )
302 aPriority=(TThreadPriority)intVal;
306 aDataWrapper.ERR_PRINTF2(_L("Illegal TThreadPriority %S"), &KThreadPriority());
307 aDataWrapper.SetBlockResult(EFail);
312 aDataWrapper.INFO_PRINTF3(_L("ReadThreadPriority %S = %d"), &KThreadPriority(), ret);
317 TBool CT_MMUtil::ReadFourCC(CDataWrapper& aDataWrapper, const TDesC& aSection, TFourCC& aFourCC)
320 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KFourCC(), str);
324 if( str==KDesMMFFourCCCodePCM8 )
326 aFourCC=KMMFFourCCCodePCM8;
328 else if( str==KDesMMFFourCCCodePCMU8 )
330 aFourCC=KMMFFourCCCodePCMU8;
332 else if( str==KDesMMFFourCCCodePCM16 )
334 aFourCC=KMMFFourCCCodePCM16;
336 else if( str==KDesMMFFourCCCodePCMU16 )
338 aFourCC=KMMFFourCCCodePCMU16;
340 else if( str==KDesMMFFourCCCodePCM16B )
342 aFourCC=KMMFFourCCCodePCM16B;
344 else if( str==KDesMMFFourCCCodePCMU16B )
346 aFourCC=KMMFFourCCCodePCMU16B;
348 else if( str==KDesMMFFourCCCodeIMAD )
350 aFourCC=KMMFFourCCCodeIMAD;
352 else if( str==KDesMMFFourCCCodeIMAS )
354 aFourCC=KMMFFourCCCodeIMAS;
356 else if( str==KDesMMFFourCCCodeALAW )
358 aFourCC=KMMFFourCCCodeALAW;
360 else if( str==KDesMMFFourCCCodeMuLAW )
362 aFourCC=KMMFFourCCCodeMuLAW;
364 else if( str==KDesMMFFourCCCodeGSM610 )
366 aFourCC=KMMFFourCCCodeGSM610;
368 else if( str==KDesFourCCCodeNULL )
370 aFourCC=KMMFFourCCCodeNULL;
372 else if( str==KDesMMFFourCCCodeAMR )
374 aFourCC=KMMFFourCCCodeAMR;
376 else if( str==KDesMMFFourCCCodeAAC )
378 aFourCC=KMMFFourCCCodeAAC;
380 else if( str==KDesMMFFourCCCodeAWB )
382 aFourCC=KMMFFourCCCodeAWB;
384 else if( str==KDesMMFFourCCCodeMP3 )
386 aFourCC=KMMFFourCCCodeMP3;
388 else if( str==KDesMMFFourCCCodeATRAC3 )
390 aFourCC=KMMFFourCCCodeATRAC3;
392 else if( str==KDesMMFFourCCCodeSBC )
394 aFourCC=KMMFFourCCCodeSBC;
396 else if( str==KDesMMFFourCCCodeAMRW )
398 aFourCC=KMMFFourCCCodeAMRW;
400 else if( str==KDesMMFFourCCCodeADTS )
402 aFourCC=KMMFFourCCCodeADTS;
407 if ( aDataWrapper.GetIntFromConfig(aSection, KFourCC(), intVal) )
413 aDataWrapper.ERR_PRINTF2(_L("Illegal TFourCC %S"), &KFourCC());
414 aDataWrapper.SetBlockResult(EFail);
422 TBool CT_MMUtil::ReadImageType(CDataWrapper& aDataWrapper, const TDesC& aSection, CImageDecoder::TImageType& aImageType)
425 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KImageType(), str);
429 if ( str==KImageTypeThumbnail )
431 aImageType=CImageDecoder::EImageTypeThumbnail;
433 else if ( str==KImageTypeMain )
435 aImageType=CImageDecoder::EImageTypeMain;
440 if ( aDataWrapper.GetIntFromConfig(aSection, KImageType(), intVal) )
442 aImageType=(CImageDecoder::TImageType)intVal;
446 aDataWrapper.ERR_PRINTF2(_L("Illegal CImageDecoder::TImageType %S"), &KImageType());
447 aDataWrapper.SetBlockResult(EFail);
455 TBool CT_MMUtil::ReadIntent(CDataWrapper& aDataWrapper, const TDesC& aSection, ContentAccess::TIntent& aIntent)
458 TBool ret=aDataWrapper.GetStringFromConfig(aSection, KIntent(), str);
462 if ( str==KIntentPeek )
464 aIntent=ContentAccess::EPeek;
466 else if ( str==KIntentPlay )
468 aIntent=ContentAccess::EPlay;
470 else if ( str==KIntentView )
472 aIntent=ContentAccess::EView;
474 else if ( str==KIntentExecute )
476 aIntent=ContentAccess::EExecute;
478 else if ( str==KIntentPrint )
480 aIntent=ContentAccess::EPrint;
482 else if ( str==KIntentPause )
484 aIntent=ContentAccess::EPause;
486 else if ( str==KIntentContinue )
488 aIntent=ContentAccess::EContinue;
490 else if ( str==KIntentStop )
492 aIntent=ContentAccess::EStop;
494 else if ( str==KIntentUnknown )
496 aIntent=ContentAccess::EUnknown;
498 else if ( str==KIntentInstall )
500 aIntent=ContentAccess::EInstall;
505 if ( aDataWrapper.GetIntFromConfig(aSection, KIntent(), intVal) )
507 aIntent=(ContentAccess::TIntent)intVal;
511 aDataWrapper.ERR_PRINTF2(_L("Illegal ContentAccess::TIntent %S"), &KIntent());
512 aDataWrapper.SetBlockResult(EFail);
520 TBool CT_MMUtil::ReadMidiState(CDataWrapper& aDataWrapper, const TDesC& aSection, const TDesC& aKeyName, TMidiState& aState)
523 TBool ret=aDataWrapper.GetStringFromConfig(aSection, aKeyName, str);
527 if ( str==KMidiStateClosedDisengaged )
529 aState=EMidiStateClosedDisengaged;
531 else if ( str==KMidiStateOpenDisengaged )
533 aState=EMidiStateOpenDisengaged;
535 else if ( str==KMidiStateOpenPlaying )
537 aState=EMidiStateOpenPlaying;
539 else if ( str==KMidiStateClosedEngaged )
541 aState=EMidiStateClosedEngaged;
543 else if ( str==KMidiStateOpenEngaged )
545 aState=EMidiStateOpenEngaged;
550 if ( aDataWrapper.GetIntFromConfig(aSection, aKeyName, intVal) )
552 aState=(TMidiState)intVal;
557 aDataWrapper.ERR_PRINTF2(_L("Illegal TMidiState %S"), &aKeyName);
558 aDataWrapper.SetBlockResult(EFail);
566 TBool CT_MMUtil::ConvertToAudioCaps(const TDesC& aDesc, TMdaAudioDataSettings::TAudioCaps& aAudioCaps)
570 if ( aDesc==KSampleRateFixed )
572 aAudioCaps=TMdaAudioDataSettings::ESampleRateFixed;
574 else if ( aDesc==KSampleRateAnyInRange )
576 aAudioCaps=TMdaAudioDataSettings::ESampleRateAnyInRange;
578 else if ( aDesc==KSampleRate8000Hz )
580 aAudioCaps=TMdaAudioDataSettings::ESampleRate8000Hz;
582 else if ( aDesc==KSampleRate11025Hz )
584 aAudioCaps=TMdaAudioDataSettings::ESampleRate11025Hz;
586 else if ( aDesc==KSampleRate12000Hz )
588 aAudioCaps=TMdaAudioDataSettings::ESampleRate12000Hz;
590 else if ( aDesc==KSampleRate16000Hz )
592 aAudioCaps=TMdaAudioDataSettings::ESampleRate16000Hz;
594 else if ( aDesc==KSampleRate22050Hz )
596 aAudioCaps=TMdaAudioDataSettings::ESampleRate22050Hz;
598 else if ( aDesc==KSampleRate24000Hz )
600 aAudioCaps=TMdaAudioDataSettings::ESampleRate24000Hz;
602 else if ( aDesc==KSampleRate32000Hz )
604 aAudioCaps=TMdaAudioDataSettings::ESampleRate32000Hz;
606 else if ( aDesc==KSampleRate44100Hz )
608 aAudioCaps=TMdaAudioDataSettings::ESampleRate44100Hz;
610 else if ( aDesc==KSampleRate48000Hz )
612 aAudioCaps=TMdaAudioDataSettings::ESampleRate48000Hz;
614 else if ( aDesc==KSampleRate96000Hz )
616 aAudioCaps=TMdaAudioDataSettings::ESampleRate96000Hz;
618 else if ( aDesc==KSampleRate64000Hz )
620 aAudioCaps=TMdaAudioDataSettings::ESampleRate64000Hz;
622 else if ( aDesc==KChannelsMono )
624 aAudioCaps=TMdaAudioDataSettings::EChannelsMono;
626 else if ( aDesc==KChannelsStereo )
628 aAudioCaps=TMdaAudioDataSettings::EChannelsStereo;
630 else if ( aDesc==KRoutingControl )
632 aAudioCaps=TMdaAudioDataSettings::ERoutingControl;
634 else if ( aDesc==KRealTime )
636 aAudioCaps=TMdaAudioDataSettings::ERealTime;
646 TBool CT_MMUtil::ConvertToAudioFlags(const TDesC& aDesc, TMdaAudioDataSettings::TAudioFlags& aAudioFlags)
650 if ( aDesc==KNoLocalRouting )
652 aAudioFlags=TMdaAudioDataSettings::ENoLocalRouting;
654 else if ( aDesc==KNoNetworkRouting )
656 aAudioFlags=TMdaAudioDataSettings::ENoNetworkRouting;
666 TBool CT_MMUtil::ConvertToOption(const TDesC& aDesc, CImageDecoder::TOptions& aOption)
670 if ( aDesc==KOptionNone )
672 aOption=CImageDecoder::EOptionNone;
674 else if ( aDesc==KOptionNoDither )
676 aOption=CImageDecoder::EOptionNoDither;
678 else if ( aDesc==KOptionAlwaysThread )
680 aOption=CImageDecoder::EOptionAlwaysThread;
682 else if ( aDesc==KOptionAllowZeroFrameOpen )
684 aOption=CImageDecoder::EOptionAllowZeroFrameOpen;
686 else if ( aDesc==KAllowGeneratedMask )
688 aOption=CImageDecoder::EAllowGeneratedMask;
698 TBool CT_MMUtil::ConvertToOption(const TDesC& aDesc, CImageEncoder::TOptions& aOption)
702 if ( aDesc==KOptionNone )
704 aOption=CImageEncoder::EOptionNone;
706 else if ( aDesc==KOptionAlwaysThread )
708 aOption=CImageEncoder::EOptionAlwaysThread;
718 TBool CT_MMUtil::ConvertToAgentProperty(const TDesC& aDesc, ContentAccess::TAgentProperty& aAgentProperty)
722 if ( aDesc==KAgentPropertyBufferSize )
724 aAgentProperty=ContentAccess::EAgentPropertyBufferSize;
726 else if ( aDesc==KAgentPropertyAgentUI )
728 aAgentProperty=ContentAccess::EAgentPropertyAgentUI;
730 else if ( aDesc==KAgentPropertyMultipleSequence )
732 aAgentProperty=ContentAccess::EAgentPropertyMultipleSequence;
742 const TDesC& CT_MMUtil::GetFourCCString(TUint32 aValue)
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;
789 return KDesMMFFourCCCodeUnknown;
792 TBool CT_MMUtil::ReadAudioDataSettings(CDataWrapper& aDataWrapper, TMdaAudioDataSettings& aSettings, const TDesC& aSection)
795 TBool callQuery=ETrue;
799 TBool moreData=ETrue;
800 TPtrC capabilityString;
802 TBool hasCapabilty=EFalse;
805 TBuf<KMaxTestExecuteCommandLength> capabilityTemp;
806 capabilityTemp.Format(KCmdCapabilty(), ++index);
807 if ( aDataWrapper.GetStringFromConfig(aSection, capabilityTemp, capabilityString) )
809 TMdaAudioDataSettings::TAudioCaps audioCap;
810 if ( ConvertToAudioCaps(capabilityString, audioCap) )
812 capability |= audioCap;
817 aDataWrapper.ERR_PRINTF2(_L("Illegal capability %S"), &capabilityString);
818 aDataWrapper.SetBlockResult(EFail);
828 aSettings.iCaps=capability;
834 if ( aDataWrapper.GetIntFromConfig(aSection, KCmdChannels(), channels) )
836 aSettings.iChannels=channels;
842 TMdaAudioDataSettings::TAudioFlags flags;
844 if ( aDataWrapper.GetStringFromConfig(aSection, KCmdFlags(), flagsString) )
846 if ( ConvertToAudioFlags(flagsString, flags) )
848 aSettings.iFlags=flags;
853 aDataWrapper.ERR_PRINTF2(_L("Illegal flags %S"), &flagsString);
854 aDataWrapper.SetBlockResult(EFail);
860 if ( aDataWrapper.GetIntFromConfig(aSection, KCmdMaxVolume(), maxVolume) )
862 aSettings.iMaxVolume=maxVolume;
868 if ( aDataWrapper.GetIntFromConfig(aSection, KCmdSampleRate(), sampleRate) )
870 aSettings.iSampleRate=sampleRate;
877 if ( aDataWrapper.GetIntFromConfig(aSection, KCmdVolume(), volume) )
879 aSettings.iVolume=volume;
892 TBool CT_MMUtil::ConvertToDisplayMode(const TDesC& aDisplayModeStr, TDisplayMode& aDisplayMode)
896 if (aDisplayModeStr == KDModeNone)
898 aDisplayMode = ENone;
900 else if (aDisplayModeStr == KDModeGray2)
902 aDisplayMode = EGray2;
904 else if (aDisplayModeStr == KDModeGray4)
906 aDisplayMode = EGray4;
908 else if (aDisplayModeStr == KDModeGray16)
910 aDisplayMode = EGray16;
912 else if (aDisplayModeStr == KDModeGray256)
914 aDisplayMode = EGray256;
916 else if (aDisplayModeStr == KDModeColor16)
918 aDisplayMode = EColor16;
920 else if (aDisplayModeStr == KDModeColor256)
922 aDisplayMode = EColor256;
924 else if (aDisplayModeStr == KDModeColor64K)
926 aDisplayMode = EColor64K;
928 else if (aDisplayModeStr == KDModeColor16M)
930 aDisplayMode = EColor16M;
932 else if (aDisplayModeStr == KDModeRgb)
936 else if (aDisplayModeStr == KDModeColor4K)
938 aDisplayMode = EColor4K;
940 else if (aDisplayModeStr == KDModeColor16MU)
942 aDisplayMode = EColor16MU;
944 else if (aDisplayModeStr == KDModeColor16MA)
946 aDisplayMode = EColor16MA;
948 else if (aDisplayModeStr == KDModeColorLast)
950 aDisplayMode = EColorLast;
960 TBool CT_MMUtil::ConvertToVideoRotation(const TDesC& aVideoRotationStr, TVideoRotation& aVideoRotation)
964 if (aVideoRotationStr == KEVideoRotationNone)
966 aVideoRotation = EVideoRotationNone;
968 else if (aVideoRotationStr == KEVideoRotationClockwise90)
970 aVideoRotation = EVideoRotationClockwise90;
972 else if (aVideoRotationStr == KEVideoRotationClockwise180)
974 aVideoRotation = EVideoRotationClockwise180;
976 else if (aVideoRotationStr == KEVideoRotationClockwise270)
978 aVideoRotation = EVideoRotationClockwise270;
988 const TDesC& CT_MMUtil::GetVideoRotationString(TVideoRotation& aVideoRotation)
990 switch(aVideoRotation)
992 case EVideoRotationNone:
993 return KEVideoRotationNone;
994 case EVideoRotationClockwise90:
995 return KEVideoRotationClockwise90;
996 case EVideoRotationClockwise180:
997 return KEVideoRotationClockwise180;
998 case EVideoRotationClockwise270:
999 return KEVideoRotationClockwise270;
1003 return KEVideoRotationUnknown;
1007 void CT_MMUtil::VerifyMIMETypeArrayL(CDataWrapper& aDataWrapper, const TDesC& aSection, const RFileExtensionMIMETypeArray& aFileExtensionArray)
1011 TInt count=aFileExtensionArray.Count();
1012 for ( TInt index=0; index<count; ++index )
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);
1032 // Verify that it is unique in the array
1033 for ( TInt index2=index+1; index2<count; ++index2 )
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)
1043 aDataWrapper.ERR_PRINTF3(_L("Duplicate Types in entries %d and %d"), index, index2);
1044 aDataWrapper.SetBlockResult(EFail);
1048 TInt expectedCount=0;
1049 if ( aDataWrapper.GetIntFromConfig(aSection, KCount(), expectedCount) )
1051 if ( count != expectedCount )
1053 aDataWrapper.ERR_PRINTF3(_L("count (%d) != expectedCount (%d)"), count, expectedCount);
1054 aDataWrapper.SetBlockResult(EFail);
1059 void CT_MMUtil::GetControllerAndFormatUidL(CDataWrapper& aDataWrapper, const TDesC& aFileName, TUid aMediaId, TBool aRecord, TUid& aControllerUid, TUid& aFormatUid)
1062 User::LeaveIfError(fs.Connect());
1063 CleanupClosePushL(fs);
1066 fs.Parse(aFileName, parse);
1067 TPtrC extension=parse.Ext();
1069 CMMFControllerPluginSelectionParameters* controllerSelection = CMMFControllerPluginSelectionParameters::NewLC();
1070 CMMFFormatSelectionParameters* formatSelection = CMMFFormatSelectionParameters::NewLC();
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);
1077 // Set the media ids
1078 RArray<TUid> mediaIds;
1079 CleanupClosePushL(mediaIds);
1080 User::LeaveIfError(mediaIds.Append(aMediaId));
1082 // Get plugins that support at least audio
1083 controllerSelection->SetMediaIdsL(mediaIds, CMMFPluginSelectionParameters::EAllowOtherMediaIds);
1084 controllerSelection->SetPreferredSupplierL(KNullDesC, CMMFPluginSelectionParameters::EPreferredSupplierPluginsFirstInList);
1086 // Array to hold all the controllers support the match data
1087 RMMFControllerImplInfoArray controllers;
1088 CleanupResetAndDestroyPushL(controllers);
1089 controllerSelection->ListImplementationsL(controllers);
1091 // Find the first controller with at least one record format available
1092 aControllerUid=TUid::Null();
1093 aFormatUid=TUid::Null();
1096 TBool stillNull = ETrue;
1097 for( TInt controllerIndex=0; (controllerIndex<controllers.Count()) && !set; ++controllerIndex )
1099 const CMMFControllerImplementationInformation* controller=controllers[controllerIndex];
1100 LogL(aDataWrapper, *controller);
1104 const RMMFFormatImplInfoArray& formats=controller->RecordFormats();
1106 for( TInt formatIndex=0; (formatIndex<formats.Count()) && !set; ++formatIndex )
1108 CMMFFormatImplementationInformation* formatInfo=formats[formatIndex];
1109 const CDesC8Array& extensions=formatInfo->SupportedFileExtensions();
1111 for ( TInt extensionsIndex=0; (extensionsIndex<extensions.Count()) && !set; ++extensionsIndex )
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
1119 aControllerUid = controller->Uid();
1120 aFormatUid = formats[0]->Uid();
1123 if ( bufferPtr == extension )
1125 aControllerUid = controller->Uid();
1126 aFormatUid = formats[0]->Uid();
1129 CleanupStack::PopAndDestroy(buffer);
1135 const RMMFFormatImplInfoArray& formats=controller->PlayFormats();
1137 for( TInt formatIndex=0; (formatIndex<formats.Count()) && !set; ++formatIndex )
1139 CMMFFormatImplementationInformation* formatInfo=formats[formatIndex];
1140 const CDesC8Array& extensions=formatInfo->SupportedFileExtensions();
1142 for ( TInt extensionsIndex=0; (extensionsIndex<extensions.Count()) && !set; ++extensionsIndex )
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
1150 aControllerUid = controller->Uid();
1151 aFormatUid = formats[0]->Uid();
1154 if ( bufferPtr == extension )
1156 aControllerUid = controller->Uid();
1157 aFormatUid = formats[0]->Uid();
1160 CleanupStack::PopAndDestroy(buffer);
1166 CleanupStack::PopAndDestroy(5, &fs);
1169 void CT_MMUtil::LogL(CDataWrapper& aDataWrapper, const CMMFControllerImplementationInformation& aControllerInfo)
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);
1175 // Print out Play Formats information
1178 const RMMFFormatImplInfoArray& playFormatArray = aControllerInfo.PlayFormats();
1179 for ( index=0; index<playFormatArray.Count(); ++index )
1181 CMMFFormatImplementationInformation* formatInfo=playFormatArray[index];
1182 aDataWrapper.INFO_PRINTF2(_L("PlayFormat [%d]"), index);
1183 LogL(aDataWrapper, *formatInfo);
1186 // Print out Record Formats information
1187 const RMMFFormatImplInfoArray& recordFormatArray = aControllerInfo.RecordFormats();
1188 for ( index=0; index<recordFormatArray.Count(); ++index )
1190 CMMFFormatImplementationInformation* formatInfo=recordFormatArray[index];
1191 aDataWrapper.INFO_PRINTF2(_L("RecordFormat [%d]"), index);
1192 LogL(aDataWrapper, *formatInfo);
1196 void CT_MMUtil::LogL(CDataWrapper& aDataWrapper, const CMMFFormatImplementationInformation& aFormatInfo)
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);
1203 const CDesC8Array& fileext=aFormatInfo.SupportedFileExtensions();
1205 for ( index=0; index<fileext.Count(); ++index )
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);
1214 const CDesC8Array& mimetypes=aFormatInfo.SupportedMimeTypes();
1215 for ( index=0; index<mimetypes.Count(); ++index )
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);
1224 const CDesC8Array& headerdata=aFormatInfo.SupportedHeaderData();
1225 for ( index=0; index<headerdata.Count(); ++index )
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);