OMX_ERRORTYPE omx_volume_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName) {
  OMX_ERRORTYPE err = OMX_ErrorNone;  
  omx_volume_component_PrivateType* omx_volume_component_Private;
  OMX_U32 i;

  if (!openmaxStandComp->pComponentPrivate) {
    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, allocating component\n",__func__);
    openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_volume_component_PrivateType));
    if(openmaxStandComp->pComponentPrivate == NULL) {
      return OMX_ErrorInsufficientResources;
    }
  } else {
    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int)openmaxStandComp->pComponentPrivate);
  }

  omx_volume_component_Private = openmaxStandComp->pComponentPrivate;
  omx_volume_component_Private->ports = NULL;
  
  /** Calling base filter constructor */
  err = omx_base_filter_Constructor(openmaxStandComp, cComponentName);

  omx_volume_component_Private->sPortTypesParam[OMX_PortDomainAudio].nStartPortNumber = 0;
  omx_volume_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts = 2;

  /** Allocate Ports and call port constructor. */  
  if (omx_volume_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts && !omx_volume_component_Private->ports) {
    omx_volume_component_Private->ports = calloc(omx_volume_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts, sizeof(omx_base_PortType *));
    if (!omx_volume_component_Private->ports) {
      return OMX_ErrorInsufficientResources;
    }
    for (i=0; i < omx_volume_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts; i++) {
      omx_volume_component_Private->ports[i] = calloc(1, sizeof(omx_base_audio_PortType));
      if (!omx_volume_component_Private->ports[i]) {
        return OMX_ErrorInsufficientResources;
      }
    }
  }

  base_audio_port_Constructor(openmaxStandComp, &omx_volume_component_Private->ports[0], 0, OMX_TRUE);
  base_audio_port_Constructor(openmaxStandComp, &omx_volume_component_Private->ports[1], 1, OMX_FALSE);
  
  /** Domain specific section for the ports. */  
  omx_volume_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE;
  omx_volume_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE;

  omx_volume_component_Private->gain = GAIN_VALUE; //100.0f; // default gain
  omx_volume_component_Private->destructor = omx_volume_component_Destructor;
  openmaxStandComp->SetParameter = omx_volume_component_SetParameter;
  openmaxStandComp->GetParameter = omx_volume_component_GetParameter;
  openmaxStandComp->GetConfig = omx_volume_component_GetConfig;
  openmaxStandComp->SetConfig = omx_volume_component_SetConfig;
  omx_volume_component_Private->BufferMgmtCallback = omx_volume_component_BufferMgmtCallback;

  noVolumeCompInstance++;
  if(noVolumeCompInstance > MAX_COMPONENT_VOLUME) {
    return OMX_ErrorInsufficientResources;
  }

  return err;
}
Exemple #2
0
static OMX_ERRORTYPE vid_dec_Constructor(OMX_COMPONENTTYPE *comp, OMX_STRING name)
{
   vid_dec_PrivateType *priv;
   omx_base_video_PortType *port;
   struct pipe_screen *screen;
   OMX_ERRORTYPE r;
   int i;

   assert(!comp->pComponentPrivate);

   priv = comp->pComponentPrivate = CALLOC(1, sizeof(vid_dec_PrivateType));
   if (!priv)
      return OMX_ErrorInsufficientResources;

   r = omx_base_filter_Constructor(comp, name);
   if (r)
      return r;

   priv->profile = PIPE_VIDEO_PROFILE_UNKNOWN;

   if (!strcmp(name, OMX_VID_DEC_MPEG2_NAME))
      priv->profile = PIPE_VIDEO_PROFILE_MPEG2_MAIN;

   if (!strcmp(name, OMX_VID_DEC_AVC_NAME))
      priv->profile = PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH;

   if (!strcmp(name, OMX_VID_DEC_HEVC_NAME))
      priv->profile = PIPE_VIDEO_PROFILE_HEVC_MAIN;

   priv->BufferMgmtCallback = vid_dec_FrameDecoded;
   priv->messageHandler = vid_dec_MessageHandler;
   priv->destructor = vid_dec_Destructor;

   comp->SetParameter = vid_dec_SetParameter;
   comp->GetParameter = vid_dec_GetParameter;

   priv->screen = omx_get_screen();
   if (!priv->screen)
      return OMX_ErrorInsufficientResources;

   screen = priv->screen->pscreen;
   priv->pipe = screen->context_create(screen, NULL, 0);
   if (!priv->pipe)
      return OMX_ErrorInsufficientResources;

   if (!vl_compositor_init(&priv->compositor, priv->pipe)) {
      priv->pipe->destroy(priv->pipe);
      priv->pipe = NULL;
      return OMX_ErrorInsufficientResources;
   }

   if (!vl_compositor_init_state(&priv->cstate, priv->pipe)) {
      vl_compositor_cleanup(&priv->compositor);
      priv->pipe->destroy(priv->pipe);
      priv->pipe = NULL;
      return OMX_ErrorInsufficientResources;
   }

   priv->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0;
   priv->sPortTypesParam[OMX_PortDomainVideo].nPorts = 2;
   priv->ports = CALLOC(2, sizeof(omx_base_PortType *));
   if (!priv->ports)
      return OMX_ErrorInsufficientResources;

   for (i = 0; i < 2; ++i) {
      priv->ports[i] = CALLOC(1, sizeof(omx_base_video_PortType));
      if (!priv->ports[i])
         return OMX_ErrorInsufficientResources;

      base_video_port_Constructor(comp, &priv->ports[i], i, i == 0);
   }

   port = (omx_base_video_PortType *)priv->ports[OMX_BASE_FILTER_INPUTPORT_INDEX];
   strcpy(port->sPortParam.format.video.cMIMEType,"video/MPEG2");
   port->sPortParam.nBufferCountMin = 8;
   port->sPortParam.nBufferCountActual = 8;
   port->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE;
   port->sPortParam.format.video.nFrameWidth = 176;
   port->sPortParam.format.video.nFrameHeight = 144;
   port->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG2;
   port->sVideoParam.eCompressionFormat = OMX_VIDEO_CodingMPEG2;
   port->Port_SendBufferFunction = vid_dec_DecodeBuffer;
   port->Port_FreeBuffer = vid_dec_FreeDecBuffer;

   port = (omx_base_video_PortType *)priv->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX];
   port->sPortParam.nBufferCountActual = 8;
   port->sPortParam.nBufferCountMin = 4;
   port->sPortParam.format.video.nFrameWidth = 176;
   port->sPortParam.format.video.nFrameHeight = 144;
   port->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
   port->sVideoParam.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;

   return OMX_ErrorNone;
}
OMX_ERRORTYPE omx_audio_decoder_component_Constructor(
  OMX_COMPONENTTYPE *pComponent,
  OMX_STRING cComponentName)
{
  OMX_ERRORTYPE err = OMX_ErrorNone;
  omx_audio_decoder_component_PrivateType* pPrivate;
  omx_audio_decoder_component_PortType* pPort;
  OMX_U32 i, idx = 0;

  if((MAX_COMPONENT_INSTANCES > 0) &&
     (noAudioSplitterCompInstance > MAX_COMPONENT_INSTANCES))
    err = OMX_ErrorInsufficientResources;

  if(OMX_ErrorNone == err) {
    if(NULL == pComponent->pComponentPrivate) {
      DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, allocating component\n", __func__);
      pComponent->pComponentPrivate = calloc(1, sizeof(omx_audio_decoder_component_PrivateType));
    if(pComponent->pComponentPrivate == NULL) {
      return OMX_ErrorInsufficientResources;
    }
    } else {
      DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int) pComponent->pComponentPrivate);
    }
  }

  /** Calling base filter constructor */
  err = omx_base_filter_Constructor(pComponent, cComponentName);

  pPrivate = pComponent->pComponentPrivate;
  pPrivate->sPortTypesParam[OMX_PortDomainAudio].nPorts = NUM_PORTS;

  /** Allocate Ports and call port constructor. */
  pPrivate->ports = calloc(pPrivate->sPortTypesParam[OMX_PortDomainAudio].nPorts, sizeof(omx_base_PortType *));
  if (NULL == pPrivate->ports)
    return OMX_ErrorInsufficientResources;

  for (i=0; i < pPrivate->sPortTypesParam[OMX_PortDomainAudio].nPorts; i++) {
    pPrivate->ports[i] = calloc(1, sizeof(omx_audio_decoder_component_PortType));
    if (NULL == pPrivate->ports[i])
      return OMX_ErrorInsufficientResources;
  }

  /* construct input ports */
  for(i = 0; i < NUM_INPUT_PORTS; i++) {
    base_audio_port_Constructor(pComponent, &pPrivate->ports[idx], idx, OMX_TRUE);
    idx++;
  }

  /* construct output ports */
  for(i = 0; i < NUM_OUTPUT_PORTS; i++) {
    base_audio_port_Constructor(pComponent, &pPrivate->ports[idx], idx, OMX_FALSE);
    idx++;
  }

  /** Domain specific section for the ports. */
  for(i = 0; i < pPrivate->sPortTypesParam[OMX_PortDomainAudio].nPorts; i++) {

    pPort = (omx_audio_decoder_component_PortType *) pPrivate->ports[i];

    pPort->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE;

    setHeader(&pPort->pAudioPcmMode,sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
    pPort->pAudioPcmMode.nPortIndex = i;
    pPort->pAudioPcmMode.nChannels = 2;
    pPort->pAudioPcmMode.eNumData = OMX_NumericalDataSigned;
    pPort->pAudioPcmMode.eEndian = OMX_EndianBig;
    pPort->pAudioPcmMode.bInterleaved = OMX_TRUE;
    pPort->pAudioPcmMode.nBitPerSample = 16;
    pPort->pAudioPcmMode.nSamplingRate = 48000;
    pPort->pAudioPcmMode.ePCMMode = OMX_AUDIO_PCMModeLinear;

  }

  pPrivate->BufferMgmtCallback = omx_audio_decoder_component_BufferMgmtCallback;
  pPrivate->destructor = omx_audio_decoder_component_Destructor;

  noAudioSplitterCompInstance++;

  return err;
}
/***************************************************************************
* Function : omx_ImageDecoderJpeg_Constructor											   
*
* Description : JpegDecoder Component Constructor. This function allocates the 
*			 omx_jpegdec_component_PrivateType private structure.
*
* Params	:
*																			   
*	Name		             Type						In/Out		Description 						   
*  	openmaxStandComp    OMX_COMPONENTTYPE*		In/Out	   	Openmax Standard Component structure
*	cComponentName	      OMX_STRING				In			name of the component to be constructed	
*
* Return : 
*	OMX_ErrorInsufficientResources if any ComponentPrivate structure alloc failed
*		  
* Note :
*
* Revision :
*
*     Author     		Date     		Version   	 Description
*     yuyiwei       	2008.10.9 	    1.0.0       
*									   
***************************************************************************/
OMX_ERRORTYPE omx_ImageDecoderJpeg_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName)
{

    OMX_ERRORTYPE err = OMX_ErrorNone;
    omx_jpegdec_component_PrivateType *omx_jpegdec_component_Private;
    OMX_S32 i;

    if (!openmaxStandComp->pComponentPrivate)
    {
        openmaxStandComp->pComponentPrivate = omx_calloc(1, sizeof(omx_jpegdec_component_PrivateType));
        if (openmaxStandComp->pComponentPrivate == NULL)
        {
            return OMX_ErrorInsufficientResources;
        }
    }
    else
    {
        DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int)openmaxStandComp->pComponentPrivate);
    }

    /** we could create our own port structures here
     * fixme maybe the base class could use a "port factory" function pointer?    
     */
    err = omx_base_filter_Constructor(openmaxStandComp, cComponentName);

    /** here we can override whatever defaults the base_component constructor set
     * e.g. we can override the function pointers in the private struct
     */
    omx_jpegdec_component_Private = (omx_jpegdec_component_PrivateType*)openmaxStandComp->pComponentPrivate;

    DEBUG(DEB_LEV_SIMPLE_SEQ, "constructor of jpeg decoder component is called\n");

    /** Allocate Ports and Call base port constructor. */
    if (omx_jpegdec_component_Private->sPortTypesParam.nPorts && !omx_jpegdec_component_Private->ports)
    {
        omx_jpegdec_component_Private->ports = omx_calloc(omx_jpegdec_component_Private->sPortTypesParam.nPorts, sizeof(omx_base_PortType*));
        if (!omx_jpegdec_component_Private->ports)
        {
            return OMX_ErrorInsufficientResources;
        }
        for (i = 0; i < omx_jpegdec_component_Private->sPortTypesParam.nPorts; i++)
        {
            /** this is the important thing separating this from the base class; size of the struct is for derived class port type
             * this could be refactored as a smarter factory function instead?
             */
            omx_jpegdec_component_Private->ports[i] = omx_calloc(1, sizeof(omx_jpegdec_component_PortType));
            if (!omx_jpegdec_component_Private->ports[i])
            {
                return OMX_ErrorInsufficientResources;
            }
        }
    }

    omx_jpegdec_component_Private->PortConstructor(openmaxStandComp, &omx_jpegdec_component_Private->ports[0], 0, OMX_TRUE);
    omx_jpegdec_component_Private->PortConstructor(openmaxStandComp, &omx_jpegdec_component_Private->ports[1], 1, OMX_FALSE);

    /**
     * Domain specific section for the ports.     
     * first we set the parameter common to both formats
     */
   
    //common parameters related to input port
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.eDomain = OMX_PortDomainImage;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.image.pNativeRender = 0;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.image.bFlagErrorConcealment = OMX_FALSE;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.image.eColorFormat = OMX_COLOR_FormatUnused;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.nBufferSize = 50*1024;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.image.cMIMEType = (OMX_STRING)malloc(sizeof(char)*DEFAULT_MIME_STRING_LENGTH);
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.image.nFrameWidth = 176; 
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.image.nFrameHeight = 144; 
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.image.nStride = 0;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.image.nSliceHeight = 0;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.image.pNativeWindow = NULL;

    //common parameters related to output port
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.eDomain = OMX_PortDomainImage;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.pNativeRender = 0;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.bFlagErrorConcealment = OMX_FALSE;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.nBufferSize = 50*1024;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.cMIMEType = (OMX_STRING)malloc(sizeof(char)*DEFAULT_MIME_STRING_LENGTH);
    strcpy(omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.cMIMEType, "raw/image");
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.nFrameWidth = 176; 
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.nFrameHeight = 144; 
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.nStride = 0;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.nSliceHeight = 0;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.pNativeWindow = NULL;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.eCompressionFormat = OMX_IMAGE_CodingUnused;
    omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.format.image.eColorFormat = OMX_JPEGDEC_DEFAULTCOLORFORMAT;

    /** now it's time to know the Image coding type of the component */
    if (!strcmp(cComponentName, IMAGE_DEC_JPEG_NAME))
    {
        omx_jpegdec_component_Private->image_coding_type = OMX_IMAGE_CodingJPEG;
    }
    else if (!strcmp(cComponentName, IMAGE_DEC_BASE_NAME))
    {
        omx_jpegdec_component_Private->image_coding_type = OMX_IMAGE_CodingUnused;
    }
    else
    {
        // IL client specified an invalid component name
        return OMX_ErrorInvalidComponentName;
    }
    /** initialise the semaphore to be used for jpeg decoder access synchronization */
    if (!omx_jpegdec_component_Private->JpegSyncSem)
    {
        omx_jpegdec_component_Private->JpegSyncSem = omx_calloc(1, sizeof(omx_sem));
        if (omx_jpegdec_component_Private->JpegSyncSem == NULL)
        {
            return OMX_ErrorInsufficientResources;
        }
        omx_sem_init(omx_jpegdec_component_Private->JpegSyncSem, 0);
    }

    // default value for private variables
    omx_jpegdec_component_Private->nImgWidth = 0;
    omx_jpegdec_component_Private->nImgHeight = 0;

    /** setting of internal port parameters related to Image format */
    omx_ImageDecoderJpeg_SetInternalParameters(openmaxStandComp);

    /** general configuration irrespective of any Image formats
     *  setting values of other fields of omx_jpegdec_component_Private structure    
     */
    omx_jpegdec_component_Private->JpegReady = OMX_FALSE;
