/** The Constructor
 */
OMX_ERRORTYPE omx_clocksrc_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) {
  int                                 omxErr;
  omx_clocksrc_component_PrivateType* omx_clocksrc_component_Private;
  OMX_U32 i;

	RM_RegisterComponent(CLOCK_COMP_NAME, MAX_CLOCK_COMPONENTS);

  if (!openmaxStandComp->pComponentPrivate) {
    openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_clocksrc_component_PrivateType));
    if(openmaxStandComp->pComponentPrivate==NULL) {
      return OMX_ErrorInsufficientResources;
    }
  }

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

  omxErr = omx_base_source_Constructor(openmaxStandComp,cComponentName);
  if (omxErr != OMX_ErrorNone) {
    return OMX_ErrorInsufficientResources;
  }

  omx_clocksrc_component_Private->sPortTypesParam[OMX_PortDomainOther].nStartPortNumber = 0;
  omx_clocksrc_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts = 3;

  /** Allocate Ports and call port constructor. */
  if (omx_clocksrc_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts && !omx_clocksrc_component_Private->ports) {
    omx_clocksrc_component_Private->ports = calloc(omx_clocksrc_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts, sizeof(omx_base_PortType *));
    if (!omx_clocksrc_component_Private->ports) {
      return OMX_ErrorInsufficientResources;
    }
    for (i=0; i < omx_clocksrc_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts; i++) {
      omx_clocksrc_component_Private->ports[i] = calloc(1, sizeof(omx_base_clock_PortType));
      if (!omx_clocksrc_component_Private->ports[i]) {
        return OMX_ErrorInsufficientResources;
      }
      base_clock_port_Constructor(openmaxStandComp, &omx_clocksrc_component_Private->ports[i], i, OMX_FALSE);
      omx_clocksrc_component_Private->ports[i]->FlushProcessingBuffers = clocksrc_port_FlushProcessingBuffers;
    }
  }


  /* initializing the OMX_TIME_CONFIG_CLOCKSTATETYPE */
  setHeader(&omx_clocksrc_component_Private->sClockState, sizeof(OMX_TIME_CONFIG_CLOCKSTATETYPE));
  omx_clocksrc_component_Private->sClockState.eState     = OMX_TIME_ClockStateStopped;
  omx_clocksrc_component_Private->sClockState.nStartTime = 0;
  omx_clocksrc_component_Private->sClockState.nOffset    = 0;
  omx_clocksrc_component_Private->sClockState.nWaitMask  = 0xFF;

  setHeader(&omx_clocksrc_component_Private->sMinStartTime, sizeof(OMX_TIME_CONFIG_TIMESTAMPTYPE));
  omx_clocksrc_component_Private->sMinStartTime.nTimestamp = 0;
  omx_clocksrc_component_Private->sMinStartTime.nPortIndex = 0;

  setHeader(&omx_clocksrc_component_Private->sConfigScale, sizeof(OMX_TIME_CONFIG_SCALETYPE));
  omx_clocksrc_component_Private->sConfigScale.xScale = 1<<16;  /* normal play mode */

  setHeader(&omx_clocksrc_component_Private->sRefClock, sizeof(OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE));
  omx_clocksrc_component_Private->sRefClock.eClock = OMX_TIME_RefClockNone;
  omx_clocksrc_component_Private->eUpdateType = OMX_TIME_UpdateMax;

  if(!omx_clocksrc_component_Private->clockEventSem) {
    omx_clocksrc_component_Private->clockEventSem = calloc(1,sizeof(tsem_t));
    tsem_init(omx_clocksrc_component_Private->clockEventSem, 0);
  }

  if(!omx_clocksrc_component_Private->clockEventCompleteSem) {
    omx_clocksrc_component_Private->clockEventCompleteSem = calloc(1,sizeof(tsem_t));
    tsem_init(omx_clocksrc_component_Private->clockEventCompleteSem, 0);
  }

  omx_clocksrc_component_Private->BufferMgmtCallback = omx_clocksrc_component_BufferMgmtCallback;
  omx_clocksrc_component_Private->destructor = omx_clocksrc_component_Destructor;
  omx_clocksrc_component_Private->BufferMgmtFunction = omx_clocksrc_BufferMgmtFunction;

  openmaxStandComp->SetParameter  = omx_clocksrc_component_SetParameter;
  openmaxStandComp->GetParameter  = omx_clocksrc_component_GetParameter;

  openmaxStandComp->SetConfig  = omx_clocksrc_component_SetConfig;
  openmaxStandComp->GetConfig  = omx_clocksrc_component_GetConfig;
  openmaxStandComp->SendCommand = omx_clocksrc_component_SendCommand;

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

  OMX_ERRORTYPE err = OMX_ErrorNone;
  omx_base_video_PortType *pPortV;
  omx_base_audio_PortType *pPortA;
  omx_parser3gp_component_PrivateType* omx_parser3gp_component_Private;
  DEBUG(DEB_LEV_FUNCTION_NAME,"In %s \n",__func__);

  if (!openmaxStandComp->pComponentPrivate) {
    openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_parser3gp_component_PrivateType));
    if(openmaxStandComp->pComponentPrivate == NULL) {
      return OMX_ErrorInsufficientResources;
    }
  }

  /*Assign size of the derived port class,so that proper memory for port class can be allocated*/
  omx_parser3gp_component_Private = openmaxStandComp->pComponentPrivate;
  omx_parser3gp_component_Private->ports = NULL;

  err = omx_base_source_Constructor(openmaxStandComp, cComponentName);

  omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainVideo].nStartPortNumber = 0;
  omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts = 1;

  omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainAudio].nStartPortNumber = 1;
  omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts = 1;

  omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainOther].nStartPortNumber = 2;
  omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts = 1;

   /** Allocate Ports and call port constructor. */
  if ((omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts  +
       omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
       omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts ) && !omx_parser3gp_component_Private->ports) {
       omx_parser3gp_component_Private->ports = calloc((omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts  +
                                                        omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainVideo].nPorts +
                                                        omx_parser3gp_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts ), sizeof(omx_base_PortType *));
    if (!omx_parser3gp_component_Private->ports) {
      return OMX_ErrorInsufficientResources;
    }
    /* allocate video port*/
   omx_parser3gp_component_Private->ports[VIDEO_PORT_INDEX] = calloc(1, sizeof(omx_base_video_PortType));
   if (!omx_parser3gp_component_Private->ports[VIDEO_PORT_INDEX])
       return OMX_ErrorInsufficientResources;
   /* allocate audio port*/
   omx_parser3gp_component_Private->ports[AUDIO_PORT_INDEX] = calloc(1, sizeof(omx_base_audio_PortType));
   if (!omx_parser3gp_component_Private->ports[AUDIO_PORT_INDEX])
       return OMX_ErrorInsufficientResources;
   /* allocate clock port*/
   omx_parser3gp_component_Private->ports[CLOCK_PORT_INDEX] = calloc(1, sizeof(omx_base_clock_PortType));
   if (!omx_parser3gp_component_Private->ports[CLOCK_PORT_INDEX])
     return OMX_ErrorInsufficientResources;

  }

  base_video_port_Constructor(openmaxStandComp, &omx_parser3gp_component_Private->ports[VIDEO_PORT_INDEX], VIDEO_PORT_INDEX, OMX_FALSE);
  base_audio_port_Constructor(openmaxStandComp, &omx_parser3gp_component_Private->ports[AUDIO_PORT_INDEX], AUDIO_PORT_INDEX, OMX_FALSE);
  base_clock_port_Constructor(openmaxStandComp, &omx_parser3gp_component_Private->ports[CLOCK_PORT_INDEX], CLOCK_PORT_INDEX, OMX_TRUE);
  omx_parser3gp_component_Private->ports[CLOCK_PORT_INDEX]->sPortParam.bEnabled = OMX_FALSE;

  pPortV = (omx_base_video_PortType *) omx_parser3gp_component_Private->ports[VIDEO_PORT_INDEX];
  pPortA = (omx_base_audio_PortType *) omx_parser3gp_component_Private->ports[AUDIO_PORT_INDEX];

  /*Input pPort buffer size is equal to the size of the output buffer of the previous component*/
  pPortV->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE;
  pPortA->sPortParam.nBufferSize = DEFAULT_IN_BUFFER_SIZE;

  omx_parser3gp_component_Private->BufferMgmtCallback = omx_parser3gp_component_BufferMgmtCallback;
  omx_parser3gp_component_Private->BufferMgmtFunction = omx_base_source_twoport_BufferMgmtFunction;

  setHeader(&omx_parser3gp_component_Private->sTimeStamp, sizeof(OMX_TIME_CONFIG_TIMESTAMPTYPE));
  omx_parser3gp_component_Private->sTimeStamp.nPortIndex=0;
  omx_parser3gp_component_Private->sTimeStamp.nTimestamp=0x0;

  omx_parser3gp_component_Private->destructor = omx_parser3gp_component_Destructor;
  omx_parser3gp_component_Private->messageHandler = omx_parser3gp_component_MessageHandler;

  noParser3gpInstance++;
  if(noParser3gpInstance > MAX_COMPONENT_PARSER_3GP) {
    return OMX_ErrorInsufficientResources;
  }

  openmaxStandComp->SetParameter  = omx_parser3gp_component_SetParameter;
  openmaxStandComp->GetParameter  = omx_parser3gp_component_GetParameter;
  openmaxStandComp->SetConfig     = omx_parser3gp_component_SetConfig;
  openmaxStandComp->GetExtensionIndex = omx_parser3gp_component_GetExtensionIndex;

  /* Write in the default paramenters */

  omx_parser3gp_component_Private->pTmpOutputBuffer = calloc(1,sizeof(OMX_BUFFERHEADERTYPE));
  omx_parser3gp_component_Private->pTmpOutputBuffer->pBuffer = calloc(1,DEFAULT_OUT_BUFFER_SIZE);
  omx_parser3gp_component_Private->pTmpOutputBuffer->nFilledLen=0;
  omx_parser3gp_component_Private->pTmpOutputBuffer->nAllocLen=DEFAULT_OUT_BUFFER_SIZE;
  omx_parser3gp_component_Private->pTmpOutputBuffer->nOffset=0;

  omx_parser3gp_component_Private->avformatReady      = OMX_FALSE;
  omx_parser3gp_component_Private->isFirstBufferAudio = OMX_TRUE;
  omx_parser3gp_component_Private->isFirstBufferVideo = OMX_TRUE;

  if(!omx_parser3gp_component_Private->avformatSyncSem) {
    omx_parser3gp_component_Private->avformatSyncSem = calloc(1,sizeof(tsem_t));
    if(omx_parser3gp_component_Private->avformatSyncSem == NULL) return OMX_ErrorInsufficientResources;
    tsem_init(omx_parser3gp_component_Private->avformatSyncSem, 0);
  }
  omx_parser3gp_component_Private->sInputFileName = malloc(DEFAULT_FILENAME_LENGTH);
  /*Default Coding type*/
  omx_parser3gp_component_Private->video_coding_type = OMX_VIDEO_CodingAVC;
  omx_parser3gp_component_Private->audio_coding_type = OMX_AUDIO_CodingMP3;
  av_register_all();  /* without this file opening gives an error */

  return err;
}
/** The Constructor
 */
