From: Taehwan Kim Date: Thu, 29 Nov 2012 01:48:25 +0000 (+0000) Subject: vdec: support Dynamic Resolution Change in case of H264dec X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=405399e51c3f67575f799c9fcaa66e612ca62e28;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung_slsi_openmax.git vdec: support Dynamic Resolution Change in case of H264dec added DPB reconfiguration handling in order to support DRC playback in case of H264Dec. Change-Id: I366374d7cb5eadd3c715ac566be16d45e92b0bc2 Signed-off-by: Taehwan Kim --- diff --git a/component/video/dec/Exynos_OMX_Vdec.c b/component/video/dec/Exynos_OMX_Vdec.c index 234deca..0dc4ab8 100644 --- a/component/video/dec/Exynos_OMX_Vdec.c +++ b/component/video/dec/Exynos_OMX_Vdec.c @@ -1190,6 +1190,8 @@ OMX_ERRORTYPE Exynos_OMX_VideoDecodeComponentInit(OMX_IN OMX_HANDLETYPE hCompone } Exynos_OSAL_Memset(pVideoDec, 0, sizeof(EXYNOS_OMX_VIDEODEC_COMPONENT)); + pVideoDec->bReconfigDPB = OMX_FALSE; + pVideoDec->nSavedDPBCnt = 0; pExynosComponent->hComponentHandle = (OMX_HANDLETYPE)pVideoDec; pExynosComponent->bSaveFlagEOS = OMX_FALSE; diff --git a/component/video/dec/Exynos_OMX_Vdec.h b/component/video/dec/Exynos_OMX_Vdec.h index 124fc21..51eb6cd 100644 --- a/component/video/dec/Exynos_OMX_Vdec.h +++ b/component/video/dec/Exynos_OMX_Vdec.h @@ -102,6 +102,10 @@ typedef struct _EXYNOS_OMX_VIDEODEC_COMPONENT /* For DRM Play */ OMX_BOOL bDRMPlayerMode; + /* For Reconfiguration DPB */ + OMX_BOOL bReconfigDPB; + OMX_U32 nSavedDPBCnt; + /* CSC handle */ OMX_PTR csc_handle; OMX_U32 csc_set_format; @@ -120,6 +124,7 @@ typedef struct _EXYNOS_OMX_VIDEODEC_COMPONENT OMX_BOOL bPreviousFrameEOF, OMX_BOOL *pbEndOfFrame); OMX_ERRORTYPE (*exynos_codec_getCodecInputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr, OMX_U32 *size); OMX_ERRORTYPE (*exynos_codec_getCodecOutputPrivateData) (OMX_PTR codecBuffer, OMX_PTR addr[], OMX_U32 size[]); + OMX_ERRORTYPE (*exynos_codec_reconfigAllBuffers) (OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex); } EXYNOS_OMX_VIDEODEC_COMPONENT; #ifdef __cplusplus diff --git a/component/video/dec/Exynos_OMX_VdecControl.c b/component/video/dec/Exynos_OMX_VdecControl.c index 4519f47..d42f7c8 100644 --- a/component/video/dec/Exynos_OMX_VdecControl.c +++ b/component/video/dec/Exynos_OMX_VdecControl.c @@ -413,6 +413,7 @@ OMX_ERRORTYPE Exynos_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 por { OMX_ERRORTYPE ret = OMX_ErrorNone; EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; + EXYNOS_OMX_VIDEODEC_COMPONENT *pVideoDec = (EXYNOS_OMX_VIDEODEC_COMPONENT *)pExynosComponent->hComponentHandle; EXYNOS_OMX_BASEPORT *pExynosPort = NULL; OMX_BUFFERHEADERTYPE *bufferHeader = NULL; EXYNOS_OMX_DATABUFFER *pDataPortBuffer[2] = {NULL, NULL}; @@ -473,7 +474,10 @@ OMX_ERRORTYPE Exynos_OMX_FlushPort(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 por } Exynos_ResetCodecData(&pExynosPort->processData); - maxBufferNum = pExynosPort->portDefinition.nBufferCountActual; + if (pVideoDec->bReconfigDPB == OMX_TRUE) + maxBufferNum = pVideoDec->nSavedDPBCnt; + else + maxBufferNum = pExynosPort->portDefinition.nBufferCountActual; for (i = 0; i < maxBufferNum; i++) { if (pExynosPort->extendBufferHeader[i].bBufferInOMX == OMX_TRUE) { if (portIndex == OUTPUT_PORT_INDEX) { @@ -556,7 +560,9 @@ OMX_ERRORTYPE Exynos_OMX_BufferFlush(OMX_COMPONENTTYPE *pOMXComponent, OMX_S32 n pVideoDec->exynos_codec_stop(pOMXComponent, nPortIndex); Exynos_OSAL_MutexLock(flushPortBuffer[1]->bufferMutex); ret = Exynos_OMX_FlushPort(pOMXComponent, nPortIndex); - if (pExynosComponent->pExynosPort[nPortIndex].bufferProcessType & BUFFER_COPY) + if (pVideoDec->bReconfigDPB == OMX_TRUE) + pVideoDec->exynos_codec_reconfigAllBuffers(pOMXComponent, nPortIndex); + else if (pExynosComponent->pExynosPort[nPortIndex].bufferProcessType & BUFFER_COPY) pVideoDec->exynos_codec_enqueueAllBuffer(pOMXComponent, nPortIndex); Exynos_ResetCodecData(&pExynosPort->processData); diff --git a/component/video/dec/h264/Exynos_OMX_H264dec.c b/component/video/dec/h264/Exynos_OMX_H264dec.c index 6384b77..d55a1da 100644 --- a/component/video/dec/h264/Exynos_OMX_H264dec.c +++ b/component/video/dec/h264/Exynos_OMX_H264dec.c @@ -606,6 +606,61 @@ EXIT: return ret; } +OMX_ERRORTYPE H264CodecReconfigAllBuffers( + OMX_COMPONENTTYPE *pOMXComponent, + OMX_U32 nPortIndex) +{ + OMX_ERRORTYPE ret = OMX_ErrorNone; + EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; + EXYNOS_OMX_VIDEODEC_COMPONENT *pVideoDec = (EXYNOS_OMX_VIDEODEC_COMPONENT *)pExynosComponent->hComponentHandle; + EXYNOS_OMX_BASEPORT *pExynosPort = &pExynosComponent->pExynosPort[nPortIndex]; + EXYNOS_H264DEC_HANDLE *pH264Dec = (EXYNOS_H264DEC_HANDLE *)pVideoDec->hCodecHandle; + void *hMFCHandle = pH264Dec->hMFCH264Handle.hMFCHandle; + ExynosVideoDecBufferOps *pBufferOps = NULL; + + FunctionIn(); + + if ((nPortIndex == INPUT_PORT_INDEX) && + (pH264Dec->bSourceStart == OMX_TRUE)) { + ret = OMX_ErrorNotImplemented; + goto EXIT; + } else if ((nPortIndex == OUTPUT_PORT_INDEX) && + (pH264Dec->bDestinationStart == OMX_TRUE)) { + pBufferOps = pH264Dec->hMFCH264Handle.pOutbufOps; + + if (pExynosPort->bufferProcessType & BUFFER_COPY) { + /**********************************/ + /* Codec Buffer Free & Unregister */ + /**********************************/ + Exynos_Free_CodecBuffers(pOMXComponent, OUTPUT_PORT_INDEX); + Exynos_CodecBufferReset(pExynosComponent, OUTPUT_PORT_INDEX); + pBufferOps->Clear_RegisteredBuffer(hMFCHandle); + pBufferOps->Cleanup_Buffer(hMFCHandle); + + /******************************************************/ + /* V4L2 Destnation Setup for DPB Buffer Number Change */ + /******************************************************/ + H264CodecDstSetup(pOMXComponent); + + pVideoDec->bReconfigDPB = OMX_FALSE; + } else if (pExynosPort->bufferProcessType & BUFFER_SHARE) { + /**********************************/ + /* Codec Buffer Unregister */ + /**********************************/ + pBufferOps->Clear_RegisteredBuffer(hMFCHandle); + pBufferOps->Cleanup_Buffer(hMFCHandle); + } + } else { + ret = OMX_ErrorBadParameter; + goto EXIT; + } + +EXIT: + FunctionOut(); + + return ret; +} + OMX_ERRORTYPE H264CodecEnQueueAllBuffer(OMX_COMPONENTTYPE *pOMXComponent, OMX_U32 nPortIndex) { OMX_ERRORTYPE ret = OMX_ErrorNone; @@ -704,6 +759,118 @@ EXIT: } #endif +OMX_ERRORTYPE H264CodecCheckResolutionChange(OMX_COMPONENTTYPE *pOMXComponent) +{ + OMX_ERRORTYPE ret = OMX_ErrorNone; + EXYNOS_OMX_BASECOMPONENT *pExynosComponent = (EXYNOS_OMX_BASECOMPONENT *)pOMXComponent->pComponentPrivate; + EXYNOS_OMX_VIDEODEC_COMPONENT *pVideoDec = (EXYNOS_OMX_VIDEODEC_COMPONENT *)pExynosComponent->hComponentHandle; + EXYNOS_H264DEC_HANDLE *pH264Dec = (EXYNOS_H264DEC_HANDLE *)pVideoDec->hCodecHandle; + void *hMFCHandle = pH264Dec->hMFCH264Handle.hMFCHandle; + EXYNOS_OMX_BASEPORT *pInputPort = &pExynosComponent->pExynosPort[INPUT_PORT_INDEX]; + EXYNOS_OMX_BASEPORT *pOutputPort = &pExynosComponent->pExynosPort[OUTPUT_PORT_INDEX]; + ExynosVideoDecOps *pDecOps = pH264Dec->hMFCH264Handle.pDecOps; + ExynosVideoDecBufferOps *pOutbufOps = pH264Dec->hMFCH264Handle.pOutbufOps; + + FunctionIn(); + /* get geometry for output */ + Exynos_OSAL_Memset(&pH264Dec->hMFCH264Handle.codecOutbufConf, 0, sizeof(ExynosVideoGeometry)); + if (pOutbufOps->Get_Geometry(hMFCHandle, &pH264Dec->hMFCH264Handle.codecOutbufConf) != VIDEO_ERROR_NONE) { + Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to get geometry for parsed header info"); + ret = OMX_ErrorInsufficientResources; + goto EXIT; + } + + /* get dpb count */ + pH264Dec->hMFCH264Handle.maxDPBNum = pDecOps->Get_ActualBufferCount(hMFCHandle); + if (pVideoDec->bThumbnailMode == OMX_FALSE) + pH264Dec->hMFCH264Handle.maxDPBNum += EXTRA_DPB_NUM; + Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "H264CodecSetup nOutbufs: %d", pH264Dec->hMFCH264Handle.maxDPBNum); + + pH264Dec->hMFCH264Handle.bConfiguredMFCSrc = OMX_TRUE; + + pOutputPort->cropRectangle.nTop = pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nTop; + pOutputPort->cropRectangle.nLeft = pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nLeft; + pOutputPort->cropRectangle.nWidth = pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nWidth; + pOutputPort->cropRectangle.nHeight = pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nHeight; + + if (pVideoDec->bReconfigDPB == OMX_TRUE) + pVideoDec->nSavedDPBCnt = pOutputPort->portDefinition.nBufferCountActual; + + if (pOutputPort->bufferProcessType & BUFFER_COPY) { + if ((pVideoDec->bReconfigDPB) || + (pInputPort->portDefinition.format.video.nFrameWidth != pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth) || + (pInputPort->portDefinition.format.video.nFrameHeight != pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight)) { + pInputPort->portDefinition.format.video.nFrameWidth = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth; + pInputPort->portDefinition.format.video.nFrameHeight = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight; + pInputPort->portDefinition.format.video.nStride = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth + 15) & (~15)); + pInputPort->portDefinition.format.video.nSliceHeight = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight + 15) & (~15)); + + Exynos_UpdateFrameSize(pOMXComponent); + pOutputPort->exceptionFlag = NEED_PORT_DISABLE; + + /** Send Port Settings changed call back **/ + (*(pExynosComponent->pCallbacks->EventHandler)) + (pOMXComponent, + pExynosComponent->callbackData, + OMX_EventPortSettingsChanged, /* The command was completed */ + OMX_DirOutput, /* This is the port index */ + 0, + NULL); + } + } else if (pOutputPort->bufferProcessType & BUFFER_SHARE) { + if ((pVideoDec->bReconfigDPB) || + (pInputPort->portDefinition.format.video.nFrameWidth != pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth) || + (pInputPort->portDefinition.format.video.nFrameHeight != pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight) || + (pOutputPort->portDefinition.nBufferCountActual != pH264Dec->hMFCH264Handle.maxDPBNum)) { + pInputPort->portDefinition.format.video.nFrameWidth = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth; + pInputPort->portDefinition.format.video.nFrameHeight = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight; + pInputPort->portDefinition.format.video.nStride = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth + 15) & (~15)); + pInputPort->portDefinition.format.video.nSliceHeight = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight + 15) & (~15)); + + pOutputPort->portDefinition.nBufferCountActual = pH264Dec->hMFCH264Handle.maxDPBNum - 2; + pOutputPort->portDefinition.nBufferCountMin = pH264Dec->hMFCH264Handle.maxDPBNum - 2; + + Exynos_UpdateFrameSize(pOMXComponent); + pOutputPort->exceptionFlag = NEED_PORT_DISABLE; + + /** Send Port Settings changed call back **/ + (*(pExynosComponent->pCallbacks->EventHandler)) + (pOMXComponent, + pExynosComponent->callbackData, + OMX_EventPortSettingsChanged, /* The command was completed */ + OMX_DirOutput, /* This is the port index */ + 0, + NULL); + } + } + if ((pVideoDec->bReconfigDPB == OMX_TRUE) || + (pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth != pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nWidth) || + (pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight != pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nHeight)) { + /* Check Crop */ + pInputPort->portDefinition.format.video.nFrameWidth = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth; + pInputPort->portDefinition.format.video.nFrameHeight = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight; + pInputPort->portDefinition.format.video.nStride = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth + 15) & (~15)); + pInputPort->portDefinition.format.video.nSliceHeight = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight + 15) & (~15)); + Exynos_UpdateFrameSize(pOMXComponent); + + /** Send crop info call back **/ + (*(pExynosComponent->pCallbacks->EventHandler)) + (pOMXComponent, + pExynosComponent->callbackData, + OMX_EventPortSettingsChanged, /* The command was completed */ + OMX_DirOutput, /* This is the port index */ + OMX_IndexConfigCommonOutputCrop, + NULL); + } + + ret = OMX_ErrorNone; + +EXIT: + FunctionOut(); + + return ret; +} + OMX_ERRORTYPE H264CodecSrcSetup(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DATA *pSrcInputData) { OMX_ERRORTYPE ret = OMX_ErrorNone; @@ -825,90 +992,7 @@ OMX_ERRORTYPE H264CodecSrcSetup(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_DAT goto EXIT; } - /* get geometry for output */ - Exynos_OSAL_Memset(&pH264Dec->hMFCH264Handle.codecOutbufConf, 0, sizeof(ExynosVideoGeometry)); - if (pOutbufOps->Get_Geometry(hMFCHandle, &pH264Dec->hMFCH264Handle.codecOutbufConf) != VIDEO_ERROR_NONE) { - Exynos_OSAL_Log(EXYNOS_LOG_ERROR, "Failed to get geometry for parsed header info"); - ret = OMX_ErrorInsufficientResources; - goto EXIT; - } - - /* get dpb count */ - pH264Dec->hMFCH264Handle.maxDPBNum = pDecOps->Get_ActualBufferCount(hMFCHandle); - if (pVideoDec->bThumbnailMode == OMX_FALSE) - pH264Dec->hMFCH264Handle.maxDPBNum += EXTRA_DPB_NUM; - Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "H264CodecSetup nOutbufs: %d", pH264Dec->hMFCH264Handle.maxDPBNum); - - pH264Dec->hMFCH264Handle.bConfiguredMFCSrc = OMX_TRUE; - - pExynosOutputPort->cropRectangle.nTop = pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nTop; - pExynosOutputPort->cropRectangle.nLeft = pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nLeft; - pExynosOutputPort->cropRectangle.nWidth = pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nWidth; - pExynosOutputPort->cropRectangle.nHeight = pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nHeight; - - if (pExynosOutputPort->bufferProcessType & BUFFER_COPY) { - if ((pExynosInputPort->portDefinition.format.video.nFrameWidth != pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth) || - (pExynosInputPort->portDefinition.format.video.nFrameHeight != pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight)) { - pExynosInputPort->portDefinition.format.video.nFrameWidth = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth; - pExynosInputPort->portDefinition.format.video.nFrameHeight = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight; - pExynosInputPort->portDefinition.format.video.nStride = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth + 15) & (~15)); - pExynosInputPort->portDefinition.format.video.nSliceHeight = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight + 15) & (~15)); - - Exynos_UpdateFrameSize(pOMXComponent); - pExynosOutputPort->exceptionFlag = NEED_PORT_DISABLE; - - /** Send Port Settings changed call back **/ - (*(pExynosComponent->pCallbacks->EventHandler)) - (pOMXComponent, - pExynosComponent->callbackData, - OMX_EventPortSettingsChanged, /* The command was completed */ - OMX_DirOutput, /* This is the port index */ - 0, - NULL); - } - } else if (pExynosOutputPort->bufferProcessType & BUFFER_SHARE) { - if ((pExynosInputPort->portDefinition.format.video.nFrameWidth != pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth) || - (pExynosInputPort->portDefinition.format.video.nFrameHeight != pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight) || - (pExynosOutputPort->portDefinition.nBufferCountActual != pH264Dec->hMFCH264Handle.maxDPBNum)) { - pExynosInputPort->portDefinition.format.video.nFrameWidth = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth; - pExynosInputPort->portDefinition.format.video.nFrameHeight = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight; - pExynosInputPort->portDefinition.format.video.nStride = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth + 15) & (~15)); - pExynosInputPort->portDefinition.format.video.nSliceHeight = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight + 15) & (~15)); - - pExynosOutputPort->portDefinition.nBufferCountActual = pH264Dec->hMFCH264Handle.maxDPBNum - 2; - pExynosOutputPort->portDefinition.nBufferCountMin = pH264Dec->hMFCH264Handle.maxDPBNum - 2; - - Exynos_UpdateFrameSize(pOMXComponent); - pExynosOutputPort->exceptionFlag = NEED_PORT_DISABLE; - - /** Send Port Settings changed call back **/ - (*(pExynosComponent->pCallbacks->EventHandler)) - (pOMXComponent, - pExynosComponent->callbackData, - OMX_EventPortSettingsChanged, /* The command was completed */ - OMX_DirOutput, /* This is the port index */ - 0, - NULL); - } - } - if ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth != pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nWidth) || - (pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight != pH264Dec->hMFCH264Handle.codecOutbufConf.cropRect.nHeight)) { - /* Check Crop */ - pExynosInputPort->portDefinition.format.video.nFrameWidth = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth; - pExynosInputPort->portDefinition.format.video.nFrameHeight = pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight; - pExynosInputPort->portDefinition.format.video.nStride = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameWidth + 15) & (~15)); - pExynosInputPort->portDefinition.format.video.nSliceHeight = ((pH264Dec->hMFCH264Handle.codecOutbufConf.nFrameHeight + 15) & (~15)); - Exynos_UpdateFrameSize(pOMXComponent); - - /** Send crop info call back **/ - (*(pExynosComponent->pCallbacks->EventHandler)) - (pOMXComponent, - pExynosComponent->callbackData, - OMX_EventPortSettingsChanged, /* The command was completed */ - OMX_DirOutput, /* This is the port index */ - OMX_IndexConfigCommonOutputCrop, - NULL); - } + H264CodecCheckResolutionChange(pOMXComponent); Exynos_OSAL_SleepMillisec(0); ret = OMX_ErrorInputDataDecodeYet; @@ -1846,6 +1930,14 @@ OMX_ERRORTYPE Exynos_H264Dec_DstIn(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_ pDstInputData->buffer.multiPlaneBuffer.dataBuffer[0], pDstInputData->buffer.multiPlaneBuffer.dataBuffer[1]); + if ((pVideoDec->bReconfigDPB == OMX_TRUE) && + (pExynosOutputPort->bufferProcessType & BUFFER_SHARE)) { + ret = H264CodecDstSetup(pOMXComponent); + if (ret != OMX_ErrorNone) + goto EXIT; + pVideoDec->bReconfigDPB = OMX_FALSE; + } + codecReturn = pOutbufOps->Enqueue(hMFCHandle, (unsigned char **)pDstInputData->buffer.multiPlaneBuffer.dataBuffer, (unsigned int *)dataLen, MFC_OUTPUT_BUFFER_PLANE, pDstInputData->bufferHeader); @@ -1900,12 +1992,24 @@ OMX_ERRORTYPE Exynos_H264Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX if ((displayStatus == VIDEO_FRAME_STATUS_DISPLAY_DECODING) || (displayStatus == VIDEO_FRAME_STATUS_DISPLAY_ONLY) || (displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) || + (displayStatus == VIDEO_FRAME_STATUS_DECODING_FINISHED) || (CHECK_PORT_BEING_FLUSHED(pExynosOutputPort))) { ret = OMX_ErrorNone; break; } } + if ((pVideoDec->bThumbnailMode == OMX_FALSE) && + (displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL)) { + if (pVideoDec->bReconfigDPB != OMX_TRUE) { + pVideoDec->bReconfigDPB = OMX_TRUE; + H264CodecCheckResolutionChange(pOMXComponent); + pVideoDec->csc_set_format = OMX_FALSE; + } + ret = OMX_ErrorNone; + goto EXIT; + } + pH264Dec->hMFCH264Handle.outputIndexTimestamp++; pH264Dec->hMFCH264Handle.outputIndexTimestamp %= MAX_TIMESTAMP; @@ -1993,7 +2097,7 @@ OMX_ERRORTYPE Exynos_H264Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "timestamp %lld us (%.2f secs), indexTimestamp: %d, nFlags: 0x%x", pDstOutputData->timeStamp, pDstOutputData->timeStamp / 1E6, indexTimestamp, pDstOutputData->nFlags); } - if ((displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) || + if ((displayStatus == VIDEO_FRAME_STATUS_DECODING_FINISHED) || ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) { Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags); pDstOutputData->remainDataLen = 0; @@ -2303,6 +2407,7 @@ OSCL_EXPORT_REF OMX_ERRORTYPE Exynos_OMX_ComponentInit(OMX_HANDLETYPE hComponent pVideoDec->exynos_checkInputFrame = &Check_H264_Frame; pVideoDec->exynos_codec_getCodecInputPrivateData = &GetCodecInputPrivateData; pVideoDec->exynos_codec_getCodecOutputPrivateData = &GetCodecOutputPrivateData; + pVideoDec->exynos_codec_reconfigAllBuffers = &H264CodecReconfigAllBuffers; pVideoDec->hSharedMemory = Exynos_OSAL_SharedMemory_Open(); if (pVideoDec->hSharedMemory == NULL) { diff --git a/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c b/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c index c7f1000..5f7cab2 100644 --- a/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c +++ b/component/video/dec/mpeg2/Exynos_OMX_Mpeg2dec.c @@ -1606,6 +1606,7 @@ OMX_ERRORTYPE Exynos_Mpeg2Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OM if ((displayStatus == VIDEO_FRAME_STATUS_DISPLAY_DECODING) || (displayStatus == VIDEO_FRAME_STATUS_DISPLAY_ONLY) || (displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) || + (displayStatus == VIDEO_FRAME_STATUS_DECODING_FINISHED) || (CHECK_PORT_BEING_FLUSHED(pExynosOutputPort))) { ret = OMX_ErrorNone; break; @@ -1691,6 +1692,7 @@ OMX_ERRORTYPE Exynos_Mpeg2Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OM } if ((displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) || + (displayStatus == VIDEO_FRAME_STATUS_DECODING_FINISHED) || ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) { Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags); pDstOutputData->remainDataLen = 0; diff --git a/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c b/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c index 336ab47..b57900b 100644 --- a/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c +++ b/component/video/dec/mpeg4/Exynos_OMX_Mpeg4dec.c @@ -1958,6 +1958,7 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OM if ((displayStatus == VIDEO_FRAME_STATUS_DISPLAY_DECODING) || (displayStatus == VIDEO_FRAME_STATUS_DISPLAY_ONLY) || (displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) || + (displayStatus == VIDEO_FRAME_STATUS_DECODING_FINISHED) || (CHECK_PORT_BEING_FLUSHED(pExynosOutputPort))) { ret = OMX_ErrorNone; break; @@ -2043,6 +2044,7 @@ OMX_ERRORTYPE Exynos_Mpeg4Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OM } if ((displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) || + (displayStatus == VIDEO_FRAME_STATUS_DECODING_FINISHED) || ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) { Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags); pDstOutputData->remainDataLen = 0; diff --git a/component/video/dec/vc1/Exynos_OMX_Wmvdec.c b/component/video/dec/vc1/Exynos_OMX_Wmvdec.c index 08eb64f..aacfbbe 100644 --- a/component/video/dec/vc1/Exynos_OMX_Wmvdec.c +++ b/component/video/dec/vc1/Exynos_OMX_Wmvdec.c @@ -1837,6 +1837,7 @@ OMX_ERRORTYPE Exynos_WmvDec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_ if ((displayStatus == VIDEO_FRAME_STATUS_DISPLAY_DECODING) || (displayStatus == VIDEO_FRAME_STATUS_DISPLAY_ONLY) || (displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) || + (displayStatus == VIDEO_FRAME_STATUS_DECODING_FINISHED) || (CHECK_PORT_BEING_FLUSHED(pExynosOutputPort))) { ret = OMX_ErrorNone; break; @@ -1922,6 +1923,7 @@ OMX_ERRORTYPE Exynos_WmvDec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_ } if ((displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) || + (displayStatus == VIDEO_FRAME_STATUS_DECODING_FINISHED) || ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) { Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags); pDstOutputData->remainDataLen = 0; diff --git a/component/video/dec/vp8/Exynos_OMX_Vp8dec.c b/component/video/dec/vp8/Exynos_OMX_Vp8dec.c index 28e18a6..55e8dbb 100644 --- a/component/video/dec/vp8/Exynos_OMX_Vp8dec.c +++ b/component/video/dec/vp8/Exynos_OMX_Vp8dec.c @@ -1550,6 +1550,7 @@ OMX_ERRORTYPE Exynos_VP8Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_ if ((displayStatus == VIDEO_FRAME_STATUS_DISPLAY_DECODING) || (displayStatus == VIDEO_FRAME_STATUS_DISPLAY_ONLY) || (displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) || + (displayStatus == VIDEO_FRAME_STATUS_DECODING_FINISHED) || (CHECK_PORT_BEING_FLUSHED(pExynosOutputPort))) { ret = OMX_ErrorNone; break; @@ -1635,6 +1636,7 @@ OMX_ERRORTYPE Exynos_VP8Dec_DstOut(OMX_COMPONENTTYPE *pOMXComponent, EXYNOS_OMX_ } if ((displayStatus == VIDEO_FRAME_STATUS_CHANGE_RESOL) || + (displayStatus == VIDEO_FRAME_STATUS_DECODING_FINISHED) || ((pDstOutputData->nFlags & OMX_BUFFERFLAG_EOS) == OMX_BUFFERFLAG_EOS)) { Exynos_OSAL_Log(EXYNOS_LOG_TRACE, "displayStatus:%d, nFlags0x%x", displayStatus, pDstOutputData->nFlags); pDstOutputData->remainDataLen = 0;