//    omx_jpegdec_component_Private->needSetParam = OMX_FALSE;
    omx_jpegdec_component_Private->BufferMgmtCallback = omx_ImageDecoderJpeg_BufferMgmtCallback;
    omx_jpegdec_component_Private->messageHandler = omx_ImageDecoderJpeg_MessageHandler;
    omx_jpegdec_component_Private->destructor = omx_ImageDecoderJpeg_Destructor;
    openmaxStandComp->SetParameter = omx_ImageDecoderJpeg_SetParameter;
    openmaxStandComp->GetParameter = omx_ImageDecoderJpeg_GetParameter;

    /** increamenting component counter and checking against max allowed components */
    nojpegdecInstance++;

    if (nojpegdecInstance > MAX_COMPONENT_JPEG)
    {
        return OMX_ErrorInsufficientResources;
    }
    return err;
}
/** The Constructor
 */
OMX_ERRORTYPE omx_amr_audiodec_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) {

    OMX_ERRORTYPE err = OMX_ErrorNone;
    omx_amr_audiodec_component_PrivateType* omx_amr_audiodec_component_Private;
    omx_base_audio_PortType *pPort;
    OMX_U32 i;

    if (!openmaxStandComp->pComponentPrivate) {
        DEBUG(DEB_LEV_FUNCTION_NAME,"In %s, allocating component\n",__func__);
        openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_amr_audiodec_component_PrivateType));
        if(openmaxStandComp->pComponentPrivate==NULL)
            return OMX_ErrorInsufficientResources;
    }
    else
        DEBUG(DEB_LEV_FUNCTION_NAME,"In %s, Error Component %x Already Allocated\n",__func__, (int)openmaxStandComp->pComponentPrivate);

    omx_amr_audiodec_component_Private = openmaxStandComp->pComponentPrivate;
    omx_amr_audiodec_component_Private->ports = NULL;

    /** Calling base filter constructor */
    err = omx_base_filter_Constructor(openmaxStandComp,cComponentName);

    omx_amr_audiodec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nStartPortNumber = 0;
    omx_amr_audiodec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts = 2;

    /** Allocate Ports and call port constructor. */
    if (omx_amr_audiodec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts && !omx_amr_audiodec_component_Private->ports) {
        omx_amr_audiodec_component_Private->ports = calloc(omx_amr_audiodec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts, sizeof(omx_base_PortType *));
        if (!omx_amr_audiodec_component_Private->ports) {
            return OMX_ErrorInsufficientResources;
        }
        for (i=0; i < omx_amr_audiodec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts; i++) {
            omx_amr_audiodec_component_Private->ports[i] = calloc(1, sizeof(omx_base_audio_PortType));
            if (!omx_amr_audiodec_component_Private->ports[i]) {
                return OMX_ErrorInsufficientResources;
            }
        }
    }

    base_audio_port_Constructor(openmaxStandComp, &omx_amr_audiodec_component_Private->ports[0], 0, OMX_TRUE);
    base_audio_port_Constructor(openmaxStandComp, &omx_amr_audiodec_component_Private->ports[1], 1, OMX_FALSE);

    /** Domain specific section for the ports. */
    // first we set the parameter common to both formats
    //common parameters related to input port
    omx_amr_audiodec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.nBufferSize = DEFAULT_IN_BUFFER_SIZE;

    //common parameters related to output port
    pPort = (omx_base_audio_PortType *) omx_amr_audiodec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX];
    pPort->sAudioParam.nIndex    = OMX_IndexParamAudioPcm;
    pPort->sAudioParam.eEncoding = OMX_AUDIO_CodingPCM;
    pPort->sPortParam.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
    pPort->sPortParam.nBufferSize            = DEFAULT_OUT_BUFFER_SIZE;

    // now it's time to know the audio coding type of the component
    if(!strcmp(cComponentName, AUDIO_DEC_AMR_NAME))   // AMR format encoder
        omx_amr_audiodec_component_Private->audio_coding_type = OMX_AUDIO_CodingAMR;

    else  // IL client specified an invalid component name
        return OMX_ErrorInvalidComponentName;

    //set internal port parameters
    omx_amr_audiodec_component_SetInternalParameters(openmaxStandComp);

    //general configuration irrespective of any audio formats
    //setting other parameters of omx_amr_audiodec_component_private
    omx_amr_audiodec_component_Private->avCodec         = NULL;
    omx_amr_audiodec_component_Private->avCodecContext  = NULL;
    omx_amr_audiodec_component_Private->avcodecReady    = OMX_FALSE;
    omx_amr_audiodec_component_Private->extradata       = NULL;
    omx_amr_audiodec_component_Private->extradata_size  = 0;
    omx_amr_audiodec_component_Private->isFirstBuffer       = OMX_TRUE;

    omx_amr_audiodec_component_Private->BufferMgmtCallback = omx_amr_audiodec_component_BufferMgmtCallback;

    /** first initializing the codec context etc that was done earlier by ffmpeglibinit function */
    avcodec_init();
    av_register_all();
    omx_amr_audiodec_component_Private->avCodecContext = avcodec_alloc_context();

    omx_amr_audiodec_component_Private->messageHandler = omx_amr_audiodec_component_MessageHandler;
    omx_amr_audiodec_component_Private->destructor = omx_amr_audiodec_component_Destructor;
    openmaxStandComp->SetParameter = omx_amr_audiodec_component_SetParameter;
    openmaxStandComp->GetParameter = omx_amr_audiodec_component_GetParameter;
    openmaxStandComp->ComponentRoleEnum = omx_amr_audiodec_component_ComponentRoleEnum;

    noAudioDecInstance++;

    if(noAudioDecInstance>MAX_COMPONENT_AMR_AUDIODEC)
        return OMX_ErrorInsufficientResources;

    return err;
}
/** The Constructor of the video decoder component
  * @param openmaxStandComp the component handle to be constructed
  * @param cComponentName is the name of the constructed component
  */
