|
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 // to trace out which command has been passed from xml file |
|
175 TBuf<32> elemNameCopy; |
|
176 elemNameCopy.Copy(elemName); |
|
177 TBuf<44> message; |
|
178 message.Append(_L("command: ")); |
|
179 message.Append(elemNameCopy); |
|
180 iCallback.MosParseError(message); |
|
181 |
|
182 if(elemName == _L8("LoadComponent")) |
|
183 { |
|
184 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
185 const TDesC8& name = FindAttributeL(aAttributes, _L8("name")); |
|
186 |
|
187 TBool baseEnabled = EFalse; |
|
188 const TDesC8* baseImpl = NULL; |
|
189 const TDesC8* baseEnabledAttr = FindAttribute(aAttributes, _L8("baseprofilesupport")); |
|
190 if (baseEnabledAttr != NULL) |
|
191 { |
|
192 baseEnabled = ParseBoolean(*baseEnabledAttr); |
|
193 baseImpl = &(FindAttributeL(aAttributes, _L8("baseprofileimpl"))); |
|
194 } |
|
195 |
|
196 TBool loadInCoreServerThread = EFalse; |
|
197 const TDesC8* loadInCoreServerThreadAttr = FindAttribute(aAttributes, _L8("loadincoreserverthread")); |
|
198 if(loadInCoreServerThreadAttr != NULL) |
|
199 { |
|
200 loadInCoreServerThread = ParseBoolean(*loadInCoreServerThreadAttr); |
|
201 } |
|
202 |
|
203 CheckForAbortL(iCallback.MosLoadComponentL(comp, name, baseEnabled, baseImpl, loadInCoreServerThread)); |
|
204 } |
|
205 else if(elemName == _L8("LogAllEvents")) //utility |
|
206 { |
|
207 CheckForAbortL(iCallback.MosLogAllEventsL()); |
|
208 } |
|
209 |
|
210 else if(elemName == _L8("SetSensorModeType")) //camera |
|
211 { |
|
212 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
213 |
|
214 TPtrC8 comp; |
|
215 TInt port = 0; |
|
216 ParseCompPortL(compPort, comp, port); |
|
217 |
|
218 TInt frameRate = ParseOptionalIntL(aAttributes, _L8("frameRate"), -1); |
|
219 |
|
220 const TDesC8& oneShotStr = FindAttributeL(aAttributes, _L8("oneShot")); |
|
221 TBool oneShot = ParseBooleanL(oneShotStr); |
|
222 TInt width = ParseOptionalIntL(aAttributes, _L8("width"), -1); |
|
223 TInt height = ParseOptionalIntL(aAttributes, _L8("height"), -1); |
|
224 |
|
225 CheckForAbortL(iCallback.MosSetSensorModeTypeL(comp, port, frameRate, oneShot, width, height)); |
|
226 } |
|
227 else if(elemName == _L8("DeleteFile")) //utility |
|
228 { |
|
229 const TDesC8& fileName8 = FindAttributeL(aAttributes, _L8("filename")); |
|
230 |
|
231 HBufC* fileName = HBufC::NewLC(fileName8.Length() + 1); |
|
232 fileName->Des().Copy(fileName8); |
|
233 fileName->Des().ZeroTerminate(); |
|
234 |
|
235 TBool fileMustExist = EFalse; |
|
236 const TDesC8* fileMustExistAttr = FindAttribute(aAttributes, _L8("fileMustExist")); |
|
237 if (fileMustExistAttr != NULL) |
|
238 { |
|
239 fileMustExist = ParseBoolean(*fileMustExistAttr); |
|
240 } |
|
241 |
|
242 CheckForAbortL(iCallback.MosDeleteFileL(*fileName, fileMustExist)); |
|
243 CleanupStack::PopAndDestroy(fileName); |
|
244 } |
|
245 else if(elemName == _L8("SetupTunnel")) |
|
246 { |
|
247 const TDesC8& source = FindAttributeL(aAttributes, _L8("output")); |
|
248 const TDesC8& sink = FindAttributeL(aAttributes, _L8("input")); |
|
249 |
|
250 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
251 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
252 if (expectedError) |
|
253 { |
|
254 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
255 } |
|
256 |
|
257 TPtrC8 sourceComp; |
|
258 TPtrC8 sinkComp; |
|
259 TInt sourcePort = 0; |
|
260 TInt sinkPort = 0; |
|
261 _LIT8(KTemp, ""); |
|
262 const TDesC8& temp = KTemp; |
|
263 if (source.Compare(temp)) |
|
264 { |
|
265 ParseCompPortL(source, sourceComp, sourcePort); |
|
266 } |
|
267 if(sink.Compare(temp)) |
|
268 { |
|
269 ParseCompPortL(sink, sinkComp, sinkPort); |
|
270 } |
|
271 CheckForAbortL(iCallback.MosSetupTunnel(sourceComp, sourcePort, sinkComp, sinkPort, expectedErrorInt)); |
|
272 } |
|
273 |
|
274 else if (elemName == _L8("SetupNonTunnel")) |
|
275 { |
|
276 const TDesC8& source = FindAttributeL(aAttributes, _L8("output")); |
|
277 const TDesC8& sink = FindAttributeL(aAttributes, _L8("input")); |
|
278 const TDesC8& supplierDes = FindAttributeL(aAttributes, _L8("supplier")); |
|
279 TPtrC8 sourceComp; |
|
280 TPtrC8 sinkComp; |
|
281 TInt sourcePort; |
|
282 TInt sinkPort; |
|
283 ParseCompPortL(source, sourceComp, sourcePort); |
|
284 ParseCompPortL(sink, sinkComp, sinkPort); |
|
285 OMX_BUFFERSUPPLIERTYPE supplier = ParseOmxSupplierL(supplierDes, ETrue); |
|
286 CheckForAbortL(iCallback.MosSetupNonTunnel(sourceComp, sourcePort, sinkComp, sinkPort, supplier)); |
|
287 } |
|
288 else if (elemName == _L8("SetBufferForPort")) |
|
289 { |
|
290 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
291 TPtrC8 comp; |
|
292 TInt port; |
|
293 ParseCompPortL(compPort, comp, port); |
|
294 |
|
295 const TDesC8& filename8Bit = FindAttributeL(aAttributes, _L8("filename")); |
|
296 HBufC* filename = HBufC::NewLC(filename8Bit.Length()); |
|
297 filename->Des().Copy(filename8Bit); |
|
298 TInt headerlength = KErrNone; |
|
299 headerlength = ParseOptionalIntL(aAttributes, _L8("headerlength"), -1); |
|
300 |
|
301 const TDesC8* supplierDes = FindAttribute(aAttributes, _L8("supplier")); |
|
302 OMX_BUFFERSUPPLIERTYPE supplier = OMX_BufferSupplyUnspecified; |
|
303 if(supplierDes) |
|
304 { |
|
305 supplier = ParseOmxSupplierL(*supplierDes); |
|
306 } |
|
307 CheckForAbortL(iCallback.MosSetupBufferForPortL(comp,port,*filename,headerlength,supplier)); |
|
308 CleanupStack::PopAndDestroy(filename); |
|
309 } |
|
310 else if(elemName == _L8("SetWindow")) |
|
311 { |
|
312 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
313 CheckForAbortL(iCallback.MosSetWindowL(comp)); |
|
314 } |
|
315 else if(elemName == _L8("AllTransition")) |
|
316 { |
|
317 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("state")); |
|
318 OMX_STATETYPE state = ParseOmxStateL(stateDes); |
|
319 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
320 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
321 const TDesC8* orderDes = FindAttribute(aAttributes, _L8("order")); |
|
322 TTransitionOrder order = ELoadOrder; |
|
323 if(orderDes != NULL) |
|
324 { |
|
325 if(*orderDes == _L8("auto")) |
|
326 { |
|
327 order = EAutoOrder; |
|
328 } |
|
329 else |
|
330 { |
|
331 User::Leave(KErrArgument); |
|
332 } |
|
333 } |
|
334 if (expectedError) |
|
335 { |
|
336 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
337 } |
|
338 CheckForAbortL(iCallback.MosAllTransitionL(state, expectedErrorInt, order)); |
|
339 } |
|
340 else if(elemName == _L8("Transition")) |
|
341 { |
|
342 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
343 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("state")); |
|
344 TBool async_behaviour = ParseOptionalBooleanL(aAttributes, _L8("async"), EFalse); |
|
345 OMX_STATETYPE state = ParseOmxStateL(stateDes); |
|
346 CheckForAbortL(iCallback.MosTransition(comp, state, async_behaviour)); |
|
347 } |
|
348 else if(elemName == _L8("FailingTransition")) |
|
349 { |
|
350 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
351 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("state")); |
|
352 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectederr")); |
|
353 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
354 if (expectedError) |
|
355 { |
|
356 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
357 } |
|
358 OMX_STATETYPE state = ParseOmxStateL(stateDes); |
|
359 CheckForAbortL(iCallback.MosFailingTransition(comp, state, expectedErrorInt)); |
|
360 } |
|
361 else if(elemName == _L8("WaitEOS")) |
|
362 { |
|
363 const TDesC8* comp = FindAttribute(aAttributes, _L8("comp")); |
|
364 if(comp == NULL) |
|
365 { |
|
366 CheckForAbortL(iCallback.MosWaitEOS()); |
|
367 } |
|
368 else |
|
369 { |
|
370 CheckForAbortL(iCallback.MosWaitEOS(*comp)); |
|
371 } |
|
372 } |
|
373 else if(elemName == _L8("Wait")) |
|
374 { |
|
375 const TDesC8& delay = FindAttributeL(aAttributes, _L8("delaytime")); |
|
376 TLex8 lex(delay); |
|
377 TInt delayInt; |
|
378 User::LeaveIfError(lex.Val(delayInt)); |
|
379 CheckForAbortL(iCallback.MosWaitL(delayInt)); |
|
380 } |
|
381 else if(elemName == _L8("WaitForAllEvents")) |
|
382 { |
|
383 CheckForAbortL(iCallback.MosWaitForAllEventsL()); |
|
384 } |
|
385 else if(elemName == _L8("SetFilename")) |
|
386 { |
|
387 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
388 const TDesC8& filename8Bit = FindAttributeL(aAttributes, _L8("filename")); |
|
389 HBufC* filename = HBufC::NewLC(filename8Bit.Length()); |
|
390 filename->Des().Copy(filename8Bit); |
|
391 CheckForAbortL(iCallback.MosSetFilename(comp, *filename)); |
|
392 CleanupStack::PopAndDestroy(filename); |
|
393 } |
|
394 else if(elemName == _L8("SetFilename_Bellagio")) |
|
395 { |
|
396 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
397 const TDesC8& filename8Bit = FindAttributeL(aAttributes, _L8("filename")); |
|
398 char filepath[100]; |
|
399 int i; |
|
400 for(i=0;i<filename8Bit.Length();i++) |
|
401 filepath[i]=filename8Bit.Ptr()[i]; |
|
402 filepath[i]='\0'; |
|
403 CheckForAbortL(iCallback.MosSetFilename_bellagio(comp, filepath)); |
|
404 //CleanupStack::PopAndDestroy(filename8Bit); |
|
405 } |
|
406 else if(elemName == _L8("SetDroppedFrameEvent")) |
|
407 { |
|
408 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
409 const TDesC8& action = FindAttributeL(aAttributes, _L8("action")); |
|
410 |
|
411 CheckForAbortL(iCallback.MosSetDroppedFrameEvent(comp, action)); |
|
412 } |
|
413 else if(elemName == _L8("SetBadFilename")) |
|
414 { |
|
415 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
416 CheckForAbortL(iCallback.MosSetBadFilename(comp)); |
|
417 |
|
418 } |
|
419 else if(elemName == _L8("GetFilename")) |
|
420 { |
|
421 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
422 const TDesC8& filename8Bit = FindAttributeL(aAttributes, _L8("filename")); |
|
423 HBufC* filename = HBufC::NewLC(filename8Bit.Length()); |
|
424 filename->Des().Copy(filename8Bit); |
|
425 |
|
426 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
427 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
428 if (expectedError) |
|
429 { |
|
430 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
431 } |
|
432 CheckForAbortL(iCallback.MosGetFilename(comp, *filename, expectedErrorInt)); |
|
433 CleanupStack::PopAndDestroy(filename); |
|
434 } |
|
435 |
|
436 else if(elemName == _L8("SetBufferCount")) |
|
437 { |
|
438 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
439 const TDesC8& count = FindAttributeL(aAttributes, _L8("count")); |
|
440 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
441 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
442 if (expectedError) |
|
443 { |
|
444 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
445 } |
|
446 |
|
447 TPtrC8 comp; |
|
448 TInt portIndex = 0; |
|
449 ParseCompPortL(port, comp, portIndex); |
|
450 TLex8 lex(count); |
|
451 TInt countInt; |
|
452 User::LeaveIfError(lex.Val(countInt)); |
|
453 CheckForAbortL(iCallback.MosSetBufferCount(comp, portIndex, countInt, expectedErrorInt)); |
|
454 } |
|
455 else if(elemName == _L8("CompareFiles")) |
|
456 { |
|
457 const TDesC8& file18Bit = FindAttributeL(aAttributes, _L8("file1")); |
|
458 const TDesC8& file28Bit = FindAttributeL(aAttributes, _L8("file2")); |
|
459 TBuf<64> file1, file2; |
|
460 file1.Copy(file18Bit); |
|
461 file2.Copy(file28Bit); |
|
462 CheckForAbortL(iCallback.MosCompareFilesL(file1, file2)); |
|
463 } |
|
464 else if(elemName == _L8("FilterAndCompareFiles")) |
|
465 { |
|
466 |
|
467 const TDesC8& file18Bit = FindAttributeL(aAttributes, _L8("file1")); |
|
468 const TDesC8& file28Bit = FindAttributeL(aAttributes, _L8("file2")); |
|
469 TBuf<64> file1, file2; |
|
470 file1.Copy(file18Bit); |
|
471 file2.Copy(file28Bit); |
|
472 |
|
473 const TDesC8* f1filter1 = FindAttribute(aAttributes, _L8("file1filter1")); |
|
474 const TDesC8* f1filter2 = FindAttribute(aAttributes, _L8("file1filter2")); |
|
475 const TDesC8* f1filter3 = FindAttribute(aAttributes, _L8("file1filter3")); |
|
476 |
|
477 const TDesC8* f2filter1 = FindAttribute(aAttributes, _L8("file2filter1")); |
|
478 const TDesC8* f2filter2 = FindAttribute(aAttributes, _L8("file2filter2")); |
|
479 const TDesC8* f2filter3 = FindAttribute(aAttributes, _L8("file2filter3")); |
|
480 |
|
481 CheckForAbortL( |
|
482 iCallback.MosFilterAndCompareFilesL(file1, f1filter1 ? *f1filter1 : KNullDesC8, f1filter2 ? *f1filter2 : KNullDesC8, f1filter3 ? *f1filter3 : KNullDesC8, |
|
483 file2, f2filter1 ? *f2filter1 : KNullDesC8, f2filter2 ? *f2filter2 : KNullDesC8, f2filter3 ? *f2filter3 : KNullDesC8) |
|
484 ); |
|
485 } |
|
486 else if(elemName == _L8("BufferSupplierOverride")) |
|
487 { |
|
488 const TDesC8& output = FindAttributeL(aAttributes, _L8("output")); |
|
489 const TDesC8& input = FindAttributeL(aAttributes, _L8("input")); |
|
490 const TDesC8& supplierDes = FindAttributeL(aAttributes, _L8("supplier")); |
|
491 const TDesC8* expectedError1 = FindAttribute(aAttributes, _L8("expectedomxerr1")); |
|
492 OMX_ERRORTYPE expectedError1Int = OMX_ErrorNone; |
|
493 if (expectedError1) |
|
494 { |
|
495 expectedError1Int = ParseOmxErrorCode(*expectedError1); |
|
496 } |
|
497 const TDesC8* expectedError2 = FindAttribute(aAttributes, _L8("expectedomxerr2")); |
|
498 OMX_ERRORTYPE expectedError2Int = OMX_ErrorNone; |
|
499 if (expectedError2) |
|
500 { |
|
501 expectedError2Int = ParseOmxErrorCode(*expectedError2); |
|
502 } |
|
503 TPtrC8 sourceComp; |
|
504 TPtrC8 sinkComp; |
|
505 TInt sourcePort = 0; |
|
506 TInt sinkPort = 0; |
|
507 ParseCompPortL(output, sourceComp, sourcePort); |
|
508 ParseCompPortL(input, sinkComp, sinkPort); |
|
509 OMX_BUFFERSUPPLIERTYPE supplier = ParseOmxSupplierL(supplierDes); |
|
510 CheckForAbortL(iCallback.MosBufferSupplierOverrideL(sourceComp, sourcePort, sinkComp, sinkPort, supplier, expectedError1Int, expectedError2Int)); |
|
511 } |
|
512 else if(elemName == _L8("SetCameraOneShot")) |
|
513 { |
|
514 //TODO DL |
|
515 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
516 TInt isOneShot = ParseOptionalIntL(aAttributes, _L8("isoneshot"), 1); |
|
517 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
518 CheckForAbortL(iCallback.MosSetCameraOneShotL(comp, isOneShot, expectedErrorInt)); |
|
519 } |
|
520 else if(elemName == _L8("SetCameraCapture")) |
|
521 { |
|
522 //TODO DL |
|
523 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
524 TInt isCapturing = ParseOptionalIntL(aAttributes, _L8("iscapturing"), 1); |
|
525 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
526 TPtrC8 comp1; |
|
527 TInt portIndex = 0; |
|
528 ParseCompPortL(port, comp1, portIndex); |
|
529 |
|
530 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
531 CheckForAbortL(iCallback.MosSetCameraCaptureL(comp, portIndex, isCapturing, expectedErrorInt)); |
|
532 } |
|
533 else if(elemName == _L8("SetVideoPortDef")) |
|
534 { |
|
535 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
536 TPtrC8 comp; |
|
537 TInt port; |
|
538 ParseCompPortL(compPort, comp, port); |
|
539 TInt width = ParseOptionalIntL(aAttributes, _L8("width"), -1); |
|
540 TInt height = ParseOptionalIntL(aAttributes, _L8("height"), -1); |
|
541 OMX_COLOR_FORMATTYPE colorFormat = OMX_COLOR_FormatMax; |
|
542 OMX_COLOR_FORMATTYPE* colorFormatPtr = NULL; |
|
543 const TDesC8* colorFormatDes = FindAttribute(aAttributes, _L8("colorFormat")); |
|
544 if(colorFormatDes) |
|
545 { |
|
546 colorFormat = ParseOmxColorFormatL(*colorFormatDes); |
|
547 colorFormatPtr = &colorFormat; |
|
548 } |
|
549 OMX_VIDEO_CODINGTYPE codingType = OMX_VIDEO_CodingMax; |
|
550 OMX_VIDEO_CODINGTYPE* codingTypePtr = NULL; |
|
551 const TDesC8* codingDes = FindAttribute(aAttributes, _L8("codingType")); |
|
552 if(codingDes) |
|
553 { |
|
554 codingType = ParseOmxVideoCodingL(*codingDes); |
|
555 codingTypePtr = &codingType; |
|
556 } |
|
557 TInt stride = ParseOptionalIntL(aAttributes, _L8("stride"), -1); |
|
558 |
|
559 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
560 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
561 if (expectedError) |
|
562 { |
|
563 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
564 } |
|
565 |
|
566 #ifdef HREF_ED_WITHOUT_FLOATING_POINT |
|
567 CheckForAbortL(iCallback.MosSetVideoPortDefL(comp, port, width, height, colorFormatPtr, codingTypePtr, stride, 0, expectedErrorInt)); |
|
568 #else |
|
569 TReal32 fps = ParseOptionalRealL(aAttributes, _L8("fps"), -1); |
|
570 CheckForAbortL(iCallback.MosSetVideoPortDefL(comp, port, width, height, colorFormatPtr, codingTypePtr, stride, fps, expectedErrorInt)); |
|
571 #endif //HREF_ED_WITHOUT_FLOATING_POINT |
|
572 } |
|
573 else if(elemName == _L8("ExpectEvent")) |
|
574 { |
|
575 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
576 const TDesC8& eventDes = FindAttributeL(aAttributes, _L8("event")); |
|
577 const TDesC8& nData1Des = FindAttributeL(aAttributes, _L8("nData1")); |
|
578 const TDesC8& nData2Des = FindAttributeL(aAttributes, _L8("nData2")); |
|
579 TLex8 lex(nData1Des); |
|
580 TUint32 nData1; |
|
581 OMX_EVENTTYPE event = ParseOmxEventL(eventDes); |
|
582 switch(event) |
|
583 { |
|
584 // ParseOmxErrorL and ParseOmxCommandL will also parse literal integers |
|
585 case OMX_EventError: |
|
586 nData1 = static_cast<TUint32>(ParseOmxErrorL(nData1Des)); |
|
587 break; |
|
588 case OMX_EventCmdComplete: |
|
589 nData1 = static_cast<TUint32>(ParseOmxCommandL(nData1Des)); |
|
590 break; |
|
591 default: |
|
592 nData1 = ParseUint32L(nData1Des); |
|
593 break; |
|
594 } |
|
595 TUint32 nData2 = ParseUint32L(nData2Des); |
|
596 CheckForAbortL(iCallback.MosExpectEventL(comp, event, nData1, nData2)); |
|
597 } |
|
598 else if(elemName == _L8("CheckState")) |
|
599 { |
|
600 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
601 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("state")); |
|
602 OMX_STATETYPE state = ParseOmxStateL(stateDes); |
|
603 CheckForAbortL(iCallback.MosCheckStateL(comp, state)); |
|
604 } |
|
605 else if(elemName == _L8("CheckVideoPortDef")) |
|
606 { |
|
607 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
608 TPtrC8 comp; |
|
609 TInt port; |
|
610 ParseCompPortL(compPort, comp, port); |
|
611 const TDesC8& widthDes = FindAttributeL(aAttributes, _L8("width")); |
|
612 const TDesC8& heightDes = FindAttributeL(aAttributes, _L8("height")); |
|
613 TInt width; |
|
614 TInt height; |
|
615 TLex8 lex(widthDes); |
|
616 User::LeaveIfError(lex.Val(width)); |
|
617 lex = TLex8(heightDes); |
|
618 User::LeaveIfError(lex.Val(height)); |
|
619 const TDesC8& codingDes = FindAttributeL(aAttributes, _L8("coding")); |
|
620 OMX_VIDEO_CODINGTYPE coding = ParseOmxVideoCodingL(codingDes); |
|
621 const TDesC8& colorFormatDes = FindAttributeL(aAttributes, _L8("colorFormat")); |
|
622 OMX_COLOR_FORMATTYPE colorFormat = ParseOmxColorFormatL(colorFormatDes); |
|
623 CheckForAbortL(iCallback.MosCheckVideoPortDefL(comp, port, width, height, coding, colorFormat)); |
|
624 } |
|
625 else if(elemName == _L8("CheckMetaData")) |
|
626 { |
|
627 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
628 TPtrC8 comp; |
|
629 TInt port; |
|
630 ParseCompPortL(compPort, comp, port); |
|
631 const TDesC8& scopeDes = FindAttributeL(aAttributes, _L8("scope")); |
|
632 OMX_METADATASCOPETYPE scope = ParseOmxScopeTypeL(scopeDes); |
|
633 const TDesC8& atomType = FindAttributeL(aAttributes, _L8("atomType")); |
|
634 const TDesC8& atomIndexDes = FindAttributeL(aAttributes, _L8("atomIndex")); |
|
635 TLex8 lex(atomIndexDes); |
|
636 TUint32 atomIndex = ParseUint32L(atomIndexDes); |
|
637 const TDesC8& data = FindAttributeL(aAttributes, _L8("data")); |
|
638 CheckForAbortL(iCallback.MosCheckMetaDataL(comp, port, scope, atomType, atomIndex, data)); |
|
639 } |
|
640 else if(elemName == _L8("GetParameterUnknownType")) |
|
641 { |
|
642 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
643 TPtrC8 comp; |
|
644 TInt port; |
|
645 ParseCompPortL(compPort, comp, port); |
|
646 const TDesC8& scopeDes = FindAttributeL(aAttributes, _L8("scope")); |
|
647 OMX_METADATASCOPETYPE scope = ParseOmxScopeTypeL(scopeDes); |
|
648 const TDesC8& atomType = FindAttributeL(aAttributes, _L8("atomType")); |
|
649 const TDesC8& atomIndexDes = FindAttributeL(aAttributes, _L8("atomIndex")); |
|
650 TLex8 lex(atomIndexDes); |
|
651 TUint32 atomIndex = ParseUint32L(atomIndexDes); |
|
652 const TDesC8& data = FindAttributeL(aAttributes, _L8("data")); |
|
653 CheckForAbortL(iCallback.MosGetParameterUnknownIndexTypeL(comp, port, scope, atomType, atomIndex, data)); |
|
654 } |
|
655 else if(elemName == _L8("SetParameterUnknownType")) |
|
656 { |
|
657 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
658 TPtrC8 comp; |
|
659 TInt port; |
|
660 ParseCompPortL(compPort, comp, port); |
|
661 const TDesC8& scopeDes = FindAttributeL(aAttributes, _L8("scope")); |
|
662 OMX_METADATASCOPETYPE scope = ParseOmxScopeTypeL(scopeDes); |
|
663 const TDesC8& atomType = FindAttributeL(aAttributes, _L8("atomType")); |
|
664 const TDesC8& atomIndexDes = FindAttributeL(aAttributes, _L8("atomIndex")); |
|
665 TLex8 lex(atomIndexDes); |
|
666 TUint32 atomIndex = ParseUint32L(atomIndexDes); |
|
667 const TDesC8& data = FindAttributeL(aAttributes, _L8("data")); |
|
668 CheckForAbortL(iCallback.MosSetParameterUnknownIndexTypeL(comp, port, scope, atomType, atomIndex, data)); |
|
669 } |
|
670 else if(elemName == _L8("DisablePort")) |
|
671 { |
|
672 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
673 TPtrC8 comp; |
|
674 TInt portIndex; |
|
675 ParseCompPortL(port, comp, portIndex); |
|
676 CheckForAbortL(iCallback.MosDisablePort(comp, portIndex)); |
|
677 } |
|
678 else if(elemName == _L8("EnablePort")) |
|
679 { |
|
680 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
681 TPtrC8 comp; |
|
682 TInt portIndex; |
|
683 ParseCompPortL(port, comp, portIndex); |
|
684 CheckForAbortL(iCallback.MosEnablePort(comp, portIndex)); |
|
685 } |
|
686 else if(elemName == _L8("IgnoreEvent")) |
|
687 { |
|
688 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
689 const TDesC8& eventDes = FindAttributeL(aAttributes, _L8("event")); |
|
690 const TDesC8& nData1Des = FindAttributeL(aAttributes, _L8("nData1")); |
|
691 const TDesC8& nData2Des = FindAttributeL(aAttributes, _L8("nData2")); |
|
692 TLex8 lex(nData1Des); |
|
693 TUint32 nData1; |
|
694 OMX_EVENTTYPE event = ParseOmxEventL(eventDes); |
|
695 switch(event) |
|
696 { |
|
697 // ParseOmxErrorL and ParseOmxCommandL will also parse literal integers |
|
698 case OMX_EventError: |
|
699 nData1 = static_cast<TUint32>(ParseOmxErrorL(nData1Des)); |
|
700 break; |
|
701 case OMX_EventCmdComplete: |
|
702 nData1 = static_cast<TUint32>(ParseOmxCommandL(nData1Des)); |
|
703 break; |
|
704 default: |
|
705 nData1 = ParseUint32L(nData1Des); |
|
706 break; |
|
707 } |
|
708 TUint32 nData2 = ParseUint32L(nData2Des); |
|
709 CheckForAbortL(iCallback.MosIgnoreEventL(comp, event, nData1, nData2)); |
|
710 } |
|
711 else if(elemName == _L8("SetAudioPortDef")) |
|
712 { |
|
713 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
714 TPtrC8 comp; |
|
715 TInt port; |
|
716 ParseCompPortL(compPort, comp, port); |
|
717 OMX_AUDIO_CODINGTYPE codingType = OMX_AUDIO_CodingMax; |
|
718 OMX_AUDIO_CODINGTYPE* codingTypePtr = NULL; |
|
719 const TDesC8* codingDes = FindAttribute(aAttributes, _L8("codingType")); |
|
720 if(codingDes) |
|
721 { |
|
722 codingType = ParseOmxAudioCodingL(*codingDes); |
|
723 codingTypePtr = &codingType; |
|
724 } |
|
725 |
|
726 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
727 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
728 if (expectedError) |
|
729 { |
|
730 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
731 } |
|
732 |
|
733 CheckForAbortL(iCallback.MosSetAudioPortDefL(comp, port, codingTypePtr, expectedErrorInt)); |
|
734 } |
|
735 else if(elemName == _L8("SetAACProfile")) |
|
736 { |
|
737 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
738 TPtrC8 comp; |
|
739 TInt port; |
|
740 ParseCompPortL(compPort, comp, port); |
|
741 // TODO allow some values to be unspecified (preserved from existing settings) |
|
742 TInt channels = ParseUint32L(FindAttributeL(aAttributes, _L8("channels"))); |
|
743 TInt samplingrate = ParseUint32L(FindAttributeL(aAttributes, _L8("samplingrate"))); |
|
744 TInt bitrate = ParseUint32L(FindAttributeL(aAttributes, _L8("bitrate"))); |
|
745 TInt audioBandwidth = ParseUint32L(FindAttributeL(aAttributes, _L8("bandwidth"))); |
|
746 TInt frameLength = ParseUint32L(FindAttributeL(aAttributes, _L8("frameLength"))); |
|
747 // TODO allow multiple flags in disjunctive form |
|
748 TInt aacTools = ParseUint32L(FindAttributeL(aAttributes, _L8("aacTools"))); |
|
749 TInt aacerTools = ParseUint32L(FindAttributeL(aAttributes, _L8("aacerTools"))); |
|
750 OMX_AUDIO_AACPROFILETYPE profile = ParseOmxAACProfileL(FindAttributeL(aAttributes, _L8("profile"))); |
|
751 OMX_AUDIO_AACSTREAMFORMATTYPE streamFormat = ParseOmxAACStreamFormatL(FindAttributeL(aAttributes, _L8("streamFormat"))); |
|
752 OMX_AUDIO_CHANNELMODETYPE channelMode = ParseOmxAudioChannelModeL(FindAttributeL(aAttributes, _L8("channelMode"))); |
|
753 |
|
754 CheckForAbortL(iCallback.MosSetAACProfileL(comp, port, channels, samplingrate, bitrate, audioBandwidth, frameLength, aacTools, aacerTools, profile, streamFormat, channelMode)); |
|
755 } |
|
756 else if(elemName == _L8("SetPcmAudioPortDef")) |
|
757 { |
|
758 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
759 TPtrC8 comp; |
|
760 TInt port; |
|
761 ParseCompPortL(compPort, comp, port); |
|
762 TInt channels = ParseOptionalIntL(aAttributes, _L8("channels"), -1); |
|
763 TInt samplingrate = ParseOptionalIntL(aAttributes, _L8("samplingrate"), -1); |
|
764 TInt bitspersample = ParseOptionalIntL(aAttributes, _L8("bitspersample"), -1); |
|
765 OMX_NUMERICALDATATYPE numData = OMX_NumercialDataMax; |
|
766 const TDesC8* des = FindAttribute(aAttributes, _L8("numericalData")); |
|
767 if(des != NULL) |
|
768 { |
|
769 numData = ParseNumericalDataL(*des); |
|
770 } |
|
771 else |
|
772 { |
|
773 numData = static_cast<OMX_NUMERICALDATATYPE>(-1); |
|
774 } |
|
775 OMX_ENDIANTYPE endian = OMX_EndianMax; |
|
776 des = FindAttribute(aAttributes, _L8("endian")); |
|
777 if(des != NULL) |
|
778 { |
|
779 endian = ParseEndianL(*des); |
|
780 } |
|
781 else |
|
782 { |
|
783 endian = static_cast<OMX_ENDIANTYPE>(-1); |
|
784 } |
|
785 OMX_BOOL* interleaved = NULL; |
|
786 OMX_BOOL interleavedData; |
|
787 des = FindAttribute(aAttributes, _L8("interleaved")); |
|
788 if(des != NULL) |
|
789 { |
|
790 interleavedData = ParseBoolL(*des); |
|
791 interleaved = &interleavedData; |
|
792 } |
|
793 const TDesC8* encoding = FindAttribute(aAttributes, _L8("encoding")); |
|
794 CheckForAbortL(iCallback.MosSetPcmAudioPortDefL(comp, port, channels, samplingrate, bitspersample, numData, endian, interleaved, encoding)); |
|
795 } |
|
796 else if(elemName == _L8("SetAudioMute")) |
|
797 { |
|
798 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
799 TPtrC8 comp; |
|
800 TInt port; |
|
801 ParseCompPortL(compPort, comp, port); |
|
802 TBool mute = EFalse; |
|
803 const TDesC8* muteAttr = FindAttribute(aAttributes, _L8("mute")); |
|
804 if (muteAttr != NULL) |
|
805 { |
|
806 mute = ParseBooleanL(*muteAttr); |
|
807 } |
|
808 else |
|
809 { |
|
810 User::Leave(KErrArgument); |
|
811 } |
|
812 CheckForAbortL(iCallback.MosSetConfigAudioMuteL(comp, port, mute)); |
|
813 } |
|
814 else if(elemName == _L8("CheckAudioMute")) |
|
815 { |
|
816 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
817 TPtrC8 comp; |
|
818 TInt port; |
|
819 ParseCompPortL(compPort, comp, port); |
|
820 TBool mute = EFalse; |
|
821 const TDesC8* muteAttr = FindAttribute(aAttributes, _L8("mute")); |
|
822 if (muteAttr != NULL) |
|
823 { |
|
824 mute = ParseBooleanL(*muteAttr); |
|
825 } |
|
826 else |
|
827 { |
|
828 User::Leave(KErrArgument); |
|
829 } |
|
830 CheckForAbortL(iCallback.MosCheckConfigAudioMuteL(comp, port, mute)); |
|
831 } |
|
832 else if(elemName == _L8("SetAudioVolume")) |
|
833 { |
|
834 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
835 TPtrC8 comp; |
|
836 TInt port; |
|
837 ParseCompPortL(compPort, comp, port); |
|
838 TBool linear = EFalse; |
|
839 const TDesC8* linearScaleAttr = FindAttribute(aAttributes, _L8("linearscale")); |
|
840 if (linearScaleAttr != NULL) |
|
841 { |
|
842 linear = ParseBooleanL(*linearScaleAttr); |
|
843 } |
|
844 TInt minVolume = ParseOptionalIntL(aAttributes, _L8("min"), -1); |
|
845 TInt maxVolume = ParseOptionalIntL(aAttributes, _L8("max"), -1); |
|
846 TInt volume = ParseOptionalIntL(aAttributes, _L8("volume"), -1); |
|
847 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
848 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
849 if (expectedError) |
|
850 { |
|
851 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
852 } |
|
853 |
|
854 CheckForAbortL(iCallback.MosSetConfigAudioVolumeL(comp, port, linear, minVolume, maxVolume, volume, expectedErrorInt)); |
|
855 } |
|
856 else if(elemName == _L8("CheckAudioVolume")) |
|
857 { |
|
858 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
859 TPtrC8 comp; |
|
860 TInt port; |
|
861 ParseCompPortL(compPort, comp, port); |
|
862 TBool linear = EFalse; |
|
863 const TDesC8* linearScaleAttr = FindAttribute(aAttributes, _L8("linearscale")); |
|
864 if (linearScaleAttr != NULL) |
|
865 { |
|
866 linear = ParseBooleanL(*linearScaleAttr); |
|
867 } |
|
868 TInt minVolume = ParseOptionalIntL(aAttributes, _L8("min"), -1); |
|
869 TInt maxVolume = ParseOptionalIntL(aAttributes, _L8("max"), -1); |
|
870 TInt volume = ParseOptionalIntL(aAttributes, _L8("volume"), -1); |
|
871 CheckForAbortL(iCallback.MosCheckConfigAudioVolumeL(comp, port, linear, minVolume, maxVolume, volume)); |
|
872 } |
|
873 else if(elemName == _L8("SetAacAudioPortDef")) |
|
874 { |
|
875 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
876 TPtrC8 comp; |
|
877 TInt port; |
|
878 ParseCompPortL(compPort, comp, port); |
|
879 TInt channels = ParseOptionalIntL(aAttributes, _L8("channels"), -1); |
|
880 TInt samplingRate = ParseOptionalIntL(aAttributes, _L8("samplingrate"), -1); |
|
881 TInt bitRate = ParseOptionalIntL(aAttributes, _L8("bitrate"), -1); |
|
882 TInt audioBandwidth = ParseOptionalIntL(aAttributes, _L8("audiobandwidth"), -1); |
|
883 TInt frameLength = ParseOptionalIntL(aAttributes, _L8("framelength"), -1); |
|
884 TInt aacTools = ParseOptionalIntL(aAttributes, _L8("aactools"), -1); |
|
885 TInt aacErTools = ParseOptionalIntL(aAttributes, _L8("aacertools"), -1); |
|
886 |
|
887 OMX_AUDIO_AACPROFILETYPE profile; |
|
888 const TDesC8* attbval = FindAttribute(aAttributes, _L8("profile")); |
|
889 if ( NULL != attbval ) |
|
890 { |
|
891 profile = ParseOmxAACProfileL( *attbval ); |
|
892 } |
|
893 else |
|
894 { |
|
895 profile = static_cast <OMX_AUDIO_AACPROFILETYPE>(-1); |
|
896 } |
|
897 OMX_AUDIO_AACSTREAMFORMATTYPE streamFormat = ParseOmxAACStreamFormatL(FindAttributeL(aAttributes, _L8("streamFormat"))); |
|
898 OMX_AUDIO_CHANNELMODETYPE channelMode = ParseOmxAudioChannelModeL(FindAttributeL(aAttributes, _L8("channelMode"))); |
|
899 |
|
900 CheckForAbortL(iCallback.MosSetAacAudioPortDefL(comp, port, channels, samplingRate, bitRate, audioBandwidth, frameLength, aacTools, aacErTools, profile, streamFormat, channelMode)); |
|
901 } |
|
902 else if(elemName == _L8("SetClockReference")) |
|
903 { |
|
904 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
905 const TDesC8& refDes = FindAttributeL(aAttributes, _L8("ref")); |
|
906 OMX_TIME_REFCLOCKTYPE refClockType = ParseOmxRefClockTypeL(refDes); |
|
907 CheckForAbortL(iCallback.MosSetRefClockTypeL(comp, refClockType)); |
|
908 } |
|
909 else if(elemName == _L8("SetClockState")) |
|
910 { |
|
911 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
912 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("state")); |
|
913 OMX_TIME_CLOCKSTATE clockState = ParseOmxClockStateL(stateDes); |
|
914 const TDesC8& maskDes = FindAttributeL(aAttributes, _L8("mask")); |
|
915 TUint32 mask = ParseUint32L(maskDes); |
|
916 TInt startTime = ParseOptionalIntL(aAttributes, _L8("start"), 0); |
|
917 TInt offset = ParseOptionalIntL(aAttributes, _L8("offset"), 0); |
|
918 CheckForAbortL(iCallback.MosSetClockStateL(comp, clockState, startTime, offset, mask)); |
|
919 } |
|
920 else if(elemName == _L8("SetVideoFitMode")) |
|
921 { |
|
922 const TDesC8& modeDes = FindAttributeL(aAttributes, _L8("mode")); |
|
923 TVideoFitMode mode = ParseVideoFitModeL(modeDes); |
|
924 CheckForAbortL(iCallback.MosSetVideoFitModeL(mode)); |
|
925 } |
|
926 else if(elemName == _L8("SetActiveStream")) |
|
927 { |
|
928 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
929 const TDesC8& id = FindAttributeL(aAttributes, _L8("id")); |
|
930 TLex8 lex(id); |
|
931 TInt streamId; |
|
932 User::LeaveIfError(lex.Val(streamId)); |
|
933 CheckForAbortL(iCallback.MosSetActiveStream(comp, streamId)); |
|
934 } |
|
935 else if(elemName == _L8("GetActiveStream")) |
|
936 { |
|
937 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
938 const TDesC8& id = FindAttributeL(aAttributes, _L8("id")); |
|
939 TLex8 lex(id); |
|
940 TInt streamId; |
|
941 User::LeaveIfError(lex.Val(streamId)); |
|
942 CheckForAbortL(iCallback.MosGetActiveStream(comp, streamId)); |
|
943 } |
|
944 else if(elemName == _L8("LoadBufferHandler")) |
|
945 { |
|
946 // Load buffer component handler |
|
947 // Buffer component tests |
|
948 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
949 const TDesC8& filename = FindAttributeL(aAttributes, _L8("filename")); |
|
950 const TDesC8* type = FindAttribute(aAttributes, _L8("type")); |
|
951 TBuf<KMaxFileName> name; |
|
952 User::LeaveIfError(CnvUtfConverter::ConvertToUnicodeFromUtf8(name,filename)); |
|
953 |
|
954 // Call test script to create buffer handler |
|
955 CheckForAbortL(iCallback.InitialiseBufferHandlerL(comp, name, type)); |
|
956 } |
|
957 else if(elemName == _L8("StartBufferHandler")) |
|
958 { |
|
959 iCallback.StartBufferHandler(); |
|
960 } |
|
961 else if (elemName == _L8("SendInvalidBufferId")) |
|
962 { |
|
963 const TDesC8& id = FindAttributeL(aAttributes, _L8("id")); |
|
964 TInt idValue = ParseUint32L(id); |
|
965 iCallback.SendInvalidBufferId(idValue); |
|
966 } |
|
967 else if(elemName == _L8("EndBufferHandler")) |
|
968 { |
|
969 iCallback.StopBufferHandler(); |
|
970 } |
|
971 else if(elemName == _L8("LoadBufferSinkHandler")) |
|
972 { |
|
973 // Load buffer component handler |
|
974 // Buffer component tests |
|
975 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
976 const TDesC8& filename = FindAttributeL(aAttributes, _L8("filename")); |
|
977 TBuf<KMaxFileName> name; |
|
978 User::LeaveIfError(CnvUtfConverter::ConvertToUnicodeFromUtf8(name,filename)); |
|
979 |
|
980 // Call test script to create buffer handler |
|
981 CheckForAbortL(iCallback.InitialiseBufferSinkHandlerL(comp, name)); |
|
982 } |
|
983 else if (elemName == _L8("StartBufferSinkHandler")) |
|
984 { |
|
985 iCallback.StartBufferSinkHandler(); |
|
986 } |
|
987 else if (elemName == _L8("EndBufferSinkHandler")) |
|
988 { |
|
989 iCallback.StopBufferSinkHandler(); |
|
990 } |
|
991 else if(elemName == _L8("NegativeSetDataChunk")) |
|
992 { |
|
993 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
994 |
|
995 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
996 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
997 if (expectedError) |
|
998 { |
|
999 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
1000 } |
|
1001 |
|
1002 const TDesC8* expectedSystemError = FindAttribute(aAttributes, _L8("expectederror")); |
|
1003 TInt expectedSystemErrorInt = KErrNone; |
|
1004 if (expectedSystemError) |
|
1005 { |
|
1006 expectedSystemErrorInt = ParseSystemErrorCode(*expectedSystemError); |
|
1007 } |
|
1008 |
|
1009 CheckForAbortL(iCallback.MosNegativeSetDataChunk(comp, expectedErrorInt, expectedSystemErrorInt)); |
|
1010 } |
|
1011 else if(elemName == _L8("SetBufferSize")) |
|
1012 { |
|
1013 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1014 const TDesC8& value = FindAttributeL(aAttributes, _L8("size")); |
|
1015 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
1016 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
1017 if (expectedError) |
|
1018 { |
|
1019 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
1020 } |
|
1021 TInt portIndex = 0; |
|
1022 TPtrC8 comp; |
|
1023 ParseCompPortL(port, comp, portIndex); |
|
1024 TLex8 lex(value); |
|
1025 TInt valInt = 0; |
|
1026 User::LeaveIfError(lex.Val(valInt)); |
|
1027 CheckForAbortL(iCallback.MosSetBufferSize(comp, portIndex, valInt, expectedErrorInt)); |
|
1028 } |
|
1029 else if(elemName == _L8("GetAndCompareBufferCount")) |
|
1030 { |
|
1031 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1032 const TDesC8& value = FindAttributeL(aAttributes, _L8("count")); |
|
1033 TInt portIndex = 0; |
|
1034 TPtrC8 comp; |
|
1035 ParseCompPortL(port, comp, portIndex); |
|
1036 TLex8 lex(value); |
|
1037 TInt countInt = 0; |
|
1038 User::LeaveIfError(lex.Val(countInt)); |
|
1039 CheckForAbortL(iCallback.MosGetAndCompareBufferCount(comp, portIndex, countInt)); |
|
1040 } |
|
1041 else if(elemName == _L8("GetAndCompareBufferSize")) |
|
1042 { |
|
1043 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1044 const TDesC8& value = FindAttributeL(aAttributes, _L8("size")); |
|
1045 TInt portIndex = 0; |
|
1046 TPtrC8 comp; |
|
1047 ParseCompPortL(port, comp, portIndex); |
|
1048 TLex8 lex(value); |
|
1049 TInt valInt = 0; |
|
1050 User::LeaveIfError(lex.Val(valInt)); |
|
1051 CheckForAbortL(iCallback.MosGetAndCompareBufferSize(comp, portIndex, valInt)); |
|
1052 } |
|
1053 else if(elemName == _L8("FlushBuffer")) |
|
1054 { |
|
1055 const TDesC8& expectedError = FindAttributeL(aAttributes, _L8("expectedomxerr")); |
|
1056 OMX_ERRORTYPE expectedErrorInt = ParseOmxErrorCode(expectedError); |
|
1057 |
|
1058 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1059 TPtrC8 comp; |
|
1060 TInt portIndex = 0; |
|
1061 ParseCompPortL(port, comp, portIndex); |
|
1062 CheckForAbortL(iCallback.MosFlushBuffer(comp, portIndex, expectedErrorInt)); |
|
1063 } |
|
1064 else if(elemName == _L8("ForceBufferSourceFlushBuffer")) |
|
1065 { |
|
1066 const TDesC8& expectedError = FindAttributeL(aAttributes, _L8("expectedomxerr")); |
|
1067 OMX_ERRORTYPE expectedErrorInt = ParseOmxErrorCode(expectedError); |
|
1068 |
|
1069 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1070 TPtrC8 comp; |
|
1071 TInt portIndex = 0; |
|
1072 ParseCompPortL(port, comp, portIndex); |
|
1073 CheckForAbortL(iCallback.MosForceBufferSourceFlushBufferL(comp, portIndex, expectedErrorInt)); |
|
1074 } |
|
1075 else if(elemName == _L8("ForceBufferSinkFlushBuffer")) |
|
1076 { |
|
1077 const TDesC8& expectedError = FindAttributeL(aAttributes, _L8("expectedomxerr")); |
|
1078 OMX_ERRORTYPE expectedErrorInt = ParseOmxErrorCode(expectedError); |
|
1079 |
|
1080 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1081 TPtrC8 comp; |
|
1082 TInt portIndex = 0; |
|
1083 ParseCompPortL(port, comp, portIndex); |
|
1084 CheckForAbortL(iCallback.MosForceBufferSinkFlushBuffer(comp, portIndex, expectedErrorInt)); |
|
1085 } |
|
1086 else if(elemName == _L8("SetVideoEncQuant")) |
|
1087 { |
|
1088 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
1089 TPtrC8 comp; |
|
1090 TInt port; |
|
1091 ParseCompPortL(compPort, comp, port); |
|
1092 |
|
1093 TInt qpb = ParseOptionalIntL(aAttributes, _L8("qpb"), -1); |
|
1094 |
|
1095 CheckForAbortL(iCallback.MosSetVideoEncQuantL(comp, port,qpb)); |
|
1096 } |
|
1097 else if(elemName == _L8("SetVideoEncMotionVect")) |
|
1098 { |
|
1099 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
1100 TPtrC8 comp; |
|
1101 TInt port; |
|
1102 ParseCompPortL(compPort, comp, port); |
|
1103 |
|
1104 TInt accuracy = ParseOptionalIntL(aAttributes, _L8("accuracy"), -1); |
|
1105 TInt sxsearchrange = ParseOptionalIntL(aAttributes, _L8("sxsearchrange"), -1); |
|
1106 TInt sysearchrange = ParseOptionalIntL(aAttributes, _L8("sysearchrange"), -1); |
|
1107 |
|
1108 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
1109 OMX_ERRORTYPE expectedOmxError = OMX_ErrorNone; |
|
1110 if (expectedError) |
|
1111 { |
|
1112 expectedOmxError = ParseOmxErrorCode(*expectedError); |
|
1113 } |
|
1114 |
|
1115 CheckForAbortL(iCallback.MosSetVideoEncMotionVectL(comp, port, accuracy, sxsearchrange, sysearchrange, expectedOmxError)); |
|
1116 } |
|
1117 else if(elemName == _L8("SetVideoEncMpeg4Type")) |
|
1118 { |
|
1119 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
1120 TPtrC8 comp; |
|
1121 TInt port; |
|
1122 ParseCompPortL(compPort, comp, port); |
|
1123 const TDesC8* mpeg4Profile = FindAttribute(aAttributes, _L8("mpeg4profile")); |
|
1124 OMX_VIDEO_MPEG4PROFILETYPE profile = OMX_VIDEO_MPEG4ProfileMax; |
|
1125 if (mpeg4Profile) |
|
1126 { |
|
1127 profile = ParseOmxMpeg4ProfileL(*mpeg4Profile); |
|
1128 } |
|
1129 |
|
1130 OMX_VIDEO_MPEG4LEVELTYPE level = OMX_VIDEO_MPEG4LevelMax; |
|
1131 const TDesC8* mpeg4Level = FindAttribute(aAttributes, _L8("mpeg4level")); |
|
1132 if (mpeg4Level) |
|
1133 { |
|
1134 level = ParseOmxMpeg4LevelL(*mpeg4Level); |
|
1135 } |
|
1136 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
1137 OMX_ERRORTYPE expectedOmxError = OMX_ErrorNone; |
|
1138 if (expectedError) |
|
1139 { |
|
1140 expectedOmxError = ParseOmxErrorCode(*expectedError); |
|
1141 } |
|
1142 |
|
1143 CheckForAbortL(iCallback.MosSetVideoEncMpeg4TypeL(comp, port, profile, level, expectedOmxError)); |
|
1144 } |
|
1145 else if(elemName == _L8("SetVideoEncBitRate")) |
|
1146 { |
|
1147 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
1148 TPtrC8 comp; |
|
1149 TInt port; |
|
1150 ParseCompPortL(compPort, comp, port); |
|
1151 |
|
1152 const TDesC8* controlRate = FindAttribute(aAttributes, _L8("controlrate")); |
|
1153 OMX_VIDEO_CONTROLRATETYPE omxControlRate = OMX_Video_ControlRateMax; |
|
1154 if (controlRate) |
|
1155 { |
|
1156 omxControlRate = ParseOmxControlRateL(*controlRate); |
|
1157 } |
|
1158 |
|
1159 TInt targetBitrate = ParseOptionalIntL(aAttributes, _L8("targetbitrate"), -1); |
|
1160 |
|
1161 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
1162 OMX_ERRORTYPE expectedOmxError = OMX_ErrorNone; |
|
1163 if (expectedError) |
|
1164 { |
|
1165 expectedOmxError = ParseOmxErrorCode(*expectedError); |
|
1166 } |
|
1167 |
|
1168 CheckForAbortL(iCallback.MosSetVideoEncBitRateL(comp, port, omxControlRate, targetBitrate, expectedOmxError)); |
|
1169 } |
|
1170 else if(elemName == _L8("ChangeFilledBufferLength")) |
|
1171 { |
|
1172 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1173 const TDesC8& value = FindAttributeL(aAttributes, _L8("data")); |
|
1174 TLex8 lex(value); |
|
1175 TInt valInt = 0; |
|
1176 User::LeaveIfError(lex.Val(valInt)); |
|
1177 CheckForAbortL(iCallback.MosChangeFilledBufferLength(comp, valInt)); |
|
1178 } |
|
1179 else if(elemName == _L8("SetOMX_SymbianIndexParamBufferMsgQueueData")) |
|
1180 { |
|
1181 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1182 const TDesC8& expectedError = FindAttributeL(aAttributes, _L8("expectedomxerr")); |
|
1183 OMX_ERRORTYPE expectedErrorInt = ParseOmxErrorCode(expectedError); |
|
1184 |
|
1185 CheckForAbortL(iCallback.MosSetOMX_SymbianIndexParamBufferMsgQueueData(comp, expectedErrorInt)); |
|
1186 } |
|
1187 else if(elemName == _L8("GetExtensionIndex")) |
|
1188 { |
|
1189 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1190 const TDesC8& paramName = FindAttributeL(aAttributes, _L8("parametername")); |
|
1191 |
|
1192 const TDesC8* expectedError = FindAttribute(aAttributes, _L8("expectedomxerr")); |
|
1193 OMX_ERRORTYPE expectedErrorInt = OMX_ErrorNone; |
|
1194 if (expectedError) |
|
1195 { |
|
1196 expectedErrorInt = ParseOmxErrorCode(*expectedError); |
|
1197 } |
|
1198 |
|
1199 CheckForAbortL(iCallback.MosGetExtensionIndex(comp, paramName, expectedErrorInt)); |
|
1200 } |
|
1201 else if(elemName == _L8("SetCaptureModeType")) |
|
1202 { |
|
1203 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
1204 |
|
1205 TPtrC8 comp; |
|
1206 TInt port = 0; |
|
1207 ParseCompPortL(compPort, comp, port); |
|
1208 |
|
1209 const TDesC8& continuousStr = FindAttributeL(aAttributes, _L8("continuous")); |
|
1210 TBool continuous = ParseBooleanL(continuousStr); |
|
1211 const TDesC8& framelimitedStr = FindAttributeL(aAttributes, _L8("framelimited")); |
|
1212 TBool framelimited = ParseBooleanL(framelimitedStr); |
|
1213 TInt framelimit = ParseOptionalIntL(aAttributes, _L8("framelimit"), -1); |
|
1214 |
|
1215 CheckForAbortL(iCallback.MosSetCaptureModeTypeL(comp, port, continuous, framelimited, framelimit)); |
|
1216 } |
|
1217 |
|
1218 else if(elemName == _L8("GetTimeClockState")) |
|
1219 { |
|
1220 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1221 const TDesC8& expectedState = FindAttributeL(aAttributes, _L8("expectedstate")); |
|
1222 OMX_TIME_CLOCKSTATE expectedStateInt = ParseOmxClockStateL(expectedState); |
|
1223 |
|
1224 CheckForAbortL(iCallback.MosCheckTimeClockState(comp, expectedStateInt)); |
|
1225 } |
|
1226 else if(elemName == _L8("CheckMediaTime")) |
|
1227 { |
|
1228 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
1229 TPtrC8 comp; |
|
1230 TInt port; |
|
1231 |
|
1232 ParseCompPortL(compPort, comp, port); |
|
1233 |
|
1234 TBool moreThan = ETrue; |
|
1235 const TDesC8* mediatime = FindAttribute(aAttributes, _L8("mediatimelessthan")); |
|
1236 |
|
1237 if (mediatime) |
|
1238 { |
|
1239 moreThan = EFalse; |
|
1240 } |
|
1241 else |
|
1242 { |
|
1243 const TDesC8& mTime = FindAttributeL(aAttributes, _L8("mediatimemorethan")); |
|
1244 mediatime = &mTime; |
|
1245 } |
|
1246 |
|
1247 |
|
1248 OMX_TICKS mediatimeTick; |
|
1249 TLex8 lex(*mediatime); |
|
1250 User::LeaveIfError(lex.Val(mediatimeTick)); |
|
1251 CheckForAbortL(iCallback.MosCheckMediaTime(comp, port, mediatimeTick, moreThan)); |
|
1252 } |
|
1253 else if(elemName == _L8("SetClockTimeScale")) |
|
1254 { |
|
1255 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1256 const TDesC8& scale = FindAttributeL(aAttributes, _L8("scale")); |
|
1257 |
|
1258 TReal32 xscale = ParseReal32L(scale); |
|
1259 |
|
1260 CheckForAbortL(iCallback.MosSetClockTimeScale(comp,xscale * 65536)); |
|
1261 } |
|
1262 else if(elemName == _L8("Base_AddPortSupport")) |
|
1263 { |
|
1264 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1265 TPtrC8 comp; |
|
1266 TInt portIndex; |
|
1267 ParseCompPortL(portValue, comp, portIndex); |
|
1268 CheckForAbortL(iCallback.MosBaseSupportPortL(comp, portIndex)); |
|
1269 } |
|
1270 else if(elemName == _L8("Base_SetAutonomous")) |
|
1271 { |
|
1272 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1273 TPtrC8 comp; |
|
1274 TInt portIndex; |
|
1275 ParseCompPortL(portValue, comp, portIndex); |
|
1276 const TDesC8& enabledValue = FindAttributeL(aAttributes, _L8("enabled")); |
|
1277 TBool enabled = ParseBooleanL(enabledValue); |
|
1278 CheckForAbortL(iCallback.MosBaseSetAutonomous(comp, portIndex, enabled)); |
|
1279 } |
|
1280 else if(elemName == _L8("Base_AllocateBuffers")) |
|
1281 { |
|
1282 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1283 TPtrC8 comp; |
|
1284 TInt portIndex; |
|
1285 ParseCompPortL(portValue, comp, portIndex); |
|
1286 |
|
1287 const TDesC8& numberValue = FindAttributeL(aAttributes, _L8("number")); |
|
1288 TInt numberBuffs; |
|
1289 TLex8 lex(numberValue); |
|
1290 User::LeaveIfError(lex.Val(numberBuffs)); |
|
1291 |
|
1292 CheckForAbortL(iCallback.MosBaseAllocateBuffersL(comp, portIndex, numberBuffs)); |
|
1293 } |
|
1294 else if(elemName == _L8("Base_FreeAllocatedBuffers")) |
|
1295 { |
|
1296 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1297 |
|
1298 CheckForAbortL(iCallback.MosBaseFreeAllocatedBuffersL(comp)); |
|
1299 } |
|
1300 else if(elemName == _L8("Base_SetBufSupplierPref")) |
|
1301 { |
|
1302 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1303 TPtrC8 comp; |
|
1304 TInt portIndex; |
|
1305 ParseCompPortL(portValue, comp, portIndex); |
|
1306 |
|
1307 const TDesC8& componentSupplierValue = FindAttributeL(aAttributes, _L8("iscomponentsupplier")); |
|
1308 TBool componentSupplier = ParseBooleanL(componentSupplierValue); |
|
1309 CheckForAbortL(iCallback.MosBaseSetBufSupplier(comp, portIndex, componentSupplier)); |
|
1310 } |
|
1311 else if(elemName == _L8("Base_FillThisBuffer")) |
|
1312 { |
|
1313 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1314 TPtrC8 comp; |
|
1315 TInt portIndex; |
|
1316 ParseCompPortL(portValue, comp, portIndex); |
|
1317 |
|
1318 const TDesC8& bufIndexValue = FindAttributeL(aAttributes, _L8("portrelativebufferindex")); |
|
1319 TInt bufIndex; |
|
1320 TLex8 lex(bufIndexValue); |
|
1321 User::LeaveIfError(lex.Val(bufIndex)); |
|
1322 |
|
1323 CheckForAbortL(iCallback.MosBaseFillThisBuffer(comp, portIndex, bufIndex)); |
|
1324 } |
|
1325 else if(elemName == _L8("Base_EmptyThisBuffer")) |
|
1326 { |
|
1327 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1328 TPtrC8 comp; |
|
1329 TInt portIndex; |
|
1330 ParseCompPortL(portValue, comp, portIndex); |
|
1331 |
|
1332 const TDesC8& bufIndexValue = FindAttributeL(aAttributes, _L8("portrelativebufferindex")); |
|
1333 TInt bufIndex; |
|
1334 TLex8 lex(bufIndexValue); |
|
1335 User::LeaveIfError(lex.Val(bufIndex)); |
|
1336 |
|
1337 CheckForAbortL(iCallback.MosBaseEmptyThisBuffer(comp, portIndex, bufIndex)); |
|
1338 } |
|
1339 else if(elemName == _L8("Base_WaitForBuffer")) |
|
1340 { |
|
1341 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1342 TPtrC8 comp; |
|
1343 TInt portIndex; |
|
1344 ParseCompPortL(portValue, comp, portIndex); |
|
1345 |
|
1346 const TDesC8& bufIndexValue = FindAttributeL(aAttributes, _L8("bufferindexinport")); |
|
1347 TInt bufIndex; |
|
1348 TLex8 lex(bufIndexValue); |
|
1349 User::LeaveIfError(lex.Val(bufIndex)); |
|
1350 |
|
1351 CheckForAbortL(iCallback.MosBaseWaitForBuffer(comp, portIndex, bufIndex)); |
|
1352 } |
|
1353 else if(elemName == _L8("BaseTimestamp_PassClockHandle")) |
|
1354 { |
|
1355 const TDesC8& receivingComp = FindAttributeL(aAttributes, _L8("receiver")); |
|
1356 const TDesC8& clockToPass = FindAttributeL(aAttributes, _L8("handle")); |
|
1357 |
|
1358 CheckForAbortL(iCallback.MosBaseTimestampPassClock(receivingComp, clockToPass)); |
|
1359 } |
|
1360 else if(elemName == _L8("BaseTimestamp_CheckTimestamp")) |
|
1361 { |
|
1362 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1363 TPtrC8 comp; |
|
1364 TInt portIndex; |
|
1365 ParseCompPortL(portValue, comp, portIndex); |
|
1366 |
|
1367 const TDesC8& timeValue = FindAttributeL(aAttributes, _L8("time")); |
|
1368 TUint time; |
|
1369 TLex8 lex(timeValue); |
|
1370 User::LeaveIfError(lex.Val(time)); |
|
1371 |
|
1372 const TDesC8& toleranceValue = FindAttributeL(aAttributes, _L8("tolerance")); |
|
1373 TUint tolerance; |
|
1374 lex.Assign(toleranceValue); |
|
1375 User::LeaveIfError(lex.Val(tolerance)); |
|
1376 |
|
1377 CheckForAbortL(iCallback.MosBaseTimestampCheckTimestampL(comp, portIndex, time, tolerance)); |
|
1378 } |
|
1379 else if(elemName == _L8("BaseTimestamp_CompareWithRefClock")) |
|
1380 { |
|
1381 const TDesC8& portValue = FindAttributeL(aAttributes, _L8("port")); |
|
1382 TPtrC8 comp; |
|
1383 TInt portIndex; |
|
1384 ParseCompPortL(portValue, comp, portIndex); |
|
1385 |
|
1386 const TDesC8& toleranceValue = FindAttributeL(aAttributes, _L8("tolerance")); |
|
1387 TUint tolerance; |
|
1388 TLex8 lex(toleranceValue); |
|
1389 User::LeaveIfError(lex.Val(tolerance)); |
|
1390 |
|
1391 CheckForAbortL(iCallback.MosBaseTimestampCompareWithRefClockL(comp, portIndex, tolerance)); |
|
1392 } |
|
1393 else if(elemName == _L8("CheckClockState")) |
|
1394 { |
|
1395 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1396 const TDesC8& stateDes = FindAttributeL(aAttributes, _L8("clockstate")); |
|
1397 OMX_TIME_CLOCKSTATE clockState = ParseOmxClockStateL(stateDes); |
|
1398 CheckForAbortL(iCallback.MosCheckClockStateL(comp, clockState)); |
|
1399 } |
|
1400 else if(elemName == _L8("CheckTimePosition")) |
|
1401 { |
|
1402 // Use with caution: increments position as a side-effect. |
|
1403 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1404 TPtrC8 comp; |
|
1405 TInt portIndex; |
|
1406 ParseCompPortL(port, comp, portIndex); |
|
1407 |
|
1408 TInt timestamp = ParseOptionalIntL(aAttributes, _L8("timestamp"), 0); |
|
1409 |
|
1410 CheckForAbortL(iCallback.MosCheckTimePositionL(comp, portIndex, timestamp)); |
|
1411 } |
|
1412 else if(elemName == _L8("SetTimePosition")) |
|
1413 { |
|
1414 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1415 TPtrC8 comp; |
|
1416 TInt portIndex; |
|
1417 ParseCompPortL(port, comp, portIndex); |
|
1418 |
|
1419 TInt timestamp = ParseOptionalIntL(aAttributes, _L8("timestamp"), 0); |
|
1420 |
|
1421 CheckForAbortL(iCallback.MosSetTimePositionL(comp, portIndex, timestamp)); |
|
1422 } |
|
1423 else if(elemName == _L8("StartBuffersforPort")) |
|
1424 { |
|
1425 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
1426 TPtrC8 comp; |
|
1427 TInt port; |
|
1428 ParseCompPortL(compPort, comp, port); |
|
1429 |
|
1430 CheckForAbortL(iCallback.MosStartBuffersforPort( comp,port)); |
|
1431 } |
|
1432 else if(elemName == _L8("CheckFrameCount")) |
|
1433 { |
|
1434 const TDesC8& fileName8 = FindAttributeL(aAttributes, _L8("filename")); |
|
1435 TInt count = ParseOptionalIntL(aAttributes, _L8("count"), 0); |
|
1436 |
|
1437 HBufC* fileName = HBufC::NewLC(fileName8.Length()); |
|
1438 fileName->Des().Copy(fileName8); |
|
1439 CheckForAbortL(iCallback.MosCheckFrameCountL(*fileName, count)); |
|
1440 CleanupStack::PopAndDestroy(fileName); |
|
1441 } |
|
1442 |
|
1443 else if(elemName == _L8("MarkBuffer")) |
|
1444 { |
|
1445 const TDesC8& port = FindAttributeL(aAttributes, _L8("port")); |
|
1446 TPtrC8 comp; |
|
1447 TInt portIndex; |
|
1448 ParseCompPortL(port, comp, portIndex); |
|
1449 const TDesC8& targetComp = FindAttributeL(aAttributes, _L8("targetComp")); |
|
1450 TInt markData = ParseOptionalIntL(aAttributes, _L8("markData"), 0); |
|
1451 CheckForAbortL(iCallback.MosMarkBuffer(comp, portIndex, targetComp, markData)); |
|
1452 } |
|
1453 #ifdef OLD_ADPCM_EXTENSION |
|
1454 else if (elemName == _L8("SetAdPcmAudioPortDef")) |
|
1455 { |
|
1456 const TDesC8& compPort = FindAttributeL(aAttributes, _L8("port")); |
|
1457 TPtrC8 comp; |
|
1458 TInt port; |
|
1459 ParseCompPortL(compPort, comp, port); |
|
1460 TInt channels = ParseOptionalIntL(aAttributes, _L8("channels"), -1); |
|
1461 TInt samplingrate = ParseOptionalIntL(aAttributes, _L8("samplingrate"), -1); |
|
1462 TInt bitspersample = ParseOptionalIntL(aAttributes, _L8("bitspersample"), -1); |
|
1463 CheckForAbortL(iCallback.MosSetAdPcmAudioPortDefL(comp, port, channels, samplingrate, bitspersample)); |
|
1464 } |
|
1465 else if (elemName == _L8("SetAdPcmDecoderBlockAlign")) |
|
1466 { |
|
1467 const TDesC8& comp = FindAttributeL(aAttributes, _L8("comp")); |
|
1468 const TDesC8& blockAlign = FindAttributeL(aAttributes, _L8("blockalign")); |
|
1469 TLex8 lex(blockAlign); |
|
1470 TInt blockAlignValue; |
|
1471 User::LeaveIfError(lex.Val(blockAlignValue)); |
|
1472 CheckForAbortL(iCallback.MosConfigAdPcmDecoderBlockAlign(comp, blockAlignValue)); |
|
1473 } |
|
1474 #endif |
|
1475 else |
|
1476 { |
|
1477 // element name is not recognized |
|
1478 TBuf<32> elemNameCopy; |
|
1479 elemNameCopy.Copy(elemName); |
|
1480 TBuf<44> message; |
|
1481 message.Append(_L("Unrecognized command: ")); |
|
1482 message.Append(elemNameCopy); |
|
1483 iCallback.MosParseError(message); |
|
1484 User::Leave(KErrArgument); |
|
1485 } |
|
1486 } |
|
1487 } |
|
1488 |
|
1489 TInt COmxScriptParser::ParseSystemErrorCode(const TDesC8& aErrorCode) |
|
1490 { |
|
1491 TInt error = KErrNone; |
|
1492 |
|
1493 if (aErrorCode == _L8("KErrNotFound")) |
|
1494 { |
|
1495 error = KErrNotFound; |
|
1496 } |
|
1497 |
|
1498 // TODO: the other error code will be added in demand |
|
1499 |
|
1500 return error; |
|
1501 } |
|
1502 |
|
1503 // TODO duplication with ParseOmxErrorL |
|
1504 OMX_ERRORTYPE COmxScriptParser::ParseOmxErrorCode(const TDesC8& aErrorCode) |
|
1505 { |
|
1506 #define DEFERR(e) if(aErrorCode == _L8(#e)) return e; |
|
1507 |
|
1508 DEFERR(OMX_ErrorNone); |
|
1509 DEFERR(OMX_ErrorInsufficientResources); |
|
1510 DEFERR(OMX_ErrorUndefined); |
|
1511 DEFERR(OMX_ErrorInvalidComponentName); |
|
1512 DEFERR(OMX_ErrorComponentNotFound); |
|
1513 DEFERR(OMX_ErrorInvalidComponent); |
|
1514 DEFERR(OMX_ErrorBadParameter); |
|
1515 DEFERR(OMX_ErrorNotImplemented); |
|
1516 DEFERR(OMX_ErrorUnderflow); |
|
1517 DEFERR(OMX_ErrorOverflow); |
|
1518 DEFERR(OMX_ErrorHardware); |
|
1519 DEFERR(OMX_ErrorInvalidState); |
|
1520 DEFERR(OMX_ErrorStreamCorrupt); |
|
1521 DEFERR(OMX_ErrorPortsNotCompatible); |
|
1522 DEFERR(OMX_ErrorResourcesLost); |
|
1523 DEFERR(OMX_ErrorNoMore); |
|
1524 DEFERR(OMX_ErrorVersionMismatch); |
|
1525 DEFERR(OMX_ErrorNotReady); |
|
1526 DEFERR(OMX_ErrorTimeout); |
|
1527 DEFERR(OMX_ErrorSameState); |
|
1528 DEFERR(OMX_ErrorResourcesPreempted); |
|
1529 DEFERR(OMX_ErrorPortUnresponsiveDuringAllocation); |
|
1530 DEFERR(OMX_ErrorPortUnresponsiveDuringDeallocation); |
|
1531 DEFERR(OMX_ErrorPortUnresponsiveDuringStop); |
|
1532 DEFERR(OMX_ErrorIncorrectStateTransition); |
|
1533 DEFERR(OMX_ErrorIncorrectStateOperation); |
|
1534 DEFERR(OMX_ErrorUnsupportedSetting); |
|
1535 DEFERR(OMX_ErrorUnsupportedIndex); |
|
1536 DEFERR(OMX_ErrorBadPortIndex); |
|
1537 DEFERR(OMX_ErrorPortUnpopulated); |
|
1538 DEFERR(OMX_ErrorComponentSuspended); |
|
1539 DEFERR(OMX_ErrorDynamicResourcesUnavailable); |
|
1540 DEFERR(OMX_ErrorMbErrorsInFrame); |
|
1541 DEFERR(OMX_ErrorFormatNotDetected); |
|
1542 DEFERR(OMX_ErrorContentPipeOpenFailed); |
|
1543 DEFERR(OMX_ErrorContentPipeCreationFailed); |
|
1544 DEFERR(OMX_ErrorSeperateTablesUsed); |
|
1545 DEFERR(OMX_ErrorTunnelingUnsupported); |
|
1546 DEFERR(OMX_ErrorKhronosExtensions); |
|
1547 DEFERR(OMX_ErrorVendorStartUnused); |
|
1548 #undef DEFERR |
|
1549 |
|
1550 return OMX_ErrorMax; |
|
1551 } |
|
1552 |
|
1553 void COmxScriptParser::OnEndElementL(const RTagInfo& aElement, TInt /*aErrorCode*/) |
|
1554 { |
|
1555 if(iInTest) |
|
1556 { |
|
1557 const TDesC8& elemName = aElement.LocalName().DesC(); |
|
1558 if(elemName == _L8("Test")) |
|
1559 { |
|
1560 iInTest = EFalse; |
|
1561 } |
|
1562 } |
|
1563 } |
|
1564 |
|
1565 const TDesC8* COmxScriptParser::FindAttribute(const RArray<RAttribute>& aArray, const TDesC8& aAttribName) |
|
1566 { |
|
1567 for(TInt index = 0, count = aArray.Count(); index < count; index++) |
|
1568 { |
|
1569 const RAttribute& attribute = aArray[index]; |
|
1570 const TDesC8& name = attribute.Attribute().LocalName().DesC(); |
|
1571 if(name == aAttribName) |
|
1572 { |
|
1573 return &(attribute.Value().DesC()); |
|
1574 } |
|
1575 } |
|
1576 return NULL; |
|
1577 } |
|
1578 |
|
1579 const TDesC8& COmxScriptParser::FindAttributeL(const RArray<RAttribute>& aArray, const TDesC8& aAttribName) |
|
1580 { |
|
1581 const TDesC8* result = FindAttribute(aArray, aAttribName); |
|
1582 if(!result) |
|
1583 { |
|
1584 TBuf<32> nameCopy; |
|
1585 nameCopy.Copy(aAttribName); |
|
1586 TBuf<52> msg; |
|
1587 msg.Append(_L("Attribute ")); |
|
1588 msg.Append(nameCopy); |
|
1589 msg.Append(_L(" not found")); |
|
1590 iCallback.MosParseError(msg); |
|
1591 User::Leave(KErrNotFound); |
|
1592 } |
|
1593 return *result; |
|
1594 } |
|
1595 |
|
1596 void COmxScriptParser::ParseCompPortL(const TDesC8& aInput, TPtrC8& aNameOut, TInt& aPortOut) |
|
1597 { |
|
1598 TInt offset = aInput.Locate(':'); |
|
1599 User::LeaveIfError(offset); |
|
1600 aNameOut.Set(aInput.Left(offset)); |
|
1601 TPtrC8 port = aInput.Right(aInput.Length() - offset - 1); |
|
1602 if (port == _L8("all")) |
|
1603 { |
|
1604 aPortOut = static_cast<TInt>(OMX_ALL); |
|
1605 } |
|
1606 else |
|
1607 { |
|
1608 TLex8 lex(port); |
|
1609 User::LeaveIfError(lex.Val(aPortOut)); |
|
1610 } |
|
1611 } |
|
1612 |
|
1613 |
|
1614 // The order of these entries does not matter, but for clarity's sake please |
|
1615 // maintain alphabetical order |
|
1616 |
|
1617 PARSE_MAP_START(OMX_AUDIO_AACPROFILETYPE) |
|
1618 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, ERLC), |
|
1619 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, HE), |
|
1620 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, HE_PS), |
|
1621 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, LC), |
|
1622 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, LD), |
|
1623 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, LTP), |
|
1624 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, Main), |
|
1625 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, Null), |
|
1626 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, Scalable), |
|
1627 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACObject, SSR) |
|
1628 PARSE_MAP_END(OMX_AUDIO_AACPROFILETYPE) |
|
1629 |
|
1630 PARSE_MAP_START(OMX_AUDIO_AACSTREAMFORMATTYPE) |
|
1631 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, ADIF), |
|
1632 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, MP2ADTS), |
|
1633 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, MP4ADTS), |
|
1634 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, MP4FF), |
|
1635 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, MP4LATM), |
|
1636 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, MP4LOAS), |
|
1637 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_AACStreamFormat, RAW) |
|
1638 PARSE_MAP_END(OMX_AUDIO_AACSTREAMFORMATTYPE) |
|
1639 |
|
1640 PARSE_MAP_START(OMX_AUDIO_CHANNELMODETYPE) |
|
1641 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_ChannelMode, Dual), |
|
1642 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_ChannelMode, JointStereo), |
|
1643 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_ChannelMode, Mono), |
|
1644 PARSE_MAP_PREFIXENTRY(OMX_AUDIO_ChannelMode, Stereo) |
|
1645 PARSE_MAP_END(OMX_AUDIO_CHANNELMODETYPE) |
|
1646 |
|
1647 PARSE_MAP_START(OMX_COMMANDTYPE) |
|
1648 PARSE_MAP_PREFIXENTRY(OMX_Command, StateSet), |
|
1649 PARSE_MAP_PREFIXENTRY(OMX_Command, Flush), |
|
1650 PARSE_MAP_PREFIXENTRY(OMX_Command, PortDisable), |
|
1651 PARSE_MAP_PREFIXENTRY(OMX_Command, PortEnable), |
|
1652 PARSE_MAP_PREFIXENTRY(OMX_Command, MarkBuffer) |
|
1653 PARSE_MAP_END(OMX_COMMANDTYPE) |
|
1654 |
|
1655 PARSE_MAP_START(OMX_COLOR_FORMATTYPE) |
|
1656 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, Unused), |
|
1657 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, Max), |
|
1658 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, 12bitRGB444), |
|
1659 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, 16bitRGB565), |
|
1660 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, 24bitBGR888), |
|
1661 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, 32bitARGB8888), |
|
1662 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, 32bitBGRA8888), |
|
1663 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, CbYCrY), |
|
1664 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YCbYCr), |
|
1665 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YCrYCb), |
|
1666 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YUV420PackedPlanar), |
|
1667 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YUV422PackedPlanar), |
|
1668 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YUV420Planar), |
|
1669 #if defined(NCP_COMMON_BRIDGE_FAMILY) && !defined(__WINSCW__) |
|
1670 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YUV422Planar), |
|
1671 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, STYUV420PackedSemiPlanarMB), |
|
1672 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, STYUV422PackedSemiPlanarMB) |
|
1673 #else |
|
1674 PARSE_MAP_PREFIXENTRY(OMX_COLOR_Format, YUV422Planar) |
|
1675 #endif //NCP_COMMON_BRIDGE_FAMILY |
|
1676 PARSE_MAP_END(OMX_COLOR_FORMATTYPE) |
|
1677 |
|
1678 PARSE_MAP_START(OMX_ERRORTYPE) |
|
1679 PARSE_MAP_PREFIXENTRY(OMX_Error, BadParameter), |
|
1680 PARSE_MAP_PREFIXENTRY(OMX_Error, BadPortIndex), |
|
1681 PARSE_MAP_PREFIXENTRY(OMX_Error, ContentPipeOpenFailed), |
|
1682 PARSE_MAP_PREFIXENTRY(OMX_Error, Hardware), |
|
1683 PARSE_MAP_PREFIXENTRY(OMX_Error, IncorrectStateOperation), |
|
1684 PARSE_MAP_PREFIXENTRY(OMX_Error, None), |
|
1685 PARSE_MAP_PREFIXENTRY(OMX_Error, NotReady), |
|
1686 PARSE_MAP_PREFIXENTRY(OMX_Error, PortsNotCompatible), |
|
1687 PARSE_MAP_PREFIXENTRY(OMX_Error, Underflow), |
|
1688 PARSE_MAP_PREFIXENTRY(OMX_Error, UnsupportedIndex), |
|
1689 PARSE_MAP_PREFIXENTRY(OMX_Error, UnsupportedSetting) |
|
1690 PARSE_MAP_END(OMX_ERRORTYPE) |
|
1691 |
|
1692 PARSE_MAP_START(OMX_EVENTTYPE) |
|
1693 PARSE_MAP_PREFIXENTRY(OMX_Event, BufferFlag), |
|
1694 PARSE_MAP_PREFIXENTRY(OMX_Event, CmdComplete), |
|
1695 PARSE_MAP_PREFIXENTRY(OMX_Event, Error), |
|
1696 PARSE_MAP_PREFIXENTRY(OMX_Event, Mark), |
|
1697 PARSE_MAP_PREFIXENTRY(OMX_Event, PortFormatDetected), |
|
1698 PARSE_MAP_PREFIXENTRY(OMX_Event, PortSettingsChanged), |
|
1699 PARSE_MAP_END(OMX_EVENTTYPE) |
|
1700 |
|
1701 // PARSE_MAP_PREFIXENTRY(OMX_EventNokia, FirstFrameDisplayed), |
|
1702 // PARSE_MAP_PREFIXENTRY(OMX_EventNokia, DroppedFrame) |
|
1703 |
|
1704 |
|
1705 PARSE_MAP_START(OMX_STATETYPE) |
|
1706 PARSE_MAP_PREFIXENTRY(OMX_State, Loaded), |
|
1707 PARSE_MAP_PREFIXENTRY(OMX_State, Idle), |
|
1708 PARSE_MAP_PREFIXENTRY(OMX_State, Executing), |
|
1709 PARSE_MAP_PREFIXENTRY(OMX_State, Pause), |
|
1710 PARSE_MAP_PREFIXENTRY(OMX_State, WaitForResources), |
|
1711 PARSE_MAP_PREFIXENTRY(OMX_State, Invalid) |
|
1712 PARSE_MAP_END(OMX_STATETYPE) |
|
1713 |
|
1714 /** |
|
1715 * Templated wrapper to a plain-C function generated by PARSE_MAP |
|
1716 * Accepts a descriptor as input and leaves with KErrArgument if parse fails. |
|
1717 */ |
|
1718 template<typename T> T ParseL(const TDesC8& aDes, TInt (*parseFunc)(const char*, T*)) |
|
1719 { |
|
1720 if(aDes.Length() >= 64) |
|
1721 { |
|
1722 User::Leave(KErrArgument); |
|
1723 } |
|
1724 TBuf8<64> buf = aDes; |
|
1725 T result = (T) 0; |
|
1726 TInt success = parseFunc((char*) buf.PtrZ(), &result); |
|
1727 if(!success) |
|
1728 { |
|
1729 // value not recognized |
|
1730 // maybe add it to the PARSE_MAP ? |
|
1731 __BREAKPOINT(); |
|
1732 User::Leave(KErrArgument); |
|
1733 } |
|
1734 return result; |
|
1735 } |
|
1736 |
|
1737 OMX_AUDIO_AACPROFILETYPE COmxScriptParser::ParseOmxAACProfileL(const TDesC8& aProfileDes) |
|
1738 { |
|
1739 return ParseL(aProfileDes, parse_OMX_AUDIO_AACPROFILETYPE); |
|
1740 } |
|
1741 |
|
1742 OMX_AUDIO_AACSTREAMFORMATTYPE COmxScriptParser::ParseOmxAACStreamFormatL(const TDesC8& aFormatDes) |
|
1743 { |
|
1744 return ParseL(aFormatDes, parse_OMX_AUDIO_AACSTREAMFORMATTYPE); |
|
1745 } |
|
1746 |
|
1747 OMX_AUDIO_CHANNELMODETYPE COmxScriptParser::ParseOmxAudioChannelModeL(const TDesC8& aChannelModeDes) |
|
1748 { |
|
1749 return ParseL(aChannelModeDes, parse_OMX_AUDIO_CHANNELMODETYPE); |
|
1750 } |
|
1751 |
|
1752 OMX_STATETYPE COmxScriptParser::ParseOmxStateL(const TDesC8& aStateDes) |
|
1753 { |
|
1754 return ParseL(aStateDes, parse_OMX_STATETYPE); |
|
1755 } |
|
1756 |
|
1757 OMX_METADATASCOPETYPE COmxScriptParser::ParseOmxScopeTypeL(const TDesC8& aScopeDes) |
|
1758 { |
|
1759 if(aScopeDes == _L8("all")) |
|
1760 { |
|
1761 return OMX_MetadataScopeAllLevels; |
|
1762 } |
|
1763 else if(aScopeDes == _L8("top")) |
|
1764 { |
|
1765 return OMX_MetadataScopeTopLevel; |
|
1766 } |
|
1767 else if(aScopeDes == _L8("port")) |
|
1768 { |
|
1769 return OMX_MetadataScopePortLevel; |
|
1770 } |
|
1771 else |
|
1772 { |
|
1773 User::Leave(KErrArgument); |
|
1774 return OMX_MetadataScopeTypeMax; // unreachable, prevents compiler warning |
|
1775 } |
|
1776 } |
|
1777 |
|
1778 OMX_BUFFERSUPPLIERTYPE COmxScriptParser::ParseOmxSupplierL(const TDesC8& aSupplierDes, TBool aAllowUnspecified) |
|
1779 { |
|
1780 if(aSupplierDes == _L8("input")) |
|
1781 { |
|
1782 return OMX_BufferSupplyInput; |
|
1783 } |
|
1784 else if(aSupplierDes == _L8("output")) |
|
1785 { |
|
1786 return OMX_BufferSupplyOutput; |
|
1787 } |
|
1788 else if (aAllowUnspecified && aSupplierDes == _L8("unspecified")) |
|
1789 { |
|
1790 return OMX_BufferSupplyUnspecified; |
|
1791 } |
|
1792 else |
|
1793 { |
|
1794 User::Leave(KErrArgument); |
|
1795 return OMX_BufferSupplyInput; // unreachable, prevents compiler warning |
|
1796 } |
|
1797 } |
|
1798 |
|
1799 void COmxScriptParser::CheckForAbortL(TBool success) |
|
1800 { |
|
1801 if(!success) |
|
1802 { |
|
1803 iCallbackAborted = ETrue; |
|
1804 User::Leave(KErrAbort); |
|
1805 } |
|
1806 } |
|
1807 |
|
1808 TInt COmxScriptParser::ParseOptionalIntL(const RArray<RAttribute>& aArray, const TDesC8& aAttribName, TInt aDefaultValue) |
|
1809 { |
|
1810 const TDesC8* des = FindAttribute(aArray, aAttribName); |
|
1811 if(des == NULL) |
|
1812 { |
|
1813 return aDefaultValue; |
|
1814 } |
|
1815 else |
|
1816 { |
|
1817 TInt result; |
|
1818 TLex8 lex(*des); |
|
1819 User::LeaveIfError(lex.Val(result)); |
|
1820 return result; |
|
1821 } |
|
1822 } |
|
1823 |
|
1824 TReal COmxScriptParser::ParseOptionalRealL(const RArray<RAttribute>& aArray, const TDesC8& aAttribName, TReal aDefaultValue) |
|
1825 { |
|
1826 const TDesC8* des = FindAttribute(aArray, aAttribName); |
|
1827 if(des == NULL) |
|
1828 { |
|
1829 return aDefaultValue; |
|
1830 } |
|
1831 else |
|
1832 { |
|
1833 TReal result; |
|
1834 TLex8 lex(*des); |
|
1835 User::LeaveIfError(lex.Val(result)); |
|
1836 return result; |
|
1837 } |
|
1838 } |
|
1839 |
|
1840 OMX_COLOR_FORMATTYPE COmxScriptParser::ParseOmxColorFormatL(const TDesC8& aDes) |
|
1841 { |
|
1842 return ParseL(aDes, parse_OMX_COLOR_FORMATTYPE); |
|
1843 } |
|
1844 |
|
1845 |
|
1846 OMX_COMMANDTYPE COmxScriptParser::ParseOmxCommandL(const TDesC8& aDes) |
|
1847 { |
|
1848 return ParseL(aDes, parse_OMX_COMMANDTYPE); |
|
1849 } |
|
1850 |
|
1851 OMX_ERRORTYPE COmxScriptParser::ParseOmxErrorL(const TDesC8& aDes) |
|
1852 { |
|
1853 return ParseL(aDes, parse_OMX_ERRORTYPE); |
|
1854 } |
|
1855 |
|
1856 OMX_EVENTTYPE COmxScriptParser::ParseOmxEventL(const TDesC8& aDes) |
|
1857 { |
|
1858 return ParseL(aDes, parse_OMX_EVENTTYPE); |
|
1859 } |
|
1860 |
|
1861 TBool COmxScriptParser::ParseOptionalBooleanL(const RArray<RAttribute>& aArray, const TDesC8& aAttribName, TBool aDefaultValue) |
|
1862 { |
|
1863 const TDesC8* des = FindAttribute(aArray, aAttribName); |
|
1864 if(des == NULL) |
|
1865 { |
|
1866 return aDefaultValue; |
|
1867 } |
|
1868 |
|
1869 return ParseBooleanL(*des); |
|
1870 } |
|
1871 |
|
1872 TBool COmxScriptParser::ParseBooleanL(const TDesC8& aBool) |
|
1873 { |
|
1874 if ((aBool == _L8("true")) || |
|
1875 (aBool == _L8("yes")) || |
|
1876 (aBool == _L8("1")) || |
|
1877 (aBool == _L8("ETrue")) || |
|
1878 (aBool == _L8("OMX_TRUE"))) |
|
1879 { |
|
1880 return ETrue; |
|
1881 } |
|
1882 |
|
1883 if ((aBool == _L8("false")) || |
|
1884 (aBool == _L8("no")) || |
|
1885 (aBool == _L8("0")) || |
|
1886 (aBool == _L8("EFalse")) || |
|
1887 (aBool == _L8("OMX_FALSE"))) |
|
1888 { |
|
1889 return EFalse; |
|
1890 } |
|
1891 |
|
1892 User::Leave(KErrArgument); |
|
1893 return EFalse; |
|
1894 } |
|
1895 |
|
1896 |
|
1897 TUint32 COmxScriptParser::ParseUint32L(const TDesC8& aDes) |
|
1898 { |
|
1899 TUint32 result; |
|
1900 if(aDes.Find(_L8("0x")) == 0) |
|
1901 { |
|
1902 TLex8 lex(aDes.Mid(2)); |
|
1903 User::LeaveIfError(lex.Val(result, EHex)); |
|
1904 } |
|
1905 else |
|
1906 { |
|
1907 TLex8 lex(aDes); |
|
1908 User::LeaveIfError(lex.Val(result, EDecimal)); |
|
1909 } |
|
1910 return result; |
|
1911 } |
|
1912 |
|
1913 TBool COmxScriptParser::ParseBoolean(const TDesC8& aDes) |
|
1914 { |
|
1915 if (aDes == _L8("true")) |
|
1916 { |
|
1917 return ETrue; |
|
1918 } |
|
1919 return EFalse; |
|
1920 } |
|
1921 |
|
1922 TReal32 COmxScriptParser::ParseReal32L(const TDesC8& aDes) |
|
1923 { |
|
1924 TReal32 result; |
|
1925 TLex8 lex(aDes); |
|
1926 User::LeaveIfError(lex.Val(result)); |
|
1927 return result; |
|
1928 } |
|
1929 |
|
1930 OMX_VIDEO_CODINGTYPE COmxScriptParser::ParseOmxVideoCodingL(const TDesC8& aDes) |
|
1931 { |
|
1932 if(aDes == _L8("unused")) |
|
1933 { |
|
1934 return OMX_VIDEO_CodingUnused; |
|
1935 } |
|
1936 else if (aDes == _L8("autodetect")) |
|
1937 { |
|
1938 return OMX_VIDEO_CodingAutoDetect; |
|
1939 } |
|
1940 else if(aDes == _L8("mpeg4")) |
|
1941 { |
|
1942 return OMX_VIDEO_CodingMPEG4; |
|
1943 } |
|
1944 else if(aDes == _L8("avc")) |
|
1945 { |
|
1946 return OMX_VIDEO_CodingAVC; |
|
1947 } |
|
1948 else if(aDes == _L8("max")) |
|
1949 { |
|
1950 return OMX_VIDEO_CodingMax; |
|
1951 } |
|
1952 else |
|
1953 { |
|
1954 __BREAKPOINT(); |
|
1955 User::Leave(KErrArgument); |
|
1956 } |
|
1957 |
|
1958 return OMX_VIDEO_CodingUnused; |
|
1959 } |
|
1960 |
|
1961 OMX_AUDIO_CODINGTYPE COmxScriptParser::ParseOmxAudioCodingL(const TDesC8& aDes) |
|
1962 { |
|
1963 if(aDes == _L8("unused")) |
|
1964 { |
|
1965 return OMX_AUDIO_CodingUnused; |
|
1966 } |
|
1967 else if (aDes == _L8("autodetect")) |
|
1968 { |
|
1969 return OMX_AUDIO_CodingAutoDetect; |
|
1970 } |
|
1971 else if(aDes == _L8("pcm")) |
|
1972 { |
|
1973 return OMX_AUDIO_CodingPCM; |
|
1974 } |
|
1975 else if(aDes == _L8("aac")) |
|
1976 { |
|
1977 return OMX_AUDIO_CodingAAC; |
|
1978 } |
|
1979 else if(aDes == _L8("max")) |
|
1980 { |
|
1981 return OMX_AUDIO_CodingMax; |
|
1982 } |
|
1983 else |
|
1984 { |
|
1985 __BREAKPOINT(); |
|
1986 User::Leave(KErrArgument); |
|
1987 } |
|
1988 |
|
1989 return OMX_AUDIO_CodingUnused; |
|
1990 } |
|
1991 |
|
1992 OMX_TIME_REFCLOCKTYPE COmxScriptParser::ParseOmxRefClockTypeL(const TDesC8& aDes) |
|
1993 { |
|
1994 if(aDes == _L8("none")) |
|
1995 { |
|
1996 return OMX_TIME_RefClockNone; |
|
1997 } |
|
1998 else if (aDes == _L8("audio")) |
|
1999 { |
|
2000 return OMX_TIME_RefClockAudio; |
|
2001 } |
|
2002 else if(aDes == _L8("video")) |
|
2003 { |
|
2004 return OMX_TIME_RefClockVideo; |
|
2005 } |
|
2006 else |
|
2007 { |
|
2008 __BREAKPOINT(); |
|
2009 User::Leave(KErrArgument); |
|
2010 } |
|
2011 |
|
2012 return OMX_TIME_RefClockNone; |
|
2013 } |
|
2014 |
|
2015 OMX_TIME_CLOCKSTATE COmxScriptParser::ParseOmxClockStateL(const TDesC8& aDes) |
|
2016 { |
|
2017 if(aDes == _L8("stopped")) |
|
2018 { |
|
2019 return OMX_TIME_ClockStateStopped; |
|
2020 } |
|
2021 else if (aDes == _L8("waiting")) |
|
2022 { |
|
2023 return OMX_TIME_ClockStateWaitingForStartTime; |
|
2024 } |
|
2025 else if(aDes == _L8("running")) |
|
2026 { |
|
2027 return OMX_TIME_ClockStateRunning; |
|
2028 } |
|
2029 else |
|
2030 { |
|
2031 __BREAKPOINT(); |
|
2032 User::Leave(KErrArgument); |
|
2033 return OMX_TIME_ClockStateMax; // unreachable, to prevent compiler warning |
|
2034 } |
|
2035 } |
|
2036 |
|
2037 TVideoFitMode COmxScriptParser::ParseVideoFitModeL(const TDesC8& aMode) |
|
2038 { |
|
2039 if(aMode == _L8("centre")) |
|
2040 { |
|
2041 return EVideoFitCentre; |
|
2042 } |
|
2043 else if(aMode == _L8("scaleAndCentre")) |
|
2044 { |
|
2045 return EVideoFitScaleAndCentre; |
|
2046 } |
|
2047 else if(aMode == _L8("rotateScaleAndCentre")) |
|
2048 { |
|
2049 return EVideoFitRotateScaleAndCentre; |
|
2050 } |
|
2051 else |
|
2052 { |
|
2053 __BREAKPOINT(); |
|
2054 User::Leave(KErrArgument); |
|
2055 return EVideoFitCentre; // unreachable, prevent compiler warning |
|
2056 } |
|
2057 } |
|
2058 |
|
2059 OMX_VIDEO_MPEG4PROFILETYPE COmxScriptParser::ParseOmxMpeg4ProfileL(const TDesC8& aDes) |
|
2060 { |
|
2061 if(aDes == _L8("simple")) |
|
2062 { |
|
2063 return OMX_VIDEO_MPEG4ProfileSimple; |
|
2064 } |
|
2065 else if(aDes == _L8("main")) |
|
2066 { |
|
2067 return OMX_VIDEO_MPEG4ProfileMain; |
|
2068 } |
|
2069 else if (aDes == _L8("advancedrealtime")) |
|
2070 { |
|
2071 return OMX_VIDEO_MPEG4ProfileAdvancedRealTime; |
|
2072 } |
|
2073 else if (aDes == _L8("advancedcoding")) |
|
2074 { |
|
2075 return OMX_VIDEO_MPEG4ProfileAdvancedCoding; |
|
2076 } |
|
2077 else if (aDes == _L8("core")) |
|
2078 { |
|
2079 return OMX_VIDEO_MPEG4ProfileCore; |
|
2080 } |
|
2081 else |
|
2082 { |
|
2083 __BREAKPOINT(); |
|
2084 User::Leave(KErrArgument); |
|
2085 } |
|
2086 return OMX_VIDEO_MPEG4ProfileMax; // unreachable, prevents compiler warning |
|
2087 } |
|
2088 |
|
2089 OMX_VIDEO_MPEG4LEVELTYPE COmxScriptParser::ParseOmxMpeg4LevelL(const TDesC8& aDes) |
|
2090 { |
|
2091 if(aDes == _L8("level0")) |
|
2092 { |
|
2093 return OMX_VIDEO_MPEG4Level0; |
|
2094 } |
|
2095 else if(aDes == _L8("level0b")) |
|
2096 { |
|
2097 return OMX_VIDEO_MPEG4Level0b; |
|
2098 } |
|
2099 else if (aDes == _L8("level1")) |
|
2100 { |
|
2101 return OMX_VIDEO_MPEG4Level1; |
|
2102 } |
|
2103 else if (aDes == _L8("level2")) |
|
2104 { |
|
2105 return OMX_VIDEO_MPEG4Level2; |
|
2106 } |
|
2107 else if (aDes == _L8("level3")) |
|
2108 { |
|
2109 return OMX_VIDEO_MPEG4Level3; |
|
2110 } |
|
2111 else if(aDes == _L8("level4")) |
|
2112 { |
|
2113 return OMX_VIDEO_MPEG4Level4; |
|
2114 } |
|
2115 else if (aDes == _L8("level5")) |
|
2116 { |
|
2117 return OMX_VIDEO_MPEG4Level5; |
|
2118 } |
|
2119 else |
|
2120 { |
|
2121 __BREAKPOINT(); |
|
2122 User::Leave(KErrArgument); |
|
2123 } |
|
2124 return OMX_VIDEO_MPEG4LevelMax; // unreachable, prevents compiler warning |
|
2125 } |
|
2126 |
|
2127 OMX_VIDEO_CONTROLRATETYPE COmxScriptParser::ParseOmxControlRateL(const TDesC8& aDes) |
|
2128 { |
|
2129 if(aDes == _L8("disable")) |
|
2130 { |
|
2131 return OMX_Video_ControlRateDisable; |
|
2132 } |
|
2133 else if(aDes == _L8("variable")) |
|
2134 { |
|
2135 return OMX_Video_ControlRateVariable; |
|
2136 } |
|
2137 else if (aDes == _L8("constant")) |
|
2138 { |
|
2139 return OMX_Video_ControlRateConstant; |
|
2140 } |
|
2141 else |
|
2142 { |
|
2143 __BREAKPOINT(); |
|
2144 User::Leave(KErrArgument); |
|
2145 } |
|
2146 return OMX_Video_ControlRateMax; // unreachable, prevents compiler warning |
|
2147 } |
|
2148 |
|
2149 OMX_AUDIO_AACSTREAMFORMATTYPE COmxScriptParser::ParseAacStreamFormatL(const TDesC8& aStreamFormatStr) |
|
2150 { |
|
2151 if(aStreamFormatStr == _L8("mp2adts")) |
|
2152 { |
|
2153 return OMX_AUDIO_AACStreamFormatMP2ADTS; |
|
2154 } |
|
2155 else if(aStreamFormatStr == _L8("mp4adts")) |
|
2156 { |
|
2157 return OMX_AUDIO_AACStreamFormatMP4ADTS; |
|
2158 } |
|
2159 else if(aStreamFormatStr == _L8("mp4loas")) |
|
2160 { |
|
2161 return OMX_AUDIO_AACStreamFormatMP4LOAS; |
|
2162 } |
|
2163 else if(aStreamFormatStr == _L8("mp4latm")) |
|
2164 { |
|
2165 return OMX_AUDIO_AACStreamFormatMP4LATM; |
|
2166 } |
|
2167 else if(aStreamFormatStr == _L8("adif")) |
|
2168 { |
|
2169 return OMX_AUDIO_AACStreamFormatADIF; |
|
2170 } |
|
2171 else if(aStreamFormatStr == _L8("mp4ff")) |
|
2172 { |
|
2173 return OMX_AUDIO_AACStreamFormatMP4FF; |
|
2174 } |
|
2175 else if(aStreamFormatStr == _L8("raw")) |
|
2176 { |
|
2177 return OMX_AUDIO_AACStreamFormatRAW; |
|
2178 } |
|
2179 else |
|
2180 { |
|
2181 User::Leave(KErrArgument); |
|
2182 return OMX_AUDIO_AACStreamFormatMax; |
|
2183 } |
|
2184 } |
|
2185 |
|
2186 OMX_NUMERICALDATATYPE COmxScriptParser::ParseNumericalDataL(const TDesC8& aDes) |
|
2187 { |
|
2188 if(aDes == _L8("signed")) |
|
2189 { |
|
2190 return OMX_NumericalDataSigned; |
|
2191 } |
|
2192 else if(aDes == _L8("unsigned")) |
|
2193 { |
|
2194 return OMX_NumericalDataUnsigned; |
|
2195 } |
|
2196 else |
|
2197 { |
|
2198 User::Leave(KErrArgument); |
|
2199 return OMX_NumercialDataMax; |
|
2200 } |
|
2201 } |
|
2202 |
|
2203 OMX_ENDIANTYPE COmxScriptParser::ParseEndianL(const TDesC8& aDes) |
|
2204 { |
|
2205 if(aDes == _L8("big")) |
|
2206 { |
|
2207 return OMX_EndianBig; |
|
2208 } |
|
2209 else if(aDes == _L8("little")) |
|
2210 { |
|
2211 return OMX_EndianLittle; |
|
2212 } |
|
2213 else |
|
2214 { |
|
2215 User::Leave(KErrArgument); |
|
2216 return OMX_EndianMax; |
|
2217 } |
|
2218 } |
|
2219 |
|
2220 OMX_BOOL COmxScriptParser::ParseBoolL(const TDesC8& aDes) |
|
2221 { |
|
2222 if(aDes == _L8("true")) |
|
2223 { |
|
2224 return OMX_TRUE; |
|
2225 } |
|
2226 else if(aDes == _L8("false")) |
|
2227 { |
|
2228 return OMX_FALSE; |
|
2229 } |
|
2230 else |
|
2231 { |
|
2232 User::Leave(KErrArgument); |
|
2233 return OMX_FALSE; |
|
2234 } |
|
2235 } |
|
2236 |