OMX_ERRORTYPE omx_alsasink_component_Constructor(OMX_COMPONENTTYPE *openmaxStandComp,OMX_STRING cComponentName) {
  int                                 err;
  int                                 omxErr;
  omx_base_audio_PortType             *pPort;
  omx_alsasink_component_PrivateType* omx_alsasink_component_Private;

  if (!openmaxStandComp->pComponentPrivate) {
    openmaxStandComp->pComponentPrivate = calloc(1, sizeof(omx_alsasink_component_PrivateType));
    if(openmaxStandComp->pComponentPrivate==NULL) {
      return OMX_ErrorInsufficientResources;
    }
  }

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

  omxErr = omx_base_sink_Constructor(openmaxStandComp,cComponentName);
  if (omxErr != OMX_ErrorNone) {
    return OMX_ErrorInsufficientResources;
  }

  omx_alsasink_component_Private->sPortTypesParam[OMX_PortDomainAudio].nStartPortNumber = 0;
  omx_alsasink_component_Private->sPortTypesParam[OMX_PortDomainAudio].nPorts = 1;

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

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

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

  pPort = (omx_base_audio_PortType *) omx_alsasink_component_Private->ports[OMX_BASE_SINK_INPUTPORT_INDEX];

  // set the pPort params, now that the ports exist
  /** Domain specific section for the ports. */
  pPort->sPortParam.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
  /*Input pPort buffer size is equal to the size of the output buffer of the previous component*/
  pPort->sPortParam.nBufferSize = DEFAULT_OUT_BUFFER_SIZE;

 /* Initializing the function pointers */
  omx_alsasink_component_Private->BufferMgmtCallback  = omx_alsasink_component_BufferMgmtCallback;
  omx_alsasink_component_Private->destructor          = omx_alsasink_component_Destructor;
  pPort->Port_SendBufferFunction                      = omx_alsasink_component_port_SendBufferFunction;
  pPort->FlushProcessingBuffers                       = omx_alsasink_component_port_FlushProcessingBuffers;

  setHeader(&pPort->sAudioParam, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE));
  pPort->sAudioParam.nPortIndex = 0;
  pPort->sAudioParam.nIndex = 0;
  pPort->sAudioParam.eEncoding = OMX_AUDIO_CodingPCM;

  /* OMX_AUDIO_PARAM_PCMMODETYPE */
  setHeader(&omx_alsasink_component_Private->sPCMModeParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
  omx_alsasink_component_Private->sPCMModeParam.nPortIndex = 0;
  omx_alsasink_component_Private->sPCMModeParam.nChannels = 2;
  omx_alsasink_component_Private->sPCMModeParam.eNumData = OMX_NumericalDataSigned;
  omx_alsasink_component_Private->sPCMModeParam.eEndian = OMX_EndianLittle;
  omx_alsasink_component_Private->sPCMModeParam.bInterleaved = OMX_TRUE;
  omx_alsasink_component_Private->sPCMModeParam.nBitPerSample = 16;
  omx_alsasink_component_Private->sPCMModeParam.nSamplingRate = 44100;
  omx_alsasink_component_Private->sPCMModeParam.ePCMMode = OMX_AUDIO_PCMModeLinear;
  omx_alsasink_component_Private->sPCMModeParam.eChannelMapping[0] = OMX_AUDIO_ChannelNone;

/* testing the A/V sync */
  noAlsasinkInstance++;
  if(noAlsasinkInstance > MAX_COMPONENT_ALSASINK) {
    return OMX_ErrorInsufficientResources;
  }

  /* Allocate the playback handle and the hardware parameter structure */
  if ((err = snd_pcm_open (&omx_alsasink_component_Private->playback_handle, "default", SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
    DEBUG(DEB_LEV_ERR, "cannot open audio device %s (%s)\n", "default", snd_strerror (err));
    return OMX_ErrorHardware;
  }
  else
    DEBUG(DEB_LEV_SIMPLE_SEQ, "Got playback handle at %p %p in %i\n", omx_alsasink_component_Private->playback_handle, &omx_alsasink_component_Private->playback_handle, getpid());

  if (snd_pcm_hw_params_malloc(&omx_alsasink_component_Private->hw_params) < 0) {
    DEBUG(DEB_LEV_ERR, "%s: failed allocating input pPort hw parameters\n", __func__);
    return OMX_ErrorHardware;
  }
  else
    DEBUG(DEB_LEV_SIMPLE_SEQ, "Got hw parameters at %p\n", omx_alsasink_component_Private->hw_params);

  if ((err = snd_pcm_hw_params_any (omx_alsasink_component_Private->playback_handle, omx_alsasink_component_Private->hw_params)) < 0) {
    DEBUG(DEB_LEV_ERR, "cannot initialize hardware parameter structure (%s)\n",  snd_strerror (err));
    return OMX_ErrorHardware;
  }

  openmaxStandComp->SetParameter  = omx_alsasink_component_SetParameter;
  openmaxStandComp->GetParameter  = omx_alsasink_component_GetParameter;

  /* Write in the default parameters */
  omx_alsasink_component_Private->AudioPCMConfigured  = 0;
  omx_alsasink_component_Private->eState  = OMX_TIME_ClockStateStopped;
  omx_alsasink_component_Private->xScale  = 1<<16;

  if (!omx_alsasink_component_Private->AudioPCMConfigured) {
    DEBUG(DEB_LEV_SIMPLE_SEQ, "Configuring the PCM interface in the Init function\n");
    omxErr = omx_alsasink_component_SetParameter(openmaxStandComp, OMX_IndexParamAudioPcm, &omx_alsasink_component_Private->sPCMModeParam);
    if(omxErr != OMX_ErrorNone){
      DEBUG(DEB_LEV_ERR, "In %s Error %08x\n",__func__,omxErr);
    }
  }

  return OMX_ErrorNone;
}
/** 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;
}