OMX_ERRORTYPE omx_shvpudec_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) {

  OMX_ERRORTYPE eError = OMX_ErrorNone;  
  omx_shvpudec_component_PrivateType* omx_shvpudec_component_Private;
  omx_base_video_PortType *inPort,*outPort;
  OMX_U32 i;

  if (!openmaxStandComp->pComponentPrivate) {
    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, allocating component\n", __func__);
    openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_shvpudec_component_PrivateType));
    if(openmaxStandComp->pComponentPrivate == NULL) {
      return OMX_ErrorInsufficientResources;
    }
  } else {
    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int)openmaxStandComp->pComponentPrivate);
  }

  omx_shvpudec_component_Private = openmaxStandComp->pComponentPrivate;
  omx_shvpudec_component_Private->ports = NULL;

  eError = omx_base_filter_Constructor(openmaxStandComp, cComponentName);

  omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0;
  omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts = 2;

  /** Allocate Ports and call port constructor. */
  if (omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts && !omx_shvpudec_component_Private->ports) {
    omx_shvpudec_component_Private->ports = calloc(omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts, sizeof(omx_base_PortType *));
    if (!omx_shvpudec_component_Private->ports) {
      return OMX_ErrorInsufficientResources;
    }
    for (i=0; i < omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts; i++) {
      omx_shvpudec_component_Private->ports[i] = calloc(1, sizeof(omx_base_video_PortType));
      if (!omx_shvpudec_component_Private->ports[i]) {
        return OMX_ErrorInsufficientResources;
      }
    }
  }

  base_video_port_Constructor(openmaxStandComp, &omx_shvpudec_component_Private->ports[0], 0, OMX_TRUE);
  base_video_port_Constructor(openmaxStandComp, &omx_shvpudec_component_Private->ports[1], 1, OMX_FALSE);

  /** here we can override whatever defaults the base_component constructor set
    * e.g. we can override the function pointers in the private struct  
    */

  /** Domain specific section for the ports.   
    * first we set the parameter common to both formats
    */
  //common parameters related to input port
  inPort = (omx_base_video_PortType *)omx_shvpudec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX];
  inPort->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE;
  inPort->sPortParam.format.video.xFramerate = 25;

  //common parameters related to output port
  outPort = (omx_base_video_PortType *)omx_shvpudec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX];
  outPort->sPortParam.format.video.eColorFormat = OUTPUT_DECODED_COLOR_FMT;
  outPort->sPortParam.nBufferSize = DEFAULT_VIDEO_OUTPUT_BUF_SIZE;
  outPort->sPortParam.format.video.xFramerate = 25;

  /** settings of output port parameter definition */
  outPort->sVideoParam.eColorFormat = OUTPUT_DECODED_COLOR_FMT;
  outPort->sVideoParam.xFramerate = 25;

  /** now it's time to know the video coding type of the component */
  if(!strcmp(cComponentName, VIDEO_DEC_MPEG4_NAME)) { 
    omx_shvpudec_component_Private->video_coding_type = OMX_VIDEO_CodingMPEG4;
  } else if(!strcmp(cComponentName, VIDEO_DEC_H264_NAME)) { 
    omx_shvpudec_component_Private->video_coding_type = OMX_VIDEO_CodingAVC;
  } else if (!strcmp(cComponentName, VIDEO_DEC_BASE_NAME)) {
    omx_shvpudec_component_Private->video_coding_type = OMX_VIDEO_CodingUnused;
  } else {
    // IL client specified an invalid component name 
    return OMX_ErrorInvalidComponentName;
  }  

  if(!omx_shvpudec_component_Private->avCodecSyncSem) {
    omx_shvpudec_component_Private->avCodecSyncSem = calloc(1,sizeof(tsem_t));
    if(omx_shvpudec_component_Private->avCodecSyncSem == NULL) {
      return OMX_ErrorInsufficientResources;
    }
    tsem_init(omx_shvpudec_component_Private->avCodecSyncSem, 0);
  }

  SetInternalVideoParameters(openmaxStandComp);

  //omx_shvpudec_component_Private->eOutFramePixFmt = PIX_FMT_YUV420P;

  if(omx_shvpudec_component_Private->video_coding_type == OMX_VIDEO_CodingMPEG4) {
    omx_shvpudec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
  } else {
    omx_shvpudec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingAVC;
  }

  /** general configuration irrespective of any video formats
    * setting other parameters of omx_shvpudec_component_private  
    */
  omx_shvpudec_component_Private->decoder = NULL;
  omx_shvpudec_component_Private->avcodecReady = OMX_FALSE;
  //omx_shvpudec_component_Private->extradata = NULL;
  //omx_shvpudec_component_Private->extradata_size = 0;
  omx_shvpudec_component_Private->BufferMgmtCallback = omx_shvpudec_component_BufferMgmtCallback;

  /** initializing the codec context etc that was done earlier by ffmpeglibinit function */
  omx_shvpudec_component_Private->messageHandler = omx_shvpudec_component_MessageHandler;
  omx_shvpudec_component_Private->destructor = omx_shvpudec_component_Destructor;
  openmaxStandComp->SetParameter = omx_shvpudec_component_SetParameter;
  openmaxStandComp->GetParameter = omx_shvpudec_component_GetParameter;
  openmaxStandComp->SetConfig    = omx_shvpudec_component_SetConfig;
  openmaxStandComp->ComponentRoleEnum = omx_shvpudec_component_ComponentRoleEnum;
  openmaxStandComp->GetExtensionIndex = omx_shvpudec_component_GetExtensionIndex;

  noVideoDecInstance++;

  if(noVideoDecInstance > MAX_COMPONENT_VIDEODEC) {
    return OMX_ErrorInsufficientResources;
  }
  return eError;
}
/** The Constructor of the video encoder component
  * @param openmaxStandComp the component handle to be constructed
  * @param cComponentName is the name of the constructed component
  */
