本文整理汇总了C++中OMX_INIT_STRUCT函数的典型用法代码示例。如果您正苦于以下问题:C++ OMX_INIT_STRUCT函数的具体用法?C++ OMX_INIT_STRUCT怎么用?C++ OMX_INIT_STRUCT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了OMX_INIT_STRUCT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fsl_osal_strcpy
WmaDec::WmaDec()
{
fsl_osal_strcpy((fsl_osal_char*)name, "OMX.Freescale.std.audio_decoder.wma.sw-based");
ComponentVersion.s.nVersionMajor = 0x0;
ComponentVersion.s.nVersionMinor = 0x1;
ComponentVersion.s.nRevision = 0x0;
ComponentVersion.s.nStep = 0x0;
role_cnt = 1;
role[0] = (OMX_STRING)"audio_decoder.wma";
codingType = OMX_AUDIO_CodingWMA;
outputPortBufferSize = WMA_OUTPUT_PORT_SIZE;
decoderLibName = "lib_wma10d_wrap_arm12_elinux_android.so";
OMX_INIT_STRUCT(&WmaType, OMX_AUDIO_PARAM_WMATYPE);
OMX_INIT_STRUCT(&WmaTypeExt, OMX_AUDIO_PARAM_WMATYPE_EXT);
WmaType.nPortIndex = AUDIO_FILTER_INPUT_PORT;
WmaType.nChannels = 2;
WmaType.nSamplingRate = 44100;
WmaType.nBitRate = 64000;
WmaType.eFormat = OMX_AUDIO_WMAFormat9;
WmaTypeExt.nPortIndex = AUDIO_FILTER_INPUT_PORT;
WmaTypeExt.nBitsPerSample = 16;
LOG_DEBUG("Unia -> WMA");
}
示例2: fsl_osal_strcpy
AC3ToIEC937::AC3ToIEC937()
{
fsl_osal_strcpy((fsl_osal_char*)name, "OMX.Freescale.std.audio_processor.ac3toiec937.sw-based");
ComponentVersion.s.nVersionMajor = 0x0;
ComponentVersion.s.nVersionMinor = 0x1;
ComponentVersion.s.nRevision = 0x0;
ComponentVersion.s.nStep = 0x0;
role_cnt = 1;
role[0] = (OMX_STRING)"audio_processor.ac3toiec937";
bInContext = OMX_FALSE;
nInBufferSize = IN_BUFFER_SIZE;
nOutBufferSize = OUT_BUFFER_SIZE;
eInCodingType = (OMX_AUDIO_CODINGTYPE)OMX_AUDIO_CodingAC3;
OMX_INIT_STRUCT(&Ac3Type, OMX_AUDIO_PARAM_AC3TYPE);
Ac3Type.nPortIndex = AUDIO_FILTER_INPUT_PORT;
Ac3Type.nChannels = 2;
Ac3Type.nSampleRate = 48000;
Ac3Type.nBitRate = 128*1024;
bFirstFrame = OMX_TRUE;
bSwitchWord = OMX_FALSE;
OMX_INIT_STRUCT(&PcmMode, OMX_AUDIO_PARAM_PCMMODETYPE);
PcmMode.nPortIndex = AUDIO_FILTER_OUTPUT_PORT;
PcmMode.nChannels = 2;
PcmMode.nSamplingRate = 48000;
PcmMode.nBitPerSample = 16;
PcmMode.bInterleaved = OMX_TRUE;
PcmMode.eNumData = OMX_NumericalDataSigned;
PcmMode.ePCMMode = OMX_AUDIO_PCMModeLinear;
PcmMode.eEndian = OMX_EndianLittle;
PcmMode.eChannelMapping[0] = OMX_AUDIO_ChannelNone;
}
示例3: OMX_ConfigureDynamicPFramesInH264E
static OMX_ERRORTYPE OMX_ConfigureDynamicPFramesInH264E( OMX_HANDLETYPE hComponent,
OMX_BUFFERHEADERTYPE * pBufferHdr, OMX_U32 nCurrentFrameRate, OMX_U32 nTargetFrameRate)
{
OMX_ERRORTYPE eError = OMX_ErrorNone;
OMX_U32 remainder = 0;
OMX_U16 nTargetPFrames =0; /* Target Pframes to be provided to Encoder */
OMX_U16 nCurrentPFrames = 0; /* Current pFrame Value configured to Encoder */
OMX_VIDEO_CONFIG_AVCINTRAPERIOD tPframeH264e;
OMX_VIDEO_PARAM_AVCTYPE h264type;
OMX_COMPONENTTYPE *pHandle;
if (hComponent == NULL){
DOMX_ERROR("Component is invalid/ not present ");
return OMX_ErrorBadParameter;
}
pHandle = (OMX_COMPONENTTYPE *) hComponent;
/* Initialise the OMX structures */
OMX_INIT_STRUCT(tPframeH264e, OMX_VIDEO_CONFIG_AVCINTRAPERIOD);
OMX_INIT_STRUCT(h264type,OMX_VIDEO_PARAM_AVCTYPE);
/* Read number of B Frames if not read yet */
if(!nBFrames){
h264type.nPortIndex = 1;
eError = pHandle->GetParameter(hComponent,OMX_IndexParamVideoAvc,&h264type);
if(eError != OMX_ErrorNone) {
DOMX_ERROR(" Error while reading component info = %d",eError);
return eError;
}
nBFrames = h264type.nBFrames;
}
/* Read Current pFrames set in Encoder */
tPframeH264e.nPortIndex = 1;
eError = pHandle->GetConfig(hComponent,OMX_IndexConfigVideoAVCIntraPeriod,&tPframeH264e);
if(eError != OMX_ErrorNone) {
DOMX_ERROR(" Error while Getting PFrame info, Error code = %d",eError);
return eError;
}
nCurrentPFrames = tPframeH264e.nPFrames;
/* Calculate Target P Frames */
nTargetPFrames = (nCurrentPFrames * nTargetFrameRate) /nCurrentFrameRate;
/* Number of pFrames should be multiple of (B FRAMES + 1) */
remainder = nTargetPFrames % (nBFrames + 1);
nTargetPFrames = nTargetPFrames - remainder;
if(nTargetPFrames == nCurrentPFrames){
DOMX_INFO(" No Change in P Frames, No Update required");
return OMX_ErrorNone;
}
/* Update the new PFrames to the Encoder */
tPframeH264e.nPFrames = nTargetPFrames;
eError = pHandle->SetConfig(hComponent,OMX_IndexConfigVideoAVCIntraPeriod,&tPframeH264e);
if(eError != OMX_ErrorNone) {
DOMX_ERROR(" Error while setting PFrame info, Error code = %d",eError);
}
return eError;
}
示例4: load_component
OMX_ERRORTYPE load_component(HTEST *hTest)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_HANDLETYPE hComponent = NULL;
OMX_PARAM_PORTDEFINITIONTYPE sPortDef;
OMX_U32 i;
ret = OMX_GetHandle(&hComponent, hTest->name, hTest, &gCallBacks);
if(ret != OMX_ErrorNone)
{
printf("Load component %s failed.\n", hTest->name);
return ret;
}
hTest->hComponent = (OMX_COMPONENTTYPE*)hComponent;
hTest->nPorts = get_component_ports(hComponent);
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
for(i=0; i<hTest->nPorts; i++)
{
sPortDef.nPortIndex = i;
OMX_GetParameter(hComponent, OMX_IndexParamPortDefinition, &sPortDef);
if (sPortDef.eDomain == OMX_PortDomainAudio)
hTest->nAudioTrackNum = i;
if (sPortDef.eDomain == OMX_PortDomainVideo)
hTest->nVideoTrackNum = i;
hTest->PortDir[i] = sPortDef.eDir;
if(hTest->PortDir[i] == OMX_DirInput)
hTest->bAllocater[i] = OMX_FALSE;
if(hTest->PortDir[i] == OMX_DirOutput)
hTest->bAllocater[i] = OMX_TRUE;
}
OMX_PARAM_CONTENTURITYPE *content = NULL;
content =(OMX_PARAM_CONTENTURITYPE *) fsl_osal_malloc_new(sizeof(OMX_PARAM_CONTENTURITYPE) + 1024);
if (!content)
return OMX_ErrorInsufficientResources;
fsl_osal_memset(content, 0 , sizeof(OMX_PARAM_CONTENTURITYPE)+1024);
OMX_INIT_STRUCT(content,OMX_PARAM_CONTENTURITYPE);
char* uri = (char*)&(content->contentURI);
fsl_osal_memcpy(uri, hTest->media_name, strlen(hTest->media_name)+1);
ret = OMX_SetParameter(hTest->hComponent,OMX_IndexParamContentURI,content);
if (ret != OMX_ErrorNone)
{
OMX_FreeHandle(hTest->hComponent);
hTest->hComponent = NULL;
return ret;
}
fsl_osal_thread_create(&hTest->pThreadId, NULL, process_thread, hTest);
return OMX_ErrorNone;
}
示例5: OMX_INIT_STRUCT
OMX_ERRORTYPE VideoFilter::PortFormatChanged(OMX_U32 nPortIndex)
{
OMX_PARAM_PORTDEFINITIONTYPE sPortDef;
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
if(nPortIndex == IN_PORT)
{
sPortDef.nPortIndex = IN_PORT;
ports[IN_PORT]->GetPortDefinition(&sPortDef);
//fsl_osal_memcpy(&sInFmt, &(sPortDef.format.video), sizeof(OMX_VIDEO_PORTDEFINITIONTYPE));
sInFmt.nFrameWidth = sPortDef.format.video.nFrameWidth;
sInFmt.nFrameHeight = sPortDef.format.video.nFrameHeight;
sInFmt.eCompressionFormat = sPortDef.format.video.eCompressionFormat;
sInFmt.eColorFormat = sPortDef.format.video.eColorFormat;
sInFmt.xFramerate = sPortDef.format.video.xFramerate;
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
sPortDef.nPortIndex = OUT_PORT;
ports[OUT_PORT]->GetPortDefinition(&sPortDef);
if (Rotation.nRotation == 90 || Rotation.nRotation == 270)
{
sPortDef.format.video.nFrameWidth = sInFmt.nFrameHeight;
sPortDef.format.video.nFrameHeight = sInFmt.nFrameWidth;
}
else
{
sPortDef.format.video.nFrameWidth = sInFmt.nFrameWidth;
sPortDef.format.video.nFrameHeight = sInFmt.nFrameHeight;
}
sPortDef.format.video.xFramerate = sInFmt.xFramerate;
if(sInFmt.eCompressionFormat != OMX_VIDEO_CodingUnused)
sPortDef.nBufferSize = sPortDef.format.video.nFrameWidth * sPortDef.format.video.nFrameHeight
* pxlfmt2bpp(sPortDef.format.video.eColorFormat) / 8;
ports[OUT_PORT]->SetPortDefinition(&sPortDef);
if(hTsHandle != NULL)
tsmSetFrmRate(hTsHandle, sInFmt.xFramerate, Q16_SHIFT);
}
if(nPortIndex == OUT_PORT)
{
sPortDef.nPortIndex = OUT_PORT;
ports[OUT_PORT]->GetPortDefinition(&sPortDef);
//fsl_osal_memcpy(&sOutFmt, &(sPortDef.format.video), sizeof(OMX_VIDEO_PORTDEFINITIONTYPE));
sOutFmt.nFrameWidth = sPortDef.format.video.nFrameWidth;
sOutFmt.nFrameHeight = sPortDef.format.video.nFrameHeight;
sOutFmt.xFramerate=sPortDef.format.video.xFramerate;
sOutFmt.nBitrate=sPortDef.format.video.nBitrate;
sOutFmt.eCompressionFormat = sPortDef.format.video.eCompressionFormat;
sOutFmt.eColorFormat = sPortDef.format.video.eColorFormat;
nOutBufferCnt = sPortDef.nBufferCountActual;
}
return OMX_ErrorNone;
}
示例6: load_component
OMX_ERRORTYPE load_component(HTEST *hTest)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_HANDLETYPE hComponent = NULL;
OMX_PARAM_PORTDEFINITIONTYPE sPortDef;
OMX_U32 i;
ret = OMX_GetHandle(&hComponent, hTest->name, hTest, &gCallBacks);
if(ret != OMX_ErrorNone)
{
printf("Load component %s failed.\n", hTest->name);
return ret;
}
hTest->hComponent = (OMX_COMPONENTTYPE*)hComponent;
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
sPortDef.nPortIndex = 1;
ret = OMX_GetParameter(hTest->hComponent,OMX_IndexParamPortDefinition,&sPortDef);
if (ret != OMX_ErrorNone)
return ret;
sPortDef.format.video.nFrameWidth = 176;
sPortDef.format.video.nFrameHeight = 144;
ret = OMX_SetParameter(hTest->hComponent,OMX_IndexParamPortDefinition,&sPortDef);
if (ret != OMX_ErrorNone)
return ret;
sPortDef.nPortIndex = 0;
ret = OMX_SetParameter(hTest->hComponent,OMX_IndexParamPortDefinition,&sPortDef);
if (ret != OMX_ErrorNone)
return ret;
hTest->nPorts = get_component_ports(hComponent);
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
for(i=0; i<hTest->nPorts; i++)
{
sPortDef.nPortIndex = i;
OMX_GetParameter(hComponent, OMX_IndexParamPortDefinition, &sPortDef);
if (sPortDef.eDomain == OMX_PortDomainAudio)
hTest->nAudioTrackNum = i;
if (sPortDef.eDomain == OMX_PortDomainVideo)
hTest->nVideoTrackNum = i;
hTest->PortDir[i] = sPortDef.eDir;
if(hTest->PortDir[i] == OMX_DirInput)
hTest->bAllocater[i] = OMX_FALSE;
if(hTest->PortDir[i] == OMX_DirOutput)
hTest->bAllocater[i] = OMX_TRUE;
if(i == 0)
hTest->bAllocater[i] = OMX_FALSE;
}
fsl_osal_thread_create(&hTest->pThreadId, NULL, process_thread, hTest);
return OMX_ErrorNone;
}
示例7: OMX_INIT_STRUCT
OMX_ERRORTYPE LibavAudioDec::InitComponent()
{
/*set default definition*/
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_PARAM_PORTDEFINITIONTYPE sPortDef;
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
sPortDef.nPortIndex = AUDIO_FILTER_INPUT_PORT;
sPortDef.eDir = OMX_DirInput;
sPortDef.eDomain = OMX_PortDomainAudio;
sPortDef.format.audio.eEncoding = CodingType;
sPortDef.bPopulated = OMX_FALSE;
sPortDef.bEnabled = OMX_TRUE;
sPortDef.nBufferCountMin = 1;
sPortDef.nBufferCountActual = 3;
sPortDef.nBufferSize = 32768;
ret = ports[AUDIO_FILTER_INPUT_PORT]->SetPortDefinition(&sPortDef);
if(ret != OMX_ErrorNone) {
LOG_ERROR("Set port definition for port[%d] failed.\n", AUDIO_FILTER_INPUT_PORT);
return ret;
}
sPortDef.nPortIndex = AUDIO_FILTER_OUTPUT_PORT;
sPortDef.eDir = OMX_DirOutput;
sPortDef.eDomain = OMX_PortDomainAudio;
sPortDef.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
sPortDef.bPopulated = OMX_FALSE;
sPortDef.bEnabled = OMX_TRUE;
sPortDef.nBufferCountMin = 1;
sPortDef.nBufferCountActual = 3;
sPortDef.nBufferSize = LIBAV_OUTPUT_PORT_BUFFER_SIZE;
ret = ports[AUDIO_FILTER_OUTPUT_PORT]->SetPortDefinition(&sPortDef);
if(ret != OMX_ErrorNone) {
LOG_ERROR("Set port definition for port[%d] failed.\n", 0);
return ret;
}
OMX_INIT_STRUCT(&PcmMode, OMX_AUDIO_PARAM_PCMMODETYPE);
PcmMode.nPortIndex = AUDIO_FILTER_OUTPUT_PORT;
PcmMode.nChannels = 2;
PcmMode.nSamplingRate = 44100;
PcmMode.nBitPerSample = 16;
PcmMode.bInterleaved = OMX_TRUE;
PcmMode.eNumData = OMX_NumericalDataSigned;
PcmMode.ePCMMode = OMX_AUDIO_PCMModeLinear;
PcmMode.eEndian = OMX_EndianLittle;
PcmMode.eChannelMapping[0] = OMX_AUDIO_ChannelNone;
return ret;
}
示例8: fsl_osal_strcpy
AacDec::AacDec()
{
fsl_osal_strcpy((fsl_osal_char*)name, "OMX.Freescale.std.audio_decoder.aac.sw-based");
ComponentVersion.s.nVersionMajor = 0x0;
ComponentVersion.s.nVersionMinor = 0x1;
ComponentVersion.s.nRevision = 0x0;
ComponentVersion.s.nStep = 0x0;
role_cnt = 1;
role[0] = (OMX_STRING)"audio_decoder.aac";
codingType = OMX_AUDIO_CodingAAC;
nPushModeInputLen = AAC_PUSH_MODE_LEN;
outputPortBufferSize = 6*AACD_FRAME_SIZE*2*4;
decoderLibName = "lib_aacd_wrap_arm12_elinux_android.so";
optionaDecoderlLibName = "lib_aacplusd_wrap_arm12_elinux_android.so";
OMX_INIT_STRUCT(&AacType, OMX_AUDIO_PARAM_AACPROFILETYPE);
AacType.nPortIndex = AUDIO_FILTER_INPUT_PORT;
AacType.nChannels = 2;
AacType.nSampleRate = 44100;
AacType.nAudioBandWidth = 0;
AacType.nAACERtools = OMX_AUDIO_AACERNone;
AacType.eAACProfile = OMX_AUDIO_AACObjectLC;
AacType.eChannelMode = OMX_AUDIO_ChannelModeStereo;
AacType.eAACStreamFormat = OMX_AUDIO_AACStreamFormatMax;
LOG_DEBUG("Unia -> AAC");
bFrameCheck = OMX_FALSE;
}
示例9: OMX_INIT_STRUCT
OMX_ERRORTYPE IpulibRender::PortFormatChanged(OMX_U32 nPortIndex)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_PARAM_PORTDEFINITIONTYPE sPortDef;
OMX_BOOL bFmtChanged = OMX_FALSE;
if(nPortIndex != IN_PORT)
return OMX_ErrorBadPortIndex;
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
ports[IN_PORT]->GetPortDefinition(&sPortDef);
if(sVideoFmt.nFrameWidth != sPortDef.format.video.nFrameWidth)
{
sVideoFmt.nFrameWidth = sPortDef.format.video.nFrameWidth;
bFmtChanged = OMX_TRUE;
}
if(sVideoFmt.nFrameHeight != sPortDef.format.video.nFrameHeight)
{
sVideoFmt.nFrameHeight = sPortDef.format.video.nFrameHeight;
bFmtChanged = OMX_TRUE;
}
if(sVideoFmt.eColorFormat != sPortDef.format.video.eColorFormat)
{
sVideoFmt.eColorFormat = sPortDef.format.video.eColorFormat;
bFmtChanged = OMX_TRUE;
}
if(bFmtChanged == OMX_TRUE)
ResetDevice();
return ret;
}
示例10: OMX_INIT_STRUCT
OMX_ERRORTYPE AudioSource::SendOutputBuffer()
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_TIME_CONFIG_TIMESTAMPTYPE ReferTime;
OMX_U32 nDelayLen;
OMX_S64 MediaTime;
OMX_INIT_STRUCT(&ReferTime, OMX_TIME_CONFIG_TIMESTAMPTYPE);
GetDeviceDelay(&nDelayLen);
TotalRecordedLen += pOutBufferHdr->nFilledLen;
MediaTime = StartTime.nTimestamp + ((TotalRecordedLen + nDelayLen)/nSampleSize * OMX_TICKS_PER_SECOND) / PcmMode.nSamplingRate;
pOutBufferHdr->nTimeStamp = StartTime.nTimestamp + ((TotalRecordedLen)/nSampleSize * OMX_TICKS_PER_SECOND) / PcmMode.nSamplingRate;
ReferTime.nTimestamp = MediaTime;
LOG_DEBUG("Audio source total recorded data: %lld\n", TotalRecordedLen);
LOG_DEBUG("Set reference time to clock: %lld\n", MediaTime);
//ClockSetConfig(OMX_IndexConfigTimeCurrentAudioReference, &ReferTime);
if (EOS.bEnabled == OMX_TRUE || pOutBufferHdr->nTimeStamp > nMaxDuration) {
pOutBufferHdr->nFlags |= OMX_BUFFERFLAG_EOS;
pOutBufferHdr->nFilledLen = 0;
bSendEOS = OMX_TRUE;
SendEvent(OMX_EventBufferFlag, 0, OMX_BUFFERFLAG_MAX_DURATION, NULL);
}
LOG_DEBUG("Audio source send buffer len: %d, flags: %p offset: %d time stamp: %lld\n", \
pOutBufferHdr->nFilledLen, pOutBufferHdr->nFlags, pOutBufferHdr->nOffset, \
pOutBufferHdr->nTimeStamp);
ports[OUTPUT_PORT]->SendBuffer(pOutBufferHdr);
pOutBufferHdr = NULL;
return ret;
}
示例11: OMX_INIT_STRUCT
OMX_ERRORTYPE VideoRender::ProcessDataBuffer()
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_BUFFERHEADERTYPE *pBufferHdr = NULL;
if(ports[IN_PORT]->BufferNum() == 0)
return OMX_ErrorNoMore;
if(pSyncFrame != NULL)
return OMX_ErrorNoMore;
ports[IN_PORT]->GetBuffer(&pBufferHdr);
if(nFrameCnt == 0 && ports[CLK_PORT]->IsEnabled() == OMX_TRUE) {
OMX_TIME_CONFIG_CLOCKSTATETYPE sState;
OMX_INIT_STRUCT(&sState, OMX_TIME_CONFIG_CLOCKSTATETYPE);
ports[CLK_PORT]->GetTunneledInfo(&hClock);
OMX_GetConfig(hClock.hTunneledComp, OMX_IndexConfigTimeClockState, &sState);
ClockState = sState.eState;
}
nFrameCnt ++;
LOG_DEBUG("VideoRender get bufer: %p:%lld:%x\n",
pBufferHdr->pBuffer, pBufferHdr->nTimeStamp, pBufferHdr->nFlags);
if(ports[CLK_PORT]->IsEnabled() == OMX_TRUE)
ret = SyncFrame(pBufferHdr);
else
ret = RenderFrame(pBufferHdr);
return ret;
}
示例12: ilcore_set_port_buffers_param
ret_code_t ilcore_set_port_buffers_param(ilcore_comp_h h, int size, int count, int align)
{
OMX_ERRORTYPE err;
OMX_PARAM_PORTDEFINITIONTYPE param;
ilcore_comp_ctx_t *ctx = (ilcore_comp_ctx_t *)h;
OMX_INIT_STRUCT(param);
param.nPortIndex = IL_AUDIO_RENDER_IN_PORT;
err = OMX_GetParameter(ctx->handle, OMX_IndexParamPortDefinition, ¶m);
if (err != OMX_ErrorNone)
{
DBG_E("%s: OMX_IndexParamPortDefinition failed. err=0x%x\n", ctx->name, err);
return L_FAILED;
}
param.nBufferSize = size;
param.nBufferCountActual = count;
param.nBufferAlignment = align;
err = OMX_SetParameter(ctx->handle, OMX_IndexParamPortDefinition, ¶m);
if (err != OMX_ErrorNone)
{
DBG_E("%s: OMX_IndexParamPortDefinition failed. err=0x%x\n", ctx->name, err);
return L_FAILED;
}
return L_OK;
}
示例13: prepare_port_buffers
OMX_ERRORTYPE prepare_port_buffers(HTEST *hTest, OMX_U32 nPortIndex)
{
OMX_COMPONENTTYPE *hComponent = NULL;
OMX_PARAM_PORTDEFINITIONTYPE sPortDef;
OMX_BUFFERHEADERTYPE *pBufferHdr = NULL;
OMX_U8 *pBuffer = NULL;
OMX_U32 i;
hComponent = hTest->hComponent;
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
sPortDef.nPortIndex = nPortIndex;
OMX_GetParameter(hComponent, OMX_IndexParamPortDefinition, &sPortDef);
for(i=0; i<sPortDef.nBufferCountActual; i++) {
if(hTest->bAllocater[nPortIndex] == OMX_TRUE) {
OMX_AllocateBuffer(hComponent, &pBufferHdr, nPortIndex, NULL, sPortDef.nBufferSize);
printf("Allocate buffer done.\n");
}
else {
pBuffer = (OMX_U8*)FSL_MALLOC(sPortDef.nBufferSize);
OMX_UseBuffer(hComponent, &pBufferHdr, nPortIndex, NULL, sPortDef.nBufferSize, pBuffer);
printf("Use buffer done.\n");
}
hTest->pBufferHdr[nPortIndex][i] = pBufferHdr;
}
hTest->nBufferHdr[nPortIndex] = sPortDef.nBufferCountActual;
return OMX_ErrorNone;
}
示例14: start_data_process
OMX_ERRORTYPE start_data_process(HTEST *hTest)
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_U32 i, wait_cnt = 0;
hTest->bHoldBuffers = OMX_FALSE;
OMX_CONFIG_BOOLEANTYPE sCapturing;
OMX_INIT_STRUCT(&sCapturing, OMX_CONFIG_BOOLEANTYPE);
sCapturing.bEnabled = OMX_TRUE;
ret = OMX_SetConfig(hTest->hComponent,OMX_IndexConfigCapturing, &sCapturing);
if (ret != OMX_ErrorNone)
return ret;
/* Send output buffers */
for(i=0; i<hTest->nBufferHdr[0]; i++) {
hTest->pBufferHdr[0][i]->nFilledLen = 0;
hTest->pBufferHdr[0][i]->nOffset = 0;
OMX_FillThisBuffer(hTest->hComponent, hTest->pBufferHdr[0][i]);
}
for(i=0; i<hTest->nBufferHdr[1]; i++) {
hTest->pBufferHdr[1][i]->nFilledLen = 0;
hTest->pBufferHdr[1][i]->nOffset = 0;
OMX_FillThisBuffer(hTest->hComponent, hTest->pBufferHdr[1][i]);
}
return ret;
}
示例15: OMX_INIT_STRUCT
OMX_ERRORTYPE VideoRender::InitComponent()
{
OMX_ERRORTYPE ret = OMX_ErrorNone;
OMX_PARAM_PORTDEFINITIONTYPE sPortDef;
OMX_BUFFERSUPPLIERTYPE SupplierType;
OMX_INIT_STRUCT(&sPortDef, OMX_PARAM_PORTDEFINITIONTYPE);
sPortDef.nPortIndex = IN_PORT;
sPortDef.eDir = OMX_DirInput;
sPortDef.eDomain = OMX_PortDomainVideo;
fsl_osal_memcpy(&sPortDef.format.video, &sVideoFmt, sizeof(OMX_VIDEO_PORTDEFINITIONTYPE));
sPortDef.bPopulated = OMX_FALSE;
sPortDef.bEnabled = OMX_TRUE;
sPortDef.nBufferCountMin = nFrameBufferMin;
sPortDef.nBufferCountActual = nFrameBufferActual;
sPortDef.nBufferSize = sPortDef.format.video.nFrameWidth
* sPortDef.format.video.nFrameHeight
* pxlfmt2bpp(sVideoFmt.eColorFormat) / 8;
ret = ports[IN_PORT]->SetPortDefinition(&sPortDef);
if(ret != OMX_ErrorNone) {
LOG_ERROR("Set port definition for in port failed.\n");
return ret;
}
ports[IN_PORT]->SetSupplierType(TunneledSupplierType);
sPortDef.nPortIndex = CLK_PORT;
sPortDef.eDir = OMX_DirInput;
sPortDef.eDomain = OMX_PortDomainOther;
sPortDef.format.other.eFormat = OMX_OTHER_FormatTime;
sPortDef.bPopulated = OMX_FALSE;
sPortDef.bEnabled = OMX_FALSE;
sPortDef.nBufferCountMin = 1;
sPortDef.nBufferCountActual = 1;
sPortDef.nBufferSize = sizeof(OMX_TIME_MEDIATIMETYPE);
ret = ports[CLK_PORT]->SetPortDefinition(&sPortDef);
if(ret != OMX_ErrorNone) {
LOG_ERROR("Set port definition for clk port failed.\n");
return ret;
}
SupplierType = OMX_BufferSupplyOutput;
ports[CLK_PORT]->SetSupplierType(SupplierType);
fsl_osal_memset(&hClock, 0, sizeof(TUNNEL_INFO));
ClockState = OMX_TIME_ClockStateStopped;
ClockScale = Q16_SHIFT;
pSyncFrame = NULL;
nFrameCnt = nDropCnt = nDeviceDropCnt = nContiniousDrop = 0;
playbackMode = NORMAL_MODE;
InitVideoVisitors();
ret = InitRenderComponent();
if(ret != OMX_ErrorNone)
return ret;
return ret;
}