OpenMAXBellagio  0.9.3
omx_base_component.c
Go to the documentation of this file.
1 
27 #ifdef __cplusplus
28 extern "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;
165  openmaxStandComp->SendCommand = omx_base_component_SendCommand;
166  openmaxStandComp->GetParameter = omx_base_component_GetParameter;
167  openmaxStandComp->SetParameter = omx_base_component_SetParameter;
168  openmaxStandComp->GetConfig = omx_base_component_GetConfig;
169  openmaxStandComp->SetConfig = omx_base_component_SetConfig;
171  openmaxStandComp->GetState = omx_base_component_GetState;
172  openmaxStandComp->SetCallbacks = omx_base_component_SetCallbacks;
176 
177  /*Will make Specific port Allocate buffer call*/
179  openmaxStandComp->UseBuffer = omx_base_component_UseBuffer;
180  openmaxStandComp->UseEGLImage = omx_base_component_UseEGLImage;
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;
551  case OMX_StateExecuting:
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;
604  case OMX_StateExecuting:
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;
641  err = OMX_ErrorNone;
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;
669  case OMX_StateExecuting:
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__);
724  return OMX_ErrorBadParameter;
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);
729  return OMX_ErrorBadParameter;
730  }
731  if(ver->s.nVersionMajor != SPECVERSIONMAJOR ||
732  ver->s.nVersionMinor != SPECVERSIONMINOR) {
733  DEBUG(DEB_LEV_ERR, "The version does not match\n");
735  }
736  return OMX_ErrorNone;
737 }
738 
746 void 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);
776  return OMX_ErrorBadPortIndex;
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, 3*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) {
915  return OMX_ErrorBadParameter;
916  }
917  switch((int) nParamIndex) {
919  if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_BELLAGIOTHREADS_ID))) != OMX_ErrorNone) {
920  break;
921  }
922  threadID = (OMX_PARAM_BELLAGIOTHREADS_ID *)ComponentParameterStructure;
923  threadID->nThreadBufferMngtID = omx_base_component_Private->bellagioThreads->nThreadBufferMngtID;
924  threadID->nThreadMessageID = omx_base_component_Private->bellagioThreads->nThreadMessageID;
925  break;
930  pPortDomains = (OMX_PORT_PARAM_TYPE*)ComponentParameterStructure;
931  if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) {
932  break;
933  }
934  pPortDomains->nPorts = 0;
935  pPortDomains->nStartPortNumber = 0;
936  break;
938  pPortDef = (OMX_PARAM_PORTDEFINITIONTYPE*) ComponentParameterStructure;
939  if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_PORTDEFINITIONTYPE))) != OMX_ErrorNone) {
940  break;
941  }
942  if (pPortDef->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
943  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
944  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
945  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
946  return OMX_ErrorBadPortIndex;
947  }
948 
949  memcpy(pPortDef, &omx_base_component_Private->ports[pPortDef->nPortIndex]->sPortParam, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
950  break;
952  pPrioMgmt = (OMX_PRIORITYMGMTTYPE*)ComponentParameterStructure;
953  if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PRIORITYMGMTTYPE))) != OMX_ErrorNone) {
954  break;
955  }
956  pPrioMgmt->nGroupPriority = omx_base_component_Private->nGroupPriority;
957  pPrioMgmt->nGroupID = omx_base_component_Private->nGroupID;
958  break;
960  pBufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE*)ComponentParameterStructure;
961  if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE))) != OMX_ErrorNone) {
962  break;
963  }
964  if (pBufferSupplier->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
965  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
966  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
967  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
968  return OMX_ErrorBadPortIndex;
969  }
970 
971  pPort = omx_base_component_Private->ports[pBufferSupplier->nPortIndex];
972 
973  if (pPort->sPortParam.eDir == OMX_DirInput) {
974  if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
975  pBufferSupplier->eBufferSupplier = OMX_BufferSupplyInput;
976  } else if (PORT_IS_TUNNELED(pPort)) {
977  pBufferSupplier->eBufferSupplier = OMX_BufferSupplyOutput;
978  } else {
979  pBufferSupplier->eBufferSupplier = OMX_BufferSupplyUnspecified;
980  }
981  } else {
982  if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
983  pBufferSupplier->eBufferSupplier = OMX_BufferSupplyOutput;
984  } else if (PORT_IS_TUNNELED(pPort)) {
985  pBufferSupplier->eBufferSupplier = OMX_BufferSupplyInput;
986  } else {
987  pBufferSupplier->eBufferSupplier = OMX_BufferSupplyUnspecified;
988  }
989  }
990  break;
992  pPropTunnelSetup = (OMX_VENDOR_PROP_TUNNELSETUPTYPE*)ComponentParameterStructure;
993 
994  if (pPropTunnelSetup->nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
995  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
996  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
997  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
998 
999  DEBUG(DEB_LEV_ERR,"In %s OMX_IndexVendorCompPropTunnelFlags nPortIndex=%d Line=%d \n",
1000  __func__,(int)pPropTunnelSetup->nPortIndex,__LINE__);
1001 
1002  return OMX_ErrorBadPortIndex;
1003  }
1004 
1005  pPort = omx_base_component_Private->ports[pPropTunnelSetup->nPortIndex];
1006 
1007  pPropTunnelSetup->nTunnelSetup.nTunnelFlags = pPort->nTunnelFlags;
1008  pPropTunnelSetup->nTunnelSetup.eSupplier = pPort->eBufferSupplier;
1009  break;
1010  default:
1012  break;
1013  }
1014  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1015  return err;
1016 }
1017 
1027  OMX_HANDLETYPE hComponent,
1028  OMX_INDEXTYPE nParamIndex,
1029  OMX_PTR ComponentParameterStructure) {
1030 
1031  OMX_PRIORITYMGMTTYPE* pPrioMgmt;
1032  OMX_PARAM_PORTDEFINITIONTYPE *pPortDef;
1034  OMX_COMPONENTTYPE *omxcomponent = (OMX_COMPONENTTYPE*)hComponent;
1035  omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxcomponent->pComponentPrivate;
1036  OMX_PARAM_BUFFERSUPPLIERTYPE *pBufferSupplier;
1037  omx_base_PortType *pPort;
1038 
1039  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1040  DEBUG(DEB_LEV_PARAMS, "Setting parameter %x\n", nParamIndex);
1041  if (ComponentParameterStructure == NULL) {
1042  DEBUG(DEB_LEV_ERR, "In %s parameter provided is null! err = %x\n", __func__, err);
1043  return OMX_ErrorBadParameter;
1044  }
1045 
1046  switch(nParamIndex) {
1051  /* pPortParam = (OMX_PORT_PARAM_TYPE* ) ComponentParameterStructure;*/
1052  if (omx_base_component_Private->state != OMX_StateLoaded &&
1053  omx_base_component_Private->state != OMX_StateWaitForResources) {
1055  }
1056  if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) {
1057  break;
1058  }
1059  err = OMX_ErrorUndefined;
1060  break;
1062  pPortDef = (OMX_PARAM_PORTDEFINITIONTYPE*) ComponentParameterStructure;
1063  err = omx_base_component_ParameterSanityCheck(hComponent, pPortDef->nPortIndex, pPortDef, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
1064  if(err!=OMX_ErrorNone) {
1065  DEBUG(DEB_LEV_ERR, "In %s Parameter Check Error=%x\n",__func__,err);
1066  break;
1067  }
1068  {
1069  OMX_PARAM_PORTDEFINITIONTYPE *pPortParam;
1070  OMX_U32 j,old_nBufferCountActual=0;
1071  pPortParam = &omx_base_component_Private->ports[pPortDef->nPortIndex]->sPortParam;
1072  if(pPortDef->nBufferCountActual < pPortParam->nBufferCountMin) {
1073  DEBUG(DEB_LEV_ERR, "In %s nBufferCountActual of param (%i) is < of nBufferCountMin of port(%i)\n",__func__, (int)pPortDef->nBufferCountActual, (int)pPortParam->nBufferCountMin);
1074  err = OMX_ErrorBadParameter;
1075  break;
1076  }
1077  old_nBufferCountActual = pPortParam->nBufferCountActual;
1078  pPortParam->nBufferCountActual = pPortDef->nBufferCountActual;
1079 
1080  switch(pPortDef->eDomain) {
1081  case OMX_PortDomainAudio:
1082  memcpy(&pPortParam->format.audio, &pPortDef->format.audio, sizeof(OMX_AUDIO_PORTDEFINITIONTYPE));
1083  break;
1084  case OMX_PortDomainVideo:
1085  pPortParam->format.video.pNativeRender = pPortDef->format.video.pNativeRender;
1086  pPortParam->format.video.nFrameWidth = pPortDef->format.video.nFrameWidth;
1087  pPortParam->format.video.nFrameHeight = pPortDef->format.video.nFrameHeight;
1088  pPortParam->format.video.nStride = pPortDef->format.video.nStride;
1089  pPortParam->format.video.xFramerate = pPortDef->format.video.xFramerate;
1092  pPortParam->format.video.eColorFormat = pPortDef->format.video.eColorFormat;
1093  pPortParam->format.video.pNativeWindow = pPortDef->format.video.pNativeWindow;
1094  break;
1095  case OMX_PortDomainImage:
1096  pPortParam->format.image.nFrameWidth = pPortDef->format.image.nFrameWidth;
1097  pPortParam->format.image.nFrameHeight = pPortDef->format.image.nFrameHeight;
1098  pPortParam->format.image.nStride = pPortDef->format.image.nStride;
1101  pPortParam->format.image.eColorFormat = pPortDef->format.image.eColorFormat;
1102  pPortParam->format.image.pNativeWindow = pPortDef->format.image.pNativeWindow;
1103  break;
1104  case OMX_PortDomainOther:
1105  memcpy(&pPortParam->format.other, &pPortDef->format.other, sizeof(OMX_OTHER_PORTDEFINITIONTYPE));
1106  break;
1107  default:
1108  DEBUG(DEB_LEV_ERR, "In %s wrong port domain. Out of OpenMAX scope\n",__func__);
1109  err = OMX_ErrorBadParameter;
1110  break;
1111  }
1112 
1113  /*If component state Idle/Pause/Executing and re-alloc the following private variables */
1114  if ((omx_base_component_Private->state == OMX_StateIdle ||
1115  omx_base_component_Private->state == OMX_StatePause ||
1116  omx_base_component_Private->state == OMX_StateExecuting) &&
1117  (pPortParam->nBufferCountActual > old_nBufferCountActual)) {
1118 // todo check if here it is not better != instead of >
1119  pPort = omx_base_component_Private->ports[pPortDef->nPortIndex];
1120  if(pPort->pInternalBufferStorage) {
1121  pPort->pInternalBufferStorage = realloc(pPort->pInternalBufferStorage,pPort->sPortParam.nBufferCountActual*sizeof(OMX_BUFFERHEADERTYPE *));
1122  }
1123 
1124  if(pPort->bBufferStateAllocated) {
1125  pPort->bBufferStateAllocated = realloc(pPort->bBufferStateAllocated,pPort->sPortParam.nBufferCountActual*sizeof(BUFFER_STATUS_FLAG));
1126  for(j=0; j < pPort->sPortParam.nBufferCountActual; j++) {
1127  pPort->bBufferStateAllocated[j] = BUFFER_FREE;
1128  }
1129  }
1130  }
1131  }
1132  break;
1134  if (omx_base_component_Private->state != OMX_StateLoaded &&
1135  omx_base_component_Private->state != OMX_StateWaitForResources) {
1137  }
1138  pPrioMgmt = (OMX_PRIORITYMGMTTYPE*)ComponentParameterStructure;
1139  if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PRIORITYMGMTTYPE))) != OMX_ErrorNone) {
1140  break;
1141  }
1142  omx_base_component_Private->nGroupPriority = pPrioMgmt->nGroupPriority;
1143  omx_base_component_Private->nGroupID = pPrioMgmt->nGroupID;
1144  break;
1146  pBufferSupplier = (OMX_PARAM_BUFFERSUPPLIERTYPE*)ComponentParameterStructure;
1147 
1148  DEBUG(DEB_LEV_PARAMS, "In %s Buf Sup Port index=%d\n", __func__,(int)pBufferSupplier->nPortIndex);
1149 
1150  if(pBufferSupplier == NULL) {
1151  DEBUG(DEB_LEV_ERR, "In %s pBufferSupplier is null!\n",__func__);
1152  return OMX_ErrorBadParameter;
1153  }
1154  if(pBufferSupplier->nPortIndex > (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1155  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1156  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1157  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1158  return OMX_ErrorBadPortIndex;
1159  }
1160  err = omx_base_component_ParameterSanityCheck(hComponent, pBufferSupplier->nPortIndex, pBufferSupplier, sizeof(OMX_PARAM_BUFFERSUPPLIERTYPE));
1162  if (PORT_IS_ENABLED(omx_base_component_Private->ports[pBufferSupplier->nPortIndex])) {
1163  DEBUG(DEB_LEV_ERR, "In %s Incorrect State=%x\n",__func__,omx_base_component_Private->state);
1165  }
1166  } else if (err != OMX_ErrorNone) {
1167  break;
1168  }
1169 
1170  if (pBufferSupplier->eBufferSupplier == OMX_BufferSupplyUnspecified) {
1171  DEBUG(DEB_LEV_PARAMS, "In %s: port is already buffer supplier unspecified\n", __func__);
1172  return OMX_ErrorNone;
1173  }
1174  if ((PORT_IS_TUNNELED(omx_base_component_Private->ports[pBufferSupplier->nPortIndex])) == 0) {
1175  return OMX_ErrorNone;
1176  }
1177 
1178  pPort = omx_base_component_Private->ports[pBufferSupplier->nPortIndex];
1179 
1180  if ((pBufferSupplier->eBufferSupplier == OMX_BufferSupplyInput) &&
1181  (pPort->sPortParam.eDir == OMX_DirInput)) {
1183  if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1184  err = OMX_ErrorNone;
1185  }
1186  pPort->nTunnelFlags |= TUNNEL_IS_SUPPLIER;
1187  pBufferSupplier->nPortIndex = pPort->nTunneledPort;
1188  err = OMX_SetParameter(pPort->hTunneledComponent, OMX_IndexParamCompBufferSupplier, pBufferSupplier);
1189  } else if ((pBufferSupplier->eBufferSupplier == OMX_BufferSupplyOutput) &&
1190  (pPort->sPortParam.eDir == OMX_DirInput)) {
1191  if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1192  pPort->nTunnelFlags &= ~TUNNEL_IS_SUPPLIER;
1193  pBufferSupplier->nPortIndex = pPort->nTunneledPort;
1194  err = OMX_SetParameter(pPort->hTunneledComponent, OMX_IndexParamCompBufferSupplier, pBufferSupplier);
1195  }
1196  err = OMX_ErrorNone;
1197  } else if ((pBufferSupplier->eBufferSupplier == OMX_BufferSupplyOutput) &&
1198  (pPort->sPortParam.eDir == OMX_DirOutput)) {
1200  if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1201  err = OMX_ErrorNone;
1202  }
1203  pPort->nTunnelFlags |= TUNNEL_IS_SUPPLIER;
1204  } else {
1205  if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1206  pPort->nTunnelFlags &= ~TUNNEL_IS_SUPPLIER;
1207  err = OMX_ErrorNone;
1208  }
1209  err = OMX_ErrorNone;
1210  }
1211  DEBUG(DEB_LEV_PARAMS, "In %s port %d Tunnel flag=%x \n", __func__,(int)pBufferSupplier->nPortIndex, (int)pPort->nTunnelFlags);
1212  break;
1213  default:
1215  break;
1216  }
1217  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1218  return err;
1219 }
1220 
1229  OMX_HANDLETYPE hComponent,
1230  OMX_INDEXTYPE nIndex,
1231  OMX_PTR pComponentConfigStructure) {
1232  return OMX_ErrorNone;
1233 }
1234 
1243  OMX_HANDLETYPE hComponent,
1244  OMX_INDEXTYPE nIndex,
1245  OMX_PTR pComponentConfigStructure) {
1246  return OMX_ErrorNone;
1247 }
1248 
1255  OMX_HANDLETYPE hComponent,
1256  OMX_STRING cParameterName,
1257  OMX_INDEXTYPE* pIndexType) {
1258 
1259  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1260  if(strcmp(cParameterName,"OMX.st.index.param.BellagioThreadsID") == 0) {
1261  *pIndexType = OMX_IndexParameterThreadsID;
1262  } else {
1263  return OMX_ErrorBadParameter;
1264  }
1265  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1266  return OMX_ErrorNone;
1267 }
1268 
1274  OMX_HANDLETYPE hComponent,
1275  OMX_STATETYPE* pState) {
1276  OMX_COMPONENTTYPE *omxcomponent = (OMX_COMPONENTTYPE*)hComponent;
1277  omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxcomponent->pComponentPrivate;
1278  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1279  *pState = omx_base_component_Private->state;
1280  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1281  return OMX_ErrorNone;
1282 }
1283 
1290  OMX_HANDLETYPE hComponent,
1291  OMX_COMMANDTYPE Cmd,
1292  OMX_U32 nParam,
1293  OMX_PTR pCmdData) {
1294  OMX_COMPONENTTYPE* omxComponent = (OMX_COMPONENTTYPE*)hComponent;
1295  omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)omxComponent->pComponentPrivate;
1296  internalRequestMessageType *message;
1297  queue_t* messageQueue;
1298  tsem_t* messageSem;
1299  OMX_U32 i,j,k;
1300  omx_base_PortType *pPort;
1302  int errQue;
1303  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1304 
1305  messageQueue = omx_base_component_Private->messageQueue;
1306  messageSem = omx_base_component_Private->messageSem;
1307 
1308  if (omx_base_component_Private->state == OMX_StateInvalid) {
1309  return OMX_ErrorInvalidState;
1310  }
1311 
1312  message = calloc(1,sizeof(internalRequestMessageType));
1313  message->messageParam = nParam;
1314  message->pCmdData=pCmdData;
1316  switch (Cmd) {
1317  case OMX_CommandStateSet:
1318  message->messageType = OMX_CommandStateSet;
1319  if ((nParam == OMX_StateIdle) && (omx_base_component_Private->state == OMX_StateLoaded)) {
1320  /*Allocate Internal Buffer Storage and Buffer Allocation State flags*/
1321  /* for all ports */
1322  for(j = 0; j < NUM_DOMAINS; j++) {
1323  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1324  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1325  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1326 
1327  pPort = omx_base_component_Private->ports[i];
1328 
1329  if(pPort->pInternalBufferStorage == NULL) {
1330  pPort->pInternalBufferStorage = calloc(pPort->sPortParam.nBufferCountActual,sizeof(OMX_BUFFERHEADERTYPE *));
1331  }
1332 
1333  if(pPort->bBufferStateAllocated == NULL) {
1334  pPort->bBufferStateAllocated = calloc(pPort->sPortParam.nBufferCountActual,sizeof(BUFFER_STATUS_FLAG));
1335  }
1336 
1337  for(k=0; k < pPort->sPortParam.nBufferCountActual; k++) {
1338  pPort->bBufferStateAllocated[k] = BUFFER_FREE;
1339  }
1340  }
1341  }
1342 
1343  omx_base_component_Private->transientState = OMX_TransStateLoadedToIdle;
1344  } else if ((nParam == OMX_StateLoaded) && (omx_base_component_Private->state == OMX_StateIdle)) {
1345  omx_base_component_Private->transientState = OMX_TransStateIdleToLoaded;
1346  } else if ((nParam == OMX_StateIdle) && (omx_base_component_Private->state == OMX_StateExecuting)) {
1347  omx_base_component_Private->transientState = OMX_TransStateExecutingToIdle;
1348  } else if ((nParam == OMX_StateIdle) && (omx_base_component_Private->state == OMX_StatePause)) {
1349  omx_base_component_Private->transientState = OMX_TransStatePauseToIdle;
1350  }
1351  break;
1352  case OMX_CommandFlush:
1353  if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1354  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1355  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1356  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
1357  return OMX_ErrorBadPortIndex;
1358  }
1359  message->messageType = OMX_CommandFlush;
1360  break;
1362  if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1363  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1364  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1365  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
1366  return OMX_ErrorBadPortIndex;
1367  }
1368  message->messageType = OMX_CommandPortDisable;
1369  if(message->messageParam == OMX_ALL) {
1370  /* for all ports */
1371  for(j = 0; j < NUM_DOMAINS; j++) {
1372  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1373  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1374  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1375  omx_base_component_Private->ports[i]->bIsTransientToDisabled = OMX_TRUE;
1376  }
1377  }
1378  } else {
1379  omx_base_component_Private->ports[message->messageParam]->bIsTransientToDisabled = OMX_TRUE;
1380  }
1381  break;
1382  case OMX_CommandPortEnable:
1383  if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1384  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1385  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1386  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
1387  return OMX_ErrorBadPortIndex;
1388  }
1389  message->messageType = OMX_CommandPortEnable;
1390  if(message->messageParam == OMX_ALL) {
1391  /* for all ports */
1392  for(j = 0; j < NUM_DOMAINS; j++) {
1393  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1394  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1395  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1396  omx_base_component_Private->ports[i]->bIsTransientToEnabled = OMX_TRUE;
1397  }
1398  }
1399  } else {
1400  omx_base_component_Private->ports[message->messageParam]->bIsTransientToEnabled = OMX_TRUE;
1401  }
1402  break;
1403  case OMX_CommandMarkBuffer:
1404  if (nParam >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1405  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1406  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1407  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) && nParam != OMX_ALL) {
1408  return OMX_ErrorBadPortIndex;
1409  }
1410  message->messageType = OMX_CommandMarkBuffer;
1411  break;
1412  default:
1414  break;
1415  }
1416 
1417  if (err == OMX_ErrorNone) {
1418  errQue = queue(messageQueue, message);
1419  if (errQue) {
1420  /* /TODO the queue is full. This can be handled in a fine way with
1421  * some retrials, or other checking. For the moment this is a critical error
1422  * and simply causes the failure of this call
1423  */
1425  }
1426  tsem_up(messageSem);
1427  }
1428  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1429  return err;
1430 }
1431 
1438 void* compMessageHandlerFunction(void* param) {
1439  OMX_COMPONENTTYPE *openmaxStandComp = (OMX_COMPONENTTYPE *)param;
1440  omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)openmaxStandComp->pComponentPrivate;
1441  internalRequestMessageType *message;
1442 
1443  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, openmaxStandComp);
1444  omx_base_component_Private->bellagioThreads->nThreadMessageID = (long int)syscall(__NR_gettid);
1445  DEBUG(DEB_LEV_SIMPLE_SEQ, "In %s the thread ID is %i\n", __func__, (int)omx_base_component_Private->bellagioThreads->nThreadMessageID);
1446 
1447  while(1){
1448  /* Wait for an incoming message */
1449  if (omx_base_component_Private == NULL) {
1450  break;
1451  }
1452  tsem_down(omx_base_component_Private->messageSem);
1453  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s new message\n", __func__);
1454  /*Destructor has been called. So exit from the loop*/
1455  if(omx_base_component_Private->state == OMX_StateInvalid) {
1456  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s Destructor has been called. So exit from the loop\n", __func__);
1457  break;
1458  }
1459  /* Dequeue it */
1460  message = dequeue(omx_base_component_Private->messageQueue);
1461  if(message == NULL){
1462  DEBUG(DEB_LEV_ERR, "In %s: ouch!! had null message!\n", __func__);
1463  break;
1464  }
1465  /* Process it by calling component's message handler method */
1466  omx_base_component_Private->messageHandler(openmaxStandComp, message);
1467  /* Message ownership has been transferred to us
1468  * so we gonna free it when finished.
1469  */
1470  free(message);
1471  message = NULL;
1472  }
1473  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, openmaxStandComp);
1474  return NULL;
1475 }
1476 
1489  omx_base_component_PrivateType* omx_base_component_Private=openmaxStandComp->pComponentPrivate;
1490  OMX_U32 i,j,k;
1492  omx_base_PortType* pPort;
1493 
1494  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p with message %i\n", __func__, openmaxStandComp, message->messageType);
1495 
1496  /* Dealing with a SendCommand call.
1497  * -messageType contains the command to execute
1498  * -messageParam contains the parameter of the command
1499  * (destination state in case of a state change command).
1500  */
1501  switch(message->messageType){
1502  case OMX_CommandStateSet: {
1503  /* Do the actual state change */
1504  err = (*(omx_base_component_Private->DoStateSet))(openmaxStandComp, message->messageParam);
1505  if (err != OMX_ErrorNone) {
1506  (*(omx_base_component_Private->callbacks->EventHandler))
1507  (openmaxStandComp,
1508  omx_base_component_Private->callbackData,
1509  OMX_EventError, /* The command was completed */
1510  err, /* The commands was a OMX_CommandStateSet */
1511  0, /* The state has been changed in message->messageParam */
1512  NULL);
1513  } else {
1514  /* And run the callback */
1515  if (omx_base_component_Private->callbacks) {
1516  DEBUG(DEB_LEV_SIMPLE_SEQ, "running callback in %s\n", __func__);
1517  (*(omx_base_component_Private->callbacks->EventHandler))
1518  (openmaxStandComp,
1519  omx_base_component_Private->callbackData,
1520  OMX_EventCmdComplete, /* The command was completed */
1521  OMX_CommandStateSet, /* The commands was a OMX_CommandStateSet */
1522  message->messageParam, /* The state has been changed in message->messageParam */
1523  NULL);
1524  }
1525  }
1526  }
1527  break;
1528  case OMX_CommandFlush: {
1529  /*Flush port/s*/
1530  if(message->messageParam == OMX_ALL) {
1531  /* for all ports */
1532  for(j = 0; j < NUM_DOMAINS; j++) {
1533  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1534  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1535  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1536  omx_base_component_Private->ports[i]->bIsPortFlushed = OMX_TRUE;
1537  }
1538  }
1539  /* for all ports */
1540  for(j = 0; j < NUM_DOMAINS; j++) {
1541  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1542  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1543  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1544  pPort=omx_base_component_Private->ports[i];
1545  err = pPort->FlushProcessingBuffers(pPort);
1546  }
1547  }
1548  }
1549  else {
1550  pPort=omx_base_component_Private->ports[message->messageParam];
1551  err = pPort->FlushProcessingBuffers(pPort);
1552  }
1553  if (err != OMX_ErrorNone) {
1554  (*(omx_base_component_Private->callbacks->EventHandler))
1555  (openmaxStandComp,
1556  omx_base_component_Private->callbackData,
1557  OMX_EventError, /* The command was completed */
1558  err, /* The commands was a OMX_CommandStateSet */
1559  0, /* The state has been changed in message->messageParam */
1560  NULL);
1561  } else {
1562  if(message->messageParam == OMX_ALL){ /*Flush all port*/
1563  /* for all ports */
1564  for(j = 0; j < NUM_DOMAINS; j++) {
1565  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1566  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1567  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1568  (*(omx_base_component_Private->callbacks->EventHandler))
1569  (openmaxStandComp,
1570  omx_base_component_Private->callbackData,
1571  OMX_EventCmdComplete, /* The command was completed */
1572  OMX_CommandFlush, /* The commands was a OMX_CommandStateSet */
1573  i, /* The state has been changed in message->messageParam */
1574  NULL);
1575 
1576  pPort=omx_base_component_Private->ports[i];
1577  /* Signal the buffer Semaphore and the buffer managment semaphore, to restart the exchange of buffers after flush */
1578  if (PORT_IS_TUNNELED(pPort) && PORT_IS_BUFFER_SUPPLIER(pPort)) {
1579  for(k=0;k<pPort->nNumTunnelBuffer;k++) {
1580  tsem_up(pPort->pBufferSem);
1581  /*signal buffer management thread availability of buffers*/
1582  tsem_up(omx_base_component_Private->bMgmtSem);
1583  }
1584  }
1585  }
1586  }
1587  } else {/*Flush input/output port*/
1588  (*(omx_base_component_Private->callbacks->EventHandler))
1589  (openmaxStandComp,
1590  omx_base_component_Private->callbackData,
1591  OMX_EventCmdComplete, /* The command was completed */
1592  OMX_CommandFlush, /* The commands was a OMX_CommandStateSet */
1593  message->messageParam, /* The state has been changed in message->messageParam */
1594  NULL);
1595  /* Signal the buffer Semaphore and the buffer managment semaphore, to restart the exchange of buffers after flush */
1596  if (PORT_IS_TUNNELED(omx_base_component_Private->ports[message->messageParam])
1597  && PORT_IS_BUFFER_SUPPLIER(omx_base_component_Private->ports[message->messageParam])) {
1598  for(j=0;j<omx_base_component_Private->ports[message->messageParam]->nNumTunnelBuffer;j++) {
1599  tsem_up(omx_base_component_Private->ports[message->messageParam]->pBufferSem);
1600  /*signal buffer management thread availability of buffers*/
1601  tsem_up(omx_base_component_Private->bMgmtSem);
1602  }
1603  }
1604  }
1605  }
1606  }
1607  break;
1608  case OMX_CommandPortDisable: {
1609  /*Flush port/s*/
1610  if(message->messageParam == OMX_ALL) {
1611  /*If Component is not in loaded state,then First Flush all buffers then disable the port*/
1612  if(omx_base_component_Private->state!=OMX_StateLoaded) {
1613  /* for all ports */
1614  for(j = 0; j < NUM_DOMAINS; j++) {
1615  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1616  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1617  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1618  pPort=omx_base_component_Private->ports[i];
1619  err = pPort->FlushProcessingBuffers(pPort);
1620  }
1621  }
1622  }
1623  /* for all ports */
1624  for(j = 0; j < NUM_DOMAINS; j++) {
1625  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1626  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1627  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1628  pPort=omx_base_component_Private->ports[i];
1629  err = pPort->Port_DisablePort(pPort);
1630  }
1631  }
1632  }
1633  else {
1634  pPort=omx_base_component_Private->ports[message->messageParam];
1635  if(omx_base_component_Private->state!=OMX_StateLoaded) {
1636  err = pPort->FlushProcessingBuffers(pPort);
1637  DEBUG(DEB_LEV_FULL_SEQ, "In %s: Port Flush completed for Comp %s\n",__func__,omx_base_component_Private->name);
1638  }
1639  err = pPort->Port_DisablePort(pPort);
1640  }
1642  if (err != OMX_ErrorNone) {
1643  (*(omx_base_component_Private->callbacks->EventHandler))
1644  (openmaxStandComp,
1645  omx_base_component_Private->callbackData,
1646  OMX_EventError, /* The command was completed */
1647  err, /* The commands was a OMX_CommandStateSet */
1648  0, /* The state has been changed in message->messageParam */
1649  NULL);
1650  } else {
1651  if(message->messageParam == OMX_ALL){ /*Disable all ports*/
1652  /* for all ports */
1653  for(j = 0; j < NUM_DOMAINS; j++) {
1654  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1655  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1656  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1657  (*(omx_base_component_Private->callbacks->EventHandler))
1658  (openmaxStandComp,
1659  omx_base_component_Private->callbackData,
1660  OMX_EventCmdComplete, /* The command was completed */
1661  OMX_CommandPortDisable, /* The commands was a OMX_CommandStateSet */
1662  i, /* The state has been changed in message->messageParam */
1663  NULL);
1664  }
1665  }
1666  } else {
1667  (*(omx_base_component_Private->callbacks->EventHandler))
1668  (openmaxStandComp,
1669  omx_base_component_Private->callbackData,
1670  OMX_EventCmdComplete, /* The command was completed */
1671  OMX_CommandPortDisable, /* The commands was a OMX_CommandStateSet */
1672  message->messageParam, /* The state has been changed in message->messageParam */
1673  NULL);
1674  }
1675  }
1676  }
1677  break;
1678  case OMX_CommandPortEnable:{
1679  /*Flush port/s*/
1680  if(message->messageParam == OMX_ALL) {
1681  /* for all ports */
1682  for(j = 0; j < NUM_DOMAINS; j++) {
1683  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1684  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1685  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1686  pPort=omx_base_component_Private->ports[i];
1687  err = pPort->Port_EnablePort(pPort);
1688  }
1689  }
1690  } else {
1691  pPort=omx_base_component_Private->ports[message->messageParam];
1692  err = pPort->Port_EnablePort(pPort);
1693  }
1694  if (err != OMX_ErrorNone) {
1695  (*(omx_base_component_Private->callbacks->EventHandler))
1696  (openmaxStandComp,
1697  omx_base_component_Private->callbackData,
1698  OMX_EventError, /* The command was completed */
1699  err, /* The commands was a OMX_CommandStateSet */
1700  0, /* The state has been changed in message->messageParam */
1701  NULL);
1702  } else {
1703  if(message->messageParam != OMX_ALL) {
1704  (*(omx_base_component_Private->callbacks->EventHandler))
1705  (openmaxStandComp,
1706  omx_base_component_Private->callbackData,
1707  OMX_EventCmdComplete, /* The command was completed */
1708  OMX_CommandPortEnable, /* The commands was a OMX_CommandStateSet */
1709  message->messageParam, /* The state has been changed in message->messageParam */
1710  NULL);
1711 
1712  if (omx_base_component_Private->state==OMX_StateExecuting) {
1713  pPort=omx_base_component_Private->ports[message->messageParam];
1714  if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1715  for(i=0; i < pPort->sPortParam.nBufferCountActual;i++) {
1716  tsem_up(pPort->pBufferSem);
1717  tsem_up(omx_base_component_Private->bMgmtSem);
1718  }
1719  }
1720  }
1721 
1722  } else {
1723  /* for all ports */
1724  for(j = 0; j < NUM_DOMAINS; j++) {
1725  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1726  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1727  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1728  (*(omx_base_component_Private->callbacks->EventHandler))
1729  (openmaxStandComp,
1730  omx_base_component_Private->callbackData,
1731  OMX_EventCmdComplete, /* The command was completed */
1732  OMX_CommandPortEnable, /* The commands was a OMX_CommandStateSet */
1733  i, /* The state has been changed in message->messageParam */
1734  NULL);
1735  }
1736  }
1737 
1738  if (omx_base_component_Private->state==OMX_StateExecuting) {
1739  /* for all ports */
1740  for(j = 0; j < NUM_DOMAINS; j++) {
1741  for(i = omx_base_component_Private->sPortTypesParam[j].nStartPortNumber;
1742  i < omx_base_component_Private->sPortTypesParam[j].nStartPortNumber +
1743  omx_base_component_Private->sPortTypesParam[j].nPorts; i++) {
1744  pPort=omx_base_component_Private->ports[i];
1745  if (PORT_IS_BUFFER_SUPPLIER(pPort)) {
1746  for(k=0; k < pPort->sPortParam.nBufferCountActual;k++) {
1747  tsem_up(pPort->pBufferSem);
1748  tsem_up(omx_base_component_Private->bMgmtSem);
1749  }
1750  }
1751  }
1752  }
1753  }
1754  }
1755  }
1756  }
1757  break;
1758  case OMX_CommandMarkBuffer: {
1759  omx_base_component_Private->pMark.hMarkTargetComponent = ((OMX_MARKTYPE *)message->pCmdData)->hMarkTargetComponent;
1760  omx_base_component_Private->pMark.pMarkData = ((OMX_MARKTYPE *)message->pCmdData)->pMarkData;
1761  }
1762  break;
1763  default:
1764  DEBUG(DEB_LEV_ERR, "In %s: Unrecognized command %i\n", __func__, message->messageType);
1765  break;
1766  }
1767  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, openmaxStandComp);
1768  return OMX_ErrorNone;
1769 }
1770 
1772  OMX_HANDLETYPE hComponent,
1773  OMX_BUFFERHEADERTYPE** ppBuffer,
1774  OMX_U32 nPortIndex,
1775  OMX_PTR pAppPrivate,
1776  OMX_U32 nSizeBytes) {
1777  omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1778  omx_base_PortType *pPort;
1780 
1781  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1782 
1783  if (nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1784  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1785  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1786  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1787  DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
1788  return OMX_ErrorBadPortIndex;
1789  }
1790  pPort = omx_base_component_Private->ports[nPortIndex];
1791  err = pPort->Port_AllocateBuffer(pPort, ppBuffer, nPortIndex, pAppPrivate, nSizeBytes);
1792  if (err != OMX_ErrorNone) {
1793  DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
1794  return err;
1795  }
1796  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p buffer %p\n", __func__, hComponent, ppBuffer);
1797  return OMX_ErrorNone;
1798 }
1799 
1801  OMX_HANDLETYPE hComponent,
1802  OMX_BUFFERHEADERTYPE** ppBufferHdr,
1803  OMX_U32 nPortIndex,
1804  OMX_PTR pAppPrivate,
1805  OMX_U32 nSizeBytes,
1806  OMX_U8* pBuffer) {
1807  omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1808  omx_base_PortType *pPort;
1810 
1811  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1812  if (nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1813  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1814  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1815  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1816  DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
1817  return OMX_ErrorBadPortIndex;
1818  }
1819  pPort = omx_base_component_Private->ports[nPortIndex];
1820  err = pPort->Port_UseBuffer(pPort, ppBufferHdr, nPortIndex, pAppPrivate, nSizeBytes, pBuffer);
1821  if (err != OMX_ErrorNone) {
1822  DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
1823  return err;
1824  }
1825  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1826  return OMX_ErrorNone;
1827 }
1828 
1830  OMX_HANDLETYPE hComponent,
1831  OMX_BUFFERHEADERTYPE** ppBufferHdr,
1832  OMX_U32 nPortIndex,
1833  OMX_PTR pAppPrivate,
1834  void* eglImage) {
1835  return OMX_ErrorNotImplemented;
1836 }
1837 
1839  OMX_HANDLETYPE hComponent,
1840  OMX_U32 nPortIndex,
1841  OMX_BUFFERHEADERTYPE* pBuffer) {
1842  omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1843  omx_base_PortType *pPort;
1845 
1846  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1847  if (nPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1848  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1849  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1850  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1851  DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
1852  return OMX_ErrorBadPortIndex;
1853  }
1854 
1855  pPort = omx_base_component_Private->ports[nPortIndex];
1856  err = pPort->Port_FreeBuffer(pPort, nPortIndex, pBuffer);
1857  if (err != OMX_ErrorNone) {
1858  DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
1859  return err;
1860  }
1861  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1862  return OMX_ErrorNone;
1863 }
1864 
1866  OMX_HANDLETYPE hComponent,
1867  OMX_BUFFERHEADERTYPE* pBuffer) {
1868  omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1869  omx_base_PortType *pPort;
1871 
1872  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1873 
1874  if (pBuffer->nInputPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1875  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1876  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1877  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1878  DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
1879  return OMX_ErrorBadPortIndex;
1880  }
1881  pPort = omx_base_component_Private->ports[pBuffer->nInputPortIndex];
1882  if (pPort->sPortParam.eDir != OMX_DirInput) {
1883  DEBUG(DEB_LEV_ERR, "In %s: wrong port direction in Component %s\n", __func__,omx_base_component_Private->name);
1884  return OMX_ErrorBadPortIndex;
1885  }
1886  err = pPort->Port_SendBufferFunction(pPort, pBuffer);
1887  if (err != OMX_ErrorNone) {
1888  DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %s\n", __func__, hComponent, errorName(err));
1889  return err;
1890  }
1891  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1892  return OMX_ErrorNone;
1893 }
1894 
1896  OMX_HANDLETYPE hComponent,
1897  OMX_BUFFERHEADERTYPE* pBuffer) {
1898 
1899  omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1900  omx_base_PortType *pPort;
1902 
1903  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1904  if (pBuffer->nOutputPortIndex >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1905  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1906  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1907  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1908  DEBUG(DEB_LEV_ERR, "In %s: wrong port index\n", __func__);
1909  return OMX_ErrorBadPortIndex;
1910  }
1911  pPort = omx_base_component_Private->ports[pBuffer->nOutputPortIndex];
1912  if (pPort->sPortParam.eDir != OMX_DirOutput) {
1913  DEBUG(DEB_LEV_ERR, "In %s: wrong port(%d) direction(%x) pBuffer=%p in Component %s\n", __func__,
1914  (int)pBuffer->nOutputPortIndex, (int)pPort->sPortParam.eDir, pBuffer, omx_base_component_Private->name);
1915  return OMX_ErrorBadPortIndex;
1916  }
1917  err = pPort->Port_SendBufferFunction(pPort, pBuffer);
1918  if (err != OMX_ErrorNone) {
1919  DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %s\n", __func__, hComponent, errorName(err));
1920  return err;
1921  }
1922  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1923  return OMX_ErrorNone;
1924 }
1925 
1927  OMX_HANDLETYPE hComponent,
1928  OMX_U32 nPort,
1929  OMX_HANDLETYPE hTunneledComp,
1930  OMX_U32 nTunneledPort,
1931  OMX_TUNNELSETUPTYPE* pTunnelSetup) {
1932 
1933  omx_base_component_PrivateType* omx_base_component_Private = (omx_base_component_PrivateType*)((OMX_COMPONENTTYPE*)hComponent)->pComponentPrivate;
1934  omx_base_PortType *pPort;
1936 
1937  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s for component %p\n", __func__, hComponent);
1938  if (nPort >= (omx_base_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts +
1939  omx_base_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
1940  omx_base_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts +
1941  omx_base_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)) {
1942  return OMX_ErrorBadPortIndex;
1943  }
1944 
1945  pPort = omx_base_component_Private->ports[nPort];
1946  err = pPort->ComponentTunnelRequest(pPort, hTunneledComp, nTunneledPort, pTunnelSetup);
1947  if (err != OMX_ErrorNone) {
1948  DEBUG(DEB_LEV_ERR, "Out of %s for component %p with err %i\n", __func__, hComponent, (int)err);
1949  return err;
1950  }
1951  DEBUG(DEB_LEV_FUNCTION_NAME, "Out of %s for component %p\n", __func__, hComponent);
1952  return OMX_ErrorNone;
1953 }
1954 
1956  omx_base_component_PrivateType* omx_base_component_Private = openmaxStandComp->pComponentPrivate;
1957  DEBUG(DEB_LEV_FUNCTION_NAME, "In %s\n", __func__);
1958  *pQualityLevel = omx_base_component_Private->currentQualityLevel;
1959  return OMX_ErrorNone;
1960 }
1961 
1963  omx_base_component_PrivateType* omx_base_component_Private = openmaxStandComp->pComponentPrivate;
1964  /* this change is done regardless to the state. When the way to change effectively quality in a component is known
1965  * change this function adding state checks
1966  */
1967  DEBUG(DEB_LEV_SIMPLE_SEQ, "In %s setting %i of %i\n", __func__, (int)nQualityLevel, (int)omx_base_component_Private->nqualitylevels);
1968  if ((nQualityLevel > 0) && (nQualityLevel <= omx_base_component_Private->nqualitylevels)) {
1969  omx_base_component_Private->currentQualityLevel = nQualityLevel;
1970  return OMX_ErrorNone;
1971  } else {
1972  return OMX_ErrorBadParameter;
1973  }
1974 }
1975 
1976 #ifdef __cplusplus
1977 }
1978 #endif
1979 
OMX_ERRORTYPE(* EmptyBufferDone)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_PTR pAppData, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
Definition: OMX_Core.h:560
OMX_PTR pMarkData
Definition: OMX_Types.h:302
OMX_U32 nNumTunnelBuffer
OMX_ERRORTYPE omx_base_component_SetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
Part of the standard OpenMAX function.
OMX_BOOL bIsTransientToDisabled
void * OMX_HANDLETYPE
Definition: OMX_Types.h:295
char * errorName(OMX_ERRORTYPE error)
Definition: utils.c:90
OMX_ERRORTYPE(* BufferProcessedCallback)(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE *pBuffer)
#define DEB_LEV_PARAMS
OMX_IMAGE_PORTDEFINITIONTYPE image
Definition: OMX_Component.h:81
unsigned long OMX_U32
Definition: OMX_Types.h:145
OMX_ERRORTYPE omx_base_setQualityLevel(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 nQualityLevel)
OMX_ERRORTYPE omx_base_component_EmptyThisBuffer(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_U32 nStartPortNumber
Definition: OMX_Core.h:475
OMX_BOOL bIsTransientToEnabled
OMX_ERRORTYPE omx_base_component_ParameterSanityCheck(OMX_HANDLETYPE hComponent, OMX_U32 nPortIndex, OMX_PTR pStructure, size_t size)
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(* Port_DisablePort)(omx_base_PortType *openmaxStandPort)
OMX_ERRORTYPE omx_base_getQualityLevel(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 *pQualityLevel)
OMX_ERRORTYPE omx_base_component_UseEGLImage(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE **ppBufferHdr, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, void *eglImage)
#define SPECVERSIONMINOR
Definition: omxcore.h:52
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_MessageHandler(OMX_COMPONENTTYPE *openmaxStandComp, internalRequestMessageType *message)
OMX_ERRORTYPE checkHeader(OMX_PTR header, OMX_U32 size)
Checks the header of a structure for consistency with size and spec version.
OMX_NATIVE_WINDOWTYPE pNativeWindow
Definition: OMX_Video.h:136
#define DEB_LEV_SIMPLE_SEQ
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)
OMX_ERRORTYPE omx_base_component_DoStateSet(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 destinationState)
#define SPECSTEP
Definition: omxcore.h:56
void tsem_signal(tsem_t *tsem)
Definition: tsemaphore.c:141
OMX_ERRORTYPE omx_base_component_SetConfig(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure)
base SetConfig function
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(* FillBufferDone)(OMX_OUT OMX_HANDLETYPE hComponent, OMX_OUT OMX_PTR pAppData, OMX_OUT OMX_BUFFERHEADERTYPE *pBuffer)
Definition: OMX_Core.h:589
OMX_ERRORTYPE(* Port_AllocateBuffer)(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE **pBuffer, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, OMX_U32 nSizeBytes)
OMX_U32 nGroupPriority
Definition: OMX_Core.h:276
#define DEBUG(n, fmt, args...)
struct OMX_VERSIONTYPE::@1 s
struct OMX_COMPONENTTYPE OMX_COMPONENTTYPE
OMX_ERRORTYPE(* setQualityLevel)(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 nQualityLevel)
OMX_HANDLETYPE hMarkTargetComponent
Definition: OMX_Types.h:299
OMX_ERRORTYPE omx_base_component_GetState(OMX_HANDLETYPE hComponent, OMX_STATETYPE *pState)
union OMX_PARAM_PORTDEFINITIONTYPE::@0 format
void queue_deinit(queue_t *queue)
Definition: queue.c:77
char * OMX_STRING
Definition: OMX_Types.h:206
unsigned char OMX_UUIDTYPE[128]
Definition: OMX_Types.h:219
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)
void * OMX_PTR
Definition: OMX_Types.h:199
OMX_BOOL
Definition: OMX_Types.h:189
OMX_INDEXTYPE
Definition: OMX_Index.h:60
OMX_ERRORTYPE omx_base_component_SetCallbacks(OMX_HANDLETYPE hComponent, OMX_CALLBACKTYPE *pCallbacks, OMX_PTR pAppData)
standard OpenMAX function
OMX_ERRORTYPE(* FreeBuffer)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_U32 nPortIndex, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
#define DEB_LEV_ERR
OMX_ERRORTYPE omx_base_component_AllocateBuffer(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE **ppBuffer, OMX_U32 nPortIndex, OMX_PTR pAppPrivate, OMX_U32 nSizeBytes)
OMX_VERSIONTYPE nVersion
OMX_NATIVE_DEVICETYPE pNativeRender
Definition: OMX_Video.h:126
OMX_VIDEO_PORTDEFINITIONTYPE video
Definition: OMX_Component.h:80
OMX_ERRORTYPE(* ComponentRoleEnum)(OMX_IN OMX_HANDLETYPE hComponent, OMX_OUT OMX_U8 *cRole, OMX_IN OMX_U32 nIndex)
void tsem_up(tsem_t *tsem)
Definition: tsemaphore.c:110
void * compMessageHandlerFunction(void *param)
Component's message handler thread function.
int queue_init(queue_t *queue)
Definition: queue.c:38
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(* 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_NATIVE_WINDOWTYPE pNativeWindow
Definition: OMX_Image.h:121
OMX_IMAGE_CODINGTYPE eCompressionFormat
Definition: OMX_Image.h:119
OMX_OTHER_PORTDEFINITIONTYPE other
Definition: OMX_Component.h:82
void tsem_down(tsem_t *tsem)
Definition: tsemaphore.c:97
#define SPECREVISION
Definition: omxcore.h:54
Definition: queue.h:43
OMX_ERRORTYPE omx_base_component_ComponentTunnelRequest(OMX_HANDLETYPE hComponent, OMX_U32 nPort, OMX_HANDLETYPE hTunneledComp, OMX_U32 nTunneledPort, OMX_TUNNELSETUPTYPE *pTunnelSetup)
#define PORT_IS_BUFFER_SUPPLIER(pPort)
Definition: omx_base_port.h:45
OMX_VIDEO_CODINGTYPE eCompressionFormat
Definition: OMX_Video.h:134
OMX_ERRORTYPE(* DoStateSet)(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32)
OMX_U32 nInputPortIndex
Definition: OMX_Core.h:441
OMX_COLOR_FORMATTYPE eColorFormat
Definition: OMX_Video.h:135
The container of an internal message.
OMX_ERRORTYPE(* GetState)(OMX_IN OMX_HANDLETYPE hComponent, OMX_OUT OMX_STATETYPE *pState)
OMX_ERRORTYPE(* ComponentDeInit)(OMX_IN OMX_HANDLETYPE hComponent)
OMX_ERRORTYPE omx_base_component_GetConfig(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nIndex, OMX_PTR pComponentConfigStructure)
base GetConfig function
OMX_COMPONENTTYPE * openmaxStandComp
#define OMX_SetParameter(hComponent,nParamIndex,pComponentParameterStructure)
Definition: OMX_Core.h:825
OMX_ERRORTYPE(* SetCallbacks)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_CALLBACKTYPE *pCallbacks, OMX_IN OMX_PTR pAppData)
OMX_ERRORTYPE(* destructor)(OMX_COMPONENTTYPE *openmaxStandComp)
#define NUM_DOMAINS
#define OMX_ALL
Definition: OMX_Types.h:99
#define PORT_IS_ENABLED(pPort)
Definition: omx_base_port.h:41
int queue(queue_t *queue, void *data)
Definition: queue.c:103
OMX_ERRORTYPE omx_base_component_Destructor(OMX_COMPONENTTYPE *openmaxStandComp)
The base destructor for ST OpenMAX components.
OMX_ERRORTYPE omx_base_component_ComponentDeInit(OMX_HANDLETYPE hComponent)
This standard functionality is called when the component is destroyed in the FreeHandle standard call...
#define OSCL_EXPORT_REF
OMX_ERRORTYPE(* SetConfig)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_IN OMX_PTR pComponentConfigStructure)
#define OMX_MAX_STRINGNAME_SIZE
Definition: OMX_Core.h:281
OMX_PARAM_BELLAGIOTHREADS_ID * bellagioThreads
unsigned char OMX_U8
Definition: OMX_Types.h:133
OMX_U32 nOutputPortIndex
Definition: OMX_Core.h:439
OMX_ERRORTYPE(* FlushProcessingBuffers)(omx_base_PortType *openmaxStandPort)
OMX_ERRORTYPE err
OMX_BUFFERSUPPLIERTYPE eBufferSupplier
OMX_PTR pApplicationPrivate
OMX_ERRORTYPE RM_getResource(OMX_COMPONENTTYPE *openmaxStandComp)
OMX_U8 nVersionMinor
Definition: OMX_Types.h:333
OMX_ERRORTYPE(* Port_FreeBuffer)(omx_base_PortType *openmaxStandPort, OMX_U32 nPortIndex, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE(* ComponentTunnelRequest)(omx_base_PortType *openmaxStandPort, OMX_HANDLETYPE hTunneledComp, OMX_U32 nTunneledPort, OMX_TUNNELSETUPTYPE *pTunnelSetup)
OMX_PORTDOMAINTYPE eDomain
Definition: OMX_Component.h:77
OMX_U8 nVersionMajor
Definition: OMX_Types.h:332
OMX_ERRORTYPE RM_removeFromWaitForResource(OMX_COMPONENTTYPE *openmaxStandComp)
#define DEB_LEV_FULL_SEQ
OMX_BUFFERHEADERTYPE ** pInternalBufferStorage
OMX_ERRORTYPE(* FillThisBuffer)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
void tsem_deinit(tsem_t *tsem)
Definition: tsemaphore.c:57
OMX_ERRORTYPE(* SendCommand)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_COMMANDTYPE Cmd, OMX_IN OMX_U32 nParam1, OMX_IN OMX_PTR pCmdData)
OMX_ERRORTYPE(* EmptyThisBuffer)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE(* GetConfig)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_INOUT OMX_PTR pComponentConfigStructure)
OMX_STATETYPE
Definition: OMX_Core.h:92
OMX_ERRORTYPE(* GetExtensionIndex)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_STRING cParameterName, OMX_OUT OMX_INDEXTYPE *pIndexType)
OMX_ERRORTYPE(* SetParameter)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_IN OMX_PTR pComponentParameterStructure)
OMX_ERRORTYPE(* Port_EnablePort)(omx_base_PortType *openmaxStandPort)
OMX_COMMANDTYPE
Definition: OMX_Core.h:49
OMX_PTR pComponentPrivate
#define DEB_LEV_FUNCTION_NAME
int tsem_init(tsem_t *tsem, unsigned int val)
Definition: tsemaphore.c:39
OMX_ERRORTYPE(* getQualityLevel)(OMX_COMPONENTTYPE *openmaxStandComp, OMX_U32 *pQualityLevel)
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 omx_base_component_GetParameter(OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure)
Part of the standard OpenMAX function.
void base_constructor_remove_garbage_collected(omx_base_component_PrivateType *omx_base_component_Private)
OMX_AUDIO_PORTDEFINITIONTYPE audio
Definition: OMX_Component.h:79
#define PORT_IS_TUNNELED_N_BUFFER_SUPPLIER(pPort)
Definition: omx_base_port.h:46
OMX_ERRORTYPE omx_base_component_SendCommand(OMX_HANDLETYPE hComponent, OMX_COMMANDTYPE Cmd, OMX_U32 nParam, OMX_PTR pCmdData)
standard SendCommand function
OMX_ERRORTYPE(* Port_SendBufferFunction)(omx_base_PortType *openmaxStandPort, OMX_BUFFERHEADERTYPE *pBuffer)
OMX_ERRORTYPE omx_base_component_GetExtensionIndex(OMX_HANDLETYPE hComponent, OMX_STRING cParameterName, OMX_INDEXTYPE *pIndexType)
base function not implemented
OMX_ERRORTYPE omx_base_component_FillThisBuffer(OMX_HANDLETYPE hComponent, OMX_BUFFERHEADERTYPE *pBuffer)
void * dequeue(queue_t *queue)
Definition: queue.c:122
OMX_ERRORTYPE(* messageHandler)(OMX_COMPONENTTYPE *, internalRequestMessageType *)
OMX_ERRORTYPE(* GetParameter)(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR pComponentParameterStructure)
OMX_ERRORTYPE RM_waitForResource(OMX_COMPONENTTYPE *openmaxStandComp)
BUFFER_STATUS_FLAG
Definition: omx_base_port.h:72
OMX_ERRORTYPE omx_base_component_ComponentRoleEnum(OMX_HANDLETYPE hComponent, OMX_U8 *cRole, OMX_U32 nIndex)
Enumerates all the roles of the component.
#define SPECVERSIONMAJOR
Definition: omxcore.h:50
void *(* BufferMgmtFunction)(void *param)
OMX_ERRORTYPE RM_releaseResource(OMX_COMPONENTTYPE *openmaxStandComp)
OMX_PARAM_PORTDEFINITIONTYPE sPortParam
OMX_PORT_PARAM_TYPE sPortTypesParam[4]
#define PORT_IS_TUNNELED(pPort)
Definition: omx_base_port.h:43
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(* 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_BOOL bIsPortFlushed
OMX_COLOR_FORMATTYPE eColorFormat
Definition: OMX_Image.h:120
OMX_ERRORTYPE
Definition: OMX_Core.h:126
OMX_U8 nRevision
Definition: OMX_Types.h:334
OMX_ERRORTYPE omx_base_component_FreeBuffer(OMX_HANDLETYPE hComponent, 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)

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