OMX_ERRORTYPE omx_videoenc_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) {

  OMX_ERRORTYPE eError = OMX_ErrorNone;  
  omx_videoenc_component_PrivateType* omx_videoenc_component_Private;
  omx_base_video_PortType *inPort,*outPort;
  OMX_U32 i;

  if (!openmaxStandComp->pComponentPrivate) {
    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, allocating component\n", __func__);
    openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_videoenc_component_PrivateType));
    if(openmaxStandComp->pComponentPrivate == NULL) {
      return OMX_ErrorInsufficientResources;
    }
  } else {
    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int)openmaxStandComp->pComponentPrivate);
  }

  omx_videoenc_component_Private = openmaxStandComp->pComponentPrivate;
  omx_videoenc_component_Private->ports = NULL;

  /** we could create our own port structures here
    * fixme maybe the base class could use a "port factory" function pointer?  
    */
  eError = omx_base_filter_Constructor(openmaxStandComp, cComponentName);

  omx_videoenc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0;
  omx_videoenc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts = 2;

  /** Allocate Ports and call port constructor. */  
  if (omx_videoenc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts && !omx_videoenc_component_Private->ports) {
    omx_videoenc_component_Private->ports = calloc(omx_videoenc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts, sizeof(omx_base_PortType *));
    if (!omx_videoenc_component_Private->ports) {
      return OMX_ErrorInsufficientResources;
    }
    for (i=0; i < omx_videoenc_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts; i++) {
      omx_videoenc_component_Private->ports[i] = calloc(1, sizeof(omx_base_video_PortType));
      if (!omx_videoenc_component_Private->ports[i]) {
        return OMX_ErrorInsufficientResources;
      }
    }
  }

  base_video_port_Constructor(openmaxStandComp, &omx_videoenc_component_Private->ports[0], 0, OMX_TRUE);
  base_video_port_Constructor(openmaxStandComp, &omx_videoenc_component_Private->ports[1], 1, OMX_FALSE);

  /** Domain specific section for the ports.   
    * first we set the parameter common to both formats
    */
  //common parameters related to input port
  inPort = (omx_base_video_PortType *)omx_videoenc_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX];
  inPort->sPortParam.format.video.nFrameWidth = 176;
  inPort->sPortParam.format.video.nFrameHeight = 144;
  inPort->sPortParam.nBufferSize = inPort->sPortParam.format.video.nFrameWidth*
                                   inPort->sPortParam.format.video.nFrameHeight*3/2; //YUV 420
  inPort->sPortParam.format.video.xFramerate = 25;
  inPort->sPortParam.format.video.eColorFormat = OMX_COLOR_FormatYUV420Planar;
  inPort->sVideoParam.eColorFormat = OMX_COLOR_FormatYUV420Planar;

  //common parameters related to output port
  outPort = (omx_base_video_PortType *)omx_videoenc_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX];
  outPort->sPortParam.nBufferSize = FF_MIN_BUFFER_SIZE;
  outPort->sPortParam.format.video.xFramerate = 25;
  outPort->sPortParam.format.video.nFrameWidth = 176;
  outPort->sPortParam.format.video.nFrameHeight = 144;

  /** now it's time to know the video coding type of the component */
  if(!strcmp(cComponentName, VIDEO_ENC_MPEG4_NAME)) { 
    omx_videoenc_component_Private->video_encoding_type = OMX_VIDEO_CodingMPEG4;
  } else if (!strcmp(cComponentName, VIDEO_ENC_BASE_NAME)) {
    omx_videoenc_component_Private->video_encoding_type = OMX_VIDEO_CodingUnused;
  } else {
    // IL client specified an invalid component name 
    DEBUG(DEB_LEV_ERR, "In valid component name\n");
    return OMX_ErrorInvalidComponentName;
  }  

  if(!omx_videoenc_component_Private->avCodecSyncSem) {
    omx_videoenc_component_Private->avCodecSyncSem = calloc(1,sizeof(tsem_t));
    if(omx_videoenc_component_Private->avCodecSyncSem == NULL) {
      return OMX_ErrorInsufficientResources;
    }
    tsem_init(omx_videoenc_component_Private->avCodecSyncSem, 0);
  }

  SetInternalVideoEncParameters(openmaxStandComp);

  omx_videoenc_component_Private->eOutFramePixFmt = PIX_FMT_YUV420P;

  if(omx_videoenc_component_Private->video_encoding_type == OMX_VIDEO_CodingMPEG4) {
    omx_videoenc_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.format.video.eCompressionFormat = OMX_VIDEO_CodingMPEG4;
  }

  /** general configuration irrespective of any video formats
    * setting other parameters of omx_videoenc_component_private  
    */
  omx_videoenc_component_Private->avCodec = NULL;
  omx_videoenc_component_Private->avCodecContext= NULL;
  omx_videoenc_component_Private->avcodecReady = OMX_FALSE;
  omx_videoenc_component_Private->BufferMgmtCallback = omx_videoenc_component_BufferMgmtCallback;

  /** initializing the coenc context etc that was done earlier by ffmpeglibinit function */
  omx_videoenc_component_Private->messageHandler = omx_videoenc_component_MessageHandler;
  omx_videoenc_component_Private->destructor = omx_videoenc_component_Destructor;
  openmaxStandComp->SetParameter = omx_videoenc_component_SetParameter;
  openmaxStandComp->GetParameter = omx_videoenc_component_GetParameter;
  openmaxStandComp->ComponentRoleEnum = omx_videoenc_component_ComponentRoleEnum;

  noVideoEncInstance++;

  if(noVideoEncInstance > MAX_COMPONENT_VIDEOENC) {
    return OMX_ErrorInsufficientResources;
  }
  return eError;
}
/** The Constructor
  * @param openmaxStandComp the component handle to be constructed
  * @param cComponentName is the name of the constructed component
  */
