static OMX_ERRORTYPE vid_dec_GetParameter(OMX_HANDLETYPE handle, OMX_INDEXTYPE idx, OMX_PTR param) { OMX_COMPONENTTYPE *comp = handle; vid_dec_PrivateType *priv = comp->pComponentPrivate; OMX_ERRORTYPE r; if (!param) return OMX_ErrorBadParameter; switch(idx) { case OMX_IndexParamStandardComponentRole: { OMX_PARAM_COMPONENTROLETYPE *role = param; r = checkHeader(param, sizeof(OMX_PARAM_COMPONENTROLETYPE)); if (r) return r; if (priv->profile == PIPE_VIDEO_PROFILE_MPEG2_MAIN) strcpy((char *)role->cRole, OMX_VID_DEC_MPEG2_ROLE); else if (priv->profile == PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH) strcpy((char *)role->cRole, OMX_VID_DEC_AVC_ROLE); else if (priv->profile == PIPE_VIDEO_PROFILE_HEVC_MAIN) strcpy((char *)role->cRole, OMX_VID_DEC_HEVC_ROLE); break; } case OMX_IndexParamVideoInit: r = checkHeader(param, sizeof(OMX_PORT_PARAM_TYPE)); if (r) return r; memcpy(param, &priv->sPortTypesParam[OMX_PortDomainVideo], sizeof(OMX_PORT_PARAM_TYPE)); break; case OMX_IndexParamVideoPortFormat: { OMX_VIDEO_PARAM_PORTFORMATTYPE *format = param; omx_base_video_PortType *port; r = checkHeader(param, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE)); if (r) return r; if (format->nPortIndex > 1) return OMX_ErrorBadPortIndex; port = (omx_base_video_PortType *)priv->ports[format->nPortIndex]; memcpy(format, &port->sVideoParam, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE)); break; } default: return omx_base_component_GetParameter(handle, idx, param); } return OMX_ErrorNone; }
OMX_ERRORTYPE omx_volume_component_GetParameter( OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR ComponentParameterStructure) { OMX_AUDIO_PARAM_PORTFORMATTYPE *pAudioPortFormat; OMX_AUDIO_PARAM_PCMMODETYPE *pAudioPcmMode; OMX_ERRORTYPE err = OMX_ErrorNone; omx_base_audio_PortType *port; OMX_COMPONENTTYPE *openmaxStandComp = (OMX_COMPONENTTYPE *)hComponent; omx_volume_component_PrivateType* omx_volume_component_Private = openmaxStandComp->pComponentPrivate; if (ComponentParameterStructure == NULL) { return OMX_ErrorBadParameter; } DEBUG(DEB_LEV_SIMPLE_SEQ, " Getting parameter %i\n", nParamIndex); /* Check which structure we are being fed and fill its header */ switch(nParamIndex) { case OMX_IndexParamAudioInit: if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) { break; } memcpy(ComponentParameterStructure, &omx_volume_component_Private->sPortTypesParam[OMX_PortDomainAudio], sizeof(OMX_PORT_PARAM_TYPE)); break; case OMX_IndexParamAudioPortFormat: pAudioPortFormat = (OMX_AUDIO_PARAM_PORTFORMATTYPE*)ComponentParameterStructure; if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE))) != OMX_ErrorNone) { break; } if (pAudioPortFormat->nPortIndex <= 1) { port= (omx_base_audio_PortType *)omx_volume_component_Private->ports[pAudioPortFormat->nPortIndex]; memcpy(pAudioPortFormat, &port->sAudioParam, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE)); } else { err = OMX_ErrorBadPortIndex; } break; case OMX_IndexParamAudioPcm: pAudioPcmMode = (OMX_AUDIO_PARAM_PCMMODETYPE*)ComponentParameterStructure; if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE))) != OMX_ErrorNone) { break; } if (pAudioPcmMode->nPortIndex > 1) { return OMX_ErrorBadPortIndex; } pAudioPcmMode->nChannels = 2; pAudioPcmMode->eNumData = OMX_NumericalDataSigned; pAudioPcmMode->eEndian = OMX_EndianBig; pAudioPcmMode->bInterleaved = OMX_TRUE; pAudioPcmMode->nBitPerSample = 16; pAudioPcmMode->nSamplingRate = 0; pAudioPcmMode->ePCMMode = OMX_AUDIO_PCMModeLinear; break; default: err = omx_base_component_GetParameter(hComponent, nParamIndex, ComponentParameterStructure); } return err; }
OMX_ERRORTYPE omx_audio_capturer_GetParameter( OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure) { OMX_AUDIO_PARAM_PORTFORMATTYPE *pAudioPortFormat; OMX_ERRORTYPE err = OMX_ErrorNone; OMX_COMPONENTTYPE *pComponent = (OMX_COMPONENTTYPE*)hComponent; omx_audio_capturer_component_PrivateType* pPrivate = (omx_audio_capturer_component_PrivateType*) pComponent->pComponentPrivate; omx_base_audio_PortType *pPort = (omx_base_audio_PortType *) pPrivate->ports[OMX_BASE_SOURCE_OUTPUTPORT_INDEX]; if (ComponentParameterStructure == NULL) { return OMX_ErrorBadParameter; } DEBUG(DEB_LEV_SIMPLE_SEQ, " Getting parameter %i\n", nParamIndex); /* Check which structure we are being fed and fill its header */ switch(nParamIndex) { case OMX_IndexParamAudioInit: if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) { break; } memcpy(ComponentParameterStructure, &pPrivate->sPortTypesParam[OMX_PortDomainAudio], sizeof(OMX_PORT_PARAM_TYPE)); break; case OMX_IndexParamAudioPortFormat: pAudioPortFormat = (OMX_AUDIO_PARAM_PORTFORMATTYPE*)ComponentParameterStructure; if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE))) != OMX_ErrorNone) { break; } if (pAudioPortFormat->nPortIndex < 1) { memcpy(pAudioPortFormat, &pPort->sAudioParam, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE)); } else { return OMX_ErrorBadPortIndex; } break; case OMX_IndexParamAudioPcm: if(((OMX_AUDIO_PARAM_PCMMODETYPE*)ComponentParameterStructure)->nPortIndex != 0) { return OMX_ErrorBadParameter; } if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE))) != OMX_ErrorNone) { break; } omx_audio_capturer_component_PortType* pPort; pPort = (omx_audio_capturer_component_PortType *) pPrivate->ports[0]; memcpy(ComponentParameterStructure, &pPort->sPCMModeParam, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); break; default: /*Call the base component function*/ return omx_base_component_GetParameter(hComponent, nParamIndex, ComponentParameterStructure); } return err; }
OMX_ERRORTYPE omx_clocksrc_component_GetParameter( OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure) { OMX_ERRORTYPE err = OMX_ErrorNone; OMX_OTHER_PARAM_PORTFORMATTYPE *pOtherPortFormat; OMX_COMPONENTTYPE *openmaxStandComp = (OMX_COMPONENTTYPE*)hComponent; omx_clocksrc_component_PrivateType* omx_clocksrc_component_Private = openmaxStandComp->pComponentPrivate; omx_base_clock_PortType* pPort; // = (omx_base_clock_PortType *) omx_clocksrc_component_Private->ports[OMX_BASE_SOURCE_OUTPUTPORT_INDEX]; OMX_PARAM_COMPONENTROLETYPE *pComponentRole; if (ComponentParameterStructure == NULL) { return OMX_ErrorBadParameter; } DEBUG(DEB_LEV_SIMPLE_SEQ, " Getting parameter %i\n", nParamIndex); /* Check which structure we are being fed and fill its header */ switch(nParamIndex) { case OMX_IndexParamOtherInit: if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) { break; } memcpy(ComponentParameterStructure, &omx_clocksrc_component_Private->sPortTypesParam[OMX_PortDomainOther], sizeof(OMX_PORT_PARAM_TYPE)); break; case OMX_IndexParamOtherPortFormat: pOtherPortFormat = (OMX_OTHER_PARAM_PORTFORMATTYPE*)ComponentParameterStructure; if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_OTHER_PARAM_PORTFORMATTYPE))) != OMX_ErrorNone) { break; } if (pOtherPortFormat->nPortIndex < omx_clocksrc_component_Private->sPortTypesParam[OMX_PortDomainOther].nPorts) { pPort = (omx_base_clock_PortType *) omx_clocksrc_component_Private->ports[pOtherPortFormat->nPortIndex]; memcpy(pOtherPortFormat, &pPort->sOtherParam, sizeof(OMX_OTHER_PARAM_PORTFORMATTYPE)); } else { return OMX_ErrorBadPortIndex; } break; case OMX_IndexParamStandardComponentRole: pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)ComponentParameterStructure; if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_COMPONENTROLETYPE))) != OMX_ErrorNone) { break; } strcpy( (char*) pComponentRole->cRole, ""); break; default: /*Call the base component function*/ return omx_base_component_GetParameter(hComponent, nParamIndex, ComponentParameterStructure); } return err; }
OMX_ERRORTYPE omx_xvideo_sink_component_GetParameter( OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure) { OMX_VIDEO_PARAM_PORTFORMATTYPE *pVideoPortFormat; OMX_ERRORTYPE err = OMX_ErrorNone; OMX_COMPONENTTYPE *openmaxStandComp = (OMX_COMPONENTTYPE *)hComponent; omx_xvideo_sink_component_PrivateType* omx_xvideo_sink_component_Private = openmaxStandComp->pComponentPrivate; omx_xvideo_sink_component_PortType *pPort = (omx_xvideo_sink_component_PortType *) omx_xvideo_sink_component_Private->ports[OMX_BASE_SINK_INPUTPORT_INDEX]; if (ComponentParameterStructure == NULL) { return OMX_ErrorBadParameter; } DEBUG(DEB_LEV_SIMPLE_SEQ, " Getting parameter %i\n", nParamIndex); /* Check which structure we are being fed and fill its header */ switch(nParamIndex) { case OMX_IndexParamVideoInit: if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) { break; } memcpy(ComponentParameterStructure, &omx_xvideo_sink_component_Private->sPortTypesParam[OMX_PortDomainVideo], sizeof(OMX_PORT_PARAM_TYPE)); break; case OMX_IndexParamVideoPortFormat: pVideoPortFormat = (OMX_VIDEO_PARAM_PORTFORMATTYPE*)ComponentParameterStructure; if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE))) != OMX_ErrorNone) { break; } if (pVideoPortFormat->nPortIndex < 1) { memcpy(pVideoPortFormat, &pPort->sVideoParam, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE)); } else { return OMX_ErrorBadPortIndex; } break; default: /*Call the base component function*/ return omx_base_component_GetParameter(hComponent, nParamIndex, ComponentParameterStructure); } return err; }
/*************************************************************************** * Function : omx_ImageDecoderJpeg_GetParameter * * Description : this function gets the parameters regarding audio formats and index. * * Params : * * Name Type In/Out Description * hComponent OMX_HANDLETYPE In Component Handle * nParamIndex OMX_INDEXTYPE In Parameter Index * ComponentParameterStructure OMX_PTR Out Component Parameter Structure to return * * Return: * OMX_ErrorBadParameter if there is no Parameter structure * OMX_ErrorBadPortIndex if portindex is wrong * * Note: * * Revision: * * Author Date Version Description * yuyiwei 2008.10.9 1.0.0 * ***************************************************************************/ OMX_ERRORTYPE omx_ImageDecoderJpeg_GetParameter(OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR ComponentParameterStructure) { OMX_IMAGE_PARAM_PORTFORMATTYPE *pImagePortFormat; OMX_PARAM_COMPONENTROLETYPE *pComponentRole; omx_jpegdec_component_PortType *port; OMX_ERRORTYPE err = OMX_ErrorNone; OMX_COMPONENTTYPE *openmaxStandComp = (OMX_COMPONENTTYPE*)hComponent; omx_jpegdec_component_PrivateType *omx_jpegdec_component_Private = openmaxStandComp->pComponentPrivate; if (ComponentParameterStructure == NULL) { /** no parameter structure */ return OMX_ErrorBadParameter; } DEBUG(DEB_LEV_SIMPLE_SEQ, " Getting parameter %i\n", nParamIndex); /* Check which structure we are being fed and fill its header */ switch (nParamIndex) { case OMX_IndexParamImageInit: /*Check Structure Header and verify component state*/ if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) { break; } memcpy(ComponentParameterStructure, &omx_jpegdec_component_Private->sPortTypesParam, sizeof(OMX_PORT_PARAM_TYPE)); break; case OMX_IndexParamImagePortFormat: pImagePortFormat = (OMX_IMAGE_PARAM_PORTFORMATTYPE*)ComponentParameterStructure; /*Check Structure Header and verify component state*/ if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_IMAGE_PARAM_PORTFORMATTYPE))) != OMX_ErrorNone) { break; } if (pImagePortFormat->nPortIndex <= 1) { port = (omx_jpegdec_component_PortType*)omx_jpegdec_component_Private->ports[pImagePortFormat->nPortIndex]; memcpy(pImagePortFormat, &port->sImageParam, sizeof(OMX_IMAGE_PARAM_PORTFORMATTYPE)); } else { return OMX_ErrorBadPortIndex; } break; case OMX_IndexParamStandardComponentRole: pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)ComponentParameterStructure; if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_COMPONENTROLETYPE))) != OMX_ErrorNone) { break; } if (omx_jpegdec_component_Private->image_coding_type == OMX_IMAGE_CodingJPEG) { strcpy((char*)pComponentRole->cRole, IMAGE_DEC_JPEG_ROLE); } else { strcpy((char*)pComponentRole->cRole, "\0"); } break; default: /*Call the base component function*/ return omx_base_component_GetParameter(hComponent, nParamIndex, ComponentParameterStructure); } return OMX_ErrorNone; }
OMX_ERRORTYPE omx_amr_audiodec_component_GetParameter( OMX_HANDLETYPE hComponent, OMX_INDEXTYPE nParamIndex, OMX_PTR ComponentParameterStructure) { OMX_AUDIO_PARAM_PORTFORMATTYPE *pAudioPortFormat; OMX_AUDIO_PARAM_PCMMODETYPE *pAudioPcmMode; OMX_PARAM_COMPONENTROLETYPE * pComponentRole; OMX_AUDIO_PARAM_AMRTYPE *pAudioAmr; omx_base_audio_PortType *port; OMX_ERRORTYPE err = OMX_ErrorNone; OMX_COMPONENTTYPE *openmaxStandComp = (OMX_COMPONENTTYPE *)hComponent; omx_amr_audiodec_component_PrivateType* omx_amr_audiodec_component_Private = (omx_amr_audiodec_component_PrivateType*)openmaxStandComp->pComponentPrivate; if (ComponentParameterStructure == NULL) { return OMX_ErrorBadParameter; } DEBUG(DEB_LEV_SIMPLE_SEQ, " Getting parameter %i\n", nParamIndex); /* Check which structure we are being fed and fill its header */ switch(nParamIndex) { case OMX_IndexParamAudioInit: if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) { break; } memcpy(ComponentParameterStructure, &omx_amr_audiodec_component_Private->sPortTypesParam[OMX_PortDomainAudio], sizeof(OMX_PORT_PARAM_TYPE)); break; case OMX_IndexParamAudioPortFormat: pAudioPortFormat = (OMX_AUDIO_PARAM_PORTFORMATTYPE*)ComponentParameterStructure; if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE))) != OMX_ErrorNone) { break; } if (pAudioPortFormat->nPortIndex <= 1) { port = (omx_base_audio_PortType *)omx_amr_audiodec_component_Private->ports[pAudioPortFormat->nPortIndex]; memcpy(pAudioPortFormat, &port->sAudioParam, sizeof(OMX_AUDIO_PARAM_PORTFORMATTYPE)); } else { return OMX_ErrorBadPortIndex; } break; case OMX_IndexParamAudioPcm: pAudioPcmMode = (OMX_AUDIO_PARAM_PCMMODETYPE*)ComponentParameterStructure; if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE))) != OMX_ErrorNone) { break; } if (pAudioPcmMode->nPortIndex > 1) { return OMX_ErrorBadPortIndex; } memcpy(pAudioPcmMode,&omx_amr_audiodec_component_Private->pAudioPcmMode,sizeof(OMX_AUDIO_PARAM_PCMMODETYPE)); break; case OMX_IndexParamAudioAmr: pAudioAmr = (OMX_AUDIO_PARAM_AMRTYPE*)ComponentParameterStructure; if (pAudioAmr->nPortIndex != 0) { return OMX_ErrorBadPortIndex; } if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_AUDIO_PARAM_AMRTYPE))) != OMX_ErrorNone) { break; } memcpy(pAudioAmr,&omx_amr_audiodec_component_Private->pAudioAmr,sizeof(OMX_AUDIO_PARAM_AMRTYPE)); break; case OMX_IndexParamStandardComponentRole: pComponentRole = (OMX_PARAM_COMPONENTROLETYPE*)ComponentParameterStructure; if ((err = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_COMPONENTROLETYPE))) != OMX_ErrorNone) { break; } if (omx_amr_audiodec_component_Private->audio_coding_type == OMX_AUDIO_CodingAMR) { strcpy((char*)pComponentRole->cRole, AUDIO_DEC_AMR_ROLE); } else { strcpy((char*)pComponentRole->cRole,"\0");; } break; default: /*Call the base component function*/ return omx_base_component_GetParameter(hComponent, nParamIndex, ComponentParameterStructure); } return err; }
OMX_ERRORTYPE omx_shvpudec_component_GetParameter( OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR ComponentParameterStructure) { omx_base_video_PortType *port; OMX_ERRORTYPE eError = OMX_ErrorNone; OMX_COMPONENTTYPE *openmaxStandComp = hComponent; omx_shvpudec_component_PrivateType* omx_shvpudec_component_Private = openmaxStandComp->pComponentPrivate; if (ComponentParameterStructure == NULL) { return OMX_ErrorBadParameter; } DEBUG(DEB_LEV_SIMPLE_SEQ, " Getting parameter %i\n", nParamIndex); /* Check which structure we are being fed and fill its header */ switch(nParamIndex) { case OMX_IndexParamVideoInit: if ((eError = checkHeader(ComponentParameterStructure, sizeof(OMX_PORT_PARAM_TYPE))) != OMX_ErrorNone) { break; } memcpy(ComponentParameterStructure, &omx_shvpudec_component_Private->sPortTypesParam[OMX_PortDomainVideo], sizeof(OMX_PORT_PARAM_TYPE)); break; case OMX_IndexParamVideoPortFormat: { OMX_VIDEO_PARAM_PORTFORMATTYPE *pVideoPortFormat; pVideoPortFormat = ComponentParameterStructure; if ((eError = checkHeader(ComponentParameterStructure, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE))) != OMX_ErrorNone) { break; } if (pVideoPortFormat->nPortIndex <= 1) { port = (omx_base_video_PortType *)omx_shvpudec_component_Private->ports[pVideoPortFormat->nPortIndex]; memcpy(pVideoPortFormat, &port->sVideoParam, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE)); } else { return OMX_ErrorBadPortIndex; } break; } case OMX_IndexParamVideoMpeg4: { OMX_VIDEO_PARAM_MPEG4TYPE *pVideoMpeg4; pVideoMpeg4 = ComponentParameterStructure; if (pVideoMpeg4->nPortIndex != 0) { return OMX_ErrorBadPortIndex; } if ((eError = checkHeader(ComponentParameterStructure, sizeof(OMX_VIDEO_PARAM_MPEG4TYPE))) != OMX_ErrorNone) { break; } memcpy(pVideoMpeg4, &omx_shvpudec_component_Private->pVideoMpeg4, sizeof(OMX_VIDEO_PARAM_MPEG4TYPE)); break; } case OMX_IndexParamVideoAvc: { OMX_VIDEO_PARAM_AVCTYPE * pVideoAvc; pVideoAvc = ComponentParameterStructure; if (pVideoAvc->nPortIndex != 0) { return OMX_ErrorBadPortIndex; } if ((eError = checkHeader(ComponentParameterStructure, sizeof(OMX_VIDEO_PARAM_AVCTYPE))) != OMX_ErrorNone) { break; } memcpy(pVideoAvc, &omx_shvpudec_component_Private->pVideoAvc, sizeof(OMX_VIDEO_PARAM_AVCTYPE)); break; } case OMX_IndexParamStandardComponentRole: { OMX_PARAM_COMPONENTROLETYPE * pComponentRole; pComponentRole = ComponentParameterStructure; if ((eError = checkHeader(ComponentParameterStructure, sizeof(OMX_PARAM_COMPONENTROLETYPE))) != OMX_ErrorNone) { break; } if (omx_shvpudec_component_Private->video_coding_type == OMX_VIDEO_CodingMPEG4) { strcpy((char *)pComponentRole->cRole, VIDEO_DEC_MPEG4_ROLE); } else if (omx_shvpudec_component_Private->video_coding_type == OMX_VIDEO_CodingAVC) { strcpy((char *)pComponentRole->cRole, VIDEO_DEC_H264_ROLE); } else { strcpy((char *)pComponentRole->cRole,"\0"); } break; } default: /*Call the base component function*/ return omx_base_component_GetParameter(hComponent, nParamIndex, ComponentParameterStructure); } return OMX_ErrorNone; }