summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngela Stegmaier <angelabaker@ti.com>2016-11-21 16:07:42 -0600
committerVishal Mahaveer <vishalm@ti.com>2016-12-06 22:37:06 -0500
commita3df895b91e716e305ef516d31edaaeea1cb4727 (patch)
tree022ee3d2ef5a1968ad0339891e3dfe7ee63a17a5
parent3f01f2d12a7a39cef0a1e5d493d73841e7233633 (diff)
downloaddra7xx-d-lollipop-mr1-release.tar.gz
OMX: Send Dummy Output Buffers When Parsing Header for Mpeg2d-lollipop-mr1-release
The Mpeg2 Decoder codec will throw an error if output buffers are not passed to the process call, even if only the header parsing is being requested. To get around this error and avoid using user buffers for this purpose, a dummy buffer is allocated before calling the process for parsing the header, and then freed after the process call. Change-Id: I90b68045f108b253b127fe6d32724c79994a3058 Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
-rw-r--r--omx/videodecode/omx_videodec_common/src/omx_video_decoder.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c b/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c
index 19d228e..a452c05 100644
--- a/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c
+++ b/omx/videodecode/omx_videodec_common/src/omx_video_decoder.c
@@ -872,6 +872,9 @@ OMX_ERRORTYPE OMXVidDec_CommandNotify(OMX_HANDLETYPE hComponent,
}
pVidDecComp->pDecStaticParams->maxHeight = nFrameHeight;
pVidDecComp->pDecStaticParams->maxWidth = nFrameWidth;
+ if( pVidDecComp->tVideoParams[OMX_VIDDEC_INPUT_PORT].eCompressionFormat == OMX_VIDEO_CodingMPEG2 ) {
+ pVidDecComp->pDecStaticParams->maxWidth = pVidDecComp->t2DBufferAllocParams[OMX_VIDDEC_OUTPUT_PORT].nWidth;
+ }
// And Call the Codec Create
pVidDecComp->pDecHandle = VIDDEC3_create(pVidDecComp->ce,
@@ -983,6 +986,7 @@ OMX_ERRORTYPE OMXVidDec_DataNotify(OMX_HANDLETYPE hComponent)
OMX_BOOL went_thru_loop = OMX_FALSE;
OMX_BOOL duped_IPbuffer = OMX_TRUE;
IMG_native_handle_t* grallocHandle;
+ MemHeader *pTempBuffer[2];
OMX_CHECK(hComponent != NULL, OMX_ErrorBadParameter);
@@ -1145,7 +1149,28 @@ OMX_ERRORTYPE OMXVidDec_DataNotify(OMX_HANDLETYPE hComponent)
pInBufDescPtr->descs[0].buf = (XDAS_Int8*)(pVidDecComp->sCodecConfig.sBuffer);
pInBufDescPtr->descs[0].memType = XDM_MEMTYPE_TILEDPAGE;
pInBufDescPtr->descs[0].bufSize.bytes = pVidDecComp->sCodecConfig.sBuffer->size;
- pOutBufDescPtr->numBufs = 0;
+ pTempBuffer[0] = NULL;
+ pTempBuffer[1] = NULL;
+ if( pVidDecComp->tVideoParams[OMX_VIDDEC_INPUT_PORT].eCompressionFormat == OMX_VIDEO_CodingMPEG2 ) {
+ // allocate a dummy buffer for mpeg2 in this case
+ pTempBuffer[0] = OSAL_Malloc(sizeof(MemHeader));
+ pTempBuffer[0]->ptr = memplugin_alloc_noheader(pTempBuffer[0],
+ pVidDecComp->t2DBufferAllocParams[OMX_VIDDEC_OUTPUT_PORT].nWidth,
+ 1, MEM_CARVEOUT, 0, 0);
+ OMX_CHECK(pTempBuffer[0]->ptr != NULL, OMX_ErrorInsufficientResources);
+ pTempBuffer[1] = OSAL_Malloc(sizeof(MemHeader));
+ memcpy(pTempBuffer[1], pTempBuffer[0], sizeof(MemHeader));
+ pOutBufDescPtr->numBufs = 2;
+ pOutBufDescPtr->descs[0].bufSize.bytes = pVidDecComp->t2DBufferAllocParams[OMX_VIDDEC_OUTPUT_PORT].nWidth;
+ pOutBufDescPtr->descs[0].bufSize.tileMem.height = 1;
+ pOutBufDescPtr->descs[0].buf = (XDAS_Int8 *)pTempBuffer[0];
+ pOutBufDescPtr->descs[0].memType = XDM_MEMTYPE_TILEDPAGE;
+
+ pOutBufDescPtr->descs[1].bufSize.bytes = pVidDecComp->t2DBufferAllocParams[OMX_VIDDEC_OUTPUT_PORT].nWidth;
+ pOutBufDescPtr->descs[1].bufSize.tileMem.height = 1;
+ pOutBufDescPtr->descs[1].buf = (XDAS_Int8 *)pTempBuffer[1];
+ pOutBufDescPtr->descs[1].memType = XDM_MEMTYPE_TILEDPAGE;
+ }
} else if( pInBufHeader != NULL && pVidDecComp->pDecDynParams->decodeHeader == XDM_DECODE_AU ) {
// In case EOS and Number of Input bytes=0. Flush Decoder and exit
if( pInBufHeader->nFlags & OMX_BUFFERFLAG_EOS ) {
@@ -1236,6 +1261,15 @@ OMX_ERRORTYPE OMXVidDec_DataNotify(OMX_HANDLETYPE hComponent)
status = VIDDEC3_process(pVidDecComp->pDecHandle, pInBufDescPtr, pOutBufDescPtr,
(VIDDEC3_InArgs *)pVidDecComp->pDecInArgs, (VIDDEC3_OutArgs *)pVidDecComp->pDecOutArgs);
+ if (pTempBuffer[0]) {
+ memplugin_free_noheader(pTempBuffer[0]);
+ OSAL_Free(pTempBuffer[0]);
+ pTempBuffer[0] = NULL;
+ }
+ if (pTempBuffer[1]) {
+ OSAL_Free(pTempBuffer[1]);
+ pTempBuffer[1] = NULL;
+ }
pDecOutArgs = pVidDecComp->pDecOutArgs;
/*! In case Process returns error */