OMX_ERRORTYPE omx_video_scheduler_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName) {
  OMX_ERRORTYPE                                err = OMX_ErrorNone;
  omx_video_scheduler_component_PrivateType*   omx_video_scheduler_component_Private;
  omx_base_video_PortType       *inPort,*outPort;
  OMX_U32                                      i;

  if (!openmaxStandComp->pComponentPrivate) {
    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, allocating component\n", __func__);
    openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_video_scheduler_component_PrivateType));
    if(openmaxStandComp->pComponentPrivate == NULL) {
      return OMX_ErrorInsufficientResources;
    }
  } else {
    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int)openmaxStandComp->pComponentPrivate);
  }

  omx_video_scheduler_component_Private        = openmaxStandComp->pComponentPrivate;
  omx_video_scheduler_component_Private->ports = NULL;

  /** we could create our own port structures here
    * fixme maybe the base class could use a "port factory" function pointer?
    */
  err = omx_base_filter_Constructor(openmaxStandComp, cComponentName);

  omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0;
  omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts = 2;

  omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainOther].nStartPortNumber = CLOCKPORT_INDEX;
  omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts = 1;

  /** Allocate Ports and call port constructor. */
 if ((omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts
       + omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts)
       && !omx_video_scheduler_component_Private->ports) {
    omx_video_scheduler_component_Private->ports = calloc((omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts
                                                           + omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts),
                                                           sizeof(omx_base_PortType *));
    if (!omx_video_scheduler_component_Private->ports) {
      return OMX_ErrorInsufficientResources;
    }
    for (i=0; i < omx_video_scheduler_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts; i++) {
      omx_video_scheduler_component_Private->ports[i] = calloc(1, sizeof(omx_base_video_PortType));
      if (!omx_video_scheduler_component_Private->ports[i]) {
        return OMX_ErrorInsufficientResources;
      }
    }
    base_video_port_Constructor(openmaxStandComp, &omx_video_scheduler_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX], 0, OMX_TRUE);
    base_video_port_Constructor(openmaxStandComp, &omx_video_scheduler_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX], 1, OMX_FALSE);

    omx_video_scheduler_component_Private->ports[CLOCKPORT_INDEX] = calloc(1, sizeof(omx_base_clock_PortType));
    if (!omx_video_scheduler_component_Private->ports[CLOCKPORT_INDEX]) {
      return OMX_ErrorInsufficientResources;
    }
    base_clock_port_Constructor(openmaxStandComp, &omx_video_scheduler_component_Private->ports[CLOCKPORT_INDEX], 2, OMX_TRUE);
    omx_video_scheduler_component_Private->ports[CLOCKPORT_INDEX]->sPortParam.bEnabled = OMX_TRUE;
  }

  inPort = (omx_base_video_PortType *) omx_video_scheduler_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX];
  outPort= (omx_base_video_PortType *) omx_video_scheduler_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX];

  /** Domain specific section for the ports. */

  //input port parameter settings
  inPort->sVideoParam.eColorFormat             = OMX_COLOR_Format24bitRGB888;
  inPort->sPortParam.format.video.nFrameWidth  = DEFAULT_WIDTH;
  inPort->sPortParam.format.video.nFrameHeight = DEFAULT_HEIGHT;
  inPort->sPortParam.nBufferSize               = DEFAULT_VIDEO_INPUT_BUF_SIZE * 2 ;
  inPort->sPortParam.format.video.eColorFormat = OMX_COLOR_Format24bitRGB888;

  outPort->sVideoParam.eColorFormat             = OMX_COLOR_Format24bitRGB888;
  outPort->sPortParam.format.video.nFrameWidth  = DEFAULT_WIDTH;
  outPort->sPortParam.format.video.nFrameHeight = DEFAULT_HEIGHT;
  outPort->sPortParam.nBufferSize               = DEFAULT_VIDEO_INPUT_BUF_SIZE * 2;
  outPort->sPortParam.format.video.eColorFormat = OMX_COLOR_Format24bitRGB888;

  omx_video_scheduler_component_Private->destructor         = omx_video_scheduler_component_Destructor;
  omx_video_scheduler_component_Private->BufferMgmtCallback = omx_video_scheduler_component_BufferMgmtCallback;

  inPort->FlushProcessingBuffers  = omx_video_scheduler_component_port_FlushProcessingBuffers;
  openmaxStandComp->SetParameter  = omx_video_scheduler_component_SetParameter;
  openmaxStandComp->GetParameter  = omx_video_scheduler_component_GetParameter;

  /* resource management special section */
  omx_video_scheduler_component_Private->nqualitylevels = VIDEOSCHED_QUALITY_LEVELS;
  omx_video_scheduler_component_Private->currentQualityLevel = 1;
  omx_video_scheduler_component_Private->multiResourceLevel = malloc(sizeof(multiResourceDescriptor *) * VIDEOSCHED_QUALITY_LEVELS);
  for (i = 0; i<VIDEOSCHED_QUALITY_LEVELS; i++) {
	  omx_video_scheduler_component_Private->multiResourceLevel[i] = malloc(sizeof(multiResourceDescriptor));
	  omx_video_scheduler_component_Private->multiResourceLevel[i]->CPUResourceRequested = videoSchedQualityLevels[i * 2];
	  omx_video_scheduler_component_Private->multiResourceLevel[i]->MemoryResourceRequested = videoSchedQualityLevels[i * 2 + 1];
  }

  return err;
}
OMX_ERRORTYPE omx_flacdec_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName) 
{

	OMX_ERRORTYPE err = OMX_ErrorNone;  
	omx_flacdec_component_PrivateType* omx_flacdec_component_Private;
	omx_base_audio_PortType *inPort,*outPort;
	OMX_U32 i;

#ifdef HAVE_ANDROID_OS
	if (1)
#else
	if (!openmaxStandComp->pComponentPrivate) 
#endif
	{
		openmaxStandComp->pComponentPrivate = TCC_calloc(1, sizeof(omx_flacdec_component_PrivateType));

		if(openmaxStandComp->pComponentPrivate==NULL)  
		{
			return OMX_ErrorInsufficientResources;
		}
	} 
	else 
	{
	    DBUG_MSG("In %s, Error Component %x Already Allocated\n", 
	              __func__, (int)openmaxStandComp->pComponentPrivate);
	}

	omx_flacdec_component_Private = openmaxStandComp->pComponentPrivate;
	omx_flacdec_component_Private->ports = NULL;

	/** we could create our own port structures here
	* fixme maybe the base class could use a "port factory" function pointer?  
	*/
	err = omx_base_filter_Constructor(openmaxStandComp, cComponentName);

	DBUG_MSG("constructor of FLAC decoder component is called\n");

	/* Domain specific section for the ports. */  
	/* first we set the parameter common to both formats */
	/* parameters related to input port which does not depend upon input audio format    */
	/* Allocate Ports and call port constructor. */  

	omx_flacdec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nStartPortNumber = 0;
  	omx_flacdec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts = 2;

	if (omx_flacdec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts && !omx_flacdec_component_Private->ports) 
	{
	    omx_flacdec_component_Private->ports = TCC_calloc(omx_flacdec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts, sizeof(omx_base_PortType *));
	    if (!omx_flacdec_component_Private->ports) 
	    {
	  	    return OMX_ErrorInsufficientResources;
	    }
	    for (i=0; i < omx_flacdec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts; i++) 
	    {
		      omx_flacdec_component_Private->ports[i] = TCC_calloc(1, sizeof(omx_base_audio_PortType));
		      if (!omx_flacdec_component_Private->ports[i]) 
		      {
		        	return OMX_ErrorInsufficientResources;
		      }
	    }
	}

	base_audio_port_Constructor(openmaxStandComp, &omx_flacdec_component_Private->ports[0], 0, OMX_TRUE); // input
	base_audio_port_Constructor(openmaxStandComp, &omx_flacdec_component_Private->ports[1], 1, OMX_FALSE); // output

	/** parameters related to input port */
	inPort = (omx_base_audio_PortType *) omx_flacdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX];
	  
	inPort->sPortParam.nBufferSize = DEFAULT_IN_BUFFER_SIZE*2;
	strcpy(inPort->sPortParam.format.audio.cMIMEType, "audio/flac");
	inPort->sPortParam.format.audio.eEncoding = OMX_AUDIO_CodingFLAC;
	inPort->sAudioParam.eEncoding = OMX_AUDIO_CodingFLAC;
	
	/** parameters related to output port */
	outPort = (omx_base_audio_PortType *) omx_flacdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX];
	outPort->sPortParam.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
	outPort->sPortParam.nBufferSize = AUDIO_DEC_OUT_BUFFER_SIZE;
	outPort->sAudioParam.eEncoding = OMX_AUDIO_CodingPCM;

    //Default values for AAC audio param port
	setHeader(&omx_flacdec_component_Private->pAudioFlac, sizeof(OMX_AUDIO_PARAM_FLACTYPE));
    omx_flacdec_component_Private->pAudioFlac.nPortIndex = 0;
    omx_flacdec_component_Private->pAudioFlac.nChannels = 2;
    omx_flacdec_component_Private->pAudioFlac.nBitRate = 0;
    omx_flacdec_component_Private->pAudioFlac.nSampleRate = 44100;
    omx_flacdec_component_Private->pAudioFlac.eChannelMode = OMX_AUDIO_ChannelModeStereo;

	/** settings of output port audio format - pcm */
	setHeader(&omx_flacdec_component_Private->pAudioPcmMode, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
	omx_flacdec_component_Private->pAudioPcmMode.nPortIndex = 1;
	omx_flacdec_component_Private->pAudioPcmMode.nChannels = 2;
	omx_flacdec_component_Private->pAudioPcmMode.eNumData = OMX_NumericalDataSigned;
	omx_flacdec_component_Private->pAudioPcmMode.eEndian = OMX_EndianLittle;
	omx_flacdec_component_Private->pAudioPcmMode.bInterleaved = OMX_TRUE;
	omx_flacdec_component_Private->pAudioPcmMode.nBitPerSample = 16;
	omx_flacdec_component_Private->pAudioPcmMode.nSamplingRate = 44100;
	omx_flacdec_component_Private->pAudioPcmMode.ePCMMode = OMX_AUDIO_PCMModeLinear;
	omx_flacdec_component_Private->pAudioPcmMode.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
	omx_flacdec_component_Private->pAudioPcmMode.eChannelMapping[1] = OMX_AUDIO_ChannelRF;

	/** now it's time to know the audio coding type of the component */
	if(!strcmp(cComponentName, AUDIO_DEC_FLAC_NAME))  
	{   
		 omx_flacdec_component_Private->audio_coding_type = OMX_AUDIO_CodingFLAC;
	} 
	else if (!strcmp(cComponentName, AUDIO_DEC_BASE_NAME)) 
	{
		omx_flacdec_component_Private->audio_coding_type = OMX_AUDIO_CodingUnused;
	}
	else  
	{
	    // IL client specified an invalid component name
	    
		LOGE("OMX_ErrorInvalidComponentName %s", cComponentName);
	    return OMX_ErrorInvalidComponentName;
	}


	/** general configuration irrespective of any audio formats */
	/**  setting values of other fields of omx_maddec_component_Private structure */
	
	omx_flacdec_component_Private->BufferMgmtCallback = omx_audiodec_component_BufferMgmtCallback;
	omx_flacdec_component_Private->messageHandler = omx_audiodec_component_MessageHandler;
	omx_flacdec_component_Private->destructor = omx_audiodec_component_Destructor;
	openmaxStandComp->SetParameter = omx_audiodec_component_SetParameter;
	openmaxStandComp->GetParameter = omx_audiodec_component_GetParameter;
	openmaxStandComp->GetExtensionIndex = omx_audiodec_component_GetExtensionIndex;

	omx_flacdec_component_Private->decode_ready = OMX_FALSE;	
	
	memset(&omx_flacdec_component_Private->cdk_core, 0x00, sizeof(cdk_core_t));
	memset(&omx_flacdec_component_Private->cdmx_info, 0x00, sizeof(cdmx_info_t));
	memset(&omx_flacdec_component_Private->cdmx_out, 0x00, sizeof(cdmx_output_t));
		
	omx_flacdec_component_Private->cdk_core.m_iAudioProcessMode = 2; /* decoded pcm mode */

	omx_flacdec_component_Private->cdk_core.m_psCallback = &(omx_flacdec_component_Private->callback_func);
	omx_flacdec_component_Private->cdk_core.m_psCallback->m_pfMalloc   = (void* (*) ( unsigned int ))malloc;
	omx_flacdec_component_Private->cdk_core.m_psCallback->m_pfRealloc  = (void* (*) ( void*, unsigned int ))realloc;
	omx_flacdec_component_Private->cdk_core.m_psCallback->m_pfFree	  = (void  (*) ( void* ))free;
	omx_flacdec_component_Private->cdk_core.m_psCallback->m_pfMemcpy   = (void* (*) ( void*, const void*, unsigned int ))memcpy;
	omx_flacdec_component_Private->cdk_core.m_psCallback->m_pfMemmove  = (void* (*) ( void*, const void*, unsigned int ))memmove;
	omx_flacdec_component_Private->cdk_core.m_psCallback->m_pfMemset   = (void  (*) ( void*, int, unsigned int ))memset;
  
	omx_flacdec_component_Private->iAdecType = AUDIO_ID_FLAC;
	omx_flacdec_component_Private->iCtype = CONTAINER_TYPE_AUDIO;
	omx_flacdec_component_Private->cb_function = TCC_FLAC_DEC;

	if (omx_flacdec_component_Private->pRest == NULL)
	{
		omx_flacdec_component_Private->pRest = (OMX_U8*)malloc(DEFAULT_OUT_BUFFER_SIZE);
	}

	DBUG_MSG("constructor of FLAC decoder component is completed ret = %d \n", err);

	return err;

}
OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE hComponent)
{
  OMX_ERRORTYPE err = OMX_ErrorNone;  
  OMX_COMPONENTTYPE *pHandle = NULL;
  char std_string[10]; 
  omx_jpegdec_component_PrivateType* omx_jpegdec_component_Private = NULL;
  OMX_STRING cComponentName = "OMX.Action.Image.Decoder";
  omx_base_image_PortType *pInPort,*pOutPort;
  OMX_U32 i;
	pHandle = (OMX_COMPONENTTYPE *)hComponent;
	pHandle->pComponentPrivate = calloc(1, sizeof(omx_jpegdec_component_PrivateType));

    if(pHandle->pComponentPrivate==NULL)  {
      return OMX_ErrorInsufficientResources;
    }
 
  
  omx_jpegdec_component_Private = (omx_jpegdec_component_PrivateType *)pHandle->pComponentPrivate;
  omx_jpegdec_component_Private->ports = NULL;

  /** we could create our own port structures here
    * fixme maybe the base class could use a "port factory" function pointer?  
    */
  err = omx_base_filter_Constructor(pHandle, cComponentName);
 	if (err != OMX_ErrorNone) {
	  return err;
  }

  /** Domain specific section for the ports. */  
  /** first we set the parameter common to both formats
    * parameters related to input port which does not depend upon input image format
    */
  omx_jpegdec_component_Private->sPortTypesParam[OMX_PortDomainImage].nStartPortNumber = 0;
  omx_jpegdec_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts = 2;

  /** Allocate Ports and call port constructor. */  
  if (omx_jpegdec_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts && !omx_jpegdec_component_Private->ports) {
    omx_jpegdec_component_Private->ports = calloc(omx_jpegdec_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts, sizeof(omx_base_PortType *));
    if (!omx_jpegdec_component_Private->ports) {
      return OMX_ErrorInsufficientResources;
    }
    for (i=0; i < omx_jpegdec_component_Private->sPortTypesParam[OMX_PortDomainImage].nPorts; i++) {
      omx_jpegdec_component_Private->ports[i] = calloc(1, sizeof(omx_base_image_PortType));
      if (!omx_jpegdec_component_Private->ports[i]) {
        return OMX_ErrorInsufficientResources;
      }
    }
  }

  err = base_image_port_Constructor(pHandle, &omx_jpegdec_component_Private->ports[0], 0, OMX_TRUE);
  if (err != OMX_ErrorNone) 
  {
  	return err;
  }
  err = base_image_port_Constructor(pHandle, &omx_jpegdec_component_Private->ports[1], 1, OMX_FALSE);
	if (err != OMX_ErrorNone) 
  	{
  		return err;
  	}

    pInPort = (omx_base_image_PortType *) omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX];
    pInPort->sPortParam.nBufferSize = IN_BUFFER_SIZE;
    pInPort->sPortParam.nBufferCountActual = 1;
  /** parameters related to output port */
    pOutPort = (omx_base_image_PortType *) omx_jpegdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX];
    pOutPort->sPortParam.nBufferCountActual = 1;
    pOutPort->sPortParam.nBufferSize = OUT_BUFFER_SIZE;

  /** initialise the semaphore to be used for mad decoder access synchronization */
  if(!omx_jpegdec_component_Private->jpegdecSyncSem) {
    omx_jpegdec_component_Private->jpegdecSyncSem = calloc(1,sizeof(tsem_t));
    if(omx_jpegdec_component_Private->jpegdecSyncSem == NULL) {
      return OMX_ErrorInsufficientResources;
    }
    tsem_init(omx_jpegdec_component_Private->jpegdecSyncSem, 0);
  }

  if(!omx_jpegdec_component_Private->jpegdecSyncSem1) {
    omx_jpegdec_component_Private->jpegdecSyncSem1 = calloc(1,sizeof(tsem_t));
    if(omx_jpegdec_component_Private->jpegdecSyncSem1 == NULL) {
      return OMX_ErrorInsufficientResources;
    }
    tsem_init(omx_jpegdec_component_Private->jpegdecSyncSem1, 0);
  }

  /** general configuration irrespective of any image formats
    *  setting values of other fields of omx_jpegdec_component_Private structure  
    */ 
  omx_jpegdec_component_Private->jpegdecReady = OMX_FALSE;
  omx_jpegdec_component_Private->hMarkTargetComponent = NULL;
  omx_jpegdec_component_Private->nFlags = 0x0;
  omx_jpegdec_component_Private->BufferMgmtCallback = omx_jpegdec_component_BufferMgmtCallback;
