OpenMAX Bellagio 0.9.3
omx_base_component.c
Go to the documentation of this file.
1
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#include <OMX_Core.h>
32#include <OMX_Component.h>
33
34#include "omx_base_component.h"
36
37#include "tsemaphore.h"
38#include "queue.h"
39
45 if (omx_base_component_Private->flush_condition) {
46 tsem_deinit(omx_base_component_Private->flush_condition);
47 free(omx_base_component_Private->flush_condition);
48 }
49 if (omx_base_component_Private->flush_all_condition) {
50 tsem_deinit(omx_base_component_Private->flush_all_condition);
51 free(omx_base_component_Private->flush_all_condition);
52 }
53 if (omx_base_component_Private->bellagioThreads) {
54 free(omx_base_component_Private->bellagioThreads);
55 }
56 if (omx_base_component_Private->name) {
57 free(omx_base_component_Private->name);
58 }
59 if (omx_base_component_Private->bStateSem) {
60 tsem_deinit(omx_base_component_Private->bStateSem);
61 free(omx_base_component_Private->bStateSem);
62 }
63 if (omx_base_component_Private->bMgmtSem) {
64 tsem_deinit(omx_base_component_Private->bMgmtSem);
65 free(omx_base_component_Private->bMgmtSem);
66 }
67 if (omx_base_component_Private->messageSem) {
68 tsem_deinit(omx_base_component_Private->messageSem);
69 free(omx_base_component_Private->messageSem);
70 }
71 if (omx_base_component_Private->messageQueue) {
72 queue_deinit(omx_base_component_Private->messageQueue);
73 free(omx_base_component_Private->messageQueue);
74 }
75 if (omx_base_component_Private) {
76 free(omx_base_component_Private);
77 }
78}
96 omx_base_component_PrivateType* omx_base_component_Private;
97 OMX_U32 i;
98 int err;
99
100 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, openmaxStandComp);
101
102 if (openmaxStandComp->pComponentPrivate) {
103 omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
104 } else {
105 omx_base_component_Private = calloc(1,sizeof(omx_base_component_PrivateType));
106 if (!omx_base_component_Private) {
108 }
109 }
110
111 if(!omx_base_component_Private->messageQueue) {
112 omx_base_component_Private->messageQueue = calloc(1,sizeof(queue_t));
113 if (!omx_base_component_Private->messageQueue) {
114 base_constructor_remove_garbage_collected(omx_base_component_Private);
116 }
117 err = queue_init(omx_base_component_Private->messageQueue);
118 if (err != 0) {
119 base_constructor_remove_garbage_collected(omx_base_component_Private);
121 }
122 }
123
124 if(!omx_base_component_Private->messageSem) {
125 omx_base_component_Private->messageSem = calloc(1,sizeof(tsem_t));
126 if (!omx_base_component_Private->messageSem) {
127 base_constructor_remove_garbage_collected(omx_base_component_Private);
129 }
130 err = tsem_init(omx_base_component_Private->messageSem, 0);
131 if (err != 0) {
132 base_constructor_remove_garbage_collected(omx_base_component_Private);
134 }
135 }
136 if(!omx_base_component_Private->bMgmtSem) {
137 omx_base_component_Private->bMgmtSem = calloc(1,sizeof(tsem_t));
138 if (!omx_base_component_Private->bMgmtSem) {
139 base_constructor_remove_garbage_collected(omx_base_component_Private);
141 }
142 err = tsem_init(omx_base_component_Private->bMgmtSem, 0);
143 if (err != 0) {
144 base_constructor_remove_garbage_collected(omx_base_component_Private);
146 }
147 }
148
149 if(!omx_base_component_Private->bStateSem) {
150 omx_base_component_Private->bStateSem = calloc(1,sizeof(tsem_t));
151 if (!omx_base_component_Private->bStateSem) {
152 base_constructor_remove_garbage_collected(omx_base_component_Private);
154 }
155 err = tsem_init(omx_base_component_Private->bStateSem, 0);
156 if (err != 0) {
157 base_constructor_remove_garbage_collected(omx_base_component_Private);
159 }
160 }
161
162 openmaxStandComp->nSize = sizeof(OMX_COMPONENTTYPE);
163 openmaxStandComp->pApplicationPrivate = NULL;
168 openmaxStandComp->GetConfig = omx_base_component_GetConfig;
169 openmaxStandComp->SetConfig = omx_base_component_SetConfig;
171 openmaxStandComp->GetState = omx_base_component_GetState;
176
177 /*Will make Specific port Allocate buffer call*/
179 openmaxStandComp->UseBuffer = omx_base_component_UseBuffer;
181 openmaxStandComp->FreeBuffer = omx_base_component_FreeBuffer;
184
185 openmaxStandComp->nVersion.s.nVersionMajor = SPECVERSIONMAJOR;
186 openmaxStandComp->nVersion.s.nVersionMinor = SPECVERSIONMINOR;
187 openmaxStandComp->nVersion.s.nRevision = SPECREVISION;
188 openmaxStandComp->nVersion.s.nStep = SPECSTEP;
189
190 omx_base_component_Private->name = calloc(1,OMX_MAX_STRINGNAME_SIZE);
191 if (!omx_base_component_Private->name) {
192 base_constructor_remove_garbage_collected(omx_base_component_Private);
194 }
195 strcpy(omx_base_component_Private->name,cComponentName);
196 omx_base_component_Private->state = OMX_StateLoaded;
197 omx_base_component_Private->transientState = OMX_TransStateMax;
198 omx_base_component_Private->callbacks = NULL;
199 omx_base_component_Private->callbackData = NULL;
200 omx_base_component_Private->nGroupPriority = 100;
201 omx_base_component_Private->nGroupID = 0;
202 omx_base_component_Private->pMark.hMarkTargetComponent = NULL;
203 omx_base_component_Private->pMark.pMarkData = NULL;
204 omx_base_component_Private->openmaxStandComp = openmaxStandComp;
205 omx_base_component_Private->DoStateSet = &omx_base_component_DoStateSet;
206 omx_base_component_Private->messageHandler = omx_base_component_MessageHandler;
207 omx_base_component_Private->destructor = omx_base_component_Destructor;
208 omx_base_component_Private->getQualityLevel = omx_base_getQualityLevel;
209 omx_base_component_Private->setQualityLevel = omx_base_setQualityLevel;
210 omx_base_component_Private->currentQualityLevel = 0;
211 omx_base_component_Private->nqualitylevels = 0;
212 omx_base_component_Private->bufferMgmtThreadID = -1;
213 omx_base_component_Private->bellagioThreads = calloc(1, sizeof(OMX_PARAM_BELLAGIOTHREADS_ID));
214 if (omx_base_component_Private->bellagioThreads == NULL) {
215 base_constructor_remove_garbage_collected(omx_base_component_Private);
217 }
218 omx_base_component_Private->bellagioThreads->nThreadBufferMngtID = 0;
219 omx_base_component_Private->bellagioThreads->nThreadMessageID = 0;
220 omx_base_component_Private->bIsEOSReached = OMX_FALSE;
221
222 pthread_mutex_init(&omx_base_component_Private->flush_mutex, NULL);
223
224 if(!omx_base_component_Private->flush_all_condition) {
225 omx_base_component_Private->flush_all_condition = calloc(1,sizeof(tsem_t));
226 if(!omx_base_component_Private->flush_all_condition) {
227 base_constructor_remove_garbage_collected(omx_base_component_Private);
229 }
230 err = tsem_init(omx_base_component_Private->flush_all_condition, 0);
231 if (err != 0) {
232 base_constructor_remove_garbage_collected(omx_base_component_Private);
234 }
235 }
236
237 if(!omx_base_component_Private->flush_condition) {
238 omx_base_component_Private->flush_condition = calloc(1,sizeof(tsem_t));
239 if(!omx_base_component_Private->flush_condition) {
240 base_constructor_remove_garbage_collected(omx_base_component_Private);
242 }
243 err = tsem_init(omx_base_component_Private->flush_condition, 0);
244 if (err != 0) {
245 base_constructor_remove_garbage_collected(omx_base_component_Private);
247 }
248 }
249
250 for(i=0;i<NUM_DOMAINS;i++) {
251 memset(&omx_base_component_Private->sPortTypesParam[i], 0, sizeof(OMX_PORT_PARAM_TYPE));
252 setHeader(&omx_base_component_Private->sPortTypesParam[i], sizeof(OMX_PORT_PARAM_TYPE));
253 }
254
255 err = pthread_create(&omx_base_component_Private->messageHandlerThread, NULL, compMessageHandlerFunction, openmaxStandComp);
256 if (err) {
257 base_constructor_remove_garbage_collected(omx_base_component_Private);
259 }
260 DEBUG(DEB_LEV_FUNCTION_NAME,"Out of %s for component %p\n", __func__, openmaxStandComp);
261 return OMX_ErrorNone;
262}
263
272 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
273 int err;
274 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, openmaxStandComp);
275 omx_base_component_Private->state = OMX_StateInvalid;
276 omx_base_component_Private->callbacks=NULL;
277
278 /*Send Dummy signal to Component Message handler to exit*/
279 tsem_up(omx_base_component_Private->messageSem);
280
281 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s before pthread_detach\n", __func__);
282 err = pthread_detach(omx_base_component_Private->messageHandlerThread);
283 if(err!=0) {
284 DEBUG(DEB_LEV_FUNCTION_NAME,"In %s pthread_detach returned err=%d\n", __func__, err);
285 }
286 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s after pthread_detach\n", __func__);
287 /*Deinitialize and free message queue*/
288 if(omx_base_component_Private->messageQueue) {
289 queue_deinit(omx_base_component_Private->messageQueue);
290 free(omx_base_component_Private->messageQueue);
291 omx_base_component_Private->messageQueue=NULL;
292 }
293
294
295 /*Deinitialize and free buffer management semaphore*/
296 if(omx_base_component_Private->bMgmtSem){
297 tsem_deinit(omx_base_component_Private->bMgmtSem);
298 free(omx_base_component_Private->bMgmtSem);
299 omx_base_component_Private->bMgmtSem=NULL;
300 }
301
302 /*Deinitialize and free message semaphore*/
303 if(omx_base_component_Private->messageSem) {
304 tsem_deinit(omx_base_component_Private->messageSem);
305 free(omx_base_component_Private->messageSem);
306 omx_base_component_Private->messageSem=NULL;
307 }
308
309 if(omx_base_component_Private->bStateSem){
310 tsem_deinit(omx_base_component_Private->bStateSem);
311 free(omx_base_component_Private->bStateSem);
312 omx_base_component_Private->bStateSem=NULL;
313 }
314
315 if(omx_base_component_Private->name){
316 free(omx_base_component_Private->name);
317 omx_base_component_Private->name=NULL;
318 }
319
320 pthread_mutex_destroy(&omx_base_component_Private->flush_mutex);
321
322 if(omx_base_component_Private->flush_all_condition){
323 tsem_deinit(omx_base_component_Private->flush_all_condition);
324 free(omx_base_component_Private->flush_all_condition);
325 omx_base_component_Private->flush_all_condition=NULL;
326 }
327
328 if(omx_base_component_Private->flush_condition){
329 tsem_deinit(omx_base_component_Private->flush_condition);
330 free(omx_base_component_Private->flush_condition);
331 omx_base_component_Private->flush_condition=NULL;
332 }
333
334 DEBUG(DEB_LEV_FUNCTION_NAME,"Out of %s for component %p\n", __func__, openmaxStandComp);
335 return OMX_ErrorNone;
336}
337
347 OMX_HANDLETYPE hComponent) {
348 OMX_COMPONENTTYPE *openmaxStandComp = (OMX_COMPONENTTYPE *)hComponent;
349 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
350 DEBUG(DEB_LEV_FUNCTION_NAME,"In %s for component %p\n", __func__, openmaxStandComp);
351
352 omx_base_component_Private->destructor(openmaxStandComp);
353
354 free(openmaxStandComp->pComponentPrivate);
355 openmaxStandComp->pComponentPrivate=NULL;
356 DEBUG(DEB_LEV_FUNCTION_NAME,"Out of %s for component %p\n", __func__, openmaxStandComp);
357 return OMX_ErrorNone;
358}
359
371 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
372 omx_base_PortType *pPort;
373 OMX_U32 i,j,k;
375 OMX_BOOL bExit = OMX_FALSE;
376
377 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, openmaxStandComp);
378 DEBUG(DEB_LEV_PARAMS, "Changing state from %i to %i\n", omx_base_component_Private->state, (int)destinationState);
379
380 if (omx_base_component_Private->state == OMX_StateLoaded && destinationState == OMX_StateIdle) {
381 err = RM_getResource(openmaxStandComp);
382 if (err != OMX_ErrorNone) {
384 }
385 }
386 if (omx_base_component_Private->state == OMX_StateIdle && destinationState == OMX_StateLoaded) {
387 RM_releaseResource(openmaxStandComp);
388 }
389
390 if(destinationState == OMX_StateLoaded){
391 switch(omx_base_component_Private->state){
392 case OMX_StateInvalid:
394 break;
396 /* return back from wait for resources */
397 RM_removeFromWaitForResource(openmaxStandComp);
398 omx_base_component_Private->state = OMX_StateLoaded;
399 break;
400 case OMX_StateLoaded:
402 break;
403 case OMX_StateIdle:
404 /* for all ports */
405 for(j = 0; j < NUM_DOMAINS; j++) {
406 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
407 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
408 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
409
410 pPort = omx_base_component_Private->ports[i];
411 if (PORT_IS_TUNNELED(pPort) && PORT_IS_BUFFER_SUPPLIER(pPort)) {
412 while(pPort->pBufferQueue->nelem > 0) {
413 DEBUG(DEB_LEV_PARAMS, "In %s Buffer %d remained in the port %d queue of comp%s\n",
414 __func__,(int)pPort->pBufferQueue->nelem,(int)i,omx_base_component_Private->name);
415 dequeue(pPort->pBufferQueue);
416 }
417 /* Freeing here the buffers allocated for the tunneling:*/
418 err = pPort->Port_FreeTunnelBuffer(pPort,i);
419 if(err!=OMX_ErrorNone) {
420 DEBUG(DEB_LEV_ERR, "In %s Freeing Tunnel Buffer Error=%x\n",__func__,err);
421 return err;
422 }
423 } else {
424 DEBUG(DEB_LEV_FULL_SEQ, "In %s nPortIndex=%d pAllocSem Semval=%x\n", __func__,(int)i,(int)pPort->pAllocSem->semval);
425
426 /*If ports are enabled then wait till all buffers are freed*/
427 if(PORT_IS_ENABLED(pPort)) {
428 tsem_down(pPort->pAllocSem);
429 }
430 }
431 pPort->sPortParam.bPopulated = OMX_FALSE;
432
433 if(pPort->pInternalBufferStorage != NULL) {
434 free(pPort->pInternalBufferStorage);
435 pPort->pInternalBufferStorage=NULL;
436 }
437
438 if(pPort->bBufferStateAllocated != NULL) {
439 free(pPort->bBufferStateAllocated);
440 pPort->bBufferStateAllocated=NULL;
441 }
442 }
443 }
444 omx_base_component_Private->state = OMX_StateLoaded;
445
446 if(omx_base_component_Private->bufferMgmtThreadID == 0 ){
447 /*Signal Buffer Management thread to exit*/
448 tsem_up(omx_base_component_Private->bMgmtSem);
449 pthread_join(omx_base_component_Private->bufferMgmtThread, NULL);
450 omx_base_component_Private->bufferMgmtThreadID = -1;
451 if(err != 0) {
452 DEBUG(DEB_LEV_ERR,"In %s pthread_join returned err=%d\n",__func__,err);
453 }
454 }
455
456 break;
457 default:
458 DEBUG(DEB_LEV_ERR, "In %s: state transition not allowed\n", __func__);
460 break;
461 }
462 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
463 return err;
464 }
465
466 if(destinationState == OMX_StateWaitForResources){
467 switch(omx_base_component_Private->state){
468 case OMX_StateInvalid:
470 break;
471 case OMX_StateLoaded:
472 omx_base_component_Private->state = OMX_StateWaitForResources;
473 err = RM_waitForResource(openmaxStandComp);
474 break;
477 break;
478 default:
479 DEBUG(DEB_LEV_ERR, "In %s: state transition not allowed\n", __func__);
481 break;
482 }
483 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
484 return err;
485 }
486
487 if(destinationState == OMX_StateIdle){
488 switch(omx_base_component_Private->state){
489 case OMX_StateInvalid:
491 break;
493 omx_base_component_Private->state = OMX_StateIdle;
494 break;
495 case OMX_StateLoaded:
496 /* for all ports */
497 for(j = 0; j < NUM_DOMAINS; j++) {
498 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
499 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
500 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
501 pPort = omx_base_component_Private->ports[i];
502 if (PORT_IS_TUNNELED(pPort) && PORT_IS_BUFFER_SUPPLIER(pPort)) {
503 if(PORT_IS_ENABLED(pPort)) {
505 err= pPort->Port_AllocateTunnelBuffer(pPort, i);
506 if(err!=OMX_ErrorNone) {
507 DEBUG(DEB_LEV_ERR, "In %s Allocating Tunnel Buffer Error=%x\n",__func__,err);
508 return err;
509 }
510 }
511 } else {
512 if(PORT_IS_ENABLED(pPort)) {
513 DEBUG(DEB_LEV_FULL_SEQ, "In %s: wait for buffers. port enabled %i, port populated %i\n",
514 __func__, pPort->sPortParam.bEnabled,pPort->sPortParam.bPopulated);
515 if (pPort->sPortParam.nBufferCountActual > 0) {
516 tsem_down(pPort->pAllocSem);
517 pthread_mutex_lock(&pPort->exitMutex);
518 if (pPort->bIsDestroying) {
519 bExit = OMX_TRUE;
520 pthread_mutex_unlock(&pPort->exitMutex);
521 continue;
522 }
523 pthread_mutex_unlock(&pPort->exitMutex);
524 }
525 pPort->sPortParam.bPopulated = OMX_TRUE;
526 }
527 else {
528 DEBUG(DEB_LEV_SIMPLE_SEQ, "In %s: Port %i Disabled So no wait\n",__func__,(int)i);
529 }
530 }
531 DEBUG(DEB_LEV_SIMPLE_SEQ, "Tunnel status : port %d flags 0x%x\n",(int)i, (int)pPort->nTunnelFlags);
532 }
533 }
534 if (bExit) {
535 break;
536 }
537 omx_base_component_Private->state = OMX_StateIdle;
539 omx_base_component_Private->bufferMgmtThreadID = pthread_create(&omx_base_component_Private->bufferMgmtThread,
540 NULL,
541 omx_base_component_Private->BufferMgmtFunction,
542 openmaxStandComp);
543 if(omx_base_component_Private->bufferMgmtThreadID < 0){
544 DEBUG(DEB_LEV_ERR, "Starting buffer management thread failed\n");
545 return OMX_ErrorUndefined;
546 }
547 break;
548 case OMX_StateIdle:
550 break;
552 /*Flush Ports*/
553 /* for all ports */
554 for(j = 0; j < NUM_DOMAINS; j++) {
555 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
556 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
557 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
558 DEBUG(DEB_LEV_FULL_SEQ, "Flushing Port %i\n",(int)i);
559 pPort = omx_base_component_Private->ports[i];
560 if(PORT_IS_ENABLED(pPort)) {
561 pPort->FlushProcessingBuffers(pPort);
562 }
563 }
564 }
565 omx_base_component_Private->state = OMX_StateIdle;
566 break;
567 case OMX_StatePause:
568 /*Flush Ports*/
569 /* for all ports */
570 for(j = 0; j < NUM_DOMAINS; j++) {
571 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
572 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
573 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
574 DEBUG(DEB_LEV_FULL_SEQ, "Flushing Port %i\n",(int)i);
575 pPort = omx_base_component_Private->ports[i];
576 if(PORT_IS_ENABLED(pPort)) {
577 pPort->FlushProcessingBuffers(pPort);
578 }
579 }
580 }
581 omx_base_component_Private->state = OMX_StateIdle;
582 /*Signal buffer management thread if waiting at paused state*/
583 tsem_signal(omx_base_component_Private->bStateSem);
584 break;
585 default:
586 DEBUG(DEB_LEV_ERR, "In %s: state transition not allowed\n", __func__);
588 break;
589 }
590 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
591 return err;
592 }
593
594 if(destinationState == OMX_StatePause) {
595 switch(omx_base_component_Private->state) {
596 case OMX_StateInvalid:
598 break;
599 case OMX_StatePause:
601 break;
602 case OMX_StateIdle:
603 omx_base_component_Private->bIsEOSReached = OMX_FALSE;
605 omx_base_component_Private->state = OMX_StatePause;
606 break;
607 default:
608 DEBUG(DEB_LEV_ERR, "In %s: state transition not allowed\n", __func__);
610 break;
611 }
612 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
613 return err;
614 }
615
616 if(destinationState == OMX_StateExecuting) {
617 switch(omx_base_component_Private->state) {
618 case OMX_StateInvalid:
620 break;
621 case OMX_StateIdle:
622 omx_base_component_Private->state = OMX_StateExecuting;
623 omx_base_component_Private->bIsEOSReached = OMX_FALSE;
624 /*Send Tunneled Buffer to the Neighbouring Components*/
625 /* for all ports */
626 for(j = 0; j < NUM_DOMAINS; j++) {
627 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
628 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
629 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
630 pPort = omx_base_component_Private->ports[i];
631 if (PORT_IS_TUNNELED(pPort) && PORT_IS_BUFFER_SUPPLIER(pPort) && PORT_IS_ENABLED(pPort)) {
632 for(k=0;k<pPort->nNumTunnelBuffer;k++) {
633 tsem_up(pPort->pBufferSem);
634 /*signal buffer management thread availability of buffers*/
635 tsem_up(omx_base_component_Private->bMgmtSem);
636 }
637 }
638 }
639 }
640 omx_base_component_Private->transientState = OMX_TransStateMax;
642 break;
643 case OMX_StatePause:
644 omx_base_component_Private->state=OMX_StateExecuting;
645
646 /* Tunneled Supplier Ports were enabled in paused state. So signal buffer managment thread*/
647 /* for all ports */
648 for(j = 0; j < NUM_DOMAINS; j++) {
649 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
650 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
651 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
652
653 pPort=omx_base_component_Private->ports[i];
654 DEBUG(DEB_LEV_PARAMS, "In %s: state transition Paused 2 Executing, nelem=%d,semval=%d,Buf Count Actual=%d\n", __func__,
655 pPort->pBufferQueue->nelem,pPort->pBufferSem->semval,(int)pPort->sPortParam.nBufferCountActual);
656
658 (pPort->pBufferQueue->nelem == (pPort->pBufferSem->semval + pPort->sPortParam.nBufferCountActual))) {
659 for(k=0; k < pPort->sPortParam.nBufferCountActual;k++) {
660 tsem_up(pPort->pBufferSem);
661 tsem_up(omx_base_component_Private->bMgmtSem);
662 }
663 }
664 }
665 }
666 /*Signal buffer management thread if waiting at paused state*/
667 tsem_signal(omx_base_component_Private->bStateSem);
668 break;
671 break;
672 default:
673 DEBUG(DEB_LEV_ERR, "In %s: state transition not allowed\n", __func__);
675 break;
676 }
677 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
678 return err;
679 }
680
681 if(destinationState == OMX_StateInvalid) {
682 switch(omx_base_component_Private->state) {
683 case OMX_StateInvalid:
685 break;
686 default:
687 omx_base_component_Private->state = OMX_StateInvalid;
688
689 if(omx_base_component_Private->bufferMgmtThreadID == 0 ){
690 tsem_signal(omx_base_component_Private->bStateSem);
691 /*Signal Buffer Management Thread to Exit*/
692 tsem_up(omx_base_component_Private->bMgmtSem);
693 pthread_join(omx_base_component_Private->bufferMgmtThread, NULL);
694 omx_base_component_Private->bufferMgmtThreadID = -1;
695 if(err!=0) {
696 DEBUG(DEB_LEV_FUNCTION_NAME,"In %s pthread_join returned err=%d\n",__func__,err);
697 }
698 }
700 break;
701 }
702 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p with err %i\n", __func__, openmaxStandComp, err);
703 return err;
704 }
705 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, openmaxStandComp);
706 return OMX_ErrorNone;
707}
708
721 OMX_VERSIONTYPE* ver;
722 if (header == NULL) {
723 DEBUG(DEB_LEV_ERR, "In %s the header is null\n",__func__);
725 }
726 ver = (OMX_VERSIONTYPE*)((char*)header + sizeof(OMX_U32));
727 if(*((OMX_U32*)header) != size) {
728 DEBUG(DEB_LEV_ERR, "In %s the header has a wrong size %i should be %i\n",__func__,(int)*((OMX_U32*)header),(int)size);
730 }
731 if(ver->s.nVersionMajor != SPECVERSIONMAJOR ||
733 DEBUG(DEB_LEV_ERR, "The version does not match\n");
735 }
736 return OMX_ErrorNone;
737}
738
746void setHeader(OMX_PTR header, OMX_U32 size) {
747 OMX_VERSIONTYPE* ver = (OMX_VERSIONTYPE*)((char*)header + sizeof(OMX_U32));
748 *((OMX_U32*)header) = size;
749
752 ver->s.nRevision = SPECREVISION;
753 ver->s.nStep = SPECSTEP;
754}
755
760 OMX_U32 nPortIndex,
761 OMX_PTR pStructure,
762 size_t size) {
763 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)(((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate);
764 omx_base_PortType *pPort;
765 int nNumPorts;
767
768 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
769 nNumPorts = omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
770 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
771 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
772 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts;
773
774 if (nPortIndex >= nNumPorts) {
775 DEBUG(DEB_LEV_ERR, "Bad Port index %i when the component has %i ports\n", (int)nPortIndex, (int)nNumPorts);
777 }
778
779 pPort = omx_base_component_Private->ports[nPortIndex];
780
781 if (omx_base_component_Private->state != OMX_StateLoaded && omx_base_component_Private->state != OMX_StateWaitForResources) {
782 if(PORT_IS_ENABLED(pPort) && !pPort->bIsTransientToEnabled) {
783 DEBUG(DEB_LEV_ERR, "In %s Incorrect State=%x lineno=%d\n",__func__,omx_base_component_Private->state,__LINE__);
785 }
786 }
787
788 err = checkHeader(pStructure, size);
789 if (err != OMX_ErrorNone) {
790 DEBUG(DEB_LEV_ERR, "In %s failing the checkHeader with err %i\n", __func__, (int)err);
791 return err;
792 }
793 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
794 return OMX_ErrorNone;
795}
796
802 OMX_STRING pComponentName,
803 OMX_VERSIONTYPE* pComponentVersion,
804 OMX_VERSIONTYPE* pSpecVersion,
805 OMX_UUIDTYPE* pComponentUUID) {
806
807 OMX_COMPONENTTYPE* omx_component = (OMX_COMPONENTTYPE*)hComponent;
808 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omx_component->pComponentPrivate;
809
810 OMX_U32 uuid[3];
811
812 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
813 /* Fill component name */
814 strcpy(pComponentName, omx_base_component_Private->name);
815
816 /* Fill component version */
817 pComponentVersion->s.nVersionMajor = SPECVERSIONMAJOR;
818 pComponentVersion->s.nVersionMinor = SPECVERSIONMINOR;
819 pComponentVersion->s.nRevision = SPECREVISION;
820 pComponentVersion->s.nStep = SPECSTEP;
821
822 /* Fill spec version (copy from component field) */
823 memcpy(pSpecVersion, &omx_component->nVersion, sizeof(OMX_VERSIONTYPE));
824
825 /* Fill UUID with handle address, PID and UID.
826 * This should guarantee uiniqness */
827 uuid[0] = (OMX_U32)omx_component;
828 uuid[1] = getpid();
829 uuid[2] = getuid();
830 memcpy(*pComponentUUID, uuid, sizeof(uuid));
831
832 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
833 return OMX_ErrorNone;
834}
835
845 OMX_HANDLETYPE hComponent,
846 OMX_U8 *cRole,
847 OMX_U32 nIndex) {
848 strcat((char*)cRole, "\0");
849 return OMX_ErrorNoMore;
850}
851
858 OMX_HANDLETYPE hComponent,
859 OMX_CALLBACKTYPE* pCallbacks,
860 OMX_PTR pAppData) {
861
862 OMX_COMPONENTTYPE *omxcomponent = (OMX_COMPONENTTYPE*)hComponent;
863 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxcomponent->pComponentPrivate;
864 omx_base_PortType *pPort;
865 OMX_U32 i,j;
866
867 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
868 omx_base_component_Private->callbacks = pCallbacks;
869 omx_base_component_Private->callbackData = pAppData;
870
871 /* for all ports */
872 for(j = 0; j < NUM_DOMAINS; j++) {
873 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
874 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
875 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
876 pPort = omx_base_component_Private->ports[i];
877 if (pPort->sPortParam.eDir == OMX_DirInput) {
878 pPort->BufferProcessedCallback = omx_base_component_Private->callbacks->EmptyBufferDone;
879 } else {
880 pPort->BufferProcessedCallback = omx_base_component_Private->callbacks->FillBufferDone;
881 }
882 }
883 }
884 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
885 return OMX_ErrorNone;
886}
887
897 OMX_HANDLETYPE hComponent,
898 OMX_INDEXTYPE nParamIndex,
899 OMX_PTR ComponentParameterStructure) {
900
901 OMX_COMPONENTTYPE *omxcomponent = (OMX_COMPONENTTYPE*)hComponent;
902 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxcomponent->pComponentPrivate;
903 OMX_PRIORITYMGMTTYPE* pPrioMgmt;
905 OMX_PARAM_BUFFERSUPPLIERTYPE *pBufferSupplier;
906 omx_base_PortType *pPort;
907 OMX_PORT_PARAM_TYPE* pPortDomains;
909 OMX_VENDOR_PROP_TUNNELSETUPTYPE *pPropTunnelSetup;
911
912 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
913 DEBUG(DEB_LEV_PARAMS, "Getting parameter %i\n", nParamIndex);
914 if (ComponentParameterStructure == NULL) {
916 }
917 switch(nParamIndex) {
922 pPortDomains = (OMX_PORT_PARAM_TYPE*)ComponentParameterStructure;
923 if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) {
924 break;
925 }
926 pPortDomains->nPorts = 0;
927 pPortDomains->nStartPortNumber = 0;
928 break;
930 pPortDef = (OMX_PARAM_PORTDEFINITIONTYPE*) ComponentParameterStructure;
931 if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_PORTDEFINITIONTYPE))) != OMX_ErrorNone) {
932 break;
933 }
934 if (pPortDef->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
935 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
936 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
937 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
939 }
940
941 memcpy(pPortDef, &omx_base_component_Private->ports[pPortDef->nPortIndex]->sPortParam, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
942 break;
944 pPrioMgmt = (OMX_PRIORITYMGMTTYPE*)ComponentParameterStructure;
945 if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PRIORITYMGMTTYPE))) != OMX_ErrorNone) {
946 break;
947 }
948 pPrioMgmt->nGroupPriority = omx_base_component_Private->nGroupPriority;
949 pPrioMgmt->nGroupID = omx_base_component_Private->nGroupID;
950 break;
952 pBufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE*)ComponentParameterStructure;
953 if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE))) != OMX_ErrorNone) {
954 break;
955 }
956 if (pBufferSupplier->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
957 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
958 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
959 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
961 }
962
963 pPort = omx_base_component_Private->ports[pBufferSupplier->nPortIndex];
964
965 if (pPort->sPortParam.eDir == OMX_DirInput) {
966 if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
967 pBufferSupplier->eBufferSupplier = OMX_BufferSupplyInput;
968 } else if (PORT_IS_TUNNELED(pPort)) {
969 pBufferSupplier->eBufferSupplier = OMX_BufferSupplyOutput;
970 } else {
971 pBufferSupplier->eBufferSupplier = OMX_BufferSupplyUnspecified;
972 }
973 } else {
974 if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
975 pBufferSupplier->eBufferSupplier = OMX_BufferSupplyOutput;
976 } else if (PORT_IS_TUNNELED(pPort)) {
977 pBufferSupplier->eBufferSupplier = OMX_BufferSupplyInput;
978 } else {
979 pBufferSupplier->eBufferSupplier = OMX_BufferSupplyUnspecified;
980 }
981 }
982 break;
983 default:
984 /* additional switch statement for extended OMX_INDEXTYPE */
985 switch((OMX_INDEXVENDORTYPE) nParamIndex) {
987 if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_BELLAGIOTHREADS_ID))) != OMX_ErrorNone) {
988 break;
989 }
990 threadID = (OMX_PARAM_BELLAGIOTHREADS_ID *)ComponentParameterStructure;
991 threadID->nThreadBufferMngtID = omx_base_component_Private->bellagioThreads->nThreadBufferMngtID;
992 threadID->nThreadMessageID = omx_base_component_Private->bellagioThreads->nThreadMessageID;
993 break;
995 pPropTunnelSetup = (OMX_VENDOR_PROP_TUNNELSETUPTYPE*)ComponentParameterStructure;
996
997 if (pPropTunnelSetup->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
998 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
999 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1000 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1001
1002 DEBUG(DEB_LEV_ERR,"In %s OMX_IndexVendorCompPropTunnelFlags nPortIndex=%d Line=%d \n",
1003 __func__,(int)pPropTunnelSetup->nPortIndex,__LINE__);
1004
1005 return OMX_ErrorBadPortIndex;
1006 }
1007
1008 pPort = omx_base_component_Private->ports[pPropTunnelSetup->nPortIndex];
1009
1010 pPropTunnelSetup->nTunnelSetup.nTunnelFlags = pPort->nTunnelFlags;
1011 pPropTunnelSetup->nTunnelSetup.eSupplier = pPort->eBufferSupplier;
1012 break;
1013 default:
1015 break;
1016 }
1017 }
1018 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1019 return err;
1020}
1021
1031 OMX_HANDLETYPE hComponent,
1032 OMX_INDEXTYPE nParamIndex,
1033 OMX_PTR ComponentParameterStructure) {
1034
1035 OMX_PRIORITYMGMTTYPE* pPrioMgmt;
1038 OMX_COMPONENTTYPE *omxcomponent = (OMX_COMPONENTTYPE*)hComponent;
1039 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxcomponent->pComponentPrivate;
1040 OMX_PARAM_BUFFERSUPPLIERTYPE *pBufferSupplier;
1041 omx_base_PortType *pPort;
1042
1043 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1044 DEBUG(DEB_LEV_PARAMS, "Setting parameter %x\n", nParamIndex);
1045 if (ComponentParameterStructure == NULL) {
1046 DEBUG(DEB_LEV_ERR, "In %s parameter provided is null! err = %x\n", __func__, err);
1047 return OMX_ErrorBadParameter;
1048 }
1049
1050 switch(nParamIndex) {
1055 /* pPortParam = (OMX_PORT_PARAM_TYPE* ) ComponentParameterStructure;*/
1056 if (omx_base_component_Private->state != OMX_StateLoaded &&
1057 omx_base_component_Private->state != OMX_StateWaitForResources) {
1059 }
1060 if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) {
1061 break;
1062 }
1064 break;
1066 pPortDef = (OMX_PARAM_PORTDEFINITIONTYPE*) ComponentParameterStructure;
1067 err = omx_base_component_ParameterSanityCheck(hComponent, pPortDef->nPortIndex, pPortDef, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
1068 if(err!=OMX_ErrorNone) {
1069 DEBUG(DEB_LEV_ERR, "In %s Parameter Check Error=%x\n",__func__,err);
1070 break;
1071 }
1072 {
1073 OMX_PARAM_PORTDEFINITIONTYPE *pPortParam;
1074 OMX_U32 j,old_nBufferCountActual=0;
1075 pPortParam = &omx_base_component_Private->ports[pPortDef->nPortIndex]->sPortParam;
1076 if(pPortDef->nBufferCountActual < pPortParam->nBufferCountMin) {
1077 DEBUG(DEB_LEV_ERR, "In %s nBufferCountActual of param (%i) is < of nBufferCountMin of port(%i)\n",__func__, (int)pPortDef->nBufferCountActual, (int)pPortParam->nBufferCountMin);
1079 break;
1080 }
1081 old_nBufferCountActual = pPortParam->nBufferCountActual;
1082 pPortParam->nBufferCountActual = pPortDef->nBufferCountActual;
1083
1084 switch(pPortDef->eDomain) {
1086 memcpy(&pPortParam->format.audio, &pPortDef->format.audio, sizeof(OMX_AUDIO_PORTDEFINITIONTYPE));
1087 break;
1089 pPortParam->format.video.pNativeRender = pPortDef->format.video.pNativeRender;
1090 pPortParam->format.video.nFrameWidth = pPortDef->format.video.nFrameWidth;
1091 pPortParam->format.video.nFrameHeight = pPortDef->format.video.nFrameHeight;
1092 pPortParam->format.video.nStride = pPortDef->format.video.nStride;
1093 pPortParam->format.video.xFramerate = pPortDef->format.video.xFramerate;
1096 pPortParam->format.video.eColorFormat = pPortDef->format.video.eColorFormat;
1097 pPortParam->format.video.pNativeWindow = pPortDef->format.video.pNativeWindow;
1098 break;
1100 pPortParam->format.image.nFrameWidth = pPortDef->format.image.nFrameWidth;
1101 pPortParam->format.image.nFrameHeight = pPortDef->format.image.nFrameHeight;
1102 pPortParam->format.image.nStride = pPortDef->format.image.nStride;
1105 pPortParam->format.image.eColorFormat = pPortDef->format.image.eColorFormat;
1106 pPortParam->format.image.pNativeWindow = pPortDef->format.image.pNativeWindow;
1107 break;
1109 memcpy(&pPortParam->format.other, &pPortDef->format.other, sizeof(OMX_OTHER_PORTDEFINITIONTYPE));
1110 break;
1111 default:
1112 DEBUG(DEB_LEV_ERR, "In %s wrong port domain. Out of OpenMAX scope\n",__func__);
1114 break;
1115 }
1116
1117 /*If component state Idle/Pause/Executing and re-alloc the following private variables */
1118 if ((omx_base_component_Private->state == OMX_StateIdle ||
1119 omx_base_component_Private->state == OMX_StatePause ||
1120 omx_base_component_Private->state == OMX_StateExecuting) &&
1121 (pPortParam->nBufferCountActual > old_nBufferCountActual)) {
1122// todo check if here it is not better != instead of >
1123 pPort = omx_base_component_Private->ports[pPortDef->nPortIndex];
1124 if(pPort->pInternalBufferStorage) {
1125 pPort->pInternalBufferStorage = realloc(pPort->pInternalBufferStorage,pPort->sPortParam.nBufferCountActual*sizeof(OMX_BUFFERHEADERTYPE *));
1126 }
1127
1128 if(pPort->bBufferStateAllocated) {
1129 pPort->bBufferStateAllocated = realloc(pPort->bBufferStateAllocated,pPort->sPortParam.nBufferCountActual*sizeof(BUFFER_STATUS_FLAG));
1130 for(j=0; j < pPort->sPortParam.nBufferCountActual; j++) {
1131 pPort->bBufferStateAllocated[j] = BUFFER_FREE;
1132 }
1133 }
1134 }
1135 }
1136 break;
1138 if (omx_base_component_Private->state != OMX_StateLoaded &&
1139 omx_base_component_Private->state != OMX_StateWaitForResources) {
1141 }
1142 pPrioMgmt = (OMX_PRIORITYMGMTTYPE*)ComponentParameterStructure;
1143 if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PRIORITYMGMTTYPE))) != OMX_ErrorNone) {
1144 break;
1145 }
1146 omx_base_component_Private->nGroupPriority = pPrioMgmt->nGroupPriority;
1147 omx_base_component_Private->nGroupID = pPrioMgmt->nGroupID;
1148 break;
1150 pBufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE*)ComponentParameterStructure;
1151
1152 DEBUG(DEB_LEV_PARAMS, "In %s Buf Sup Port index=%d\n", __func__,(int)pBufferSupplier->nPortIndex);
1153
1154 if(pBufferSupplier == NULL) {
1155 DEBUG(DEB_LEV_ERR, "In %s pBufferSupplier is null!\n",__func__);
1156 return OMX_ErrorBadParameter;
1157 }
1158 if(pBufferSupplier->nPortIndex > (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1159 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1160 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1161 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1162 return OMX_ErrorBadPortIndex;
1163 }
1164 err = omx_base_component_ParameterSanityCheck(hComponent, pBufferSupplier->nPortIndex, pBufferSupplier, sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE));
1166 if (PORT_IS_ENABLED(omx_base_component_Private->ports[pBufferSupplier->nPortIndex])) {
1167 DEBUG(DEB_LEV_ERR, "In %s Incorrect State=%x\n",__func__,omx_base_component_Private->state);
1169 }
1170 } else if (err != OMX_ErrorNone) {
1171 break;
1172 }
1173
1174 if (pBufferSupplier->eBufferSupplier == OMX_BufferSupplyUnspecified) {
1175 DEBUG(DEB_LEV_PARAMS, "In %s: port is already buffer supplier unspecified\n", __func__);
1176 return OMX_ErrorNone;
1177 }
1178 if ((PORT_IS_TUNNELED(omx_base_component_Private->ports[pBufferSupplier->nPortIndex])) == 0) {
1179 return OMX_ErrorNone;
1180 }
1181
1182 pPort = omx_base_component_Private->ports[pBufferSupplier->nPortIndex];
1183
1184 if ((pBufferSupplier->eBufferSupplier == OMX_BufferSupplyInput) &&
1185 (pPort->sPortParam.eDir == OMX_DirInput)) {
1187 if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1189 }
1190 pPort->nTunnelFlags |= TUNNEL_IS_SUPPLIER;
1191 pBufferSupplier->nPortIndex = pPort->nTunneledPort;
1192 err = OMX_SetParameter(pPort->hTunneledComponent, OMX_IndexParamCompBufferSupplier, pBufferSupplier);
1193 } else if ((pBufferSupplier->eBufferSupplier == OMX_BufferSupplyOutput) &&
1194 (pPort->sPortParam.eDir == OMX_DirInput)) {
1195 if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1196 pPort->nTunnelFlags &= ~TUNNEL_IS_SUPPLIER;
1197 pBufferSupplier->nPortIndex = pPort->nTunneledPort;
1198 err = OMX_SetParameter(pPort->hTunneledComponent, OMX_IndexParamCompBufferSupplier, pBufferSupplier);
1199 }
1201 } else if ((pBufferSupplier->eBufferSupplier == OMX_BufferSupplyOutput) &&
1202 (pPort->sPortParam.eDir == OMX_DirOutput)) {
1204 if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1206 }
1207 pPort->nTunnelFlags |= TUNNEL_IS_SUPPLIER;
1208 } else {
1209 if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1210 pPort->nTunnelFlags &= ~TUNNEL_IS_SUPPLIER;
1212 }
1214 }
1215 DEBUG(DEB_LEV_PARAMS, "In %s port %d Tunnel flag=%x \n", __func__,(int)pBufferSupplier->nPortIndex, (int)pPort->nTunnelFlags);
1216 break;
1217 default:
1219 break;
1220 }
1221 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1222 return err;
1223}
1224
1233 OMX_HANDLETYPE hComponent,
1234 OMX_INDEXTYPE nIndex,
1235 OMX_PTR pComponentConfigStructure) {
1236 return OMX_ErrorNone;
1237}
1238
1247 OMX_HANDLETYPE hComponent,
1248 OMX_INDEXTYPE nIndex,
1249 OMX_PTR pComponentConfigStructure) {
1250 return OMX_ErrorNone;
1251}
1252
1259 OMX_HANDLETYPE hComponent,
1260 OMX_STRING cParameterName,
1261 OMX_INDEXTYPE* pIndexType) {
1262
1263 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1264 if(strcmp(cParameterName,"OMX.st.index.param.BellagioThreadsID") == 0) {
1265 *pIndexType = OMX_IndexParameterThreadsID;
1266 } else {
1267 return OMX_ErrorBadParameter;
1268 }
1269 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1270 return OMX_ErrorNone;
1271}
1272
1278 OMX_HANDLETYPE hComponent,
1279 OMX_STATETYPE* pState) {
1280 OMX_COMPONENTTYPE *omxcomponent = (OMX_COMPONENTTYPE*)hComponent;
1281 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxcomponent->pComponentPrivate;
1282 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1283 *pState = omx_base_component_Private->state;
1284 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1285 return OMX_ErrorNone;
1286}
1287
1294 OMX_HANDLETYPE hComponent,
1295 OMX_COMMANDTYPE Cmd,
1296 OMX_U32 nParam,
1297 OMX_PTR pCmdData) {
1298 OMX_COMPONENTTYPE* omxComponent = (OMX_COMPONENTTYPE*)hComponent;
1299 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxComponent->pComponentPrivate;
1301 queue_t* messageQueue;
1302 tsem_t* messageSem;
1303 OMX_U32 i,j,k;
1304 omx_base_PortType *pPort;
1306 int errQue;
1307 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1308
1309 messageQueue = omx_base_component_Private->messageQueue;
1310 messageSem = omx_base_component_Private->messageSem;
1311
1312 if (omx_base_component_Private->state == OMX_StateInvalid) {
1313 return OMX_ErrorInvalidState;
1314 }
1315
1316 message = calloc(1,sizeof(internalRequestMessageType));
1317 message->messageParam = nParam;
1318 message->pCmdData=pCmdData;
1320 switch (Cmd) {
1322 message->messageType = OMX_CommandStateSet;
1323 if ((nParam == OMX_StateIdle) && (omx_base_component_Private->state == OMX_StateLoaded)) {
1324 /*Allocate Internal Buffer Storage and Buffer Allocation State flags*/
1325 /* for all ports */
1326 for(j = 0; j < NUM_DOMAINS; j++) {
1327 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1328 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1329 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1330
1331 pPort = omx_base_component_Private->ports[i];
1332
1333 if(pPort->pInternalBufferStorage == NULL) {
1334 pPort->pInternalBufferStorage = calloc(pPort->sPortParam.nBufferCountActual,sizeof(OMX_BUFFERHEADERTYPE *));
1335 }
1336
1337 if(pPort->bBufferStateAllocated == NULL) {
1338 pPort->bBufferStateAllocated = calloc(pPort->sPortParam.nBufferCountActual,sizeof(BUFFER_STATUS_FLAG));
1339 }
1340
1341 for(k=0; k < pPort->sPortParam.nBufferCountActual; k++) {
1342 pPort->bBufferStateAllocated[k] = BUFFER_FREE;
1343 }
1344 }
1345 }
1346
1347 omx_base_component_Private->transientState = OMX_TransStateLoadedToIdle;
1348 } else if ((nParam == OMX_StateLoaded) && (omx_base_component_Private->state == OMX_StateIdle)) {
1349 omx_base_component_Private->transientState = OMX_TransStateIdleToLoaded;
1350 } else if ((nParam == OMX_StateIdle) && (omx_base_component_Private->state == OMX_StateExecuting)) {
1351 omx_base_component_Private->transientState = OMX_TransStateExecutingToIdle;
1352 } else if ((nParam == OMX_StateIdle) && (omx_base_component_Private->state == OMX_StatePause)) {
1353 omx_base_component_Private->transientState = OMX_TransStatePauseToIdle;
1354 }
1355 break;
1356 case OMX_CommandFlush:
1357 if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1358 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1359 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1360 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
1361 return OMX_ErrorBadPortIndex;
1362 }
1363 message->messageType = OMX_CommandFlush;
1364 break;
1366 if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1367 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1368 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1369 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
1370 return OMX_ErrorBadPortIndex;
1371 }
1372 message->messageType = OMX_CommandPortDisable;
1373 if(message->messageParam == OMX_ALL) {
1374 /* for all ports */
1375 for(j = 0; j < NUM_DOMAINS; j++) {
1376 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1377 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1378 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1379 omx_base_component_Private->ports[i]->bIsTransientToDisabled = OMX_TRUE;
1380 }
1381 }
1382 } else {
1383 omx_base_component_Private->ports[message->messageParam]->bIsTransientToDisabled = OMX_TRUE;
1384 }
1385 break;
1387 if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1388 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1389 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1390 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
1391 return OMX_ErrorBadPortIndex;
1392 }
1393 message->messageType = OMX_CommandPortEnable;
1394 if(message->messageParam == OMX_ALL) {
1395 /* for all ports */
1396 for(j = 0; j < NUM_DOMAINS; j++) {
1397 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1398 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1399 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1400 omx_base_component_Private->ports[i]->bIsTransientToEnabled = OMX_TRUE;
1401 }
1402 }
1403 } else {
1404 omx_base_component_Private->ports[message->messageParam]->bIsTransientToEnabled = OMX_TRUE;
1405 }
1406 break;
1408 if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1409 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1410 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1411 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
1412 return OMX_ErrorBadPortIndex;
1413 }
1414 message->messageType = OMX_CommandMarkBuffer;
1415 break;
1416 default:
1418 break;
1419 }
1420
1421 if (err == OMX_ErrorNone) {
1422 errQue = queue(messageQueue, message);
1423 if (errQue) {
1424 /* /TODO the queue is full. This can be handled in a fine way with
1425 * some retrials, or other checking. For the moment this is a critical error
1426 * and simply causes the failure of this call
1427 */
1429 }
1430 tsem_up(messageSem);
1431 }
1432 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1433 return err;
1434}
1435
1442void* compMessageHandlerFunction(void* param) {
1443 OMX_COMPONENTTYPE *openmaxStandComp = (OMX_COMPONENTTYPE *)param;
1444 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
1446
1447 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, openmaxStandComp);
1448 omx_base_component_Private->bellagioThreads->nThreadMessageID = (long int)syscall(__NR_gettid);
1449 DEBUG(DEB_LEV_SIMPLE_SEQ, "In %s the thread ID is %i\n", __func__, (int)omx_base_component_Private->bellagioThreads->nThreadMessageID);
1450
1451 while(1){
1452 /* Wait for an incoming message */
1453 if (omx_base_component_Private == NULL) {
1454 break;
1455 }
1456 tsem_down(omx_base_component_Private->messageSem);
1457 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s new message\n", __func__);
1458 /*Destructor has been called. So exit from the loop*/
1459 if(omx_base_component_Private->state == OMX_StateInvalid) {
1460 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s Destructor has been called. So exit from the loop\n", __func__);
1461 break;
1462 }
1463 /* Dequeue it */
1464 message = dequeue(omx_base_component_Private->messageQueue);
1465 if(message == NULL){
1466 DEBUG(DEB_LEV_ERR, "In %s: ouch!! had null message!\n", __func__);
1467 break;
1468 }
1469 /* Process it by calling component's message handler method */
1470 omx_base_component_Private->messageHandler(openmaxStandComp, message);
1471 /* Message ownership has been transferred to us
1472 * so we gonna free it when finished.
1473 */
1474 free(message);
1475 message = NULL;
1476 }
1477 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, openmaxStandComp);
1478 return NULL;
1479}
1480
1493 omx_base_component_PrivateType* omx_base_component_Private=openmaxStandComp->pComponentPrivate;
1494 OMX_U32 i,j,k;
1496 omx_base_PortType* pPort;
1497
1498 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p with message %i\n", __func__, openmaxStandComp, message->messageType);
1499
1500 /* Dealing with a SendCommand call.
1501 * -messageType contains the command to execute
1502 * -messageParam contains the parameter of the command
1503 * (destination state in case of a state change command).
1504 */
1505 switch(message->messageType){
1506 case OMX_CommandStateSet: {
1507 /* Do the actual state change */
1508 err = (*(omx_base_component_Private->DoStateSet))(openmaxStandComp, message->messageParam);
1509 if (err != OMX_ErrorNone) {
1510 (*(omx_base_component_Private->callbacks->EventHandler))
1511 (openmaxStandComp,
1512 omx_base_component_Private->callbackData,
1513 OMX_EventError, /* The command was completed */
1514 err, /* The commands was a OMX_CommandStateSet */
1515 0, /* The state has been changed in message->messageParam */
1516 NULL);
1517 } else {
1518 /* And run the callback */
1519 if (omx_base_component_Private->callbacks) {
1520 DEBUG(DEB_LEV_SIMPLE_SEQ, "running callback in %s\n", __func__);
1521 (*(omx_base_component_Private->callbacks->EventHandler))
1522 (openmaxStandComp,
1523 omx_base_component_Private->callbackData,
1524 OMX_EventCmdComplete, /* The command was completed */
1525 OMX_CommandStateSet, /* The commands was a OMX_CommandStateSet */
1526 message->messageParam, /* The state has been changed in message->messageParam */
1527 NULL);
1528 }
1529 }
1530 }
1531 break;
1532 case OMX_CommandFlush: {
1533 /*Flush port/s*/
1534 if(message->messageParam == OMX_ALL) {
1535 /* for all ports */
1536 for(j = 0; j < NUM_DOMAINS; j++) {
1537 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1538 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1539 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1540 omx_base_component_Private->ports[i]->bIsPortFlushed = OMX_TRUE;
1541 }
1542 }
1543 /* for all ports */
1544 for(j = 0; j < NUM_DOMAINS; j++) {
1545 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1546 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1547 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1548 pPort=omx_base_component_Private->ports[i];
1549 err = pPort->FlushProcessingBuffers(pPort);
1550 }
1551 }
1552 }
1553 else {
1554 pPort=omx_base_component_Private->ports[message->messageParam];
1555 err = pPort->FlushProcessingBuffers(pPort);
1556 }
1557 if (err != OMX_ErrorNone) {
1558 (*(omx_base_component_Private->callbacks->EventHandler))
1559 (openmaxStandComp,
1560 omx_base_component_Private->callbackData,
1561 OMX_EventError, /* The command was completed */
1562 err, /* The commands was a OMX_CommandStateSet */
1563 0, /* The state has been changed in message->messageParam */
1564 NULL);
1565 } else {
1566 if(message->messageParam == OMX_ALL){ /*Flush all port*/
1567 /* for all ports */
1568 for(j = 0; j < NUM_DOMAINS; j++) {
1569 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1570 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1571 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1572 (*(omx_base_component_Private->callbacks->EventHandler))
1573 (openmaxStandComp,
1574 omx_base_component_Private->callbackData,
1575 OMX_EventCmdComplete, /* The command was completed */
1576 OMX_CommandFlush, /* The commands was a OMX_CommandStateSet */
1577 i, /* The state has been changed in message->messageParam */
1578 NULL);
1579
1580 pPort=omx_base_component_Private->ports[i];
1581 /* Signal the buffer Semaphore and the buffer managment semaphore, to restart the exchange of buffers after flush */
1582 if (PORT_IS_TUNNELED(pPort) && PORT_IS_BUFFER_SUPPLIER(pPort)) {
1583 for(k=0;k<pPort->nNumTunnelBuffer;k++) {
1584 tsem_up(pPort->pBufferSem);
1585 /*signal buffer management thread availability of buffers*/
1586 tsem_up(omx_base_component_Private->bMgmtSem);
1587 }
1588 }
1589 }
1590 }
1591 } else {/*Flush input/output port*/
1592 (*(omx_base_component_Private->callbacks->EventHandler))
1593 (openmaxStandComp,
1594 omx_base_component_Private->callbackData,
1595 OMX_EventCmdComplete, /* The command was completed */
1596 OMX_CommandFlush, /* The commands was a OMX_CommandStateSet */
1597 message->messageParam, /* The state has been changed in message->messageParam */
1598 NULL);
1599 /* Signal the buffer Semaphore and the buffer managment semaphore, to restart the exchange of buffers after flush */
1600 if (PORT_IS_TUNNELED(omx_base_component_Private->ports[message->messageParam])
1601 && PORT_IS_BUFFER_SUPPLIER(omx_base_component_Private->ports[message->messageParam])) {
1602 for(j=0;j<omx_base_component_Private->ports[message->messageParam]->nNumTunnelBuffer;j++) {
1603 tsem_up(omx_base_component_Private->ports[message->messageParam]->pBufferSem);
1604 /*signal buffer management thread availability of buffers*/
1605 tsem_up(omx_base_component_Private->bMgmtSem);
1606 }
1607 }
1608 }
1609 }
1610 }
1611 break;
1613 /*Flush port/s*/
1614 if(message->messageParam == OMX_ALL) {
1615 /*If Component is not in loaded state,then First Flush all buffers then disable the port*/
1616 if(omx_base_component_Private->state!=OMX_StateLoaded) {
1617 /* for all ports */
1618 for(j = 0; j < NUM_DOMAINS; j++) {
1619 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1620 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1621 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1622 pPort=omx_base_component_Private->ports[i];
1623 err = pPort->FlushProcessingBuffers(pPort);
1624 }
1625 }
1626 }
1627 /* for all ports */
1628 for(j = 0; j < NUM_DOMAINS; j++) {
1629 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1630 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1631 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1632 pPort=omx_base_component_Private->ports[i];
1633 err = pPort->Port_DisablePort(pPort);
1634 }
1635 }
1636 }
1637 else {
1638 pPort=omx_base_component_Private->ports[message->messageParam];
1639 if(omx_base_component_Private->state!=OMX_StateLoaded) {
1640 err = pPort->FlushProcessingBuffers(pPort);
1641 DEBUG(DEB_LEV_FULL_SEQ, "In %s: Port Flush completed for Comp %s\n",__func__,omx_base_component_Private->name);
1642 }
1643 err = pPort->Port_DisablePort(pPort);
1644 }
1646 if (err != OMX_ErrorNone) {
1647 (*(omx_base_component_Private->callbacks->EventHandler))
1648 (openmaxStandComp,
1649 omx_base_component_Private->callbackData,
1650 OMX_EventError, /* The command was completed */
1651 err, /* The commands was a OMX_CommandStateSet */
1652 0, /* The state has been changed in message->messageParam */
1653 NULL);
1654 } else {
1655 if(message->messageParam == OMX_ALL){ /*Disable all ports*/
1656 /* for all ports */
1657 for(j = 0; j < NUM_DOMAINS; j++) {
1658 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1659 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1660 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1661 (*(omx_base_component_Private->callbacks->EventHandler))
1662 (openmaxStandComp,
1663 omx_base_component_Private->callbackData,
1664 OMX_EventCmdComplete, /* The command was completed */
1665 OMX_CommandPortDisable, /* The commands was a OMX_CommandStateSet */
1666 i, /* The state has been changed in message->messageParam */
1667 NULL);
1668 }
1669 }
1670 } else {
1671 (*(omx_base_component_Private->callbacks->EventHandler))
1672 (openmaxStandComp,
1673 omx_base_component_Private->callbackData,
1674 OMX_EventCmdComplete, /* The command was completed */
1675 OMX_CommandPortDisable, /* The commands was a OMX_CommandStateSet */
1676 message->messageParam, /* The state has been changed in message->messageParam */
1677 NULL);
1678 }
1679 }
1680 }
1681 break;
1683 /*Flush port/s*/
1684 if(message->messageParam == OMX_ALL) {
1685 /* for all ports */
1686 for(j = 0; j < NUM_DOMAINS; j++) {
1687 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1688 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1689 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1690 pPort=omx_base_component_Private->ports[i];
1691 err = pPort->Port_EnablePort(pPort);
1692 }
1693 }
1694 } else {
1695 pPort=omx_base_component_Private->ports[message->messageParam];
1696 err = pPort->Port_EnablePort(pPort);
1697 }
1698 if (err != OMX_ErrorNone) {
1699 (*(omx_base_component_Private->callbacks->EventHandler))
1700 (openmaxStandComp,
1701 omx_base_component_Private->callbackData,
1702 OMX_EventError, /* The command was completed */
1703 err, /* The commands was a OMX_CommandStateSet */
1704 0, /* The state has been changed in message->messageParam */
1705 NULL);
1706 } else {
1707 if(message->messageParam != OMX_ALL) {
1708 (*(omx_base_component_Private->callbacks->EventHandler))
1709 (openmaxStandComp,
1710 omx_base_component_Private->callbackData,
1711 OMX_EventCmdComplete, /* The command was completed */
1712 OMX_CommandPortEnable, /* The commands was a OMX_CommandStateSet */
1713 message->messageParam, /* The state has been changed in message->messageParam */
1714 NULL);
1715
1716 if (omx_base_component_Private->state==OMX_StateExecuting) {
1717 pPort=omx_base_component_Private->ports[message->messageParam];
1718 if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1719 for(i=0; i < pPort->sPortParam.nBufferCountActual;i++) {
1720 tsem_up(pPort->pBufferSem);
1721 tsem_up(omx_base_component_Private->bMgmtSem);
1722 }
1723 }
1724 }
1725
1726 } else {
1727 /* for all ports */
1728 for(j = 0; j < NUM_DOMAINS; j++) {
1729 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1730 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1731 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1732 (*(omx_base_component_Private->callbacks->EventHandler))
1733 (openmaxStandComp,
1734 omx_base_component_Private->callbackData,
1735 OMX_EventCmdComplete, /* The command was completed */
1736 OMX_CommandPortEnable, /* The commands was a OMX_CommandStateSet */
1737 i, /* The state has been changed in message->messageParam */
1738 NULL);
1739 }
1740 }
1741
1742 if (omx_base_component_Private->state==OMX_StateExecuting) {
1743 /* for all ports */
1744 for(j = 0; j < NUM_DOMAINS; j++) {
1745 for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1746 i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1747 omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1748 pPort=omx_base_component_Private->ports[i];
1749 if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1750 for(k=0; k < pPort->sPortParam.nBufferCountActual;k++) {
1751 tsem_up(pPort->pBufferSem);
1752 tsem_up(omx_base_component_Private->bMgmtSem);
1753 }
1754 }
1755 }
1756 }
1757 }
1758 }
1759 }
1760 }
1761 break;
1762 case OMX_CommandMarkBuffer: {
1763 omx_base_component_Private->pMark.hMarkTargetComponent = ((OMX_MARKTYPE *)message->pCmdData)->hMarkTargetComponent;
1764 omx_base_component_Private->pMark.pMarkData = ((OMX_MARKTYPE *)message->pCmdData)->pMarkData;
1765 }
1766 break;
1767 default:
1768 DEBUG(DEB_LEV_ERR, "In %s: Unrecognized command %i\n", __func__, message->messageType);
1769 break;
1770 }
1771 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, openmaxStandComp);
1772 return OMX_ErrorNone;
1773}
1774
1776 OMX_HANDLETYPE hComponent,
1777 OMX_BUFFERHEADERTYPE** ppBuffer,
1778 OMX_U32 nPortIndex,
1779 OMX_PTR pAppPrivate,
1780 OMX_U32 nSizeBytes) {
1781 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1782 omx_base_PortType *pPort;
1784
1785 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1786
1787 if (nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1788 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1789 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1790 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1791 DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
1792 return OMX_ErrorBadPortIndex;
1793 }
1794 pPort = omx_base_component_Private->ports[nPortIndex];
1795 err = pPort->Port_AllocateBuffer(pPort, ppBuffer, nPortIndex, pAppPrivate, nSizeBytes);
1796 if (err != OMX_ErrorNone) {
1797 DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
1798 return err;
1799 }
1800 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p buffer %p\n", __func__, hComponent, ppBuffer);
1801 return OMX_ErrorNone;
1802}
1803
1805 OMX_HANDLETYPE hComponent,
1806 OMX_BUFFERHEADERTYPE** ppBufferHdr,
1807 OMX_U32 nPortIndex,
1808 OMX_PTR pAppPrivate,
1809 OMX_U32 nSizeBytes,
1810 OMX_U8* pBuffer) {
1811 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1812 omx_base_PortType *pPort;
1814
1815 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1816 if (nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1817 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1818 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1819 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1820 DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
1821 return OMX_ErrorBadPortIndex;
1822 }
1823 pPort = omx_base_component_Private->ports[nPortIndex];
1824 err = pPort->Port_UseBuffer(pPort, ppBufferHdr, nPortIndex, pAppPrivate, nSizeBytes, pBuffer);
1825 if (err != OMX_ErrorNone) {
1826 DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
1827 return err;
1828 }
1829 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1830 return OMX_ErrorNone;
1831}
1832
1834 OMX_HANDLETYPE hComponent,
1835 OMX_BUFFERHEADERTYPE** ppBufferHdr,
1836 OMX_U32 nPortIndex,
1837 OMX_PTR pAppPrivate,
1838 void* eglImage) {
1840}
1841
1843 OMX_HANDLETYPE hComponent,
1844 OMX_U32 nPortIndex,
1845 OMX_BUFFERHEADERTYPE* pBuffer) {
1846 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1847 omx_base_PortType *pPort;
1849
1850 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1851 if (nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1852 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1853 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1854 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1855 DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
1856 return OMX_ErrorBadPortIndex;
1857 }
1858
1859 pPort = omx_base_component_Private->ports[nPortIndex];
1860 err = pPort->Port_FreeBuffer(pPort, nPortIndex, pBuffer);
1861 if (err != OMX_ErrorNone) {
1862 DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
1863 return err;
1864 }
1865 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1866 return OMX_ErrorNone;
1867}
1868
1870 OMX_HANDLETYPE hComponent,
1871 OMX_BUFFERHEADERTYPE* pBuffer) {
1872 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1873 omx_base_PortType *pPort;
1875
1876 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1877
1878 if (pBuffer->nInputPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1879 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1880 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1881 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1882 DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
1883 return OMX_ErrorBadPortIndex;
1884 }
1885 pPort = omx_base_component_Private->ports[pBuffer->nInputPortIndex];
1886 if (pPort->sPortParam.eDir != OMX_DirInput) {
1887 DEBUG(DEB_LEV_ERR, "In %s: wrong port direction in Component %s\n", __func__,omx_base_component_Private->name);
1888 return OMX_ErrorBadPortIndex;
1889 }
1890 err = pPort->Port_SendBufferFunction(pPort, pBuffer);
1891 if (err != OMX_ErrorNone) {
1892 DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %s\n", __func__, hComponent, errorName(err));
1893 return err;
1894 }
1895 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1896 return OMX_ErrorNone;
1897}
1898
1900 OMX_HANDLETYPE hComponent,
1901 OMX_BUFFERHEADERTYPE* pBuffer) {
1902
1903 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1904 omx_base_PortType *pPort;
1906
1907 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1908 if (pBuffer->nOutputPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1909 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1910 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1911 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1912 DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
1913 return OMX_ErrorBadPortIndex;
1914 }
1915 pPort = omx_base_component_Private->ports[pBuffer->nOutputPortIndex];
1916 if (pPort->sPortParam.eDir != OMX_DirOutput) {
1917 DEBUG(DEB_LEV_ERR, "In %s: wrong port(%d) direction(%x) pBuffer=%p in Component %s\n", __func__,
1918 (int)pBuffer->nOutputPortIndex, (int)pPort->sPortParam.eDir, pBuffer, omx_base_component_Private->name);
1919 return OMX_ErrorBadPortIndex;
1920 }
1921 err = pPort->Port_SendBufferFunction(pPort, pBuffer);
1922 if (err != OMX_ErrorNone) {
1923 DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %s\n", __func__, hComponent, errorName(err));
1924 return err;
1925 }
1926 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1927 return OMX_ErrorNone;
1928}
1929
1931 OMX_HANDLETYPE hComponent,
1932 OMX_U32 nPort,
1933 OMX_HANDLETYPE hTunneledComp,
1934 OMX_U32 nTunneledPort,
1935 OMX_TUNNELSETUPTYPE* pTunnelSetup) {
1936
1937 omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1938 omx_base_PortType *pPort;
1940
1941 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1942 if (nPort >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1943 omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1944 omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1945 omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1946 return OMX_ErrorBadPortIndex;
1947 }
1948
1949 pPort = omx_base_component_Private->ports[nPort];
1950 err = pPort->ComponentTunnelRequest(pPort, hTunneledComp, nTunneledPort, pTunnelSetup);
1951 if (err != OMX_ErrorNone) {
1952 DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
1953 return err;
1954 }
1955 DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1956 return OMX_ErrorNone;
1957}
1958
1960 omx_base_component_PrivateType* omx_base_component_Private = openmaxStandComp->pComponentPrivate;
1961 DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
1962 *pQualityLevel = omx_base_component_Private->currentQualityLevel;
1963 return OMX_ErrorNone;
1964}
1965
1967 omx_base_component_PrivateType* omx_base_component_Private = openmaxStandComp->pComponentPrivate;
1968 /* this change is done regardless to the state. When the way to change effectively quality in a component is known
1969 * change this function adding state checks
1970 */
1971 DEBUG(DEB_LEV_SIMPLE_SEQ, "In %s setting %i of %i\n", __func__, (int)nQualityLevel, (int)omx_base_component_Private->nqualitylevels);
1972 if ((nQualityLevel > 0) && (nQualityLevel <= omx_base_component_Private->nqualitylevels)) {
1973 omx_base_component_Private->currentQualityLevel = nQualityLevel;
1974 return OMX_ErrorNone;
1975 } else {
1976 return OMX_ErrorBadParameter;
1977 }
1978}
1979
1980#ifdef __cplusplus
1981}
1982#endif
1983
#define OMX_MAX_STRINGNAME_SIZE
Definition: OMX_Core.h:281
OMX_ERRORTYPE
Definition: OMX_Core.h:127
@ OMX_ErrorInvalidState
Definition: OMX_Core.h:162
@ OMX_ErrorInsufficientResources
Definition: OMX_Core.h:131
@ OMX_ErrorSameState
Definition: OMX_Core.h:187
@ OMX_ErrorNotImplemented
Definition: OMX_Core.h:150
@ OMX_ErrorBadPortIndex
Definition: OMX_Core.h:224
@ OMX_ErrorNoMore
Definition: OMX_Core.h:175
@ OMX_ErrorNone
Definition: OMX_Core.h:128
@ OMX_ErrorUndefined
Definition: OMX_Core.h:134
@ OMX_ErrorUnsupportedIndex
Definition: OMX_Core.h:221
@ OMX_ErrorBadParameter
Definition: OMX_Core.h:147
@ OMX_ErrorIncorrectStateTransition
Definition: OMX_Core.h:212
@ OMX_ErrorVersionMismatch
Definition: OMX_Core.h:178
@ OMX_ErrorIncorrectStateOperation
Definition: OMX_Core.h:215
OMX_INDEXTYPE
Definition: OMX_Index.h:60
@ OMX_IndexParamPriorityMgmt
Definition: OMX_Index.h:63
@ OMX_IndexParamVideoInit
Definition: OMX_Index.h:66
@ OMX_IndexParamImageInit
Definition: OMX_Index.h:65
@ OMX_IndexParamAudioInit
Definition: OMX_Index.h:64
@ OMX_IndexParamCompBufferSupplier
Definition: OMX_Index.h:89
@ OMX_IndexParamPortDefinition
Definition: OMX_Index.h:88
@ OMX_IndexParamOtherInit
Definition: OMX_Index.h:67
#define OMX_ALL
Definition: OMX_Types.h:99
unsigned long OMX_U32
Definition: OMX_Types.h:145
char * OMX_STRING
Definition: OMX_Types.h:206
unsigned char OMX_U8
Definition: OMX_Types.h:133
OMX_BOOL
Definition: OMX_Types.h:189
@ OMX_TRUE
Definition: OMX_Types.h:191
@ OMX_FALSE
Definition: OMX_Types.h:190
void * OMX_PTR
Definition: OMX_Types.h:199
void * OMX_HANDLETYPE
Definition: OMX_Types.h:295
unsigned char OMX_UUIDTYPE[128]
Definition: OMX_Types.h:219
@ OMX_DirInput
Definition: OMX_Types.h:226
@ OMX_DirOutput
Definition: OMX_Types.h:227
OMX_ERRORTYPE(* AllocateBuffer)(OMX_IN OMX_HANDLETYPE hComponent, OMX_INOUT OMX_BUFFERHEADERTYPE **ppBuffer, OMX_IN OMX_U32 nPortIndex, OMX_IN OMX_PTR pAppPrivate, OMX_IN OMX_U32 nSizeBytes)
OMX_ERRORTYPE(* FillBufferDone)(OMX_OUT OMX_HANDLETYPE hComponent, OMX_OUT OMX_PTR pAppData, OMX_OUT OMX_BUFFERHEADERTYPE *pBuffer)
Definition: OMX_Core.h:589
OMX_ERRORTYPE(* FillThisBuffer)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE(* FreeBuffer)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_U32 nPortIndex, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE(* UseEGLImage)(OMX_IN OMX_HANDLETYPE hComponent, OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr, OMX_IN OMX_U32 nPortIndex, OMX_IN OMX_PTR pAppPrivate, OMX_IN void *eglImage)
OMX_ERRORTYPE(* UseBuffer)(OMX_IN OMX_HANDLETYPE hComponent, OMX_INOUT OMX_BUFFERHEADERTYPE **ppBufferHdr, OMX_IN OMX_U32 nPortIndex, OMX_IN OMX_PTR pAppPrivate, OMX_IN OMX_U32 nSizeBytes, OMX_IN OMX_U8 *pBuffer)
OMX_ERRORTYPE(* EmptyThisBuffer)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE(* EmptyBufferDone)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_PTR pAppData, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
Definition: OMX_Core.h:560
@ OMX_BufferSupplyOutput
Definition: OMX_Core.h:605
@ OMX_BufferSupplyInput
Definition: OMX_Core.h:604
@ OMX_BufferSupplyUnspecified
Definition: OMX_Core.h:602
struct OMX_COMPONENTTYPE OMX_COMPONENTTYPE
OMX_STATETYPE
Definition: OMX_Core.h:93
#define OMX_SetParameter( hComponent, nParamIndex, pComponentParameterStructure)
Definition: OMX_Core.h:825
@ OMX_PortDomainAudio
Definition: OMX_Component.h:51
@ OMX_PortDomainVideo
Definition: OMX_Component.h:52
@ OMX_PortDomainOther
Definition: OMX_Component.h:54
@ OMX_PortDomainImage
Definition: OMX_Component.h:53
@ OMX_StateExecuting
Definition: OMX_Core.h:105
@ OMX_StateWaitForResources
Definition: OMX_Core.h:108
@ OMX_StateLoaded
Definition: OMX_Core.h:97
@ OMX_StateInvalid
Definition: OMX_Core.h:94
@ OMX_StateIdle
Definition: OMX_Core.h:102
@ OMX_StatePause
Definition: OMX_Core.h:107
@ OMX_EventCmdComplete
Definition: OMX_Core.h:481
@ OMX_EventError
Definition: OMX_Core.h:482
OMX_COMMANDTYPE
Definition: OMX_Core.h:50
@ OMX_CommandMarkBuffer
Definition: OMX_Core.h:55
@ OMX_CommandPortDisable
Definition: OMX_Core.h:53
@ OMX_CommandPortEnable
Definition: OMX_Core.h:54
@ OMX_CommandFlush
Definition: OMX_Core.h:52
@ OMX_CommandStateSet
Definition: OMX_Core.h:51
OMX_ERRORTYPE(* ComponentTunnelRequest)(OMX_IN OMX_HANDLETYPE hComp, OMX_IN OMX_U32 nPort, OMX_IN OMX_HANDLETYPE hTunneledComp, OMX_IN OMX_U32 nTunneledPort, OMX_INOUT OMX_TUNNELSETUPTYPE *pTunnelSetup)
void * compMessageHandlerFunction(void *param)
Component's message handler thread function.
OMX_ERRORTYPE omx_base_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
The base constructor for the OpenMAX ST components.
OMX_ERRORTYPE omx_base_component_EmptyThisBuffer(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE omx_base_component_GetState(OMX_HANDLETYPE hComponent, OMX_STATETYPE *pState)
OMX_ERRORTYPE omx_base_component_ComponentDeInit(OMX_HANDLETYPE hComponent)
This standard functionality is called when the component is destroyed in the FreeHandle standard call...
OMX_ERRORTYPE omx_base_component_MessageHandler(OMX_COMPONENTTYPE *openmaxStandComp, internalRequestMessageType *message)
OMX_ERRORTYPE omx_base_component_AllocateBuffer(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE **ppBuffer, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, OMX_U32 nSizeBytes)
OMX_ERRORTYPE omx_base_component_GetComponentVersion(OMX_HANDLETYPE hComponent, OMX_STRING pComponentName, OMX_VERSIONTYPE *pComponentVersion, OMX_VERSIONTYPE *pSpecVersion, OMX_UUIDTYPE *pComponentUUID)
Standard OpenMAX function.
OMX_ERRORTYPE omx_base_component_SendCommand(OMX_HANDLETYPE hComponent, OMX_COMMANDTYPE Cmd, OMX_U32 nParam, OMX_PTR pCmdData)
standard SendCommand function
OMX_ERRORTYPE omx_base_component_ComponentTunnelRequest(OMX_HANDLETYPE hComponent, OMX_U32 nPort, OMX_HANDLETYPE hTunneledComp, OMX_U32 nTunneledPort, OMX_TUNNELSETUPTYPE *pTunnelSetup)
OMX_ERRORTYPE omx_base_component_SetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
Part of the standard OpenMAX function.
OMX_ERRORTYPE omx_base_component_UseBuffer(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE **ppBufferHdr, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, OMX_U32 nSizeBytes, OMX_U8 *pBuffer)
OMX_ERRORTYPE omx_base_component_FillThisBuffer(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE omx_base_component_DoStateSet(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 destinationState)
OMX_ERRORTYPE omx_base_component_Destructor(OMX_COMPONENTTYPE *openmaxStandComp)
The base destructor for ST OpenMAX components.
OMX_ERRORTYPE omx_base_component_ParameterSanityCheck(OMX_HANDLETYPE hComponent, OMX_U32 nPortIndex, OMX_PTR pStructure, size_t size)
OMX_ERRORTYPE omx_base_getQualityLevel(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 *pQualityLevel)
void setHeader(OMX_PTR header, OMX_U32 size)
Simply fills the first two fields in any OMX structure with the size and the version.
OMX_ERRORTYPE omx_base_component_SetCallbacks(OMX_HANDLETYPE hComponent, OMX_CALLBACKTYPE *pCallbacks, OMX_PTR pAppData)
standard OpenMAX function
OMX_ERRORTYPE omx_base_component_GetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
Part of the standard OpenMAX function.
OMX_ERRORTYPE omx_base_component_SetConfig(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure)
base SetConfig function
OMX_ERRORTYPE omx_base_component_GetExtensionIndex(OMX_HANDLETYPE hComponent, OMX_STRING cParameterName, OMX_INDEXTYPE *pIndexType)
base function not implemented
void base_constructor_remove_garbage_collected(omx_base_component_PrivateType *omx_base_component_Private)
OMX_ERRORTYPE omx_base_component_UseEGLImage(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE **ppBufferHdr, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, void *eglImage)
OMX_ERRORTYPE omx_base_component_GetConfig(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure)
base GetConfig function
OMX_ERRORTYPE checkHeader(OMX_PTR header, OMX_U32 size)
Checks the header of a structure for consistency with size and spec version.
OMX_ERRORTYPE omx_base_component_FreeBuffer(OMX_HANDLETYPE hComponent, OMX_U32 nPortIndex, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE omx_base_setQualityLevel(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 nQualityLevel)
OMX_ERRORTYPE omx_base_component_ComponentRoleEnum(OMX_HANDLETYPE hComponent, OMX_U8 *cRole, OMX_U32 nIndex)
Enumerates all the roles of the component.
#define NUM_DOMAINS
#define OSCL_EXPORT_REF
OMX_INDEXVENDORTYPE
@ OMX_IndexParameterThreadsID
@ OMX_IndexVendorCompPropTunnelFlags
@ OMX_TransStateExecutingToIdle
@ OMX_TransStateIdleToLoaded
@ OMX_TransStatePauseToIdle
@ OMX_TransStateMax
@ OMX_TransStateLoadedToIdle
#define PORT_IS_TUNNELED_N_BUFFER_SUPPLIER(pPort)
Definition: omx_base_port.h:46
BUFFER_STATUS_FLAG
Definition: omx_base_port.h:72
@ BUFFER_FREE
Definition: omx_base_port.h:73
@ TUNNEL_IS_SUPPLIER
Definition: omx_base_port.h:89
#define PORT_IS_BUFFER_SUPPLIER(pPort)
Definition: omx_base_port.h:45
#define PORT_IS_TUNNELED(pPort)
Definition: omx_base_port.h:43
#define PORT_IS_ENABLED(pPort)
Definition: omx_base_port.h:41
#define DEB_LEV_PARAMS
#define DEB_LEV_FUNCTION_NAME
#define DEB_LEV_ERR
#define DEB_LEV_SIMPLE_SEQ
#define DEB_LEV_FULL_SEQ
#define DEBUG(n, fmt, args...)
OMX_ERRORTYPE RM_removeFromWaitForResource(OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE RM_getResource(OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE RM_releaseResource(OMX_COMPONENTTYPE *openmaxStandComp)
OMX_ERRORTYPE RM_waitForResource(OMX_COMPONENTTYPE *openmaxStandComp)
#define SPECVERSIONMINOR
Definition: omxcore.h:52
#define SPECREVISION
Definition: omxcore.h:54
#define SPECSTEP
Definition: omxcore.h:56
#define SPECVERSIONMAJOR
Definition: omxcore.h:50
OMX_ERRORTYPE err
int queue(queue_t *queue, void *data)
Definition: queue.c:103
void * dequeue(queue_t *queue)
Definition: queue.c:122
void queue_deinit(queue_t *queue)
Definition: queue.c:77
int queue_init(queue_t *queue)
Definition: queue.c:38
OMX_U32 nOutputPortIndex
Definition: OMX_Core.h:439
OMX_U32 nInputPortIndex
Definition: OMX_Core.h:441
OMX_ERRORTYPE(* EventHandler)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_PTR pAppData, OMX_IN OMX_EVENTTYPE eEvent, OMX_IN OMX_U32 nData1, OMX_IN OMX_U32 nData2, OMX_IN OMX_PTR pEventData)
Definition: OMX_Core.h:530
OMX_ERRORTYPE(* GetConfig)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_INOUT OMX_PTR pComponentConfigStructure)
OMX_ERRORTYPE(* SetConfig)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_IN OMX_PTR pComponentConfigStructure)
OMX_ERRORTYPE(* ComponentDeInit)(OMX_IN OMX_HANDLETYPE hComponent)
OMX_ERRORTYPE(* SetParameter)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_IN OMX_PTR pComponentParameterStructure)
OMX_ERRORTYPE(* GetParameter)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR pComponentParameterStructure)
OMX_VERSIONTYPE nVersion
OMX_PTR pApplicationPrivate
OMX_ERRORTYPE(* GetComponentVersion)(OMX_IN OMX_HANDLETYPE hComponent, OMX_OUT OMX_STRING pComponentName, OMX_OUT OMX_VERSIONTYPE *pComponentVersion, OMX_OUT OMX_VERSIONTYPE *pSpecVersion, OMX_OUT OMX_UUIDTYPE *pComponentUUID)
OMX_ERRORTYPE(* GetExtensionIndex)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_STRING cParameterName, OMX_OUT OMX_INDEXTYPE *pIndexType)
OMX_PTR pComponentPrivate
OMX_ERRORTYPE(* SetCallbacks)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_CALLBACKTYPE *pCallbacks, OMX_IN OMX_PTR pAppData)
OMX_ERRORTYPE(* ComponentRoleEnum)(OMX_IN OMX_HANDLETYPE hComponent, OMX_OUT OMX_U8 *cRole, OMX_IN OMX_U32 nIndex)
OMX_ERRORTYPE(* GetState)(OMX_IN OMX_HANDLETYPE hComponent, OMX_OUT OMX_STATETYPE *pState)
OMX_ERRORTYPE(* SendCommand)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_COMMANDTYPE Cmd, OMX_IN OMX_U32 nParam1, OMX_IN OMX_PTR pCmdData)
OMX_IMAGE_CODINGTYPE eCompressionFormat
Definition: OMX_Image.h:119
OMX_NATIVE_WINDOWTYPE pNativeWindow
Definition: OMX_Image.h:121
OMX_COLOR_FORMATTYPE eColorFormat
Definition: OMX_Image.h:120
OMX_HANDLETYPE hMarkTargetComponent
Definition: OMX_Types.h:299
OMX_PTR pMarkData
Definition: OMX_Types.h:302
union OMX_PARAM_PORTDEFINITIONTYPE::@0 format
OMX_PORTDOMAINTYPE eDomain
Definition: OMX_Component.h:77
OMX_AUDIO_PORTDEFINITIONTYPE audio
Definition: OMX_Component.h:79
OMX_OTHER_PORTDEFINITIONTYPE other
Definition: OMX_Component.h:82
OMX_IMAGE_PORTDEFINITIONTYPE image
Definition: OMX_Component.h:81
OMX_VIDEO_PORTDEFINITIONTYPE video
Definition: OMX_Component.h:80
OMX_U32 nStartPortNumber
Definition: OMX_Core.h:475
OMX_U32 nGroupPriority
Definition: OMX_Core.h:276
OMX_VIDEO_CODINGTYPE eCompressionFormat
Definition: OMX_Video.h:134
OMX_NATIVE_DEVICETYPE pNativeRender
Definition: OMX_Video.h:126
OMX_NATIVE_WINDOWTYPE pNativeWindow
Definition: OMX_Video.h:136
OMX_COLOR_FORMATTYPE eColorFormat
Definition: OMX_Video.h:135
The container of an internal message.
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
OMX_ERRORTYPE(* Port_DisablePort)(omx_base_PortType *openmaxStandPort)
OMX_ERRORTYPE(* BufferProcessedCallback)(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_BOOL bIsTransientToEnabled
OMX_ERRORTYPE(* FlushProcessingBuffers)(omx_base_PortType *openmaxStandPort)
OMX_ERRORTYPE(* Port_EnablePort)(omx_base_PortType *openmaxStandPort)
OMX_ERRORTYPE(* Port_SendBufferFunction)(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_BOOL bIsPortFlushed
OMX_ERRORTYPE(* ComponentTunnelRequest)(omx_base_PortType *openmaxStandPort, OMX_HANDLETYPE hTunneledComp, OMX_U32 nTunneledPort, OMX_TUNNELSETUPTYPE *pTunnelSetup)
OMX_U32 nNumTunnelBuffer
OMX_BUFFERSUPPLIERTYPE eBufferSupplier
OMX_ERRORTYPE(* Port_FreeBuffer)(omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE(* Port_UseBuffer)(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE **ppBufferHdr, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, OMX_U32 nSizeBytes, OMX_U8 *pBuffer)
OMX_BOOL bIsTransientToDisabled
OMX_BUFFERHEADERTYPE ** pInternalBufferStorage
OMX_ERRORTYPE(* Port_AllocateBuffer)(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE **pBuffer, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, OMX_U32 nSizeBytes)
OMX_PARAM_BELLAGIOTHREADS_ID * bellagioThreads
OMX_COMPONENTTYPE * openmaxStandComp
OMX_ERRORTYPE(* messageHandler)(OMX_COMPONENTTYPE *, internalRequestMessageType *)
OMX_ERRORTYPE(* DoStateSet)(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32)
OMX_ERRORTYPE(* getQualityLevel)(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 *pQualityLevel)
OMX_ERRORTYPE(* setQualityLevel)(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 nQualityLevel)
OMX_ERRORTYPE(* destructor)(OMX_COMPONENTTYPE *openmaxStandComp)
void *(* BufferMgmtFunction)(void *param)
OMX_PORT_PARAM_TYPE sPortTypesParam[4]
Definition: queue.h:43
void tsem_deinit(tsem_t *tsem)
Definition: tsemaphore.c:57
void tsem_signal(tsem_t *tsem)
Definition: tsemaphore.c:141
void tsem_up(tsem_t *tsem)
Definition: tsemaphore.c:110
int tsem_init(tsem_t *tsem, unsigned int val)
Definition: tsemaphore.c:39
void tsem_down(tsem_t *tsem)
Definition: tsemaphore.c:97
OMX_U8 nVersionMajor
Definition: OMX_Types.h:344
struct OMX_VERSIONTYPE::@1 s
OMX_U8 nVersionMinor
Definition: OMX_Types.h:345
OMX_U8 nRevision
Definition: OMX_Types.h:346
char * errorName(OMX_ERRORTYPE error)
Definition: utils.c:90

Generated for OpenMAX Bellagio rel. 0.9.3 by  doxygen 1.5.1
SourceForge.net Logo