3 * Copyright 2012 Samsung Electronics S.LSI Co. LTD
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 * @file Exynos_OMX_Vdec.c
21 * @author SeungBeom Kim (sbcrux.kim@samsung.com)
22 * HyeYeon Chung (hyeon.chung@samsung.com)
23 * Yunji Kim (yunji.kim@samsung.com)
32 #include "Exynos_OMX_Macros.h"
33 #include "Exynos_OSAL_Event.h"
34 #include "Exynos_OMX_Vdec.h"
35 #include "Exynos_OMX_VdecControl.h"
36 #include "Exynos_OMX_Basecomponent.h"
37 #include "Exynos_OSAL_SharedMemory.h"
38 #include "Exynos_OSAL_Thread.h"
39 #include "Exynos_OSAL_Semaphore.h"
40 #include "Exynos_OSAL_Mutex.h"
41 #include "Exynos_OSAL_ETC.h"
44 #include "Exynos_OSAL_Android.h"
47 #include "ExynosVideoApi.h"
51 #define EXYNOS_LOG_TAG "EXYNOS_VIDEO_DEC"
52 #define EXYNOS_LOG_OFF
53 //#define EXYNOS_TRACE_ON
54 #include "Exynos_OSAL_Log.h"
56 inline void Exynos_UpdateFrameSize(OMX_COMPONENTTYPE
*pOMXComponent
)
58 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
59 EXYNOS_OMX_BASEPORT
*exynosInputPort
= &pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
];
60 EXYNOS_OMX_BASEPORT
*exynosOutputPort
= &pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
];
62 if ((exynosOutputPort
->portDefinition
.format
.video
.nFrameWidth
!=
63 exynosInputPort
->portDefinition
.format
.video
.nFrameWidth
) ||
64 (exynosOutputPort
->portDefinition
.format
.video
.nFrameHeight
!=
65 exynosInputPort
->portDefinition
.format
.video
.nFrameHeight
)) {
66 OMX_U32 width
= 0, height
= 0;
68 exynosOutputPort
->portDefinition
.format
.video
.nFrameWidth
=
69 exynosInputPort
->portDefinition
.format
.video
.nFrameWidth
;
70 exynosOutputPort
->portDefinition
.format
.video
.nFrameHeight
=
71 exynosInputPort
->portDefinition
.format
.video
.nFrameHeight
;
72 width
= exynosOutputPort
->portDefinition
.format
.video
.nStride
=
73 exynosInputPort
->portDefinition
.format
.video
.nStride
;
74 height
= exynosOutputPort
->portDefinition
.format
.video
.nSliceHeight
=
75 exynosInputPort
->portDefinition
.format
.video
.nSliceHeight
;
77 switch(exynosOutputPort
->portDefinition
.format
.video
.eColorFormat
) {
78 case OMX_COLOR_FormatYUV420Planar
:
79 case OMX_COLOR_FormatYUV420SemiPlanar
:
80 case OMX_SEC_COLOR_FormatNV12Tiled
:
81 case OMX_SEC_COLOR_FormatYVU420Planar
:
82 case OMX_SEC_COLOR_FormatNV21Linear
:
84 exynosOutputPort
->portDefinition
.nBufferSize
= (width
* height
* 3) / 2;
88 exynosOutputPort
->portDefinition
.nBufferSize
= width
* height
* 2;
96 void Exynos_Free_CodecBuffers(
97 OMX_COMPONENTTYPE
*pOMXComponent
,
100 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
101 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
102 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
103 CODEC_DEC_BUFFER
**ppCodecBuffer
= NULL
;
105 OMX_U32 nBufferCnt
= 0, nPlaneCnt
= 0;
110 if (nPortIndex
== INPUT_PORT_INDEX
) {
111 ppCodecBuffer
= &(pVideoDec
->pMFCDecInputBuffer
[0]);
112 nBufferCnt
= MFC_INPUT_BUFFER_NUM_MAX
;
114 ppCodecBuffer
= &(pVideoDec
->pMFCDecOutputBuffer
[0]);
115 nBufferCnt
= MFC_OUTPUT_BUFFER_NUM_MAX
;
117 nPlaneCnt
= pExynosComponent
->pExynosPort
[nPortIndex
].nPlaneCnt
;
119 for (i
= 0; i
< nBufferCnt
; i
++) {
120 if (ppCodecBuffer
[i
] != NULL
) {
121 for (j
= 0; j
< nPlaneCnt
; j
++) {
122 if (ppCodecBuffer
[i
]->pVirAddr
[j
] != NULL
)
123 Exynos_OSAL_SharedMemory_Free(pVideoDec
->hSharedMemory
, ppCodecBuffer
[i
]->pVirAddr
[j
]);
126 Exynos_OSAL_Free(ppCodecBuffer
[i
]);
127 ppCodecBuffer
[i
] = NULL
;
134 OMX_ERRORTYPE
Exynos_Allocate_CodecBuffers(
135 OMX_COMPONENTTYPE
*pOMXComponent
,
138 OMX_U32 nPlaneSize
[MAX_BUFFER_PLANE
])
140 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
141 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
142 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
143 MEMORY_TYPE eMemoryType
= SYSTEM_MEMORY
;
144 CODEC_DEC_BUFFER
**ppCodecBuffer
= NULL
;
146 OMX_U32 nPlaneCnt
= 0;
151 if (nPortIndex
== INPUT_PORT_INDEX
) {
152 ppCodecBuffer
= &(pVideoDec
->pMFCDecInputBuffer
[0]);
154 ppCodecBuffer
= &(pVideoDec
->pMFCDecOutputBuffer
[0]);
156 eMemoryType
= NORMAL_MEMORY
;
159 nPlaneCnt
= pExynosComponent
->pExynosPort
[nPortIndex
].nPlaneCnt
;
161 if (pVideoDec
->bDRMPlayerMode
== OMX_TRUE
)
162 eMemoryType
= SECURE_MEMORY
;
164 for (i
= 0; i
< nBufferCnt
; i
++) {
165 ppCodecBuffer
[i
] = (CODEC_DEC_BUFFER
*)Exynos_OSAL_Malloc(sizeof(CODEC_DEC_BUFFER
));
166 if (ppCodecBuffer
[i
] == NULL
) {
167 Exynos_OSAL_Log(EXYNOS_LOG_ERROR
, "Failed to Alloc codec buffer");
168 ret
= OMX_ErrorInsufficientResources
;
171 Exynos_OSAL_Memset(ppCodecBuffer
[i
], 0, sizeof(CODEC_DEC_BUFFER
));
173 for (j
= 0; j
< nPlaneCnt
; j
++) {
174 ppCodecBuffer
[i
]->pVirAddr
[j
] =
175 (void *)Exynos_OSAL_SharedMemory_Alloc(pVideoDec
->hSharedMemory
, nPlaneSize
[j
], eMemoryType
);
176 if (ppCodecBuffer
[i
]->pVirAddr
[j
] == NULL
) {
177 Exynos_OSAL_Log(EXYNOS_LOG_ERROR
, "Failed to Alloc plane");
178 ret
= OMX_ErrorInsufficientResources
;
182 ppCodecBuffer
[i
]->fd
[j
] =
183 Exynos_OSAL_SharedMemory_VirtToION(pVideoDec
->hSharedMemory
, ppCodecBuffer
[i
]->pVirAddr
[j
]);
184 ppCodecBuffer
[i
]->bufferSize
[j
] = nPlaneSize
[j
];
185 Exynos_OSAL_Log(EXYNOS_LOG_TRACE
, "PORT[%d]: pMFCCodecBuffer[%d]->pVirAddr[%d]: 0x%x", nPortIndex
, i
, j
, ppCodecBuffer
[i
]->pVirAddr
[j
]);
188 ppCodecBuffer
[i
]->dataSize
= 0;
191 return OMX_ErrorNone
;
194 Exynos_Free_CodecBuffers(pOMXComponent
, nPortIndex
);
201 OMX_BOOL
Exynos_Check_BufferProcess_State(EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
, OMX_U32 nPortIndex
)
203 OMX_BOOL ret
= OMX_FALSE
;
205 if ((pExynosComponent
->currentState
== OMX_StateExecuting
) &&
206 (pExynosComponent
->pExynosPort
[nPortIndex
].portState
== OMX_StateIdle
) &&
207 (pExynosComponent
->transientState
!= EXYNOS_OMX_TransStateExecutingToIdle
) &&
208 (pExynosComponent
->transientState
!= EXYNOS_OMX_TransStateIdleToExecuting
)) {
217 OMX_ERRORTYPE
Exynos_ResetAllPortConfig(OMX_COMPONENTTYPE
*pOMXComponent
)
219 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
220 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
221 EXYNOS_OMX_BASEPORT
*pInputPort
= &pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
];
222 EXYNOS_OMX_BASEPORT
*pOutputPort
= &pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
];
225 pInputPort
->portDefinition
.format
.video
.nFrameWidth
= DEFAULT_FRAME_WIDTH
;
226 pInputPort
->portDefinition
.format
.video
.nFrameHeight
= DEFAULT_FRAME_HEIGHT
;
227 pInputPort
->portDefinition
.format
.video
.nStride
= 0; /*DEFAULT_FRAME_WIDTH;*/
228 pInputPort
->portDefinition
.format
.video
.nSliceHeight
= 0;
229 pInputPort
->portDefinition
.format
.video
.pNativeRender
= 0;
230 pInputPort
->portDefinition
.format
.video
.bFlagErrorConcealment
= OMX_FALSE
;
231 pInputPort
->portDefinition
.format
.video
.eColorFormat
= OMX_COLOR_FormatUnused
;
233 pInputPort
->portDefinition
.nBufferSize
= DEFAULT_VIDEO_INPUT_BUFFER_SIZE
;
234 pInputPort
->portDefinition
.bEnabled
= OMX_TRUE
;
236 pInputPort
->bufferProcessType
= BUFFER_SHARE
;
237 pInputPort
->portWayType
= WAY2_PORT
;
238 pInputPort
->nPlaneCnt
= MFC_DEFAULT_INPUT_BUFFER_PLANE
;
241 pOutputPort
->portDefinition
.format
.video
.nFrameWidth
= DEFAULT_FRAME_WIDTH
;
242 pOutputPort
->portDefinition
.format
.video
.nFrameHeight
= DEFAULT_FRAME_HEIGHT
;
243 pOutputPort
->portDefinition
.format
.video
.nStride
= 0; /*DEFAULT_FRAME_WIDTH;*/
244 pOutputPort
->portDefinition
.format
.video
.nSliceHeight
= 0;
245 pOutputPort
->portDefinition
.format
.video
.pNativeRender
= 0;
246 pOutputPort
->portDefinition
.format
.video
.bFlagErrorConcealment
= OMX_FALSE
;
247 pOutputPort
->portDefinition
.format
.video
.eColorFormat
= OMX_COLOR_FormatYUV420Planar
;
249 pOutputPort
->portDefinition
.nBufferSize
= DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE
;
250 pOutputPort
->portDefinition
.bEnabled
= OMX_TRUE
;
252 pOutputPort
->bufferProcessType
= BUFFER_COPY
| BUFFER_ANBSHARE
;
253 pOutputPort
->bIsANBEnabled
= OMX_FALSE
;
254 pOutputPort
->portWayType
= WAY2_PORT
;
255 pOutputPort
->nPlaneCnt
= Exynos_OSAL_GetPlaneCount(OMX_COLOR_FormatYUV420Planar
);
260 OMX_ERRORTYPE
Exynos_Input_CodecBufferToData(EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
, OMX_PTR codecBuffer
, EXYNOS_OMX_DATA
*pData
)
262 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
263 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
264 CODEC_DEC_BUFFER
*pInputCodecBuffer
= (CODEC_DEC_BUFFER
*)codecBuffer
;
266 pData
->buffer
.singlePlaneBuffer
.dataBuffer
= pInputCodecBuffer
->pVirAddr
[0];
267 pData
->buffer
.singlePlaneBuffer
.fd
= pInputCodecBuffer
->fd
[0];
268 pData
->allocSize
= pInputCodecBuffer
->bufferSize
[0];
269 pData
->dataLen
= pInputCodecBuffer
->dataSize
;
270 pData
->usedDataLen
= 0;
271 pData
->remainDataLen
= pInputCodecBuffer
->dataSize
;
274 pData
->timeStamp
= 0;
275 pData
->pPrivate
= codecBuffer
;
276 pData
->bufferHeader
= NULL
;
281 OMX_ERRORTYPE
Exynos_Output_CodecBufferToData(
282 CODEC_DEC_BUFFER
*pCodecBuffer
,
283 EXYNOS_OMX_DATA
*pData
)
285 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
287 pData
->buffer
.multiPlaneBuffer
.dataBuffer
[0] = pCodecBuffer
->pVirAddr
[0];
288 pData
->buffer
.multiPlaneBuffer
.dataBuffer
[1] = pCodecBuffer
->pVirAddr
[1];
289 pData
->buffer
.multiPlaneBuffer
.dataBuffer
[2] = pCodecBuffer
->pVirAddr
[2];
290 pData
->buffer
.multiPlaneBuffer
.fd
[0] = pCodecBuffer
->fd
[0];
291 pData
->buffer
.multiPlaneBuffer
.fd
[1] = pCodecBuffer
->fd
[1];
292 pData
->buffer
.multiPlaneBuffer
.fd
[2] = pCodecBuffer
->fd
[2];
293 pData
->allocSize
= pCodecBuffer
->bufferSize
[0] + pCodecBuffer
->bufferSize
[1] + pCodecBuffer
->bufferSize
[2];
295 pData
->usedDataLen
= 0;
296 pData
->remainDataLen
= 0;
299 pData
->timeStamp
= 0;
300 pData
->pPrivate
= pCodecBuffer
;
301 pData
->bufferHeader
= NULL
;
306 void Exynos_Wait_ProcessPause(EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
, OMX_U32 nPortIndex
)
308 EXYNOS_OMX_BASEPORT
*exynosOMXInputPort
= &pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
];
309 EXYNOS_OMX_BASEPORT
*exynosOMXOutputPort
= &pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
];
310 EXYNOS_OMX_BASEPORT
*exynosOMXPort
= NULL
;
314 exynosOMXPort
= &pExynosComponent
->pExynosPort
[nPortIndex
];
316 if (((pExynosComponent
->currentState
== OMX_StatePause
) ||
317 (pExynosComponent
->currentState
== OMX_StateIdle
) ||
318 (pExynosComponent
->transientState
== EXYNOS_OMX_TransStateLoadedToIdle
) ||
319 (pExynosComponent
->transientState
== EXYNOS_OMX_TransStateExecutingToIdle
)) &&
320 (pExynosComponent
->transientState
!= EXYNOS_OMX_TransStateIdleToLoaded
) &&
321 (!CHECK_PORT_BEING_FLUSHED(exynosOMXPort
))) {
322 Exynos_OSAL_SignalWait(pExynosComponent
->pExynosPort
[nPortIndex
].pauseEvent
, DEF_MAX_WAIT_TIME
);
323 Exynos_OSAL_SignalReset(pExynosComponent
->pExynosPort
[nPortIndex
].pauseEvent
);
331 OMX_BOOL
Exynos_CSC_OutputData(OMX_COMPONENTTYPE
*pOMXComponent
, EXYNOS_OMX_DATA
*dstOutputData
)
333 OMX_BOOL ret
= OMX_FALSE
;
334 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
335 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
336 EXYNOS_OMX_BASEPORT
*exynosOutputPort
= &pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
];
337 EXYNOS_OMX_DATABUFFER
*outputUseBuffer
= &exynosOutputPort
->way
.port2WayDataBuffer
.outputDataBuffer
;
338 OMX_U32 copySize
= 0;
339 DECODE_CODEC_EXTRA_BUFFERINFO
*pBufferInfo
= NULL
;
340 OMX_COLOR_FORMATTYPE eColorFormat
= exynosOutputPort
->portDefinition
.format
.video
.eColorFormat
;
344 void *pOutputBuf
= (void *)outputUseBuffer
->bufferHeader
->pBuffer
;
345 void *pSrcBuf
[MAX_BUFFER_PLANE
] = {NULL
, };
346 void *pYUVBuf
[MAX_BUFFER_PLANE
] = {NULL
, };
348 ExynosVideoPlane planes
[MAX_BUFFER_PLANE
];
349 OMX_U32 nPlaneSize
[MAX_BUFFER_PLANE
] = {0, 0, 0};
351 OMX_U32 nFrameWidth
= 0, nFrameHeight
= 0;
352 OMX_U32 nImageWidth
= 0, nImageHeight
= 0, stride
= 0;
354 CSC_MEMTYPE csc_memType
= CSC_MEMORY_USERPTR
;
355 CSC_METHOD csc_method
= CSC_METHOD_SW
;
356 CSC_ERRORCODE cscRet
= CSC_ErrorNone
;
357 unsigned int srcCacheable
= 1, dstCacheable
= 1;
359 nFrameWidth
= exynosOutputPort
->portDefinition
.format
.video
.nStride
;
360 nFrameHeight
= exynosOutputPort
->portDefinition
.format
.video
.nSliceHeight
;
362 pBufferInfo
= (DECODE_CODEC_EXTRA_BUFFERINFO
*)dstOutputData
->extInfo
;
363 nImageWidth
= pBufferInfo
->imageWidth
;
364 nImageHeight
= pBufferInfo
->imageHeight
;
366 pSrcBuf
[0] = dstOutputData
->buffer
.multiPlaneBuffer
.dataBuffer
[0];
367 pSrcBuf
[1] = dstOutputData
->buffer
.multiPlaneBuffer
.dataBuffer
[1];
368 pSrcBuf
[2] = dstOutputData
->buffer
.multiPlaneBuffer
.dataBuffer
[2];
370 Exynos_OSAL_GetPlaneSize(eColorFormat
, nImageWidth
, nImageHeight
, nPlaneSize
);
372 pYUVBuf
[0] = (unsigned char *)pOutputBuf
;
373 pYUVBuf
[1] = (unsigned char *)pOutputBuf
+ nPlaneSize
[0];
374 pYUVBuf
[2] = (unsigned char *)pOutputBuf
+ nPlaneSize
[0] + nPlaneSize
[1];
377 if (exynosOutputPort
->bIsANBEnabled
== OMX_TRUE
) {
378 Exynos_OSAL_LockANBHandle(pOutputBuf
, nImageWidth
, nImageHeight
, eColorFormat
, &stride
, planes
);
379 nImageWidth
= stride
;
380 outputUseBuffer
->dataLen
= sizeof(void *);
382 pYUVBuf
[0] = (unsigned char *)planes
[0].addr
;
383 pYUVBuf
[1] = (unsigned char *)planes
[1].addr
;
384 pYUVBuf
[2] = (unsigned char *)planes
[2].addr
;
388 if (pVideoDec
->bDualDPBMode
== OMX_TRUE
) {
389 switch (eColorFormat
) {
390 case OMX_COLOR_FormatYUV420SemiPlanar
:
391 case (OMX_COLOR_FORMATTYPE
)OMX_SEC_COLOR_FormatNV21Linear
:
392 case (OMX_COLOR_FORMATTYPE
)OMX_SEC_COLOR_FormatNV12Tiled
:
393 case OMX_COLOR_FormatYUV420Planar
:
394 case (OMX_COLOR_FORMATTYPE
)OMX_SEC_COLOR_FormatYVU420Planar
:
395 csc_set_method(pVideoDec
->csc_handle
, CSC_METHOD_SW
);
396 csc_memType
= CSC_MEMORY_MFC
;
397 if (pVideoDec
->csc_set_format
== OMX_FALSE
) {
399 pVideoDec
->csc_handle
, /* handle */
400 nFrameWidth
, /* width */
401 nFrameHeight
, /* height */
404 nImageWidth
, /* crop_width */
405 nImageHeight
, /* crop_height */
406 omx_2_hal_pixel_format(pBufferInfo
->ColorFormat
), /* color_format */
409 pVideoDec
->csc_handle
, /* handle */
410 nImageWidth
, /* width */
411 nImageHeight
, /* height */
414 nImageWidth
, /* crop_width */
415 nImageHeight
, /* crop_height */
416 omx_2_hal_pixel_format(eColorFormat
), /* color_format */
418 pVideoDec
->csc_set_format
= OMX_TRUE
;
422 Exynos_OSAL_Log(EXYNOS_LOG_ERROR
, "[%s] unspported color format : %x. can't support this format", __FUNCTION__
, eColorFormat
);
428 csc_get_method(pVideoDec
->csc_handle
, &csc_method
);
429 if (csc_method
== CSC_METHOD_HW
)
433 if (csc_method
== CSC_METHOD_HW
) {
434 csc_memType
= CSC_MEMORY_DMABUF
;
436 pSrcBuf
[0] = dstOutputData
->buffer
.multiPlaneBuffer
.fd
[0];
437 pSrcBuf
[1] = dstOutputData
->buffer
.multiPlaneBuffer
.fd
[1];
438 pSrcBuf
[2] = dstOutputData
->buffer
.multiPlaneBuffer
.fd
[2];
440 if (exynosOutputPort
->bIsANBEnabled
== OMX_TRUE
) {
441 pYUVBuf
[0] = (unsigned char *)planes
[0].fd
;
442 pYUVBuf
[1] = (unsigned char *)planes
[1].fd
;
443 pYUVBuf
[2] = (unsigned char *)planes
[2].fd
;
445 pYUVBuf
[0] = Exynos_OSAL_SharedMemory_VirtToION(pVideoDec
->hSharedMemory
, pOutputBuf
);
451 if (pVideoDec
->csc_set_format
== OMX_FALSE
) {
453 pVideoDec
->csc_handle
, /* handle */
454 nImageWidth
, /* width */
455 nImageHeight
, /* height */
458 nImageWidth
, /* crop_width */
459 nImageHeight
, /* crop_height */
460 omx_2_hal_pixel_format(pBufferInfo
->ColorFormat
), /* color_format */
461 srcCacheable
); /* cacheable */
463 pVideoDec
->csc_handle
, /* handle */
464 nImageWidth
, /* width */
465 nImageHeight
, /* height */
468 nImageWidth
, /* crop_width */
469 nImageHeight
, /* crop_height */
470 omx_2_hal_pixel_format(eColorFormat
), /* color_format */
471 dstCacheable
); /* cacheable */
472 pVideoDec
->csc_set_format
= OMX_TRUE
;
477 pVideoDec
->csc_handle
, /* handle */
479 csc_memType
); /* YUV Addr or FD */
481 pVideoDec
->csc_handle
, /* handle */
483 csc_memType
); /* YUV Addr or FD */
484 cscRet
= csc_convert(pVideoDec
->csc_handle
);
485 if (cscRet
!= CSC_ErrorNone
)
491 if (exynosOutputPort
->bIsANBEnabled
== OMX_TRUE
) {
492 Exynos_OSAL_UnlockANBHandle(pOutputBuf
);
502 OMX_BOOL
Exynos_Preprocessor_InputData(OMX_COMPONENTTYPE
*pOMXComponent
, EXYNOS_OMX_DATA
*srcInputData
)
504 OMX_BOOL ret
= OMX_FALSE
;
505 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
506 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
507 EXYNOS_OMX_BASEPORT
*exynosInputPort
= &pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
];
508 EXYNOS_OMX_DATABUFFER
*inputUseBuffer
= &exynosInputPort
->way
.port2WayDataBuffer
.inputDataBuffer
;
509 OMX_U32 copySize
= 0;
510 OMX_BYTE checkInputStream
= NULL
;
511 OMX_U32 checkInputStreamLen
= 0;
515 if (exynosInputPort
->bufferProcessType
& BUFFER_COPY
) {
516 if ((srcInputData
->buffer
.singlePlaneBuffer
.dataBuffer
== NULL
) ||
517 (srcInputData
->pPrivate
== NULL
)) {
523 if (inputUseBuffer
->dataValid
== OMX_TRUE
) {
524 if (exynosInputPort
->bufferProcessType
& BUFFER_SHARE
) {
525 Exynos_Shared_BufferToData(inputUseBuffer
, srcInputData
, ONE_PLANE
);
527 if (pVideoDec
->bDRMPlayerMode
== OMX_TRUE
) {
528 OMX_PTR dataBuffer
= NULL
;
530 dataBuffer
= Exynos_OSAL_SharedMemory_IONToVirt(pVideoDec
->hSharedMemory
,
531 srcInputData
->buffer
.singlePlaneBuffer
.dataBuffer
);
532 if (dataBuffer
== NULL
) {
537 srcInputData
->buffer
.singlePlaneBuffer
.fd
= srcInputData
->buffer
.singlePlaneBuffer
.dataBuffer
;
538 srcInputData
->buffer
.singlePlaneBuffer
.dataBuffer
= dataBuffer
;
540 srcInputData
->buffer
.singlePlaneBuffer
.fd
=
541 Exynos_OSAL_SharedMemory_VirtToION(pVideoDec
->hSharedMemory
,
542 srcInputData
->buffer
.singlePlaneBuffer
.dataBuffer
);
545 /* reset dataBuffer */
546 Exynos_ResetDataBuffer(inputUseBuffer
);
547 } else if (exynosInputPort
->bufferProcessType
& BUFFER_COPY
) {
548 checkInputStream
= inputUseBuffer
->bufferHeader
->pBuffer
+ inputUseBuffer
->usedDataLen
;
549 checkInputStreamLen
= inputUseBuffer
->remainDataLen
;
551 pExynosComponent
->bUseFlagEOF
= OMX_TRUE
;
553 copySize
= checkInputStreamLen
;
554 Exynos_OSAL_Log(EXYNOS_LOG_TRACE
, "exynos_checkInputFrame : OMX_TRUE");
556 if (((srcInputData
->allocSize
) - (srcInputData
->dataLen
)) >= copySize
) {
558 Exynos_OSAL_Memcpy(srcInputData
->buffer
.singlePlaneBuffer
.dataBuffer
+ srcInputData
->dataLen
,
559 checkInputStream
, copySize
);
562 inputUseBuffer
->dataLen
-= copySize
;
563 inputUseBuffer
->remainDataLen
-= copySize
;
564 inputUseBuffer
->usedDataLen
+= copySize
;
566 srcInputData
->dataLen
+= copySize
;
567 srcInputData
->remainDataLen
+= copySize
;
569 srcInputData
->timeStamp
= inputUseBuffer
->timeStamp
;
570 srcInputData
->nFlags
= inputUseBuffer
->nFlags
;
571 srcInputData
->bufferHeader
= inputUseBuffer
->bufferHeader
;
573 Exynos_OSAL_Log(EXYNOS_LOG_ERROR
, "input codec buffer is smaller than decoded input data size Out Length");
574 pExynosComponent
->pCallbacks
->EventHandler((OMX_HANDLETYPE
)pOMXComponent
,
575 pExynosComponent
->callbackData
,
576 OMX_EventError
, OMX_ErrorUndefined
, 0, NULL
);
580 Exynos_InputBufferReturn(pOMXComponent
, inputUseBuffer
);
583 if ((srcInputData
->nFlags
& OMX_BUFFERFLAG_EOS
) == OMX_BUFFERFLAG_EOS
) {
584 Exynos_OSAL_Log(EXYNOS_LOG_TRACE
, "bSaveFlagEOS : OMX_TRUE");
585 pExynosComponent
->bSaveFlagEOS
= OMX_TRUE
;
586 if (srcInputData
->dataLen
!= 0)
587 pExynosComponent
->bBehaviorEOS
= OMX_TRUE
;
590 if (pExynosComponent
->checkTimeStamp
.needSetStartTimeStamp
== OMX_TRUE
) {
591 pExynosComponent
->checkTimeStamp
.needCheckStartTimeStamp
= OMX_TRUE
;
592 pExynosComponent
->checkTimeStamp
.startTimeStamp
= srcInputData
->timeStamp
;
593 pExynosComponent
->checkTimeStamp
.nStartFlags
= srcInputData
->nFlags
;
594 pExynosComponent
->checkTimeStamp
.needSetStartTimeStamp
= OMX_FALSE
;
595 Exynos_OSAL_Log(EXYNOS_LOG_TRACE
, "first frame timestamp after seeking %lld us (%.2f secs)",
596 srcInputData
->timeStamp
, srcInputData
->timeStamp
/ 1E6
);
609 OMX_BOOL
Exynos_Postprocess_OutputData(OMX_COMPONENTTYPE
*pOMXComponent
, EXYNOS_OMX_DATA
*dstOutputData
)
611 OMX_BOOL ret
= OMX_FALSE
;
612 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
613 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
614 EXYNOS_OMX_BASEPORT
*exynosOutputPort
= &pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
];
615 EXYNOS_OMX_DATABUFFER
*outputUseBuffer
= &exynosOutputPort
->way
.port2WayDataBuffer
.outputDataBuffer
;
616 OMX_U32 copySize
= 0;
617 DECODE_CODEC_EXTRA_BUFFERINFO
*pBufferInfo
= NULL
;
621 if (exynosOutputPort
->bufferProcessType
& BUFFER_SHARE
) {
622 if (exynosOutputPort
->bIsANBEnabled
== OMX_FALSE
) {
623 if (Exynos_Shared_DataToBuffer(dstOutputData
, outputUseBuffer
) == OMX_ErrorNone
)
624 outputUseBuffer
->dataValid
= OMX_TRUE
;
626 if (Exynos_Shared_DataToANBBuffer(dstOutputData
, outputUseBuffer
, exynosOutputPort
) == OMX_ErrorNone
) {
627 outputUseBuffer
->dataValid
= OMX_TRUE
;
635 if (outputUseBuffer
->dataValid
== OMX_TRUE
) {
636 Exynos_OSAL_Log(EXYNOS_LOG_TRACE
, "out timestamp after seeking %lld us (%.2f secs)",
637 dstOutputData
->timeStamp
, dstOutputData
->timeStamp
/ 1E6
);
638 if ((pExynosComponent
->checkTimeStamp
.needCheckStartTimeStamp
== OMX_TRUE
) &&
639 ((dstOutputData
->nFlags
& OMX_BUFFERFLAG_EOS
) != OMX_BUFFERFLAG_EOS
)) {
640 if ((pExynosComponent
->checkTimeStamp
.startTimeStamp
== dstOutputData
->timeStamp
) &&
641 (pExynosComponent
->checkTimeStamp
.nStartFlags
== dstOutputData
->nFlags
)){
642 pExynosComponent
->checkTimeStamp
.startTimeStamp
= -19761123;
643 pExynosComponent
->checkTimeStamp
.nStartFlags
= 0x0;
644 pExynosComponent
->checkTimeStamp
.needSetStartTimeStamp
= OMX_FALSE
;
645 pExynosComponent
->checkTimeStamp
.needCheckStartTimeStamp
= OMX_FALSE
;
647 if (pExynosComponent
->checkTimeStamp
.startTimeStamp
< dstOutputData
->timeStamp
) {
648 pExynosComponent
->checkTimeStamp
.startTimeStamp
= -19761123;
649 pExynosComponent
->checkTimeStamp
.nStartFlags
= 0x0;
650 pExynosComponent
->checkTimeStamp
.needSetStartTimeStamp
= OMX_FALSE
;
651 pExynosComponent
->checkTimeStamp
.needCheckStartTimeStamp
= OMX_FALSE
;
653 Exynos_OSAL_Log(EXYNOS_LOG_TRACE
, "drop frame after seeking", pExynosComponent
);
654 if (exynosOutputPort
->bufferProcessType
& BUFFER_SHARE
)
655 Exynos_OMX_FillThisBuffer(pOMXComponent
, outputUseBuffer
->bufferHeader
);
661 } else if ((pExynosComponent
->checkTimeStamp
.needSetStartTimeStamp
== OMX_TRUE
)) {
663 Exynos_OSAL_Log(EXYNOS_LOG_TRACE
, "not set check timestame after seeking");
667 if (exynosOutputPort
->bufferProcessType
& BUFFER_COPY
) {
668 if ((dstOutputData
->remainDataLen
<= (outputUseBuffer
->allocSize
- outputUseBuffer
->dataLen
)) &&
669 (!CHECK_PORT_BEING_FLUSHED(exynosOutputPort
))) {
670 copySize
= dstOutputData
->remainDataLen
;
671 Exynos_OSAL_Log(EXYNOS_LOG_TRACE
,"copySize: %d", copySize
);
673 outputUseBuffer
->dataLen
+= copySize
;
674 outputUseBuffer
->remainDataLen
+= copySize
;
675 outputUseBuffer
->nFlags
= dstOutputData
->nFlags
;
676 outputUseBuffer
->timeStamp
= dstOutputData
->timeStamp
;
678 if (outputUseBuffer
->remainDataLen
> 0) {
679 ret
= Exynos_CSC_OutputData(pOMXComponent
, dstOutputData
);
684 if (ret
== OMX_TRUE
) {
685 if ((outputUseBuffer
->remainDataLen
> 0) ||
686 ((outputUseBuffer
->nFlags
& OMX_BUFFERFLAG_EOS
) == OMX_BUFFERFLAG_EOS
) ||
687 (CHECK_PORT_BEING_FLUSHED(exynosOutputPort
))) {
688 Exynos_OutputBufferReturn(pOMXComponent
, outputUseBuffer
);
691 Exynos_OSAL_Log(EXYNOS_LOG_ERROR
, "csc_convert Error");
692 pExynosComponent
->pCallbacks
->EventHandler((OMX_HANDLETYPE
)pOMXComponent
,
693 pExynosComponent
->callbackData
,
694 OMX_EventError
, OMX_ErrorUndefined
, 0, NULL
);
697 } else if (CHECK_PORT_BEING_FLUSHED(exynosOutputPort
)) {
698 outputUseBuffer
->dataLen
= 0;
699 outputUseBuffer
->remainDataLen
= 0;
700 outputUseBuffer
->nFlags
= dstOutputData
->nFlags
;
701 outputUseBuffer
->timeStamp
= dstOutputData
->timeStamp
;
702 Exynos_OutputBufferReturn(pOMXComponent
, outputUseBuffer
);
704 Exynos_OSAL_Log(EXYNOS_LOG_ERROR
, "output buffer is smaller than decoded data size Out Length");
705 pExynosComponent
->pCallbacks
->EventHandler((OMX_HANDLETYPE
)pOMXComponent
,
706 pExynosComponent
->callbackData
,
707 OMX_EventError
, OMX_ErrorUndefined
, 0, NULL
);
710 } else if (exynosOutputPort
->bufferProcessType
& BUFFER_SHARE
) {
711 if ((outputUseBuffer
->remainDataLen
> 0) ||
712 ((outputUseBuffer
->nFlags
& OMX_BUFFERFLAG_EOS
) == OMX_BUFFERFLAG_EOS
) ||
713 (CHECK_PORT_BEING_FLUSHED(exynosOutputPort
)))
714 Exynos_OutputBufferReturn(pOMXComponent
, outputUseBuffer
);
716 Exynos_OMX_FillThisBuffer(pOMXComponent
, outputUseBuffer
->bufferHeader
);
728 OMX_ERRORTYPE
Exynos_OMX_SrcInputBufferProcess(OMX_HANDLETYPE hComponent
)
730 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
731 OMX_COMPONENTTYPE
*pOMXComponent
= (OMX_COMPONENTTYPE
*)hComponent
;
732 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
733 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
734 EXYNOS_OMX_BASEPORT
*exynosInputPort
= &pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
];
735 EXYNOS_OMX_BASEPORT
*exynosOutputPort
= &pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
];
736 EXYNOS_OMX_DATABUFFER
*srcInputUseBuffer
= &exynosInputPort
->way
.port2WayDataBuffer
.inputDataBuffer
;
737 EXYNOS_OMX_DATA
*pSrcInputData
= &exynosInputPort
->processData
;
738 OMX_BOOL bCheckInputData
= OMX_FALSE
;
739 OMX_BOOL bValidCodecData
= OMX_FALSE
;
743 while (!pVideoDec
->bExitBufferProcessThread
) {
744 Exynos_OSAL_SleepMillisec(0);
745 Exynos_Wait_ProcessPause(pExynosComponent
, INPUT_PORT_INDEX
);
747 while ((Exynos_Check_BufferProcess_State(pExynosComponent
, INPUT_PORT_INDEX
)) &&
748 (!pVideoDec
->bExitBufferProcessThread
)) {
749 Exynos_OSAL_SleepMillisec(0);
751 if ((CHECK_PORT_BEING_FLUSHED(exynosInputPort
)) ||
752 ((exynosOutputPort
->exceptionFlag
== NEED_PORT_DISABLE
) && (ret
== OMX_ErrorInputDataDecodeYet
)) ||
753 (exynosOutputPort
->exceptionFlag
== INVALID_STATE
))
755 if (exynosInputPort
->portState
!= OMX_StateIdle
)
758 Exynos_OSAL_MutexLock(srcInputUseBuffer
->bufferMutex
);
759 if (ret
!= OMX_ErrorInputDataDecodeYet
) {
760 if (exynosInputPort
->bufferProcessType
& BUFFER_COPY
) {
762 if ((pSrcInputData
->buffer
.singlePlaneBuffer
.dataBuffer
== NULL
) || (pSrcInputData
->pPrivate
== NULL
)) {
763 Exynos_CodecBufferDeQueue(pExynosComponent
, INPUT_PORT_INDEX
, &codecBuffer
);
764 if (codecBuffer
!= NULL
) {
765 Exynos_Input_CodecBufferToData(pExynosComponent
, codecBuffer
, pSrcInputData
);
767 Exynos_OSAL_MutexUnlock(srcInputUseBuffer
->bufferMutex
);
772 if (srcInputUseBuffer
->dataValid
== OMX_TRUE
) {
773 bCheckInputData
= Exynos_Preprocessor_InputData(pOMXComponent
, pSrcInputData
);
775 bCheckInputData
= OMX_FALSE
;
778 if ((bCheckInputData
== OMX_FALSE
) &&
779 (!CHECK_PORT_BEING_FLUSHED(exynosInputPort
))) {
780 ret
= Exynos_InputBufferGetQueue(pExynosComponent
);
781 Exynos_OSAL_MutexUnlock(srcInputUseBuffer
->bufferMutex
);
785 if (CHECK_PORT_BEING_FLUSHED(exynosInputPort
)) {
786 Exynos_OSAL_MutexUnlock(srcInputUseBuffer
->bufferMutex
);
791 ret
= pVideoDec
->exynos_codec_srcInputProcess(pOMXComponent
, pSrcInputData
);
792 if (ret
== OMX_ErrorCorruptedFrame
) {
793 if (exynosInputPort
->bufferProcessType
& BUFFER_COPY
) {
795 codecBuffer
= pSrcInputData
->pPrivate
;
796 if (codecBuffer
!= NULL
)
797 Exynos_CodecBufferEnQueue(pExynosComponent
, INPUT_PORT_INDEX
, codecBuffer
);
800 if (exynosInputPort
->bufferProcessType
& BUFFER_SHARE
) {
801 Exynos_OMX_InputBufferReturn(pOMXComponent
, pSrcInputData
->bufferHeader
);
805 if (ret
!= OMX_ErrorInputDataDecodeYet
) {
806 Exynos_ResetCodecData(pSrcInputData
);
808 Exynos_OSAL_MutexUnlock(srcInputUseBuffer
->bufferMutex
);
809 if (ret
== OMX_ErrorCodecInit
)
810 pVideoDec
->bExitBufferProcessThread
= OMX_TRUE
;
821 OMX_ERRORTYPE
Exynos_OMX_SrcOutputBufferProcess(OMX_HANDLETYPE hComponent
)
823 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
824 OMX_COMPONENTTYPE
*pOMXComponent
= (OMX_COMPONENTTYPE
*)hComponent
;
825 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
826 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
827 EXYNOS_OMX_BASEPORT
*exynosInputPort
= &pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
];
828 EXYNOS_OMX_DATABUFFER
*srcOutputUseBuffer
= &exynosInputPort
->way
.port2WayDataBuffer
.outputDataBuffer
;
829 EXYNOS_OMX_DATA srcOutputData
;
833 while (!pVideoDec
->bExitBufferProcessThread
) {
834 Exynos_OSAL_SleepMillisec(0);
836 while (!pVideoDec
->bExitBufferProcessThread
) {
837 if (exynosInputPort
->bufferProcessType
& BUFFER_COPY
) {
838 if (Exynos_Check_BufferProcess_State(pExynosComponent
, INPUT_PORT_INDEX
) == OMX_FALSE
)
841 Exynos_OSAL_SleepMillisec(0);
843 if (CHECK_PORT_BEING_FLUSHED(exynosInputPort
))
846 Exynos_OSAL_MutexLock(srcOutputUseBuffer
->bufferMutex
);
847 ret
= pVideoDec
->exynos_codec_srcOutputProcess(pOMXComponent
, &srcOutputData
);
849 if (ret
== OMX_ErrorNone
) {
850 if (exynosInputPort
->bufferProcessType
& BUFFER_COPY
) {
852 codecBuffer
= srcOutputData
.pPrivate
;
853 if (codecBuffer
!= NULL
)
854 Exynos_CodecBufferEnQueue(pExynosComponent
, INPUT_PORT_INDEX
, codecBuffer
);
856 if (exynosInputPort
->bufferProcessType
& BUFFER_SHARE
) {
857 Exynos_Shared_DataToBuffer(&srcOutputData
, srcOutputUseBuffer
);
858 Exynos_InputBufferReturn(pOMXComponent
, srcOutputUseBuffer
);
860 Exynos_ResetCodecData(&srcOutputData
);
862 Exynos_OSAL_MutexUnlock(srcOutputUseBuffer
->bufferMutex
);
873 OMX_ERRORTYPE
Exynos_OMX_DstInputBufferProcess(OMX_HANDLETYPE hComponent
)
875 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
876 OMX_COMPONENTTYPE
*pOMXComponent
= (OMX_COMPONENTTYPE
*)hComponent
;
877 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
878 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
879 EXYNOS_OMX_BASEPORT
*exynosOutputPort
= &pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
];
880 EXYNOS_OMX_DATABUFFER
*dstInputUseBuffer
= &exynosOutputPort
->way
.port2WayDataBuffer
.inputDataBuffer
;
881 EXYNOS_OMX_DATA dstInputData
;
885 while (!pVideoDec
->bExitBufferProcessThread
) {
886 Exynos_OSAL_SleepMillisec(0);
888 while ((Exynos_Check_BufferProcess_State(pExynosComponent
, OUTPUT_PORT_INDEX
)) &&
889 (!pVideoDec
->bExitBufferProcessThread
)) {
890 Exynos_OSAL_SleepMillisec(0);
892 if ((CHECK_PORT_BEING_FLUSHED(exynosOutputPort
)) ||
893 (!CHECK_PORT_POPULATED(exynosOutputPort
)))
895 if (exynosOutputPort
->portState
!= OMX_StateIdle
)
898 Exynos_OSAL_MutexLock(dstInputUseBuffer
->bufferMutex
);
899 if (ret
!= OMX_ErrorOutputBufferUseYet
) {
900 if (exynosOutputPort
->bufferProcessType
& BUFFER_COPY
) {
901 CODEC_DEC_BUFFER
*pCodecBuffer
= NULL
;
902 ret
= Exynos_CodecBufferDeQueue(pExynosComponent
, OUTPUT_PORT_INDEX
, (OMX_PTR
*)&pCodecBuffer
);
903 if (ret
!= OMX_ErrorNone
) {
904 Exynos_OSAL_MutexUnlock(dstInputUseBuffer
->bufferMutex
);
907 Exynos_Output_CodecBufferToData(pCodecBuffer
, &dstInputData
);
910 if (exynosOutputPort
->bufferProcessType
& BUFFER_SHARE
) {
911 if ((dstInputUseBuffer
->dataValid
!= OMX_TRUE
) &&
912 (!CHECK_PORT_BEING_FLUSHED(exynosOutputPort
))) {
913 ret
= Exynos_OutputBufferGetQueue(pExynosComponent
);
914 if (ret
!= OMX_ErrorNone
) {
915 Exynos_OSAL_MutexUnlock(dstInputUseBuffer
->bufferMutex
);
918 if (exynosOutputPort
->bIsANBEnabled
== OMX_FALSE
) {
919 Exynos_Shared_BufferToData(dstInputUseBuffer
, &dstInputData
, TWO_PLANE
);
921 ret
= Exynos_Shared_ANBBufferToData(dstInputUseBuffer
, &dstInputData
, exynosOutputPort
, TWO_PLANE
);
922 if (ret
!= OMX_ErrorNone
) {
923 dstInputUseBuffer
->dataValid
= OMX_FALSE
;
924 Exynos_OSAL_MutexUnlock(dstInputUseBuffer
->bufferMutex
);
929 OMX_PTR pBufferHandle
= dstInputData
.bufferHeader
->pBuffer
;
930 if (exynosOutputPort
->bStoreMetaData
== OMX_TRUE
) {
931 Exynos_OSAL_GetInfoFromMetaData(dstInputData
.bufferHeader
->pBuffer
, &pBufferHandle
);
933 Exynos_ResetDataBuffer(dstInputUseBuffer
);
937 if (CHECK_PORT_BEING_FLUSHED(exynosOutputPort
)) {
938 Exynos_OSAL_MutexUnlock(dstInputUseBuffer
->bufferMutex
);
943 ret
= pVideoDec
->exynos_codec_dstInputProcess(pOMXComponent
, &dstInputData
);
944 if (ret
!= OMX_ErrorOutputBufferUseYet
) {
945 Exynos_ResetCodecData(&dstInputData
);
947 Exynos_OSAL_MutexUnlock(dstInputUseBuffer
->bufferMutex
);
958 OMX_ERRORTYPE
Exynos_OMX_DstOutputBufferProcess(OMX_HANDLETYPE hComponent
)
960 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
961 OMX_COMPONENTTYPE
*pOMXComponent
= (OMX_COMPONENTTYPE
*)hComponent
;
962 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
963 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
964 EXYNOS_OMX_BASEPORT
*exynosOutputPort
= &pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
];
965 EXYNOS_OMX_DATABUFFER
*dstOutputUseBuffer
= &exynosOutputPort
->way
.port2WayDataBuffer
.outputDataBuffer
;
966 EXYNOS_OMX_DATA
*pDstOutputData
= &exynosOutputPort
->processData
;
970 while (!pVideoDec
->bExitBufferProcessThread
) {
971 Exynos_OSAL_SleepMillisec(0);
972 Exynos_Wait_ProcessPause(pExynosComponent
, OUTPUT_PORT_INDEX
);
974 while ((Exynos_Check_BufferProcess_State(pExynosComponent
, OUTPUT_PORT_INDEX
)) &&
975 (!pVideoDec
->bExitBufferProcessThread
)) {
976 Exynos_OSAL_SleepMillisec(0);
978 if (CHECK_PORT_BEING_FLUSHED(exynosOutputPort
))
981 Exynos_OSAL_MutexLock(dstOutputUseBuffer
->bufferMutex
);
982 if (exynosOutputPort
->bufferProcessType
& BUFFER_COPY
) {
983 if ((dstOutputUseBuffer
->dataValid
!= OMX_TRUE
) &&
984 (!CHECK_PORT_BEING_FLUSHED(exynosOutputPort
))) {
985 ret
= Exynos_OutputBufferGetQueue(pExynosComponent
);
986 if (ret
!= OMX_ErrorNone
) {
987 Exynos_OSAL_MutexUnlock(dstOutputUseBuffer
->bufferMutex
);
993 if ((dstOutputUseBuffer
->dataValid
== OMX_TRUE
) ||
994 (exynosOutputPort
->bufferProcessType
& BUFFER_SHARE
))
995 ret
= pVideoDec
->exynos_codec_dstOutputProcess(pOMXComponent
, pDstOutputData
);
997 if (((ret
== OMX_ErrorNone
) && (dstOutputUseBuffer
->dataValid
== OMX_TRUE
)) ||
998 (exynosOutputPort
->bufferProcessType
& BUFFER_SHARE
)) {
999 Exynos_Postprocess_OutputData(pOMXComponent
, pDstOutputData
);
1002 if (exynosOutputPort
->bufferProcessType
& BUFFER_COPY
) {
1003 if (pDstOutputData
->pPrivate
!= NULL
) {
1004 Exynos_CodecBufferEnQueue(pExynosComponent
, OUTPUT_PORT_INDEX
, pDstOutputData
->pPrivate
);
1005 pDstOutputData
->pPrivate
= NULL
;
1009 /* reset outputData */
1010 Exynos_ResetCodecData(pDstOutputData
);
1011 Exynos_OSAL_MutexUnlock(dstOutputUseBuffer
->bufferMutex
);
1022 static OMX_ERRORTYPE
Exynos_OMX_SrcInputProcessThread(OMX_PTR threadData
)
1024 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
1025 OMX_COMPONENTTYPE
*pOMXComponent
= NULL
;
1026 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= NULL
;
1027 EXYNOS_OMX_MESSAGE
*message
= NULL
;
1031 if (threadData
== NULL
) {
1032 ret
= OMX_ErrorBadParameter
;
1035 pOMXComponent
= (OMX_COMPONENTTYPE
*)threadData
;
1036 ret
= Exynos_OMX_Check_SizeVersion(pOMXComponent
, sizeof(OMX_COMPONENTTYPE
));
1037 if (ret
!= OMX_ErrorNone
) {
1040 pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
1041 Exynos_OMX_SrcInputBufferProcess(pOMXComponent
);
1043 Exynos_OSAL_ThreadExit(NULL
);
1051 static OMX_ERRORTYPE
Exynos_OMX_SrcOutputProcessThread(OMX_PTR threadData
)
1053 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
1054 OMX_COMPONENTTYPE
*pOMXComponent
= NULL
;
1055 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= NULL
;
1056 EXYNOS_OMX_MESSAGE
*message
= NULL
;
1060 if (threadData
== NULL
) {
1061 ret
= OMX_ErrorBadParameter
;
1064 pOMXComponent
= (OMX_COMPONENTTYPE
*)threadData
;
1065 ret
= Exynos_OMX_Check_SizeVersion(pOMXComponent
, sizeof(OMX_COMPONENTTYPE
));
1066 if (ret
!= OMX_ErrorNone
) {
1069 pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
1070 Exynos_OMX_SrcOutputBufferProcess(pOMXComponent
);
1072 Exynos_OSAL_ThreadExit(NULL
);
1080 static OMX_ERRORTYPE
Exynos_OMX_DstInputProcessThread(OMX_PTR threadData
)
1082 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
1083 OMX_COMPONENTTYPE
*pOMXComponent
= NULL
;
1084 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= NULL
;
1085 EXYNOS_OMX_MESSAGE
*message
= NULL
;
1089 if (threadData
== NULL
) {
1090 ret
= OMX_ErrorBadParameter
;
1093 pOMXComponent
= (OMX_COMPONENTTYPE
*)threadData
;
1094 ret
= Exynos_OMX_Check_SizeVersion(pOMXComponent
, sizeof(OMX_COMPONENTTYPE
));
1095 if (ret
!= OMX_ErrorNone
) {
1098 pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
1099 Exynos_OMX_DstInputBufferProcess(pOMXComponent
);
1101 Exynos_OSAL_ThreadExit(NULL
);
1109 static OMX_ERRORTYPE
Exynos_OMX_DstOutputProcessThread(OMX_PTR threadData
)
1111 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
1112 OMX_COMPONENTTYPE
*pOMXComponent
= NULL
;
1113 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= NULL
;
1114 EXYNOS_OMX_MESSAGE
*message
= NULL
;
1118 if (threadData
== NULL
) {
1119 ret
= OMX_ErrorBadParameter
;
1122 pOMXComponent
= (OMX_COMPONENTTYPE
*)threadData
;
1123 ret
= Exynos_OMX_Check_SizeVersion(pOMXComponent
, sizeof(OMX_COMPONENTTYPE
));
1124 if (ret
!= OMX_ErrorNone
) {
1127 pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
1128 Exynos_OMX_DstOutputBufferProcess(pOMXComponent
);
1130 Exynos_OSAL_ThreadExit(NULL
);
1138 OMX_ERRORTYPE
Exynos_OMX_BufferProcess_Create(OMX_HANDLETYPE hComponent
)
1140 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
1141 OMX_COMPONENTTYPE
*pOMXComponent
= (OMX_COMPONENTTYPE
*)hComponent
;
1142 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
1143 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
1147 pVideoDec
->bExitBufferProcessThread
= OMX_FALSE
;
1149 ret
= Exynos_OSAL_ThreadCreate(&pVideoDec
->hDstOutputThread
,
1150 Exynos_OMX_DstOutputProcessThread
,
1152 if (ret
== OMX_ErrorNone
)
1153 ret
= Exynos_OSAL_ThreadCreate(&pVideoDec
->hSrcOutputThread
,
1154 Exynos_OMX_SrcOutputProcessThread
,
1156 if (ret
== OMX_ErrorNone
)
1157 ret
= Exynos_OSAL_ThreadCreate(&pVideoDec
->hDstInputThread
,
1158 Exynos_OMX_DstInputProcessThread
,
1160 if (ret
== OMX_ErrorNone
)
1161 ret
= Exynos_OSAL_ThreadCreate(&pVideoDec
->hSrcInputThread
,
1162 Exynos_OMX_SrcInputProcessThread
,
1171 OMX_ERRORTYPE
Exynos_OMX_BufferProcess_Terminate(OMX_HANDLETYPE hComponent
)
1173 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
1174 OMX_COMPONENTTYPE
*pOMXComponent
= (OMX_COMPONENTTYPE
*)hComponent
;
1175 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
1176 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
1177 OMX_S32 countValue
= 0;
1182 pVideoDec
->bExitBufferProcessThread
= OMX_TRUE
;
1184 Exynos_OSAL_Get_SemaphoreCount(pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
].bufferSemID
, &countValue
);
1185 if (countValue
== 0)
1186 Exynos_OSAL_SemaphorePost(pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
].bufferSemID
);
1187 Exynos_OSAL_Get_SemaphoreCount(pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
].codecSemID
, &countValue
);
1188 if (countValue
== 0)
1189 Exynos_OSAL_SemaphorePost(pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
].codecSemID
);
1190 Exynos_OSAL_SignalSet(pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
].pauseEvent
);
1191 Exynos_OSAL_ThreadTerminate(pVideoDec
->hSrcInputThread
);
1192 pVideoDec
->hSrcInputThread
= NULL
;
1194 Exynos_OSAL_Get_SemaphoreCount(pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
].bufferSemID
, &countValue
);
1195 if (countValue
== 0)
1196 Exynos_OSAL_SemaphorePost(pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
].bufferSemID
);
1197 Exynos_OSAL_Get_SemaphoreCount(pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
].codecSemID
, &countValue
);
1198 if (countValue
== 0)
1199 Exynos_OSAL_SemaphorePost(pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
].codecSemID
);
1200 Exynos_OSAL_SignalSet(pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
].pauseEvent
);
1201 Exynos_OSAL_ThreadTerminate(pVideoDec
->hDstInputThread
);
1202 pVideoDec
->hDstInputThread
= NULL
;
1204 pVideoDec
->exynos_codec_stop(pOMXComponent
, INPUT_PORT_INDEX
);
1205 pVideoDec
->exynos_codec_bufferProcessRun(pOMXComponent
, INPUT_PORT_INDEX
);
1206 Exynos_OSAL_SignalSet(pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
].pauseEvent
);
1207 Exynos_OSAL_ThreadTerminate(pVideoDec
->hSrcOutputThread
);
1208 pVideoDec
->hSrcOutputThread
= NULL
;
1210 pVideoDec
->exynos_codec_stop(pOMXComponent
, OUTPUT_PORT_INDEX
);
1211 pVideoDec
->exynos_codec_bufferProcessRun(pOMXComponent
, INPUT_PORT_INDEX
);
1212 Exynos_OSAL_SignalSet(pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
].pauseEvent
);
1213 Exynos_OSAL_ThreadTerminate(pVideoDec
->hDstOutputThread
);
1214 pVideoDec
->hDstOutputThread
= NULL
;
1216 pExynosComponent
->checkTimeStamp
.needSetStartTimeStamp
= OMX_FALSE
;
1217 pExynosComponent
->checkTimeStamp
.needCheckStartTimeStamp
= OMX_FALSE
;
1225 OMX_ERRORTYPE
Exynos_OMX_VideoDecodeComponentInit(OMX_IN OMX_HANDLETYPE hComponent
)
1227 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
1228 OMX_COMPONENTTYPE
*pOMXComponent
= NULL
;
1229 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= NULL
;
1230 EXYNOS_OMX_BASEPORT
*pExynosPort
= NULL
;
1231 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= NULL
;
1235 if (hComponent
== NULL
) {
1236 ret
= OMX_ErrorBadParameter
;
1239 pOMXComponent
= (OMX_COMPONENTTYPE
*)hComponent
;
1240 ret
= Exynos_OMX_Check_SizeVersion(pOMXComponent
, sizeof(OMX_COMPONENTTYPE
));
1241 if (ret
!= OMX_ErrorNone
) {
1242 Exynos_OSAL_Log(EXYNOS_LOG_ERROR
, "OMX_Error, Line:%d", __LINE__
);
1246 ret
= Exynos_OMX_BaseComponent_Constructor(pOMXComponent
);
1247 if (ret
!= OMX_ErrorNone
) {
1248 Exynos_OSAL_Log(EXYNOS_LOG_ERROR
, "OMX_Error, Line:%d", __LINE__
);
1252 ret
= Exynos_OMX_Port_Constructor(pOMXComponent
);
1253 if (ret
!= OMX_ErrorNone
) {
1254 Exynos_OMX_BaseComponent_Destructor(pOMXComponent
);
1255 Exynos_OSAL_Log(EXYNOS_LOG_ERROR
, "OMX_Error, Line:%d", __LINE__
);
1259 pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
1261 pVideoDec
= Exynos_OSAL_Malloc(sizeof(EXYNOS_OMX_VIDEODEC_COMPONENT
));
1262 if (pVideoDec
== NULL
) {
1263 Exynos_OMX_BaseComponent_Destructor(pOMXComponent
);
1264 ret
= OMX_ErrorInsufficientResources
;
1265 Exynos_OSAL_Log(EXYNOS_LOG_ERROR
, "OMX_ErrorInsufficientResources, Line:%d", __LINE__
);
1269 Exynos_OSAL_Memset(pVideoDec
, 0, sizeof(EXYNOS_OMX_VIDEODEC_COMPONENT
));
1270 pVideoDec
->bReconfigDPB
= OMX_FALSE
;
1271 pVideoDec
->bDTSMode
= OMX_FALSE
;
1272 pVideoDec
->bQosChanged
= OMX_FALSE
;
1273 pVideoDec
->nQosRatio
= 0;
1274 pVideoDec
->bDualDPBMode
= OMX_FALSE
;
1275 pExynosComponent
->hComponentHandle
= (OMX_HANDLETYPE
)pVideoDec
;
1277 pExynosComponent
->bSaveFlagEOS
= OMX_FALSE
;
1278 pExynosComponent
->bBehaviorEOS
= OMX_FALSE
;
1279 pExynosComponent
->bMultiThreadProcess
= OMX_TRUE
;
1282 pExynosPort
= &pExynosComponent
->pExynosPort
[INPUT_PORT_INDEX
];
1283 pExynosPort
->portDefinition
.nBufferCountActual
= MAX_VIDEO_INPUTBUFFER_NUM
;
1284 pExynosPort
->portDefinition
.nBufferCountMin
= MAX_VIDEO_INPUTBUFFER_NUM
;
1285 pExynosPort
->portDefinition
.nBufferSize
= 0;
1286 pExynosPort
->portDefinition
.eDomain
= OMX_PortDomainVideo
;
1288 pExynosPort
->portDefinition
.format
.video
.cMIMEType
= Exynos_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE
);
1289 Exynos_OSAL_Strcpy(pExynosPort
->portDefinition
.format
.video
.cMIMEType
, "raw/video");
1290 pExynosPort
->portDefinition
.format
.video
.pNativeRender
= 0;
1291 pExynosPort
->portDefinition
.format
.video
.bFlagErrorConcealment
= OMX_FALSE
;
1292 pExynosPort
->portDefinition
.format
.video
.eCompressionFormat
= OMX_VIDEO_CodingUnused
;
1294 pExynosPort
->portDefinition
.format
.video
.nFrameWidth
= 0;
1295 pExynosPort
->portDefinition
.format
.video
.nFrameHeight
= 0;
1296 pExynosPort
->portDefinition
.format
.video
.nStride
= 0;
1297 pExynosPort
->portDefinition
.format
.video
.nSliceHeight
= 0;
1298 pExynosPort
->portDefinition
.format
.video
.nBitrate
= 64000;
1299 pExynosPort
->portDefinition
.format
.video
.xFramerate
= (15 << 16);
1300 pExynosPort
->portDefinition
.format
.video
.eColorFormat
= OMX_COLOR_FormatUnused
;
1301 pExynosPort
->portDefinition
.format
.video
.pNativeWindow
= NULL
;
1304 pExynosPort
= &pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
];
1305 pExynosPort
->portDefinition
.nBufferCountActual
= MAX_VIDEO_OUTPUTBUFFER_NUM
;
1306 pExynosPort
->portDefinition
.nBufferCountMin
= MAX_VIDEO_OUTPUTBUFFER_NUM
;
1307 pExynosPort
->portDefinition
.nBufferSize
= DEFAULT_VIDEO_OUTPUT_BUFFER_SIZE
;
1308 pExynosPort
->portDefinition
.eDomain
= OMX_PortDomainVideo
;
1310 pExynosPort
->portDefinition
.format
.video
.cMIMEType
= Exynos_OSAL_Malloc(MAX_OMX_MIMETYPE_SIZE
);
1311 Exynos_OSAL_Strcpy(pExynosPort
->portDefinition
.format
.video
.cMIMEType
, "raw/video");
1312 pExynosPort
->portDefinition
.format
.video
.pNativeRender
= 0;
1313 pExynosPort
->portDefinition
.format
.video
.bFlagErrorConcealment
= OMX_FALSE
;
1314 pExynosPort
->portDefinition
.format
.video
.eCompressionFormat
= OMX_VIDEO_CodingUnused
;
1316 pExynosPort
->portDefinition
.format
.video
.nFrameWidth
= 0;
1317 pExynosPort
->portDefinition
.format
.video
.nFrameHeight
= 0;
1318 pExynosPort
->portDefinition
.format
.video
.nStride
= 0;
1319 pExynosPort
->portDefinition
.format
.video
.nSliceHeight
= 0;
1320 pExynosPort
->portDefinition
.format
.video
.nBitrate
= 64000;
1321 pExynosPort
->portDefinition
.format
.video
.xFramerate
= (15 << 16);
1322 pExynosPort
->portDefinition
.format
.video
.eColorFormat
= OMX_COLOR_FormatUnused
;
1323 pExynosPort
->portDefinition
.format
.video
.pNativeWindow
= NULL
;
1325 pExynosPort
->processData
.extInfo
= (OMX_PTR
)Exynos_OSAL_Malloc(sizeof(DECODE_CODEC_EXTRA_BUFFERINFO
));
1327 pOMXComponent
->UseBuffer
= &Exynos_OMX_UseBuffer
;
1328 pOMXComponent
->AllocateBuffer
= &Exynos_OMX_AllocateBuffer
;
1329 pOMXComponent
->FreeBuffer
= &Exynos_OMX_FreeBuffer
;
1330 pOMXComponent
->ComponentTunnelRequest
= &Exynos_OMX_ComponentTunnelRequest
;
1332 pExynosComponent
->exynos_AllocateTunnelBuffer
= &Exynos_OMX_AllocateTunnelBuffer
;
1333 pExynosComponent
->exynos_FreeTunnelBuffer
= &Exynos_OMX_FreeTunnelBuffer
;
1334 pExynosComponent
->exynos_BufferProcessCreate
= &Exynos_OMX_BufferProcess_Create
;
1335 pExynosComponent
->exynos_BufferProcessTerminate
= &Exynos_OMX_BufferProcess_Terminate
;
1336 pExynosComponent
->exynos_BufferFlush
= &Exynos_OMX_BufferFlush
;
1344 OMX_ERRORTYPE
Exynos_OMX_VideoDecodeComponentDeinit(OMX_IN OMX_HANDLETYPE hComponent
)
1346 OMX_ERRORTYPE ret
= OMX_ErrorNone
;
1347 OMX_COMPONENTTYPE
*pOMXComponent
= NULL
;
1348 EXYNOS_OMX_BASECOMPONENT
*pExynosComponent
= NULL
;
1349 EXYNOS_OMX_BASEPORT
*pExynosPort
= NULL
;
1350 EXYNOS_OMX_VIDEODEC_COMPONENT
*pVideoDec
= NULL
;
1355 if (hComponent
== NULL
) {
1356 ret
= OMX_ErrorBadParameter
;
1359 pOMXComponent
= (OMX_COMPONENTTYPE
*)hComponent
;
1360 ret
= Exynos_OMX_Check_SizeVersion(pOMXComponent
, sizeof(OMX_COMPONENTTYPE
));
1361 if (ret
!= OMX_ErrorNone
) {
1365 if (pOMXComponent
->pComponentPrivate
== NULL
) {
1366 ret
= OMX_ErrorBadParameter
;
1369 pExynosComponent
= (EXYNOS_OMX_BASECOMPONENT
*)pOMXComponent
->pComponentPrivate
;
1371 pVideoDec
= (EXYNOS_OMX_VIDEODEC_COMPONENT
*)pExynosComponent
->hComponentHandle
;
1373 Exynos_OSAL_Free(pVideoDec
);
1374 pExynosComponent
->hComponentHandle
= pVideoDec
= NULL
;
1376 pExynosPort
= &pExynosComponent
->pExynosPort
[OUTPUT_PORT_INDEX
];
1377 if (pExynosPort
->processData
.extInfo
!= NULL
) {
1378 Exynos_OSAL_Free(pExynosPort
->processData
.extInfo
);
1379 pExynosPort
->processData
.extInfo
= NULL
;
1382 for(i
= 0; i
< ALL_PORT_NUM
; i
++) {
1383 pExynosPort
= &pExynosComponent
->pExynosPort
[i
];
1384 Exynos_OSAL_Free(pExynosPort
->portDefinition
.format
.video
.cMIMEType
);
1385 pExynosPort
->portDefinition
.format
.video
.cMIMEType
= NULL
;
1388 ret
= Exynos_OMX_Port_Destructor(pOMXComponent
);
1390 ret
= Exynos_OMX_BaseComponent_Destructor(hComponent
);