//  omx_jpegdec_component_Private->BufferMgmtFunction = omx_jpegdec_component_BufferMgmtFunction;
  omx_jpegdec_component_Private->messageHandler = omx_jpegdec_decoder_MessageHandler;
  omx_jpegdec_component_Private->destructor = omx_jpegdec_component_Destructor;
//  pHandle->SetParameter = omx_jpegdec_component_SetParameter;
//  pHandle->GetParameter = omx_jpegdec_component_GetParameter;

  strcpy(std_string, "jpg");
  err = IMGDEC_GetImagePlugin(omx_jpegdec_component_Private, std_string);
//  nojpegdecInstance++;

//  if(nojpegdecInstance>MAX_COMPONENT_JPEGDEC)
//    return OMX_ErrorInsufficientResources;

  return err;
	
}
/** The Constructor
 */
OMX_ERRORTYPE omx_audioenc_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) {

  OMX_ERRORTYPE err = OMX_ErrorNone;
  omx_audioenc_component_PrivateType* omx_audioenc_component_Private;
  OMX_U32 i;

  if (!openmaxStandComp->pComponentPrivate) {
    DEBUG(DEB_LEV_FUNCTION_NAME,"In %s, allocating component\n",__func__);
    openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_audioenc_component_PrivateType));
    if(openmaxStandComp->pComponentPrivate==NULL)
      return OMX_ErrorInsufficientResources;
  }
  else
    DEBUG(DEB_LEV_FUNCTION_NAME,"In %s, Error Component %x Already Allocated\n",__func__, (int)openmaxStandComp->pComponentPrivate);

  omx_audioenc_component_Private = openmaxStandComp->pComponentPrivate;
  omx_audioenc_component_Private->ports = NULL;

  /** Calling base filter constructor */
  err = omx_base_filter_Constructor(openmaxStandComp,cComponentName);

  omx_audioenc_component_Private->sPortTypesParam[OMX_PortDomainAudio].nStartPortNumber = 0;
  omx_audioenc_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts = 2;

  /** Allocate Ports and call port constructor. */
  if (omx_audioenc_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts && !omx_audioenc_component_Private->ports) {
    omx_audioenc_component_Private->ports = calloc(omx_audioenc_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts, sizeof(omx_base_PortType *));
    if (!omx_audioenc_component_Private->ports) {
      return OMX_ErrorInsufficientResources;
    }
    for (i=0; i < omx_audioenc_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts; i++) {
      omx_audioenc_component_Private->ports[i] = calloc(1, sizeof(omx_base_audio_PortType));
      if (!omx_audioenc_component_Private->ports[i]) {
        return OMX_ErrorInsufficientResources;
      }
    }
  }

  base_audio_port_Constructor(openmaxStandComp, &omx_audioenc_component_Private->ports[0], 0, OMX_TRUE);
  base_audio_port_Constructor(openmaxStandComp, &omx_audioenc_component_Private->ports[1], 1, OMX_FALSE);

  /** Domain specific section for the ports. */
  // first we set the parameter common to both formats
  //common parameters related to input port
  omx_audioenc_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX]->sPortParam.nBufferSize =  DEFAULT_OUT_BUFFER_SIZE;
  //common parameters related to output port
  omx_audioenc_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX]->sPortParam.nBufferSize = DEFAULT_IN_BUFFER_SIZE;

  // now it's time to know the audio coding type of the component
  if(!strcmp(cComponentName, AUDIO_ENC_MP3_NAME))   // mp3 format encoder
    omx_audioenc_component_Private->audio_coding_type = OMX_AUDIO_CodingMP3;

  else if(!strcmp(cComponentName, AUDIO_ENC_AAC_NAME))   // AAC format encoder
    omx_audioenc_component_Private->audio_coding_type = OMX_AUDIO_CodingAAC;

  else if(!strcmp(cComponentName, AUDIO_ENC_G726_NAME))  // G726 format encoder
    omx_audioenc_component_Private->audio_coding_type = OMX_AUDIO_CodingG726;

  else if (!strcmp(cComponentName, AUDIO_ENC_BASE_NAME))// general audio encoder
    omx_audioenc_component_Private->audio_coding_type = OMX_AUDIO_CodingUnused;

  else  // IL client specified an invalid component name
    return OMX_ErrorInvalidComponentName;

  omx_audioenc_component_SetInternalParameters(openmaxStandComp);

  //settings of output port
  //output is pcm mode for all encoders - so generalise it
  setHeader(&omx_audioenc_component_Private->pAudioPcmMode,sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
  omx_audioenc_component_Private->pAudioPcmMode.nPortIndex = 0;
  omx_audioenc_component_Private->pAudioPcmMode.nChannels = 2;
  omx_audioenc_component_Private->pAudioPcmMode.eNumData = OMX_NumericalDataSigned;
  omx_audioenc_component_Private->pAudioPcmMode.eEndian = OMX_EndianLittle;
  omx_audioenc_component_Private->pAudioPcmMode.bInterleaved = OMX_TRUE;
  omx_audioenc_component_Private->pAudioPcmMode.nBitPerSample = 16;
  omx_audioenc_component_Private->pAudioPcmMode.nSamplingRate = 44100;
  omx_audioenc_component_Private->pAudioPcmMode.ePCMMode = OMX_AUDIO_PCMModeLinear;
  omx_audioenc_component_Private->pAudioPcmMode.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
  omx_audioenc_component_Private->pAudioPcmMode.eChannelMapping[1] = OMX_AUDIO_ChannelRF;

  //general configuration irrespective of any audio formats
  //setting other parameters of omx_audioenc_component_private
  omx_audioenc_component_Private->avCodec = NULL;
  omx_audioenc_component_Private->avCodecContext= NULL;
  omx_audioenc_component_Private->avcodecReady = OMX_FALSE;

  omx_audioenc_component_Private->BufferMgmtCallback = omx_audioenc_component_BufferMgmtCallback;

  /** first initializing the codec context etc that was done earlier by ffmpeglibinit function */
  avcodec_init();
  av_register_all();
  omx_audioenc_component_Private->avCodecContext = avcodec_alloc_context();

  omx_audioenc_component_Private->messageHandler = omx_audioenc_component_MessageHandler;
  omx_audioenc_component_Private->destructor = omx_audioenc_component_Destructor;
  openmaxStandComp->SetParameter = omx_audioenc_component_SetParameter;
  openmaxStandComp->GetParameter = omx_audioenc_component_GetParameter;
  openmaxStandComp->ComponentRoleEnum = omx_audioenc_component_ComponentRoleEnum;

  noaudioencInstance++;

  if(noaudioencInstance>MAX_COMPONENT_AUDIOENC)
    return OMX_ErrorInsufficientResources;

  return err;
}
OMX_ERRORTYPE omx_vorbisdec_component_Constructor( OMX_COMPONENTTYPE *openmaxStandComp, OMX_STRING cComponentName) {

  OMX_ERRORTYPE err = OMX_ErrorNone;  
  omx_vorbisdec_component_PrivateType* omx_vorbisdec_component_Private;
  omx_base_audio_PortType *inPort,*outPort;
  OMX_U32 i;

  if (!openmaxStandComp->pComponentPrivate) {
    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, allocating component\n", __func__);
    openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_vorbisdec_component_PrivateType));
    if(openmaxStandComp->pComponentPrivate == NULL)  {
      return OMX_ErrorInsufficientResources;
    }
  }  else {
    DEBUG(DEB_LEV_FUNCTION_NAME, "In %s, Error Component %x Already Allocated\n", __func__, (int)openmaxStandComp->pComponentPrivate);
  }

  omx_vorbisdec_component_Private = openmaxStandComp->pComponentPrivate;
  omx_vorbisdec_component_Private->ports = NULL;

  /** we could create our own port structures here
    * fixme maybe the base class could use a "port factory" function pointer?  
    */
  err = omx_base_filter_Constructor(openmaxStandComp,cComponentName);

  /** Domain specific section for the ports. */  
  /** first we set the parameter common to both formats
    * common parameters related to input port
    */
  omx_vorbisdec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nStartPortNumber = 0;
  omx_vorbisdec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts = 2;

  /** Allocate Ports and call port constructor. */  
  if (omx_vorbisdec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts && !omx_vorbisdec_component_Private->ports) {
    omx_vorbisdec_component_Private->ports = calloc(omx_vorbisdec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts, sizeof(omx_base_PortType *));
    if (!omx_vorbisdec_component_Private->ports) {
      return OMX_ErrorInsufficientResources;
    }
    for (i=0; i < omx_vorbisdec_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts; i++) {
      omx_vorbisdec_component_Private->ports[i] = calloc(1, sizeof(omx_base_audio_PortType));
      if (!omx_vorbisdec_component_Private->ports[i]) {
        return OMX_ErrorInsufficientResources;
      }
    }
  }

  base_audio_port_Constructor(openmaxStandComp, &omx_vorbisdec_component_Private->ports[0], 0, OMX_TRUE);
  base_audio_port_Constructor(openmaxStandComp, &omx_vorbisdec_component_Private->ports[1], 1, OMX_FALSE);

  inPort = (omx_base_audio_PortType *) omx_vorbisdec_component_Private->ports[OMX_BASE_FILTER_INPUTPORT_INDEX];

  inPort->sPortParam.nBufferSize = DEFAULT_IN_BUFFER_SIZE;
  strcpy(inPort->sPortParam.format.audio.cMIMEType, "audio/vorbis");
  inPort->sPortParam.format.audio.eEncoding = OMX_AUDIO_CodingVORBIS;

  inPort->sAudioParam.eEncoding = OMX_AUDIO_CodingVORBIS;
                                                                                                                           
  setHeader(&omx_vorbisdec_component_Private->pAudioVorbis,sizeof(OMX_AUDIO_PARAM_VORBISTYPE));
  omx_vorbisdec_component_Private->pAudioVorbis.nPortIndex = 0;
  omx_vorbisdec_component_Private->pAudioVorbis.nChannels = 2;                                                                                                                          
  omx_vorbisdec_component_Private->pAudioVorbis.nBitRate = 28000;
  omx_vorbisdec_component_Private->pAudioVorbis.nSampleRate = 44100;
  omx_vorbisdec_component_Private->pAudioVorbis.nAudioBandWidth = 0; 
  omx_vorbisdec_component_Private->pAudioVorbis.nQuality = 3; 
  
  /**  common parameters related to output port */

  outPort = (omx_base_audio_PortType *) omx_vorbisdec_component_Private->ports[OMX_BASE_FILTER_OUTPUTPORT_INDEX];

  outPort->sPortParam.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
  outPort->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE;

  outPort->sAudioParam.eEncoding = OMX_AUDIO_CodingPCM;

  /** settings of output port 
    * output is pcm audo format - so set the pcm mode settings
    */ 
  setHeader(&omx_vorbisdec_component_Private->pAudioPcmMode, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
  omx_vorbisdec_component_Private->pAudioPcmMode.nPortIndex = 1;
  omx_vorbisdec_component_Private->pAudioPcmMode.nChannels = 2;
  omx_vorbisdec_component_Private->pAudioPcmMode.eNumData = OMX_NumericalDataSigned;
  omx_vorbisdec_component_Private->pAudioPcmMode.eEndian = OMX_EndianLittle;
  omx_vorbisdec_component_Private->pAudioPcmMode.bInterleaved = OMX_TRUE;
  omx_vorbisdec_component_Private->pAudioPcmMode.nBitPerSample = 16;
  omx_vorbisdec_component_Private->pAudioPcmMode.nSamplingRate = 44100;
  omx_vorbisdec_component_Private->pAudioPcmMode.ePCMMode = OMX_AUDIO_PCMModeLinear;
  omx_vorbisdec_component_Private->pAudioPcmMode.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
  omx_vorbisdec_component_Private->pAudioPcmMode.eChannelMapping[1] = OMX_AUDIO_ChannelRF;

  /** some more component private structure initialization */
  omx_vorbisdec_component_Private->BufferMgmtCallback = omx_vorbisdec_component_BufferMgmtCallbackVorbis;  
  omx_vorbisdec_component_Private->messageHandler = omx_vorbis_decoder_MessageHandler;
  omx_vorbisdec_component_Private->destructor = omx_vorbisdec_component_Destructor;
  openmaxStandComp->SetParameter = omx_vorbisdec_component_SetParameter;
  openmaxStandComp->GetParameter = omx_vorbisdec_component_GetParameter;

  /** increase the counter of initialized components and check against the maximum limit */
  noVorbisDecInstance++;

  /** now it's time to know the audio coding type of the component 
    * if audio coding type is set other than vorbis then error returned
    */
  if(!strcmp(cComponentName, AUDIO_DEC_VORBIS_NAME)) {
    omx_vorbisdec_component_Private->audio_coding_type = OMX_AUDIO_CodingVORBIS;
  }  else if (!strcmp(cComponentName, AUDIO_DEC_BASE_NAME)) {
    omx_vorbisdec_component_Private->audio_coding_type = OMX_AUDIO_CodingUnused;
  }  else  {
    /** IL client specified an invalid component name */
    return OMX_ErrorInvalidComponentName;
  }

  if(noVorbisDecInstance > MAX_COMPONENT_VORBISDEC) {
    return OMX_ErrorInsufficientResources;
  }

  return err;
}