|
1 /* |
|
2 * Copyright (c) 2008-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 #include "omxscriptparser.h" |
|
20 #include <xml/parser.h> |
|
21 #include <utf.h> |
|
22 #include "parsemap.h" |
|
23 //#include <openmax/il/khronos/v1_x/OMX_CoreExt_Nokia.h> |
|
24 |
|
25 #if defined(NCP_COMMON_BRIDGE_FAMILY) && !defined(__WINSCW__) |
|
26 // These definitions are from /epoc32/include/osi/video/VFM_Types.h |
|
27 // We can't include the header itself because it does not obey symbian foundation |
|
28 // rules on header file inclusion paths. |
|
29 const TInt OMX_COLOR_FormatSTYUV420PackedSemiPlanarMB = (OMX_COLOR_FormatMax-1); |
|
30 const TInt OMX_COLOR_FormatSTYUV422PackedSemiPlanarMB = (OMX_COLOR_FormatMax-2); |
|
31 #endif |
|
32 |
|
33 /////////////////////////////////////////////////////////////////////////////// |
|
34 // Temporary work-around for floating point issues on HREF 8500 ED hardware |
|
35 // Using this macro, code that uses TReal will be #defined out if running on ED. |
|
36 // TODO: Remove HREF_ED_WITHOUT_FLOATING_POINT and all of its conditional code |
|
37 // once the floating point issue has been solved. |
|
38 #if defined(NCP_COMMON_BRIDGE_FAMILY) && !defined(__WINSCW__) |
|
39 #define HREF_ED_WITHOUT_FLOATING_POINT |
|
40 #endif |
|
41 |
|
42 using Xml::CParser; |
|
43 |
|
44 COmxScriptParser* COmxScriptParser::NewL(RFs& aFs, const TDesC& aFilename, MOmxScriptIf& aCallback) |
|
45 { |
|
46 COmxScriptParser* self = new(ELeave) COmxScriptParser(aFs, aCallback); |
|
47 CleanupStack::PushL(self); |
|
48 self->ConstructL(aFilename); |
|
49 CleanupStack::Pop(self); |
|
50 return self; |
|
51 } |
|
52 |
|
53 COmxScriptParser::~COmxScriptParser() |
|
54 { |
|
55 iFilename.Close(); |
|
56 } |
|
57 |
|
58 COmxScriptParser::COmxScriptParser(RFs& aFs, MOmxScriptIf& aCallback): |
|
59 iFs(aFs), iCallback(aCallback) |
|
60 { |
|
61 |
|
62 } |
|
63 |
|
64 void COmxScriptParser::ConstructL(const TDesC& aFilename) |
|
65 { |
|
66 User::LeaveIfError(iFilename.Create(aFilename.Length())); |
|
67 iFilename = aFilename; |
|
68 } |
|
69 |
|
70 TBool COmxScriptParser::RunScriptL(const TDesC& aSectionName) |
|
71 { |
|
72 CParser* parser = CParser::NewLC(_L8("text/xml"), *this); |
|
73 iSectionName = &aSectionName; |
|
74 iInTest = EFalse; |
|
75 iFoundTest = EFalse; |
|
76 iCallbackAborted = EFalse; |
|
77 TInt error = KErrNone; |
|
78 TInt size = iFilename.Length(); |
|
79 |
|
80 TRAP(error, Xml::ParseL(*parser, iFs, iFilename)); |
|
81 CleanupStack::PopAndDestroy(parser); |
|
82 |
|
83 if(error == KErrAbort && iCallbackAborted) |
|
84 { |
|
85 return EFalse; |
|
86 } |
|
87 User::LeaveIfError(error); |
|
88 if(!iFoundTest) |
|
89 { |
|
90 User::Leave(KErrNotFound); |
|
91 } |
|
92 return ETrue; |
|
93 } |
|
94 |
|
95 void COmxScriptParser::OnStartDocumentL(const RDocumentParameters& /*aDocParam*/, TInt /*aErrorCode*/) |
|
96 { |
|
97 // do nothing |
|
98 } |
|
99 |
|
100 void COmxScriptParser::OnEndDocumentL(TInt /*aErrorCode*/) |
|
101 { |
|
102 // do nothing |
|
103 } |
|
104 |
|
105 void COmxScriptParser::OnContentL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) |
|
106 { |
|
107 // do nothing |
|
108 } |
|
109 |
|
110 void COmxScriptParser::OnStartPrefixMappingL(const RString& /*aPrefix*/, const RString& /*aUri*/, |
|
111 TInt /*aErrorCode*/) |
|
112 { |
|
113 // do nothing |
|
114 } |
|
115 |
|
116 void COmxScriptParser::OnEndPrefixMappingL(const RString& /*aPrefix*/, TInt /*aErrorCode*/) |
|
117 { |
|
118 // do nothing |
|
119 } |
|
120 |
|
121 void COmxScriptParser::OnIgnorableWhiteSpaceL(const TDesC8& /*aBytes*/, TInt /*aErrorCode*/) |
|
122 { |
|
123 // do nothing |
|
124 } |
|
125 |
|
126 void COmxScriptParser::OnSkippedEntityL(const RString& /*aName*/, TInt /*aErrorCode*/) |
|
127 { |
|
128 User::Invariant(); |
|
129 } |
|
130 |
|
131 void COmxScriptParser::OnProcessingInstructionL(const TDesC8& /*aTarget*/, const TDesC8& /*aData*/, |
|
132 TInt /*aErrorCode*/) |
|
133 { |
|
134 // do nothing |
|
135 } |
|
136 |
|
137 void COmxScriptParser::OnError(TInt aErrorCode) |
|
138 { |
|
139 (void) aErrorCode; // avoid unused parameter warning. useful to give parameter a name when debugging. |
|
140 User::Invariant(); |
|
141 } |
|
142 |
|
143 TAny* COmxScriptParser::GetExtendedInterface(const TInt32 /*aUid*/) |
|
144 { |
|
145 return 0; |
|
146 } |
|
147 |
|
148 void COmxScriptParser::OnStartElementL(const RTagInfo& aElement, |
|
149 const RAttributeArray& aAttributes, |
|
150 TInt /*aErrorCode*/) |
|
151 { |
|
152 const TDesC8& elemName = aElement.LocalName().DesC(); |
|
153 if(!iInTest) |
|
154 { |
|
155 if(elemName == _L8("Test")) |
|
156 { |
|
157 const TDesC8* testName8Bit = FindAttribute(aAttributes, _L8("name")); |
|
158 if(testName8Bit) |
|
159 { |
|
160 HBufC* testName = HBufC::NewLC(testName8Bit->Length()); |
|
161 testName->Des().Copy(*testName8Bit); |
|
162 if(*testName == *iSectionName) |
|
163 { |
|
164 __ASSERT_ALWAYS(!iFoundTest, User::Invariant()); |
|
165 iFoundTest = ETrue; |
|
166 iInTest = ETrue; |
|
167 } |
|
168 CleanupStack::PopAndDestroy(testName); |
|
169 } |
|
170 } |
|
171 } |
|
172 else |
|
173 { |
|
174 if(elemName == _L8("LoadComponent")) |
|
175 { |
|
176 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
177 const TDesC8& name = FindAttributeL(aAttributes, _L8("name")); |
|
178 |
|
179 TBool baseEnabled = EFalse; |
|
180 const TDesC8* baseImpl = NULL; |
|
181 const TDesC8* baseEnabledAttr = FindAttribute(aAttributes, _L8("baseprofilesupport")); |
|
182 if (baseEnabledAttr != NULL) |
|
183 { |
|
184 baseEnabled = ParseBoolean(*baseEnabledAttr); |
|
185 baseImpl = &(FindAttributeL(aAttributes, _L8("baseprofileimpl"))); |
|
186 } |
|
187 |
|
188 TBool loadInCoreServerThread = EFalse; |
|
189 const TDesC8* loadInCoreServerThreadAttr = FindAttribute(aAttributes, _L8("loadincoreserverthread")); |
|
190 if(loadInCoreServerThreadAttr != NULL) |
|
191 { |
|
192 loadInCoreServerThread = ParseBoolean(*loadInCoreServerThreadAttr); |
|
193 } |
|
194 |
|
195 CheckForAbortL(iCallback.MosLoadComponentL(comp, name, baseEnabled, baseImpl, loadInCoreServerThread)); |
|
196 } |
|
197 else if(elemName == _L8("LogAllEvents")) //utility |
|
198 { |
|
199 CheckForAbortL(iCallback.MosLogAllEventsL()); |
|
200 } |
|
201 |
|
202 else if(elemName == _L8("SetSensorModeType")) //camera |
|
203 { |
|
204 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
205 |
|
206 TPtrC8 comp; |
|
207 TInt port = 0; |
|
208 ParseCompPortL(compPort, comp, port); |
|
209 |
|
210 TInt frameRate = ParseOptionalIntL(aAttributes, _L8("frameRate"), -1); |
|
211 |
|
212 const TDesC8& oneShotStr = FindAttributeL(aAttributes, _L8("oneShot")); |
|
213 TBool oneShot = ParseBooleanL(oneShotStr); |
|
214 TInt width = ParseOptionalIntL(aAttributes, _L8("width"), -1); |
|
215 TInt height = ParseOptionalIntL(aAttributes, _L8("height"), -1); |
|
216 |
|
217 CheckForAbortL(iCallback.MosSetSensorModeTypeL(comp, port, frameRate, oneShot, width, height)); |
|
218 } |
|
219 else if(elemName == _L8("DeleteFile")) //utility |
|
220 { |
|
221 const TDesC8& fileName8 = FindAttributeL(aAttributes, _L8("filename")); |
|
222 |
|
223 HBufC* fileName = HBufC::NewLC(fileName8.Length() + 1); |
|
224 fileName->Des().Copy(fileName8); |
|
225 fileName->Des().ZeroTerminate(); |
|
226 |
|
227 TBool fileMustExist = EFalse; |
|
228 const TDesC8* fileMustExistAttr = FindAttribute(aAttributes, _L8("fileMustExist")); |
|
229 if (fileMustExistAttr != NULL) |
|
230 { |
|
231 fileMustExist = ParseBoolean(*fileMustExistAttr); |
|
232 } |
|
233 |
|
234 CheckForAbortL(iCallback.MosDeleteFileL(*fileName, fileMustExist)); |
|
235 CleanupStack::PopAndDestroy(fileName); |
|
236 } |
|
237 else if(elemName == _L8("SetupTunnel")) |
|
238 { |
|
239 const TDesC8& source = FindAttributeL(aAttributes, _L8("output")); |
|
240 const TDesC8& sink = FindAttributeL(aAttributes, _L8("input")); |
|
241 |
|
242 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
243 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
244 if (expectedError) |
|
245 { |
|
246 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
247 } |
|
248 |
|
249 TPtrC8 sourceComp; |
|
250 TPtrC8 sinkComp; |
|
251 TInt sourcePort = 0; |
|
252 TInt sinkPort = 0; |
|
253 _LIT8(KTemp, ""); |
|
254 const TDesC8& temp = KTemp; |
|
255 if (source.Compare(temp)) |
|
256 { |
|
257 ParseCompPortL(source, sourceComp, sourcePort); |
|
258 } |
|
259 if(sink.Compare(temp)) |
|
260 { |
|
261 ParseCompPortL(sink, sinkComp, sinkPort); |
|
262 } |
|
263 CheckForAbortL(iCallback.MosSetupTunnel(sourceComp, sourcePort, sinkComp, sinkPort, expectedErrorInt)); |
|
264 } |
|
265 |
|
266 else if (elemName == _L8("SetupNonTunnel")) |
|
267 { |
|
268 const TDesC8& source = FindAttributeL(aAttributes, _L8("output")); |
|
269 const TDesC8& sink = FindAttributeL(aAttributes, _L8("input")); |
|
270 const TDesC8& supplierDes = FindAttributeL(aAttributes, _L8("supplier")); |
|
271 TPtrC8 sourceComp; |
|
272 TPtrC8 sinkComp; |
|
273 TInt sourcePort; |
|
274 TInt sinkPort; |
|
275 ParseCompPortL(source, sourceComp, sourcePort); |
|
276 ParseCompPortL(sink, sinkComp, sinkPort); |
|
277 OMX_BUFFERSUPPLIERTYPE supplier = ParseOmxSupplierL(supplierDes, ETrue); |
|
278 CheckForAbortL(iCallback.MosSetupNonTunnel(sourceComp, sourcePort, sinkComp, sinkPort, supplier)); |
|
279 } |
|
280 else if (elemName == _L8("SetBufferForPort")) |
|
281 { |
|
282 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
283 TPtrC8 comp; |
|
284 TInt port; |
|
285 ParseCompPortL(compPort, comp, port); |
|
286 |
|
287 const TDesC8& filename8Bit = FindAttributeL(aAttributes, _L8("filename")); |
|
288 HBufC* filename = HBufC::NewLC(filename8Bit.Length()); |
|
289 filename->Des().Copy(filename8Bit); |
|
290 TInt headerlength = KErrNone; |
|
291 headerlength = ParseOptionalIntL(aAttributes, _L8("headerlength"), -1); |
|
292 |
|
293 const TDesC8* supplierDes = FindAttribute(aAttributes, _L8("supplier")); |
|
294 OMX_BUFFERSUPPLIERTYPE supplier = OMX_BufferSupplyUnspecified; |
|
295 if(supplierDes) |
|
296 { |
|
297 supplier = ParseOmxSupplierL(*supplierDes); |
|
298 } |
|
299 CheckForAbortL(iCallback.MosSetupBufferForPortL(comp,port,*filename,headerlength,supplier)); |
|
300 CleanupStack::PopAndDestroy(filename); |
|
301 } |
|
302 |
|
303 else if(elemName == _L8("AllTransition")) |
|
304 { |
|
305 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("state")); |
|
306 OMX_STATETYPE state = ParseOmxStateL(stateDes); |
|
307 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
308 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
309 const TDesC8* orderDes = FindAttribute(aAttributes, _L8("order")); |
|
310 TTransitionOrder order = ELoadOrder; |
|
311 if(orderDes != NULL) |
|
312 { |
|
313 if(*orderDes == _L8("auto")) |
|
314 { |
|
315 order = EAutoOrder; |
|
316 } |
|
317 else |
|
318 { |
|
319 User::Leave(KErrArgument); |
|
320 } |
|
321 } |
|
322 if (expectedError) |
|
323 { |
|
324 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
325 } |
|
326 CheckForAbortL(iCallback.MosAllTransitionL(state, expectedErrorInt, order)); |
|
327 } |
|
328 else if(elemName == _L8("Transition")) |
|
329 { |
|
330 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
331 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("state")); |
|
332 TBool async_behaviour = ParseOptionalBooleanL(aAttributes, _L8("async"), EFalse); |
|
333 OMX_STATETYPE state = ParseOmxStateL(stateDes); |
|
334 CheckForAbortL(iCallback.MosTransition(comp, state, async_behaviour)); |
|
335 } |
|
336 else if(elemName == _L8("FailingTransition")) |
|
337 { |
|
338 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
339 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("state")); |
|
340 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectederr")); |
|
341 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
342 if (expectedError) |
|
343 { |
|
344 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
345 } |
|
346 OMX_STATETYPE state = ParseOmxStateL(stateDes); |
|
347 CheckForAbortL(iCallback.MosFailingTransition(comp, state, expectedErrorInt)); |
|
348 } |
|
349 else if(elemName == _L8("WaitEOS")) |
|
350 { |
|
351 const TDesC8* comp = FindAttribute(aAttributes, _L8("comp")); |
|
352 if(comp == NULL) |
|
353 { |
|
354 CheckForAbortL(iCallback.MosWaitEOS()); |
|
355 } |
|
356 else |
|
357 { |
|
358 CheckForAbortL(iCallback.MosWaitEOS(*comp)); |
|
359 } |
|
360 } |
|
361 else if(elemName == _L8("Wait")) |
|
362 { |
|
363 const TDesC8& delay = FindAttributeL(aAttributes, _L8("delaytime")); |
|
364 TLex8 lex(delay); |
|
365 TInt delayInt; |
|
366 User::LeaveIfError(lex.Val(delayInt)); |
|
367 CheckForAbortL(iCallback.MosWaitL(delayInt)); |
|
368 } |
|
369 else if(elemName == _L8("WaitForAllEvents")) |
|
370 { |
|
371 CheckForAbortL(iCallback.MosWaitForAllEventsL()); |
|
372 } |
|
373 else if(elemName == _L8("SetFilename")) |
|
374 { |
|
375 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
376 const TDesC8& filename8Bit = FindAttributeL(aAttributes, _L8("filename")); |
|
377 HBufC* filename = HBufC::NewLC(filename8Bit.Length()); |
|
378 filename->Des().Copy(filename8Bit); |
|
379 CheckForAbortL(iCallback.MosSetFilename(comp, *filename)); |
|
380 CleanupStack::PopAndDestroy(filename); |
|
381 } |
|
382 |
|
383 else if(elemName == _L8("SetBadFilename")) |
|
384 { |
|
385 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
386 CheckForAbortL(iCallback.MosSetBadFilename(comp)); |
|
387 |
|
388 } |
|
389 else if(elemName == _L8("GetFilename")) |
|
390 { |
|
391 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
392 const TDesC8& filename8Bit = FindAttributeL(aAttributes, _L8("filename")); |
|
393 HBufC* filename = HBufC::NewLC(filename8Bit.Length()); |
|
394 filename->Des().Copy(filename8Bit); |
|
395 CheckForAbortL(iCallback.MosGetFilename(comp, *filename)); |
|
396 CleanupStack::PopAndDestroy(filename); |
|
397 } |
|
398 |
|
399 else if(elemName == _L8("SetBufferCount")) |
|
400 { |
|
401 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
402 const TDesC8& count = FindAttributeL(aAttributes, _L8("count")); |
|
403 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
404 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
405 if (expectedError) |
|
406 { |
|
407 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
408 } |
|
409 |
|
410 TPtrC8 comp; |
|
411 TInt portIndex = 0; |
|
412 ParseCompPortL(port, comp, portIndex); |
|
413 TLex8 lex(count); |
|
414 TInt countInt; |
|
415 User::LeaveIfError(lex.Val(countInt)); |
|
416 CheckForAbortL(iCallback.MosSetBufferCount(comp, portIndex, countInt, expectedErrorInt)); |
|
417 } |
|
418 else if(elemName == _L8("BufferSupplierOverride")) |
|
419 { |
|
420 const TDesC8& output = FindAttributeL(aAttributes, _L8("output")); |
|
421 const TDesC8& input = FindAttributeL(aAttributes, _L8("input")); |
|
422 const TDesC8& supplierDes = FindAttributeL(aAttributes, _L8("supplier")); |
|
423 const TDesC8* expectedError1 = FindAttribute(aAttributes, _L8("expectedomxerr1")); |
|
424 OMX_ERRORTYPE expectedError1Int = OMX_ErrorNone; |
|
425 if (expectedError1) |
|
426 { |
|
427 expectedError1Int = ParseOmxErrorCode(*expectedError1); |
|
428 } |
|
429 const TDesC8* expectedError2 = FindAttribute(aAttributes, _L8("expectedomxerr2")); |
|
430 OMX_ERRORTYPE expectedError2Int = OMX_ErrorNone; |
|
431 if (expectedError2) |
|
432 { |
|
433 expectedError2Int = ParseOmxErrorCode(*expectedError2); |
|
434 } |
|
435 TPtrC8 sourceComp; |
|
436 TPtrC8 sinkComp; |
|
437 TInt sourcePort = 0; |
|
438 TInt sinkPort = 0; |
|
439 ParseCompPortL(output, sourceComp, sourcePort); |
|
440 ParseCompPortL(input, sinkComp, sinkPort); |
|
441 OMX_BUFFERSUPPLIERTYPE supplier = ParseOmxSupplierL(supplierDes); |
|
442 CheckForAbortL(iCallback.MosBufferSupplierOverrideL(sourceComp, sourcePort, sinkComp, sinkPort, supplier, expectedError1Int, expectedError2Int)); |
|
443 } |
|
444 |
|
445 else if(elemName == _L8("SetVideoPortDef")) |
|
446 { |
|
447 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
448 TPtrC8 comp; |
|
449 TInt port; |
|
450 ParseCompPortL(compPort, comp, port); |
|
451 TInt width = ParseOptionalIntL(aAttributes, _L8("width"), -1); |
|
452 TInt height = ParseOptionalIntL(aAttributes, _L8("height"), -1); |
|
453 OMX_COLOR_FORMATTYPE colorFormat = OMX_COLOR_FormatMax; |
|
454 OMX_COLOR_FORMATTYPE* colorFormatPtr = NULL; |
|
455 const TDesC8* colorFormatDes = FindAttribute(aAttributes, _L8("colorFormat")); |
|
456 if(colorFormatDes) |
|
457 { |
|
458 colorFormat = ParseOmxColorFormatL(*colorFormatDes); |
|
459 colorFormatPtr = &colorFormat; |
|
460 } |
|
461 OMX_VIDEO_CODINGTYPE codingType = OMX_VIDEO_CodingMax; |
|
462 OMX_VIDEO_CODINGTYPE* codingTypePtr = NULL; |
|
463 const TDesC8* codingDes = FindAttribute(aAttributes, _L8("codingType")); |
|
464 if(codingDes) |
|
465 { |
|
466 codingType = ParseOmxVideoCodingL(*codingDes); |
|
467 codingTypePtr = &codingType; |
|
468 } |
|
469 TInt stride = ParseOptionalIntL(aAttributes, _L8("stride"), -1); |
|
470 |
|
471 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
472 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
473 if (expectedError) |
|
474 { |
|
475 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
476 } |
|
477 |
|
478 #ifdef HREF_ED_WITHOUT_FLOATING_POINT |
|
479 CheckForAbortL(iCallback.MosSetVideoPortDefL(comp, port, width, height, colorFormatPtr, codingTypePtr, stride, 0, expectedErrorInt)); |
|
480 #else |
|
481 TReal32 fps = ParseOptionalRealL(aAttributes, _L8("fps"), -1); |
|
482 CheckForAbortL(iCallback.MosSetVideoPortDefL(comp, port, width, height, colorFormatPtr, codingTypePtr, stride, fps, expectedErrorInt)); |
|
483 #endif //HREF_ED_WITHOUT_FLOATING_POINT |
|
484 } |
|
485 else if(elemName == _L8("ExpectEvent")) |
|
486 { |
|
487 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
488 const TDesC8& eventDes = FindAttributeL(aAttributes, _L8("event")); |
|
489 const TDesC8& nData1Des = FindAttributeL(aAttributes, _L8("nData1")); |
|
490 const TDesC8& nData2Des = FindAttributeL(aAttributes, _L8("nData2")); |
|
491 TLex8 lex(nData1Des); |
|
492 TUint32 nData1; |
|
493 OMX_EVENTTYPE event = ParseOmxEventL(eventDes); |
|
494 switch(event) |
|
495 { |
|
496 // ParseOmxErrorL and ParseOmxCommandL will also parse literal integers |
|
497 case OMX_EventError: |
|
498 nData1 = static_cast<TUint32>(ParseOmxErrorL(nData1Des)); |
|
499 break; |
|
500 case OMX_EventCmdComplete: |
|
501 nData1 = static_cast<TUint32>(ParseOmxCommandL(nData1Des)); |
|
502 break; |
|
503 default: |
|
504 nData1 = ParseUint32L(nData1Des); |
|
505 break; |
|
506 } |
|
507 TUint32 nData2 = ParseUint32L(nData2Des); |
|
508 CheckForAbortL(iCallback.MosExpectEventL(comp, event, nData1, nData2)); |
|
509 } |
|
510 else if(elemName == _L8("CheckState")) |
|
511 { |
|
512 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
513 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("state")); |
|
514 OMX_STATETYPE state = ParseOmxStateL(stateDes); |
|
515 CheckForAbortL(iCallback.MosCheckStateL(comp, state)); |
|
516 } |
|
517 else if(elemName == _L8("CheckVideoPortDef")) |
|
518 { |
|
519 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
520 TPtrC8 comp; |
|
521 TInt port; |
|
522 ParseCompPortL(compPort, comp, port); |
|
523 const TDesC8& widthDes = FindAttributeL(aAttributes, _L8("width")); |
|
524 const TDesC8& heightDes = FindAttributeL(aAttributes, _L8("height")); |
|
525 TInt width; |
|
526 TInt height; |
|
527 TLex8 lex(widthDes); |
|
528 User::LeaveIfError(lex.Val(width)); |
|
529 lex = TLex8(heightDes); |
|
530 User::LeaveIfError(lex.Val(height)); |
|
531 const TDesC8& codingDes = FindAttributeL(aAttributes, _L8("coding")); |
|
532 OMX_VIDEO_CODINGTYPE coding = ParseOmxVideoCodingL(codingDes); |
|
533 const TDesC8& colorFormatDes = FindAttributeL(aAttributes, _L8("colorFormat")); |
|
534 OMX_COLOR_FORMATTYPE colorFormat = ParseOmxColorFormatL(colorFormatDes); |
|
535 CheckForAbortL(iCallback.MosCheckVideoPortDefL(comp, port, width, height, coding, colorFormat)); |
|
536 } |
|
537 else if(elemName == _L8("CheckMetaData")) |
|
538 { |
|
539 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
540 TPtrC8 comp; |
|
541 TInt port; |
|
542 ParseCompPortL(compPort, comp, port); |
|
543 const TDesC8& scopeDes = FindAttributeL(aAttributes, _L8("scope")); |
|
544 OMX_METADATASCOPETYPE scope = ParseOmxScopeTypeL(scopeDes); |
|
545 const TDesC8& atomType = FindAttributeL(aAttributes, _L8("atomType")); |
|
546 const TDesC8& atomIndexDes = FindAttributeL(aAttributes, _L8("atomIndex")); |
|
547 TLex8 lex(atomIndexDes); |
|
548 TUint32 atomIndex = ParseUint32L(atomIndexDes); |
|
549 const TDesC8& data = FindAttributeL(aAttributes, _L8("data")); |
|
550 CheckForAbortL(iCallback.MosCheckMetaDataL(comp, port, scope, atomType, atomIndex, data)); |
|
551 } |
|
552 else if(elemName == _L8("GetParameterUnknownType")) |
|
553 { |
|
554 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
555 TPtrC8 comp; |
|
556 TInt port; |
|
557 ParseCompPortL(compPort, comp, port); |
|
558 const TDesC8& scopeDes = FindAttributeL(aAttributes, _L8("scope")); |
|
559 OMX_METADATASCOPETYPE scope = ParseOmxScopeTypeL(scopeDes); |
|
560 const TDesC8& atomType = FindAttributeL(aAttributes, _L8("atomType")); |
|
561 const TDesC8& atomIndexDes = FindAttributeL(aAttributes, _L8("atomIndex")); |
|
562 TLex8 lex(atomIndexDes); |
|
563 TUint32 atomIndex = ParseUint32L(atomIndexDes); |
|
564 const TDesC8& data = FindAttributeL(aAttributes, _L8("data")); |
|
565 CheckForAbortL(iCallback.MosGetParameterUnknownIndexTypeL(comp, port, scope, atomType, atomIndex, data)); |
|
566 } |
|
567 else if(elemName == _L8("SetParameterUnknownType")) |
|
568 { |
|
569 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
570 TPtrC8 comp; |
|
571 TInt port; |
|
572 ParseCompPortL(compPort, comp, port); |
|
573 const TDesC8& scopeDes = FindAttributeL(aAttributes, _L8("scope")); |
|
574 OMX_METADATASCOPETYPE scope = ParseOmxScopeTypeL(scopeDes); |
|
575 const TDesC8& atomType = FindAttributeL(aAttributes, _L8("atomType")); |
|
576 const TDesC8& atomIndexDes = FindAttributeL(aAttributes, _L8("atomIndex")); |
|
577 TLex8 lex(atomIndexDes); |
|
578 TUint32 atomIndex = ParseUint32L(atomIndexDes); |
|
579 const TDesC8& data = FindAttributeL(aAttributes, _L8("data")); |
|
580 CheckForAbortL(iCallback.MosSetParameterUnknownIndexTypeL(comp, port, scope, atomType, atomIndex, data)); |
|
581 } |
|
582 else if(elemName == _L8("DisablePort")) |
|
583 { |
|
584 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
585 TPtrC8 comp; |
|
586 TInt portIndex; |
|
587 ParseCompPortL(port, comp, portIndex); |
|
588 CheckForAbortL(iCallback.MosDisablePort(comp, portIndex)); |
|
589 } |
|
590 else if(elemName == _L8("EnablePort")) |
|
591 { |
|
592 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
593 TPtrC8 comp; |
|
594 TInt portIndex; |
|
595 ParseCompPortL(port, comp, portIndex); |
|
596 CheckForAbortL(iCallback.MosEnablePort(comp, portIndex)); |
|
597 } |
|
598 else if(elemName == _L8("IgnoreEvent")) |
|
599 { |
|
600 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
601 const TDesC8& eventDes = FindAttributeL(aAttributes, _L8("event")); |
|
602 const TDesC8& nData1Des = FindAttributeL(aAttributes, _L8("nData1")); |
|
603 const TDesC8& nData2Des = FindAttributeL(aAttributes, _L8("nData2")); |
|
604 TLex8 lex(nData1Des); |
|
605 TUint32 nData1; |
|
606 OMX_EVENTTYPE event = ParseOmxEventL(eventDes); |
|
607 switch(event) |
|
608 { |
|
609 // ParseOmxErrorL and ParseOmxCommandL will also parse literal integers |
|
610 case OMX_EventError: |
|
611 nData1 = static_cast<TUint32>(ParseOmxErrorL(nData1Des)); |
|
612 break; |
|
613 case OMX_EventCmdComplete: |
|
614 nData1 = static_cast<TUint32>(ParseOmxCommandL(nData1Des)); |
|
615 break; |
|
616 default: |
|
617 nData1 = ParseUint32L(nData1Des); |
|
618 break; |
|
619 } |
|
620 TUint32 nData2 = ParseUint32L(nData2Des); |
|
621 CheckForAbortL(iCallback.MosIgnoreEventL(comp, event, nData1, nData2)); |
|
622 } |
|
623 else if(elemName == _L8("SetAudioPortDef")) |
|
624 { |
|
625 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
626 TPtrC8 comp; |
|
627 TInt port; |
|
628 ParseCompPortL(compPort, comp, port); |
|
629 OMX_AUDIO_CODINGTYPE codingType = OMX_AUDIO_CodingMax; |
|
630 OMX_AUDIO_CODINGTYPE* codingTypePtr = NULL; |
|
631 const TDesC8* codingDes = FindAttribute(aAttributes, _L8("codingType")); |
|
632 if(codingDes) |
|
633 { |
|
634 codingType = ParseOmxAudioCodingL(*codingDes); |
|
635 codingTypePtr = &codingType; |
|
636 } |
|
637 CheckForAbortL(iCallback.MosSetAudioPortDefL(comp, port, codingTypePtr)); |
|
638 } |
|
639 else if(elemName == _L8("SetAACProfile")) |
|
640 { |
|
641 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
642 TPtrC8 comp; |
|
643 TInt port; |
|
644 ParseCompPortL(compPort, comp, port); |
|
645 // TODO allow some values to be unspecified (preserved from existing settings) |
|
646 TInt channels = ParseUint32L(FindAttributeL(aAttributes, _L8("channels"))); |
|
647 TInt samplingrate = ParseUint32L(FindAttributeL(aAttributes, _L8("samplingrate"))); |
|
648 TInt bitrate = ParseUint32L(FindAttributeL(aAttributes, _L8("bitrate"))); |
|
649 TInt audioBandwidth = ParseUint32L(FindAttributeL(aAttributes, _L8("bandwidth"))); |
|
650 TInt frameLength = ParseUint32L(FindAttributeL(aAttributes, _L8("frameLength"))); |
|
651 // TODO allow multiple flags in disjunctive form |
|
652 TInt aacTools = ParseUint32L(FindAttributeL(aAttributes, _L8("aacTools"))); |
|
653 TInt aacerTools = ParseUint32L(FindAttributeL(aAttributes, _L8("aacerTools"))); |
|
654 OMX_AUDIO_AACPROFILETYPE profile = ParseOmxAACProfileL(FindAttributeL(aAttributes, _L8("profile"))); |
|
655 OMX_AUDIO_AACSTREAMFORMATTYPE streamFormat = ParseOmxAACStreamFormatL(FindAttributeL(aAttributes, _L8("streamFormat"))); |
|
656 OMX_AUDIO_CHANNELMODETYPE channelMode = ParseOmxAudioChannelModeL(FindAttributeL(aAttributes, _L8("channelMode"))); |
|
657 |
|
658 CheckForAbortL(iCallback.MosSetAACProfileL(comp, port, channels, samplingrate, bitrate, audioBandwidth, frameLength, aacTools, aacerTools, profile, streamFormat, channelMode)); |
|
659 } |
|
660 else if(elemName == _L8("SetPcmAudioPortDef")) |
|
661 { |
|
662 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
663 TPtrC8 comp; |
|
664 TInt port; |
|
665 ParseCompPortL(compPort, comp, port); |
|
666 TInt channels = ParseOptionalIntL(aAttributes, _L8("channels"), -1); |
|
667 TInt samplingrate = ParseOptionalIntL(aAttributes, _L8("samplingrate"), -1); |
|
668 TInt bitspersample = ParseOptionalIntL(aAttributes, _L8("bitspersample"), -1); |
|
669 OMX_NUMERICALDATATYPE numData = OMX_NumercialDataMax; |
|
670 const TDesC8* des = FindAttribute(aAttributes, _L8("numericalData")); |
|
671 if(des != NULL) |
|
672 { |
|
673 numData = ParseNumericalDataL(*des); |
|
674 } |
|
675 else |
|
676 { |
|
677 numData = static_cast<OMX_NUMERICALDATATYPE>(-1); |
|
678 } |
|
679 OMX_ENDIANTYPE endian = OMX_EndianMax; |
|
680 des = FindAttribute(aAttributes, _L8("endian")); |
|
681 if(des != NULL) |
|
682 { |
|
683 endian = ParseEndianL(*des); |
|
684 } |
|
685 else |
|
686 { |
|
687 endian = static_cast<OMX_ENDIANTYPE>(-1); |
|
688 } |
|
689 OMX_BOOL* interleaved = NULL; |
|
690 OMX_BOOL interleavedData; |
|
691 des = FindAttribute(aAttributes, _L8("interleaved")); |
|
692 if(des != NULL) |
|
693 { |
|
694 interleavedData = ParseBoolL(*des); |
|
695 interleaved = &interleavedData; |
|
696 } |
|
697 const TDesC8* encoding = FindAttribute(aAttributes, _L8("encoding")); |
|
698 CheckForAbortL(iCallback.MosSetPcmAudioPortDefL(comp, port, channels, samplingrate, bitspersample, numData, endian, interleaved, encoding)); |
|
699 } |
|
700 else if(elemName == _L8("SetAudioMute")) |
|
701 { |
|
702 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
703 TPtrC8 comp; |
|
704 TInt port; |
|
705 ParseCompPortL(compPort, comp, port); |
|
706 TBool mute = EFalse; |
|
707 const TDesC8* muteAttr = FindAttribute(aAttributes, _L8("mute")); |
|
708 if (muteAttr != NULL) |
|
709 { |
|
710 mute = ParseBooleanL(*muteAttr); |
|
711 } |
|
712 else |
|
713 { |
|
714 User::Leave(KErrArgument); |
|
715 } |
|
716 CheckForAbortL(iCallback.MosSetConfigAudioMuteL(comp, port, mute)); |
|
717 } |
|
718 else if(elemName == _L8("CheckAudioMute")) |
|
719 { |
|
720 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
721 TPtrC8 comp; |
|
722 TInt port; |
|
723 ParseCompPortL(compPort, comp, port); |
|
724 TBool mute = EFalse; |
|
725 const TDesC8* muteAttr = FindAttribute(aAttributes, _L8("mute")); |
|
726 if (muteAttr != NULL) |
|
727 { |
|
728 mute = ParseBooleanL(*muteAttr); |
|
729 } |
|
730 else |
|
731 { |
|
732 User::Leave(KErrArgument); |
|
733 } |
|
734 CheckForAbortL(iCallback.MosCheckConfigAudioMuteL(comp, port, mute)); |
|
735 } |
|
736 else if(elemName == _L8("SetAudioVolume")) |
|
737 { |
|
738 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
739 TPtrC8 comp; |
|
740 TInt port; |
|
741 ParseCompPortL(compPort, comp, port); |
|
742 TBool linear = EFalse; |
|
743 const TDesC8* linearScaleAttr = FindAttribute(aAttributes, _L8("linearscale")); |
|
744 if (linearScaleAttr != NULL) |
|
745 { |
|
746 linear = ParseBooleanL(*linearScaleAttr); |
|
747 } |
|
748 TInt minVolume = ParseOptionalIntL(aAttributes, _L8("min"), -1); |
|
749 TInt maxVolume = ParseOptionalIntL(aAttributes, _L8("max"), -1); |
|
750 TInt volume = ParseOptionalIntL(aAttributes, _L8("volume"), -1); |
|
751 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
752 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
753 if (expectedError) |
|
754 { |
|
755 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
756 } |
|
757 |
|
758 CheckForAbortL(iCallback.MosSetConfigAudioVolumeL(comp, port, linear, minVolume, maxVolume, volume, expectedErrorInt)); |
|
759 } |
|
760 else if(elemName == _L8("CheckAudioVolume")) |
|
761 { |
|
762 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
763 TPtrC8 comp; |
|
764 TInt port; |
|
765 ParseCompPortL(compPort, comp, port); |
|
766 TBool linear = EFalse; |
|
767 const TDesC8* linearScaleAttr = FindAttribute(aAttributes, _L8("linearscale")); |
|
768 if (linearScaleAttr != NULL) |
|
769 { |
|
770 linear = ParseBooleanL(*linearScaleAttr); |
|
771 } |
|
772 TInt minVolume = ParseOptionalIntL(aAttributes, _L8("min"), -1); |
|
773 TInt maxVolume = ParseOptionalIntL(aAttributes, _L8("max"), -1); |
|
774 TInt volume = ParseOptionalIntL(aAttributes, _L8("volume"), -1); |
|
775 CheckForAbortL(iCallback.MosCheckConfigAudioVolumeL(comp, port, linear, minVolume, maxVolume, volume)); |
|
776 } |
|
777 else if(elemName == _L8("SetAacAudioPortDef")) |
|
778 { |
|
779 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
780 TPtrC8 comp; |
|
781 TInt port; |
|
782 ParseCompPortL(compPort, comp, port); |
|
783 TInt channels = ParseOptionalIntL(aAttributes, _L8("channels"), -1); |
|
784 TInt samplingRate = ParseOptionalIntL(aAttributes, _L8("samplingrate"), -1); |
|
785 TInt bitRate = ParseOptionalIntL(aAttributes, _L8("bitrate"), -1); |
|
786 TInt audioBandwidth = ParseOptionalIntL(aAttributes, _L8("audiobandwidth"), -1); |
|
787 TInt frameLength = ParseOptionalIntL(aAttributes, _L8("framelength"), -1); |
|
788 TInt aacTools = ParseOptionalIntL(aAttributes, _L8("aactools"), -1); |
|
789 TInt aacErTools = ParseOptionalIntL(aAttributes, _L8("aacertools"), -1); |
|
790 |
|
791 OMX_AUDIO_AACPROFILETYPE profile; |
|
792 const TDesC8* attbval = FindAttribute(aAttributes, _L8("profile")); |
|
793 if ( NULL != attbval ) |
|
794 { |
|
795 profile = ParseOmxAACProfileL( *attbval ); |
|
796 } |
|
797 else |
|
798 { |
|
799 profile = static_cast <OMX_AUDIO_AACPROFILETYPE>(-1); |
|
800 } |
|
801 OMX_AUDIO_AACSTREAMFORMATTYPE streamFormat = ParseOmxAACStreamFormatL(FindAttributeL(aAttributes, _L8("streamFormat"))); |
|
802 OMX_AUDIO_CHANNELMODETYPE channelMode = ParseOmxAudioChannelModeL(FindAttributeL(aAttributes, _L8("channelMode"))); |
|
803 |
|
804 CheckForAbortL(iCallback.MosSetAacAudioPortDefL(comp, port, channels, samplingRate, bitRate, audioBandwidth, frameLength, aacTools, aacErTools, profile, streamFormat, channelMode)); |
|
805 } |
|
806 else if(elemName == _L8("SetClockReference")) |
|
807 { |
|
808 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
809 const TDesC8& refDes = FindAttributeL(aAttributes, _L8("ref")); |
|
810 OMX_TIME_REFCLOCKTYPE refClockType = ParseOmxRefClockTypeL(refDes); |
|
811 CheckForAbortL(iCallback.MosSetRefClockTypeL(comp, refClockType)); |
|
812 } |
|
813 else if(elemName == _L8("SetClockState")) |
|
814 { |
|
815 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
816 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("state")); |
|
817 OMX_TIME_CLOCKSTATE clockState = ParseOmxClockStateL(stateDes); |
|
818 const TDesC8& maskDes = FindAttributeL(aAttributes, _L8("mask")); |
|
819 TUint32 mask = ParseUint32L(maskDes); |
|
820 TInt startTime = ParseOptionalIntL(aAttributes, _L8("start"), 0); |
|
821 TInt offset = ParseOptionalIntL(aAttributes, _L8("offset"), 0); |
|
822 CheckForAbortL(iCallback.MosSetClockStateL(comp, clockState, startTime, offset, mask)); |
|
823 } |
|
824 else if(elemName == _L8("SetVideoFitMode")) |
|
825 { |
|
826 const TDesC8& modeDes = FindAttributeL(aAttributes, _L8("mode")); |
|
827 TVideoFitMode mode = ParseVideoFitModeL(modeDes); |
|
828 CheckForAbortL(iCallback.MosSetVideoFitModeL(mode)); |
|
829 } |
|
830 else if(elemName == _L8("SetActiveStream")) |
|
831 { |
|
832 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
833 const TDesC8& id = FindAttributeL(aAttributes, _L8("id")); |
|
834 TLex8 lex(id); |
|
835 TInt streamId; |
|
836 User::LeaveIfError(lex.Val(streamId)); |
|
837 CheckForAbortL(iCallback.MosSetActiveStream(comp, streamId)); |
|
838 } |
|
839 else if(elemName == _L8("GetActiveStream")) |
|
840 { |
|
841 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
842 const TDesC8& id = FindAttributeL(aAttributes, _L8("id")); |
|
843 TLex8 lex(id); |
|
844 TInt streamId; |
|
845 User::LeaveIfError(lex.Val(streamId)); |
|
846 CheckForAbortL(iCallback.MosGetActiveStream(comp, streamId)); |
|
847 } |
|
848 else if(elemName == _L8("SetVideoEncQuant")) |
|
849 { |
|
850 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
851 TPtrC8 comp; |
|
852 TInt port; |
|
853 ParseCompPortL(compPort, comp, port); |
|
854 |
|
855 TInt qpb = ParseOptionalIntL(aAttributes, _L8("qpb"), -1); |
|
856 |
|
857 CheckForAbortL(iCallback.MosSetVideoEncQuantL(comp, port,qpb)); |
|
858 } |
|
859 else if(elemName == _L8("SetVideoEncMotionVect")) |
|
860 { |
|
861 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
862 TPtrC8 comp; |
|
863 TInt port; |
|
864 ParseCompPortL(compPort, comp, port); |
|
865 |
|
866 TInt accuracy = ParseOptionalIntL(aAttributes, _L8("accuracy"), -1); |
|
867 TInt sxsearchrange = ParseOptionalIntL(aAttributes, _L8("sxsearchrange"), -1); |
|
868 TInt sysearchrange = ParseOptionalIntL(aAttributes, _L8("sysearchrange"), -1); |
|
869 |
|
870 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
871 OMX_ERRORTYPE expectedOmxError = OMX_ErrorNone; |
|
872 if (expectedError) |
|
873 { |
|
874 expectedOmxError = ParseOmxErrorCode(*expectedError); |
|
875 } |
|
876 |
|
877 CheckForAbortL(iCallback.MosSetVideoEncMotionVectL(comp, port, accuracy, sxsearchrange, sysearchrange, expectedOmxError)); |
|
878 } |
|
879 else if(elemName == _L8("SetVideoEncMpeg4Type")) |
|
880 { |
|
881 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
882 TPtrC8 comp; |
|
883 TInt port; |
|
884 ParseCompPortL(compPort, comp, port); |
|
885 const TDesC8* mpeg4Profile = FindAttribute(aAttributes, _L8("mpeg4profile")); |
|
886 OMX_VIDEO_MPEG4PROFILETYPE profile = OMX_VIDEO_MPEG4ProfileMax; |
|
887 if (mpeg4Profile) |
|
888 { |
|
889 profile = ParseOmxMpeg4ProfileL(*mpeg4Profile); |
|
890 } |
|
891 |
|
892 OMX_VIDEO_MPEG4LEVELTYPE level = OMX_VIDEO_MPEG4LevelMax; |
|
893 const TDesC8* mpeg4Level = FindAttribute(aAttributes, _L8("mpeg4level")); |
|
894 if (mpeg4Level) |
|
895 { |
|
896 level = ParseOmxMpeg4LevelL(*mpeg4Level); |
|
897 } |
|
898 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
899 OMX_ERRORTYPE expectedOmxError = OMX_ErrorNone; |
|
900 if (expectedError) |
|
901 { |
|
902 expectedOmxError = ParseOmxErrorCode(*expectedError); |
|
903 } |
|
904 |
|
905 CheckForAbortL(iCallback.MosSetVideoEncMpeg4TypeL(comp, port, profile, level, expectedOmxError)); |
|
906 } |
|
907 else if(elemName == _L8("SetVideoEncBitRate")) |
|
908 { |
|
909 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
910 TPtrC8 comp; |
|
911 TInt port; |
|
912 ParseCompPortL(compPort, comp, port); |
|
913 |
|
914 const TDesC8* controlRate = FindAttribute(aAttributes, _L8("controlrate")); |
|
915 OMX_VIDEO_CONTROLRATETYPE omxControlRate = OMX_Video_ControlRateMax; |
|
916 if (controlRate) |
|
917 { |
|
918 omxControlRate = ParseOmxControlRateL(*controlRate); |
|
919 } |
|
920 |
|
921 TInt targetBitrate = ParseOptionalIntL(aAttributes, _L8("targetbitrate"), -1); |
|
922 |
|
923 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
924 OMX_ERRORTYPE expectedOmxError = OMX_ErrorNone; |
|
925 if (expectedError) |
|
926 { |
|
927 expectedOmxError = ParseOmxErrorCode(*expectedError); |
|
928 } |
|
929 |
|
930 CheckForAbortL(iCallback.MosSetVideoEncBitRateL(comp, port, omxControlRate, targetBitrate, expectedOmxError)); |
|
931 } |
|
932 else if(elemName == _L8("GetExtensionIndex")) |
|
933 { |
|
934 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
935 const TDesC8& paramName = FindAttributeL(aAttributes, _L8("parametername")); |
|
936 |
|
937 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
938 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
939 if (expectedError) |
|
940 { |
|
941 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
942 } |
|
943 |
|
944 CheckForAbortL(iCallback.MosGetExtensionIndex(comp, paramName, expectedErrorInt)); |
|
945 } |
|
946 else if(elemName == _L8("SetCaptureModeType")) |
|
947 { |
|
948 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
949 |
|
950 TPtrC8 comp; |
|
951 TInt port = 0; |
|
952 ParseCompPortL(compPort, comp, port); |
|
953 |
|
954 const TDesC8& continuousStr = FindAttributeL(aAttributes, _L8("continuous")); |
|
955 TBool continuous = ParseBooleanL(continuousStr); |
|
956 const TDesC8& framelimitedStr = FindAttributeL(aAttributes, _L8("framelimited")); |
|
957 TBool framelimited = ParseBooleanL(framelimitedStr); |
|
958 TInt framelimit = ParseOptionalIntL(aAttributes, _L8("framelimit"), -1); |
|
959 |
|
960 CheckForAbortL(iCallback.MosSetCaptureModeTypeL(comp, port, continuous, framelimited, framelimit)); |
|
961 } |
|
962 |
|
963 else if(elemName == _L8("GetTimeClockState")) |
|
964 { |
|
965 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
966 const TDesC8& expectedState = FindAttributeL(aAttributes, _L8("expectedstate")); |
|
967 OMX_TIME_CLOCKSTATE expectedStateInt = ParseOmxClockStateL(expectedState); |
|
968 |
|
969 CheckForAbortL(iCallback.MosCheckTimeClockState(comp, expectedStateInt)); |
|
970 } |
|
971 else if(elemName == _L8("CheckMediaTime")) |
|
972 { |
|
973 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
974 TPtrC8 comp; |
|
975 TInt port; |
|
976 |
|
977 ParseCompPortL(compPort, comp, port); |
|
978 |
|
979 TBool moreThan = ETrue; |
|
980 const TDesC8* mediatime = FindAttribute(aAttributes, _L8("mediatimelessthan")); |
|
981 |
|
982 if (mediatime) |
|
983 { |
|
984 moreThan = EFalse; |
|
985 } |
|
986 else |
|
987 { |
|
988 const TDesC8& mTime = FindAttributeL(aAttributes, _L8("mediatimemorethan")); |
|
989 mediatime = &mTime; |
|
990 } |
|
991 |
|
992 |
|
993 OMX_TICKS mediatimeTick; |
|
994 TLex8 lex(*mediatime); |
|
995 User::LeaveIfError(lex.Val(mediatimeTick)); |
|
996 CheckForAbortL(iCallback.MosCheckMediaTime(comp, port, mediatimeTick, moreThan)); |
|
997 } |
|
998 else if(elemName == _L8("SetClockTimeScale")) |
|
999 { |
|
1000 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1001 const TDesC8& scale = FindAttributeL(aAttributes, _L8("scale")); |
|
1002 |
|
1003 TReal32 xscale = ParseReal32L(scale); |
|
1004 |
|
1005 CheckForAbortL(iCallback.MosSetClockTimeScale(comp,xscale * 65536)); |
|
1006 } |
|
1007 else if(elemName == _L8("Base_AddPortSupport")) |
|
1008 { |
|
1009 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1010 TPtrC8 comp; |
|
1011 TInt portIndex; |
|
1012 ParseCompPortL(portValue, comp, portIndex); |
|
1013 CheckForAbortL(iCallback.MosBaseSupportPortL(comp, portIndex)); |
|
1014 } |
|
1015 else if(elemName == _L8("Base_SetAutonomous")) |
|
1016 { |
|
1017 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1018 TPtrC8 comp; |
|
1019 TInt portIndex; |
|
1020 ParseCompPortL(portValue, comp, portIndex); |
|
1021 const TDesC8& enabledValue = FindAttributeL(aAttributes, _L8("enabled")); |
|
1022 TBool enabled = ParseBooleanL(enabledValue); |
|
1023 CheckForAbortL(iCallback.MosBaseSetAutonomous(comp, portIndex, enabled)); |
|
1024 } |
|
1025 else if(elemName == _L8("Base_AllocateBuffers")) |
|
1026 { |
|
1027 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1028 TPtrC8 comp; |
|
1029 TInt portIndex; |
|
1030 ParseCompPortL(portValue, comp, portIndex); |
|
1031 |
|
1032 const TDesC8& numberValue = FindAttributeL(aAttributes, _L8("number")); |
|
1033 TInt numberBuffs; |
|
1034 TLex8 lex(numberValue); |
|
1035 User::LeaveIfError(lex.Val(numberBuffs)); |
|
1036 |
|
1037 CheckForAbortL(iCallback.MosBaseAllocateBuffersL(comp, portIndex, numberBuffs)); |
|
1038 } |
|
1039 else if(elemName == _L8("Base_FreeAllocatedBuffers")) |
|
1040 { |
|
1041 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1042 |
|
1043 CheckForAbortL(iCallback.MosBaseFreeAllocatedBuffersL(comp)); |
|
1044 } |
|
1045 else if(elemName == _L8("Base_SetBufSupplierPref")) |
|
1046 { |
|
1047 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1048 TPtrC8 comp; |
|
1049 TInt portIndex; |
|
1050 ParseCompPortL(portValue, comp, portIndex); |
|
1051 |
|
1052 const TDesC8& componentSupplierValue = FindAttributeL(aAttributes, _L8("iscomponentsupplier")); |
|
1053 TBool componentSupplier = ParseBooleanL(componentSupplierValue); |
|
1054 CheckForAbortL(iCallback.MosBaseSetBufSupplier(comp, portIndex, componentSupplier)); |
|
1055 } |
|
1056 else if(elemName == _L8("Base_FillThisBuffer")) |
|
1057 { |
|
1058 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1059 TPtrC8 comp; |
|
1060 TInt portIndex; |
|
1061 ParseCompPortL(portValue, comp, portIndex); |
|
1062 |
|
1063 const TDesC8& bufIndexValue = FindAttributeL(aAttributes, _L8("portrelativebufferindex")); |
|
1064 TInt bufIndex; |
|
1065 TLex8 lex(bufIndexValue); |
|
1066 User::LeaveIfError(lex.Val(bufIndex)); |
|
1067 |
|
1068 CheckForAbortL(iCallback.MosBaseFillThisBuffer(comp, portIndex, bufIndex)); |
|
1069 } |
|
1070 else if(elemName == _L8("Base_EmptyThisBuffer")) |
|
1071 { |
|
1072 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1073 TPtrC8 comp; |
|
1074 TInt portIndex; |
|
1075 ParseCompPortL(portValue, comp, portIndex); |
|
1076 |
|
1077 const TDesC8& bufIndexValue = FindAttributeL(aAttributes, _L8("portrelativebufferindex")); |
|
1078 TInt bufIndex; |
|
1079 TLex8 lex(bufIndexValue); |
|
1080 User::LeaveIfError(lex.Val(bufIndex)); |
|
1081 |
|
1082 CheckForAbortL(iCallback.MosBaseEmptyThisBuffer(comp, portIndex, bufIndex)); |
|
1083 } |
|
1084 else if(elemName == _L8("Base_WaitForBuffer")) |
|
1085 { |
|
1086 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1087 TPtrC8 comp; |
|
1088 TInt portIndex; |
|
1089 ParseCompPortL(portValue, comp, portIndex); |
|
1090 |
|
1091 const TDesC8& bufIndexValue = FindAttributeL(aAttributes, _L8("bufferindexinport")); |
|
1092 TInt bufIndex; |
|
1093 TLex8 lex(bufIndexValue); |
|
1094 User::LeaveIfError(lex.Val(bufIndex)); |
|
1095 |
|
1096 CheckForAbortL(iCallback.MosBaseWaitForBuffer(comp, portIndex, bufIndex)); |
|
1097 } |
|
1098 else if(elemName == _L8("BaseTimestamp_PassClockHandle")) |
|
1099 { |
|
1100 const TDesC8& receivingComp = FindAttributeL(aAttributes, _L8("receiver")); |
|
1101 const TDesC8& clockToPass = FindAttributeL(aAttributes, _L8("handle")); |
|
1102 |
|
1103 CheckForAbortL(iCallback.MosBaseTimestampPassClock(receivingComp, clockToPass)); |
|
1104 } |
|
1105 else if(elemName == _L8("BaseTimestamp_CheckTimestamp")) |
|
1106 { |
|
1107 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1108 TPtrC8 comp; |
|
1109 TInt portIndex; |
|
1110 ParseCompPortL(portValue, comp, portIndex); |
|
1111 |
|
1112 const TDesC8& timeValue = FindAttributeL(aAttributes, _L8("time")); |
|
1113 TUint time; |
|
1114 TLex8 lex(timeValue); |
|
1115 User::LeaveIfError(lex.Val(time)); |
|
1116 |
|
1117 const TDesC8& toleranceValue = FindAttributeL(aAttributes, _L8("tolerance")); |
|
1118 TUint tolerance; |
|
1119 lex.Assign(toleranceValue); |
|
1120 User::LeaveIfError(lex.Val(tolerance)); |
|
1121 |
|
1122 CheckForAbortL(iCallback.MosBaseTimestampCheckTimestampL(comp, portIndex, time, tolerance)); |
|
1123 } |
|
1124 else if(elemName == _L8("BaseTimestamp_CompareWithRefClock")) |
|
1125 { |
|
1126 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1127 TPtrC8 comp; |
|
1128 TInt portIndex; |
|
1129 ParseCompPortL(portValue, comp, portIndex); |
|
1130 |
|
1131 const TDesC8& toleranceValue = FindAttributeL(aAttributes, _L8("tolerance")); |
|
1132 TUint tolerance; |
|
1133 TLex8 lex(toleranceValue); |
|
1134 User::LeaveIfError(lex.Val(tolerance)); |
|
1135 |
|
1136 CheckForAbortL(iCallback.MosBaseTimestampCompareWithRefClockL(comp, portIndex, tolerance)); |
|
1137 } |
|
1138 else if(elemName == _L8("CheckClockState")) |
|
1139 { |
|
1140 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1141 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("clockstate")); |
|
1142 OMX_TIME_CLOCKSTATE clockState = ParseOmxClockStateL(stateDes); |
|
1143 CheckForAbortL(iCallback.MosCheckClockStateL(comp, clockState)); |
|
1144 } |
|
1145 else if(elemName == _L8("CheckTimePosition")) |
|
1146 { |
|
1147 // Use with caution: increments position as a side-effect. |
|
1148 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1149 TPtrC8 comp; |
|
1150 TInt portIndex; |
|
1151 ParseCompPortL(port, comp, portIndex); |
|
1152 |
|
1153 TInt timestamp = ParseOptionalIntL(aAttributes, _L8("timestamp"), 0); |
|
1154 |
|
1155 CheckForAbortL(iCallback.MosCheckTimePositionL(comp, portIndex, timestamp)); |
|
1156 } |
|
1157 else if(elemName == _L8("SetTimePosition")) |
|
1158 { |
|
1159 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1160 TPtrC8 comp; |
|
1161 TInt portIndex; |
|
1162 ParseCompPortL(port, comp, portIndex); |
|
1163 |
|
1164 TInt timestamp = ParseOptionalIntL(aAttributes, _L8("timestamp"), 0); |
|
1165 |
|
1166 CheckForAbortL(iCallback.MosSetTimePositionL(comp, portIndex, timestamp)); |
|
1167 } |
|
1168 else if(elemName == _L8("StartBuffersforPort")) |
|
1169 { |
|
1170 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
1171 TPtrC8 comp; |
|
1172 TInt port; |
|
1173 ParseCompPortL(compPort, comp, port); |
|
1174 |
|
1175 CheckForAbortL(iCallback.MosStartBuffersforPort( comp,port)); |
|
1176 } |
|
1177 |
|
1178 else if(elemName == _L8("MarkBuffer")) |
|
1179 { |
|
1180 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1181 TPtrC8 comp; |
|
1182 TInt portIndex; |
|
1183 ParseCompPortL(port, comp, portIndex); |
|
1184 const TDesC8& targetComp = FindAttributeL(aAttributes, _L8("targetComp")); |
|
1185 TInt markData = ParseOptionalIntL(aAttributes, _L8("markData"), 0); |
|
1186 CheckForAbortL(iCallback.MosMarkBuffer(comp, portIndex, targetComp, markData)); |
|
1187 } |
|
1188 |
|
1189 else |
|
1190 { |
|
1191 // element name is not recognized |
|
1192 TBuf<32> elemNameCopy; |
|
1193 elemNameCopy.Copy(elemName); |
|
1194 TBuf<44> message; |
|
1195 message.Append(_L("Unrecognized command: ")); |
|
1196 message.Append(elemNameCopy); |
|
1197 iCallback.MosParseError(message); |
|
1198 User::Leave(KErrArgument); |
|
1199 } |
|
1200 } |
|
1201 } |
|
1202 |
|
1203 TInt COmxScriptParser::ParseSystemErrorCode(const TDesC8& aErrorCode) |
|
1204 { |
|
1205 TInt error = KErrNone; |
|
1206 |
|
1207 if (aErrorCode == _L8("KErrNotFound")) |
|
1208 { |
|
1209 error = KErrNotFound; |
|
1210 } |
|
1211 |
|
1212 // TODO: the other error code will be added in demand |
|
1213 |
|
1214 return error; |
|
1215 } |
|
1216 |
|
1217 // TODO duplication with ParseOmxErrorL |
|
1218 OMX_ERRORTYPE COmxScriptParser::ParseOmxErrorCode(const TDesC8& aErrorCode) |
|
1219 { |
|
1220 OMX_ERRORTYPE error = OMX_ErrorMax; |
|
1221 |
|
1222 if (aErrorCode == _L8("OMX_ErrorNone")) |
|
1223 { |
|
1224 error = OMX_ErrorNone; |
|
1225 } |
|
1226 else if (aErrorCode == _L8("OMX_ErrorBadPortIndex")) |
|
1227 { |
|
1228 error = OMX_ErrorBadPortIndex; |
|
1229 } |
|
1230 else if (aErrorCode == _L8("OMX_ErrorBadParameter")) |
|
1231 { |
|
1232 error = OMX_ErrorBadParameter; |
|
1233 } |
|
1234 else if (aErrorCode == _L8("OMX_ErrorPortsNotCompatible")) |
|
1235 { |
|
1236 error = OMX_ErrorPortsNotCompatible; |
|
1237 } |
|
1238 else if (aErrorCode == _L8("OMX_ErrorUnsupportedSetting")) |
|
1239 { |
|
1240 error = OMX_ErrorUnsupportedSetting; |
|
1241 } |
|
1242 else if (aErrorCode == _L8("OMX_ErrorIncorrectStateOperation")) |
|
1243 { |
|
1244 error = OMX_ErrorIncorrectStateOperation; |
|
1245 } |
|
1246 else if (aErrorCode == _L8("OMX_ErrorUnsupportedIndex")) |
|
1247 { |
|
1248 error = OMX_ErrorUnsupportedIndex; |
|
1249 } |
|
1250 else if (aErrorCode == _L8("OMX_ErrorNotReady")) |
|
1251 { |
|
1252 error = OMX_ErrorNotReady; |
|
1253 } |
|
1254 else if (aErrorCode == _L8("OMX_ErrorContentPipeOpenFailed")) |
|
1255 { |
|
1256 error = OMX_ErrorContentPipeOpenFailed; |
|
1257 } |
|
1258 else if (aErrorCode == _L8("OMX_ErrorNotImplemented")) |
|
1259 { |
|
1260 error = OMX_ErrorNotImplemented; |
|
1261 } |
|
1262 |
|
1263 // TODO: the other error code will be added in demand |
|
1264 |
|
1265 return error; |
|
1266 } |
|
1267 |
|
1268 void COmxScriptParser::OnEndElementL(const RTagInfo& aElement, TInt /*aErrorCode*/) |
|
1269 { |
|
1270 if(iInTest) |
|
1271 { |
|
1272 const TDesC8& elemName = aElement.LocalName().DesC(); |
|
1273 if(elemName == _L8("Test")) |
|
1274 { |
|
1275 iInTest = EFalse; |
|
1276 } |
|
1277 } |
|
1278 } |
|
1279 |
|
1280 const TDesC8* COmxScriptParser::FindAttribute(const RArray<RAttribute>& aArray, const TDesC8& aAttribName) |
|
1281 { |
|
1282 for(TInt index = 0, count = aArray.Count(); index < count; index++) |
|
1283 { |
|
1284 const RAttribute& attribute = aArray[index]; |
|
1285 const TDesC8& name = attribute.Attribute().LocalName().DesC(); |
|
1286 if(name == aAttribName) |
|
1287 { |
|
1288 return &(attribute.Value().DesC()); |
|
1289 } |
|
1290 } |
|
1291 return NULL; |
|
1292 } |
|
1293 |
|
1294 const TDesC8& COmxScriptParser::FindAttributeL(const RArray<RAttribute>& aArray, const TDesC8& aAttribName) |
|
1295 { |
|
1296 const TDesC8* result = FindAttribute(aArray, aAttribName); |
|
1297 if(!result) |
|
1298 { |
|
1299 TBuf<32> nameCopy; |
|
1300 nameCopy.Copy(aAttribName); |
|
1301 TBuf<52> msg; |
|
1302 msg.Append(_L("Attribute ")); |
|
1303 msg.Append(nameCopy); |
|
1304 msg.Append(_L(" not found")); |
|
1305 iCallback.MosParseError(msg); |
|
1306 User::Leave(KErrNotFound); |
|
1307 } |
|
1308 return *result; |
|
1309 } |
|
1310 |
|
1311 void COmxScriptParser::ParseCompPortL(const TDesC8& aInput, TPtrC8& aNameOut, TInt& aPortOut) |
|
1312 { |
|
1313 TInt offset = aInput.Locate(':'); |
|
1314 User::LeaveIfError(offset); |
|
1315 aNameOut.Set(aInput.Left(offset)); |
|
1316 TPtrC8 port = aInput.Right(aInput.Length() - offset - 1); |
|
1317 if (port == _L8("all")) |
|
1318 { |
|
1319 aPortOut = static_cast<TInt>(OMX_ALL); |
|
1320 } |
|
1321 else |
|
1322 { |
|
1323 TLex8 lex(port); |
|
1324 User::LeaveIfError(lex.Val(aPortOut)); |
|
1325 } |
|
1326 } |
|
1327 |
|
1328 |
|
1329 // The order of these entries does not matter, but for clarity's sake please |
|
1330 // maintain alphabetical order |
|
1331 |
|
1332 PARSE_MAP_START(OMX_AUDIO_AACPROFILETYPE) |
|
1333 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, ERLC), |
|
1334 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, HE), |
|
1335 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, HE_PS), |
|
1336 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, LC), |
|
1337 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, LD), |
|
1338 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, LTP), |
|
1339 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, Main), |
|
1340 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, Null), |
|
1341 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, Scalable), |
|
1342 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, SSR) |
|
1343 PARSE_MAP_END(OMX_AUDIO_AACPROFILETYPE) |
|
1344 |
|
1345 PARSE_MAP_START(OMX_AUDIO_AACSTREAMFORMATTYPE) |
|
1346 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, ADIF), |
|
1347 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, MP2ADTS), |
|
1348 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, MP4ADTS), |
|
1349 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, MP4FF), |
|
1350 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, MP4LATM), |
|
1351 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, MP4LOAS), |
|
1352 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, RAW) |
|
1353 PARSE_MAP_END(OMX_AUDIO_AACSTREAMFORMATTYPE) |
|
1354 |
|
1355 PARSE_MAP_START(OMX_AUDIO_CHANNELMODETYPE) |
|
1356 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_ChannelMode, Dual), |
|
1357 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_ChannelMode, JointStereo), |
|
1358 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_ChannelMode, Mono), |
|
1359 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_ChannelMode, Stereo) |
|
1360 PARSE_MAP_END(OMX_AUDIO_CHANNELMODETYPE) |
|
1361 |
|
1362 PARSE_MAP_START(OMX_COMMANDTYPE) |
|
1363 PARSE_MAP_PREFIXENTRY(OMX_Command, StateSet), |
|
1364 PARSE_MAP_PREFIXENTRY(OMX_Command, Flush), |
|
1365 PARSE_MAP_PREFIXENTRY(OMX_Command, PortDisable), |
|
1366 PARSE_MAP_PREFIXENTRY(OMX_Command, PortEnable), |
|
1367 PARSE_MAP_PREFIXENTRY(OMX_Command, MarkBuffer) |
|
1368 PARSE_MAP_END(OMX_COMMANDTYPE) |
|
1369 |
|
1370 PARSE_MAP_START(OMX_COLOR_FORMATTYPE) |
|
1371 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, Unused), |
|
1372 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, Max), |
|
1373 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, 12bitRGB444), |
|
1374 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, 16bitRGB565), |
|
1375 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, 24bitBGR888), |
|
1376 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, 32bitARGB8888), |
|
1377 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, 32bitBGRA8888), |
|
1378 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, CbYCrY), |
|
1379 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YCbYCr), |
|
1380 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YCrYCb), |
|
1381 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YUV420PackedPlanar), |
|
1382 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YUV422PackedPlanar), |
|
1383 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YUV420Planar), |
|
1384 #if defined(NCP_COMMON_BRIDGE_FAMILY) && !defined(__WINSCW__) |
|
1385 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YUV422Planar), |
|
1386 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, STYUV420PackedSemiPlanarMB), |
|
1387 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, STYUV422PackedSemiPlanarMB) |
|
1388 #else |
|
1389 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YUV422Planar) |
|
1390 #endif //NCP_COMMON_BRIDGE_FAMILY |
|
1391 PARSE_MAP_END(OMX_COLOR_FORMATTYPE) |
|
1392 |
|
1393 PARSE_MAP_START(OMX_ERRORTYPE) |
|
1394 PARSE_MAP_PREFIXENTRY(OMX_Error, BadParameter), |
|
1395 PARSE_MAP_PREFIXENTRY(OMX_Error, BadPortIndex), |
|
1396 PARSE_MAP_PREFIXENTRY(OMX_Error, ContentPipeOpenFailed), |
|
1397 PARSE_MAP_PREFIXENTRY(OMX_Error, Hardware), |
|
1398 PARSE_MAP_PREFIXENTRY(OMX_Error, IncorrectStateOperation), |
|
1399 PARSE_MAP_PREFIXENTRY(OMX_Error, None), |
|
1400 PARSE_MAP_PREFIXENTRY(OMX_Error, NotReady), |
|
1401 PARSE_MAP_PREFIXENTRY(OMX_Error, PortsNotCompatible), |
|
1402 PARSE_MAP_PREFIXENTRY(OMX_Error, Underflow), |
|
1403 PARSE_MAP_PREFIXENTRY(OMX_Error, UnsupportedIndex), |
|
1404 PARSE_MAP_PREFIXENTRY(OMX_Error, UnsupportedSetting) |
|
1405 PARSE_MAP_END(OMX_ERRORTYPE) |
|
1406 |
|
1407 PARSE_MAP_START(OMX_EVENTTYPE) |
|
1408 PARSE_MAP_PREFIXENTRY(OMX_Event, BufferFlag), |
|
1409 PARSE_MAP_PREFIXENTRY(OMX_Event, CmdComplete), |
|
1410 PARSE_MAP_PREFIXENTRY(OMX_Event, Error), |
|
1411 PARSE_MAP_PREFIXENTRY(OMX_Event, Mark), |
|
1412 PARSE_MAP_PREFIXENTRY(OMX_Event, PortFormatDetected), |
|
1413 PARSE_MAP_PREFIXENTRY(OMX_Event, PortSettingsChanged), |
|
1414 PARSE_MAP_END(OMX_EVENTTYPE) |
|
1415 |
|
1416 // PARSE_MAP_PREFIXENTRY(OMX_EventNokia, FirstFrameDisplayed), |
|
1417 // PARSE_MAP_PREFIXENTRY(OMX_EventNokia, DroppedFrame) |
|
1418 |
|
1419 |
|
1420 PARSE_MAP_START(OMX_STATETYPE) |
|
1421 PARSE_MAP_PREFIXENTRY(OMX_State, Loaded), |
|
1422 PARSE_MAP_PREFIXENTRY(OMX_State, Idle), |
|
1423 PARSE_MAP_PREFIXENTRY(OMX_State, Executing), |
|
1424 PARSE_MAP_PREFIXENTRY(OMX_State, Pause), |
|
1425 PARSE_MAP_PREFIXENTRY(OMX_State, WaitForResources), |
|
1426 PARSE_MAP_PREFIXENTRY(OMX_State, Invalid) |
|
1427 PARSE_MAP_END(OMX_STATETYPE) |
|
1428 |
|
1429 /** |
|
1430 * Templated wrapper to a plain-C function generated by PARSE_MAP |
|
1431 * Accepts a descriptor as input and leaves with KErrArgument if parse fails. |
|
1432 */ |
|
1433 template<typename T> T ParseL(const TDesC8& aDes, TInt (*parseFunc)(const char*, T*)) |
|
1434 { |
|
1435 if(aDes.Length() >= 64) |
|
1436 { |
|
1437 User::Leave(KErrArgument); |
|
1438 } |
|
1439 TBuf8<64> buf = aDes; |
|
1440 T result = (T) 0; |
|
1441 TInt success = parseFunc((char*) buf.PtrZ(), &result); |
|
1442 if(!success) |
|
1443 { |
|
1444 // value not recognized |
|
1445 // maybe add it to the PARSE_MAP ? |
|
1446 __BREAKPOINT(); |
|
1447 User::Leave(KErrArgument); |
|
1448 } |
|
1449 return result; |
|
1450 } |
|
1451 |
|
1452 OMX_AUDIO_AACPROFILETYPE COmxScriptParser::ParseOmxAACProfileL(const TDesC8& aProfileDes) |
|
1453 { |
|
1454 return ParseL(aProfileDes, parse_OMX_AUDIO_AACPROFILETYPE); |
|
1455 } |
|
1456 |
|
1457 OMX_AUDIO_AACSTREAMFORMATTYPE COmxScriptParser::ParseOmxAACStreamFormatL(const TDesC8& aFormatDes) |
|
1458 { |
|
1459 return ParseL(aFormatDes, parse_OMX_AUDIO_AACSTREAMFORMATTYPE); |
|
1460 } |
|
1461 |
|
1462 OMX_AUDIO_CHANNELMODETYPE COmxScriptParser::ParseOmxAudioChannelModeL(const TDesC8& aChannelModeDes) |
|
1463 { |
|
1464 return ParseL(aChannelModeDes, parse_OMX_AUDIO_CHANNELMODETYPE); |
|
1465 } |
|
1466 |
|
1467 OMX_STATETYPE COmxScriptParser::ParseOmxStateL(const TDesC8& aStateDes) |
|
1468 { |
|
1469 return ParseL(aStateDes, parse_OMX_STATETYPE); |
|
1470 } |
|
1471 |
|
1472 OMX_METADATASCOPETYPE COmxScriptParser::ParseOmxScopeTypeL(const TDesC8& aScopeDes) |
|
1473 { |
|
1474 if(aScopeDes == _L8("all")) |
|
1475 { |
|
1476 return OMX_MetadataScopeAllLevels; |
|
1477 } |
|
1478 else if(aScopeDes == _L8("top")) |
|
1479 { |
|
1480 return OMX_MetadataScopeTopLevel; |
|
1481 } |
|
1482 else if(aScopeDes == _L8("port")) |
|
1483 { |
|
1484 return OMX_MetadataScopePortLevel; |
|
1485 } |
|
1486 else |
|
1487 { |
|
1488 User::Leave(KErrArgument); |
|
1489 return OMX_MetadataScopeTypeMax; // unreachable, prevents compiler warning |
|
1490 } |
|
1491 } |
|
1492 |
|
1493 OMX_BUFFERSUPPLIERTYPE COmxScriptParser::ParseOmxSupplierL(const TDesC8& aSupplierDes, TBool aAllowUnspecified) |
|
1494 { |
|
1495 if(aSupplierDes == _L8("input")) |
|
1496 { |
|
1497 return OMX_BufferSupplyInput; |
|
1498 } |
|
1499 else if(aSupplierDes == _L8("output")) |
|
1500 { |
|
1501 return OMX_BufferSupplyOutput; |
|
1502 } |
|
1503 else if (aAllowUnspecified && aSupplierDes == _L8("unspecified")) |
|
1504 { |
|
1505 return OMX_BufferSupplyUnspecified; |
|
1506 } |
|
1507 else |
|
1508 { |
|
1509 User::Leave(KErrArgument); |
|
1510 return OMX_BufferSupplyInput; // unreachable, prevents compiler warning |
|
1511 } |
|
1512 } |
|
1513 |
|
1514 void COmxScriptParser::CheckForAbortL(TBool success) |
|
1515 { |
|
1516 if(!success) |
|
1517 { |
|
1518 iCallbackAborted = ETrue; |
|
1519 User::Leave(KErrAbort); |
|
1520 } |
|
1521 } |
|
1522 |
|
1523 TInt COmxScriptParser::ParseOptionalIntL(const RArray<RAttribute>& aArray, const TDesC8& aAttribName, TInt aDefaultValue) |
|
1524 { |
|
1525 const TDesC8* des = FindAttribute(aArray, aAttribName); |
|
1526 if(des == NULL) |
|
1527 { |
|
1528 return aDefaultValue; |
|
1529 } |
|
1530 else |
|
1531 { |
|
1532 TInt result; |
|
1533 TLex8 lex(*des); |
|
1534 User::LeaveIfError(lex.Val(result)); |
|
1535 return result; |
|
1536 } |
|
1537 } |
|
1538 |
|
1539 TReal COmxScriptParser::ParseOptionalRealL(const RArray<RAttribute>& aArray, const TDesC8& aAttribName, TReal aDefaultValue) |
|
1540 { |
|
1541 const TDesC8* des = FindAttribute(aArray, aAttribName); |
|
1542 if(des == NULL) |
|
1543 { |
|
1544 return aDefaultValue; |
|
1545 } |
|
1546 else |
|
1547 { |
|
1548 TReal result; |
|
1549 TLex8 lex(*des); |
|
1550 User::LeaveIfError(lex.Val(result)); |
|
1551 return result; |
|
1552 } |
|
1553 } |
|
1554 |
|
1555 OMX_COLOR_FORMATTYPE COmxScriptParser::ParseOmxColorFormatL(const TDesC8& aDes) |
|
1556 { |
|
1557 return ParseL(aDes, parse_OMX_COLOR_FORMATTYPE); |
|
1558 } |
|
1559 |
|
1560 |
|
1561 OMX_COMMANDTYPE COmxScriptParser::ParseOmxCommandL(const TDesC8& aDes) |
|
1562 { |
|
1563 return ParseL(aDes, parse_OMX_COMMANDTYPE); |
|
1564 } |
|
1565 |
|
1566 OMX_ERRORTYPE COmxScriptParser::ParseOmxErrorL(const TDesC8& aDes) |
|
1567 { |
|
1568 return ParseL(aDes, parse_OMX_ERRORTYPE); |
|
1569 } |
|
1570 |
|
1571 OMX_EVENTTYPE COmxScriptParser::ParseOmxEventL(const TDesC8& aDes) |
|
1572 { |
|
1573 return ParseL(aDes, parse_OMX_EVENTTYPE); |
|
1574 } |
|
1575 |
|
1576 TBool COmxScriptParser::ParseOptionalBooleanL(const RArray<RAttribute>& aArray, const TDesC8& aAttribName, TBool aDefaultValue) |
|
1577 { |
|
1578 const TDesC8* des = FindAttribute(aArray, aAttribName); |
|
1579 if(des == NULL) |
|
1580 { |
|
1581 return aDefaultValue; |
|
1582 } |
|
1583 |
|
1584 return ParseBooleanL(*des); |
|
1585 } |
|
1586 |
|
1587 TBool COmxScriptParser::ParseBooleanL(const TDesC8& aBool) |
|
1588 { |
|
1589 if ((aBool == _L8("true")) || |
|
1590 (aBool == _L8("yes")) || |
|
1591 (aBool == _L8("1")) || |
|
1592 (aBool == _L8("ETrue")) || |
|
1593 (aBool == _L8("OMX_TRUE"))) |
|
1594 { |
|
1595 return ETrue; |
|
1596 } |
|
1597 |
|
1598 if ((aBool == _L8("false")) || |
|
1599 (aBool == _L8("no")) || |
|
1600 (aBool == _L8("0")) || |
|
1601 (aBool == _L8("EFalse")) || |
|
1602 (aBool == _L8("OMX_FALSE"))) |
|
1603 { |
|
1604 return EFalse; |
|
1605 } |
|
1606 |
|
1607 User::Leave(KErrArgument); |
|
1608 return EFalse; |
|
1609 } |
|
1610 |
|
1611 |
|
1612 TUint32 COmxScriptParser::ParseUint32L(const TDesC8& aDes) |
|
1613 { |
|
1614 TUint32 result; |
|
1615 if(aDes.Find(_L8("0x")) == 0) |
|
1616 { |
|
1617 TLex8 lex(aDes.Mid(2)); |
|
1618 User::LeaveIfError(lex.Val(result, EHex)); |
|
1619 } |
|
1620 else |
|
1621 { |
|
1622 TLex8 lex(aDes); |
|
1623 User::LeaveIfError(lex.Val(result, EDecimal)); |
|
1624 } |
|
1625 return result; |
|
1626 } |
|
1627 |
|
1628 TBool COmxScriptParser::ParseBoolean(const TDesC8& aDes) |
|
1629 { |
|
1630 if (aDes == _L8("true")) |
|
1631 { |
|
1632 return ETrue; |
|
1633 } |
|
1634 return EFalse; |
|
1635 } |
|
1636 |
|
1637 TReal32 COmxScriptParser::ParseReal32L(const TDesC8& aDes) |
|
1638 { |
|
1639 TReal32 result; |
|
1640 TLex8 lex(aDes); |
|
1641 User::LeaveIfError(lex.Val(result)); |
|
1642 return result; |
|
1643 } |
|
1644 |
|
1645 OMX_VIDEO_CODINGTYPE COmxScriptParser::ParseOmxVideoCodingL(const TDesC8& aDes) |
|
1646 { |
|
1647 if(aDes == _L8("unused")) |
|
1648 { |
|
1649 return OMX_VIDEO_CodingUnused; |
|
1650 } |
|
1651 else if (aDes == _L8("autodetect")) |
|
1652 { |
|
1653 return OMX_VIDEO_CodingAutoDetect; |
|
1654 } |
|
1655 else if(aDes == _L8("mpeg4")) |
|
1656 { |
|
1657 return OMX_VIDEO_CodingMPEG4; |
|
1658 } |
|
1659 else if(aDes == _L8("avc")) |
|
1660 { |
|
1661 return OMX_VIDEO_CodingAVC; |
|
1662 } |
|
1663 else if(aDes == _L8("max")) |
|
1664 { |
|
1665 return OMX_VIDEO_CodingMax; |
|
1666 } |
|
1667 else |
|
1668 { |
|
1669 __BREAKPOINT(); |
|
1670 User::Leave(KErrArgument); |
|
1671 } |
|
1672 |
|
1673 return OMX_VIDEO_CodingUnused; |
|
1674 } |
|
1675 |
|
1676 OMX_AUDIO_CODINGTYPE COmxScriptParser::ParseOmxAudioCodingL(const TDesC8& aDes) |
|
1677 { |
|
1678 if(aDes == _L8("unused")) |
|
1679 { |
|
1680 return OMX_AUDIO_CodingUnused; |
|
1681 } |
|
1682 else if (aDes == _L8("autodetect")) |
|
1683 { |
|
1684 return OMX_AUDIO_CodingAutoDetect; |
|
1685 } |
|
1686 else if(aDes == _L8("pcm")) |
|
1687 { |
|
1688 return OMX_AUDIO_CodingPCM; |
|
1689 } |
|
1690 else if(aDes == _L8("aac")) |
|
1691 { |
|
1692 return OMX_AUDIO_CodingAAC; |
|
1693 } |
|
1694 else if(aDes == _L8("max")) |
|
1695 { |
|
1696 return OMX_AUDIO_CodingMax; |
|
1697 } |
|
1698 else |
|
1699 { |
|
1700 __BREAKPOINT(); |
|
1701 User::Leave(KErrArgument); |
|
1702 } |
|
1703 |
|
1704 return OMX_AUDIO_CodingUnused; |
|
1705 } |
|
1706 |
|
1707 OMX_TIME_REFCLOCKTYPE COmxScriptParser::ParseOmxRefClockTypeL(const TDesC8& aDes) |
|
1708 { |
|
1709 if(aDes == _L8("none")) |
|
1710 { |
|
1711 return OMX_TIME_RefClockNone; |
|
1712 } |
|
1713 else if (aDes == _L8("audio")) |
|
1714 { |
|
1715 return OMX_TIME_RefClockAudio; |
|
1716 } |
|
1717 else if(aDes == _L8("video")) |
|
1718 { |
|
1719 return OMX_TIME_RefClockVideo; |
|
1720 } |
|
1721 else |
|
1722 { |
|
1723 __BREAKPOINT(); |
|
1724 User::Leave(KErrArgument); |
|
1725 } |
|
1726 |
|
1727 return OMX_TIME_RefClockNone; |
|
1728 } |
|
1729 |
|
1730 OMX_TIME_CLOCKSTATE COmxScriptParser::ParseOmxClockStateL(const TDesC8& aDes) |
|
1731 { |
|
1732 if(aDes == _L8("stopped")) |
|
1733 { |
|
1734 return OMX_TIME_ClockStateStopped; |
|
1735 } |
|
1736 else if (aDes == _L8("waiting")) |
|
1737 { |
|
1738 return OMX_TIME_ClockStateWaitingForStartTime; |
|
1739 } |
|
1740 else if(aDes == _L8("running")) |
|
1741 { |
|
1742 return OMX_TIME_ClockStateRunning; |
|
1743 } |
|
1744 else |
|
1745 { |
|
1746 __BREAKPOINT(); |
|
1747 User::Leave(KErrArgument); |
|
1748 return OMX_TIME_ClockStateMax; // unreachable, to prevent compiler warning |
|
1749 } |
|
1750 } |
|
1751 |
|
1752 TVideoFitMode COmxScriptParser::ParseVideoFitModeL(const TDesC8& aMode) |
|
1753 { |
|
1754 if(aMode == _L8("centre")) |
|
1755 { |
|
1756 return EVideoFitCentre; |
|
1757 } |
|
1758 else if(aMode == _L8("scaleAndCentre")) |
|
1759 { |
|
1760 return EVideoFitScaleAndCentre; |
|
1761 } |
|
1762 else if(aMode == _L8("rotateScaleAndCentre")) |
|
1763 { |
|
1764 return EVideoFitRotateScaleAndCentre; |
|
1765 } |
|
1766 else |
|
1767 { |
|
1768 __BREAKPOINT(); |
|
1769 User::Leave(KErrArgument); |
|
1770 return EVideoFitCentre; // unreachable, prevent compiler warning |
|
1771 } |
|
1772 } |
|
1773 |
|
1774 OMX_VIDEO_MPEG4PROFILETYPE COmxScriptParser::ParseOmxMpeg4ProfileL(const TDesC8& aDes) |
|
1775 { |
|
1776 if(aDes == _L8("simple")) |
|
1777 { |
|
1778 return OMX_VIDEO_MPEG4ProfileSimple; |
|
1779 } |
|
1780 else if(aDes == _L8("main")) |
|
1781 { |
|
1782 return OMX_VIDEO_MPEG4ProfileMain; |
|
1783 } |
|
1784 else if (aDes == _L8("advancedrealtime")) |
|
1785 { |
|
1786 return OMX_VIDEO_MPEG4ProfileAdvancedRealTime; |
|
1787 } |
|
1788 else if (aDes == _L8("advancedcoding")) |
|
1789 { |
|
1790 return OMX_VIDEO_MPEG4ProfileAdvancedCoding; |
|
1791 } |
|
1792 else if (aDes == _L8("core")) |
|
1793 { |
|
1794 return OMX_VIDEO_MPEG4ProfileCore; |
|
1795 } |
|
1796 else |
|
1797 { |
|
1798 __BREAKPOINT(); |
|
1799 User::Leave(KErrArgument); |
|
1800 } |
|
1801 return OMX_VIDEO_MPEG4ProfileMax; // unreachable, prevents compiler warning |
|
1802 } |
|
1803 |
|
1804 OMX_VIDEO_MPEG4LEVELTYPE COmxScriptParser::ParseOmxMpeg4LevelL(const TDesC8& aDes) |
|
1805 { |
|
1806 if(aDes == _L8("level0")) |
|
1807 { |
|
1808 return OMX_VIDEO_MPEG4Level0; |
|
1809 } |
|
1810 else if(aDes == _L8("level0b")) |
|
1811 { |
|
1812 return OMX_VIDEO_MPEG4Level0b; |
|
1813 } |
|
1814 else if (aDes == _L8("level1")) |
|
1815 { |
|
1816 return OMX_VIDEO_MPEG4Level1; |
|
1817 } |
|
1818 else if (aDes == _L8("level2")) |
|
1819 { |
|
1820 return OMX_VIDEO_MPEG4Level2; |
|
1821 } |
|
1822 else if (aDes == _L8("level3")) |
|
1823 { |
|
1824 return OMX_VIDEO_MPEG4Level3; |
|
1825 } |
|
1826 else if(aDes == _L8("level4")) |
|
1827 { |
|
1828 return OMX_VIDEO_MPEG4Level4; |
|
1829 } |
|
1830 else if (aDes == _L8("level5")) |
|
1831 { |
|
1832 return OMX_VIDEO_MPEG4Level5; |
|
1833 } |
|
1834 else |
|
1835 { |
|
1836 __BREAKPOINT(); |
|
1837 User::Leave(KErrArgument); |
|
1838 } |
|
1839 return OMX_VIDEO_MPEG4LevelMax; // unreachable, prevents compiler warning |
|
1840 } |
|
1841 |
|
1842 OMX_VIDEO_CONTROLRATETYPE COmxScriptParser::ParseOmxControlRateL(const TDesC8& aDes) |
|
1843 { |
|
1844 if(aDes == _L8("disable")) |
|
1845 { |
|
1846 return OMX_Video_ControlRateDisable; |
|
1847 } |
|
1848 else if(aDes == _L8("variable")) |
|
1849 { |
|
1850 return OMX_Video_ControlRateVariable; |
|
1851 } |
|
1852 else if (aDes == _L8("constant")) |
|
1853 { |
|
1854 return OMX_Video_ControlRateConstant; |
|
1855 } |
|
1856 else |
|
1857 { |
|
1858 __BREAKPOINT(); |
|
1859 User::Leave(KErrArgument); |
|
1860 } |
|
1861 return OMX_Video_ControlRateMax; // unreachable, prevents compiler warning |
|
1862 } |
|
1863 |
|
1864 OMX_AUDIO_AACSTREAMFORMATTYPE COmxScriptParser::ParseAacStreamFormatL(const TDesC8& aStreamFormatStr) |
|
1865 { |
|
1866 if(aStreamFormatStr == _L8("mp2adts")) |
|
1867 { |
|
1868 return OMX_AUDIO_AACStreamFormatMP2ADTS; |
|
1869 } |
|
1870 else if(aStreamFormatStr == _L8("mp4adts")) |
|
1871 { |
|
1872 return OMX_AUDIO_AACStreamFormatMP4ADTS; |
|
1873 } |
|
1874 else if(aStreamFormatStr == _L8("mp4loas")) |
|
1875 { |
|
1876 return OMX_AUDIO_AACStreamFormatMP4LOAS; |
|
1877 } |
|
1878 else if(aStreamFormatStr == _L8("mp4latm")) |
|
1879 { |
|
1880 return OMX_AUDIO_AACStreamFormatMP4LATM; |
|
1881 } |
|
1882 else if(aStreamFormatStr == _L8("adif")) |
|
1883 { |
|
1884 return OMX_AUDIO_AACStreamFormatADIF; |
|
1885 } |
|
1886 else if(aStreamFormatStr == _L8("mp4ff")) |
|
1887 { |
|
1888 return OMX_AUDIO_AACStreamFormatMP4FF; |
|
1889 } |
|
1890 else if(aStreamFormatStr == _L8("raw")) |
|
1891 { |
|
1892 return OMX_AUDIO_AACStreamFormatRAW; |
|
1893 } |
|
1894 else |
|
1895 { |
|
1896 User::Leave(KErrArgument); |
|
1897 return OMX_AUDIO_AACStreamFormatMax; |
|
1898 } |
|
1899 } |
|
1900 |
|
1901 OMX_NUMERICALDATATYPE COmxScriptParser::ParseNumericalDataL(const TDesC8& aDes) |
|
1902 { |
|
1903 if(aDes == _L8("signed")) |
|
1904 { |
|
1905 return OMX_NumericalDataSigned; |
|
1906 } |
|
1907 else if(aDes == _L8("unsigned")) |
|
1908 { |
|
1909 return OMX_NumericalDataUnsigned; |
|
1910 } |
|
1911 else |
|
1912 { |
|
1913 User::Leave(KErrArgument); |
|
1914 return OMX_NumercialDataMax; |
|
1915 } |
|
1916 } |
|
1917 |
|
1918 OMX_ENDIANTYPE COmxScriptParser::ParseEndianL(const TDesC8& aDes) |
|
1919 { |
|
1920 if(aDes == _L8("big")) |
|
1921 { |
|
1922 return OMX_EndianBig; |
|
1923 } |
|
1924 else if(aDes == _L8("little")) |
|
1925 { |
|
1926 return OMX_EndianLittle; |
|
1927 } |
|
1928 else |
|
1929 { |
|
1930 User::Leave(KErrArgument); |
|
1931 return OMX_EndianMax; |
|
1932 } |
|
1933 } |
|
1934 |
|
1935 OMX_BOOL COmxScriptParser::ParseBoolL(const TDesC8& aDes) |
|
1936 { |
|
1937 if(aDes == _L8("true")) |
|
1938 { |
|
1939 return OMX_TRUE; |
|
1940 } |
|
1941 else if(aDes == _L8("false")) |
|
1942 { |
|
1943 return OMX_FALSE; |
|
1944 } |
|
1945 else |
|
1946 { |
|
1947 User::Leave(KErrArgument); |
|
1948 return OMX_FALSE; |
|
1949 } |
|
1950 } |
|
1951 |