1 /* 2 * 3 * Copyright 2013 Rockchip Electronics Co., LTD. 4 * 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 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 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. 16 */ 17 18 /* 19 * @file Rkvpu_OMX_Vdec.h 20 * @brief 21 * @author Csy (csy@rock-chips.com) 22 23 * @version 1.0.0 24 * @history 25 * 2013.11.28 : Create 26 */ 27 28 #ifndef Rkvpu_OMX_VIDEO_DECODE 29 #define Rkvpu_OMX_VIDEO_DECODE 30 31 #include "OMX_Component.h" 32 #include "Rockchip_OMX_Def.h" 33 #include "Rockchip_OSAL_Queue.h" 34 #include "Rockchip_OMX_Baseport.h" 35 #include "Rockchip_OMX_Basecomponent.h" 36 #include "OMX_Video.h" 37 #include "VideoExt.h" 38 #include "vpu_api.h" 39 #include "OtherExt.h" 40 41 typedef struct _RKVPU_OMX_VIDEODEC_COMPONENT { 42 OMX_HANDLETYPE hCodecHandle; 43 OMX_BOOL bThumbnailMode; 44 OMX_BOOL bFirstFrame; 45 OMX_VIDEO_PARAM_AVCTYPE AVCComponent[ALL_PORT_NUM]; 46 47 /* Buffer Process */ 48 OMX_BOOL bExitBufferProcessThread; 49 OMX_HANDLETYPE hInputThread; 50 OMX_HANDLETYPE hOutputThread; 51 52 OMX_VIDEO_CODINGTYPE codecId; 53 54 /* Shared Memory Handle */ 55 OMX_HANDLETYPE hSharedMemory; 56 57 /* For DRM Play */ 58 OMX_BOOL bDRMPlayerMode; 59 OMX_U64 invalidCount; 60 OMX_BOOL bInfoChange; 61 62 /* For buffer count compute */ 63 OMX_U32 nMinUnDequeBufferCount; 64 OMX_U32 nDpbSize; 65 66 OMX_HANDLETYPE hRefHandle; 67 68 VpuCodecContext_t *vpu_ctx; 69 OMX_U32 flags; 70 71 OMX_U32 codecProfile; 72 73 OMX_BOOL bIsANBEnabled; 74 75 void *rga_ctx; 76 77 OMX_BOOL bDecSendEOS; 78 79 OMX_BOOL bStoreMetaData; 80 OMX_BOOL bOhosBufferHandle; 81 OMX_BOOL bPvr_Flag; 82 OMX_PTR vpumem_handle; 83 OMX_U32 maxCount; // when buffer in AL big than 8,if max timeout no consume we continue send one buffer to AL 84 OMX_BOOL bOld_api; 85 OMX_BOOL b4K_flags; 86 /* For vpu control */ 87 OMX_BOOL bFastMode; 88 OMX_RK_EXT_COLORSPACE extColorSpace; 89 OMX_RK_EXT_DYNCRANGE extDyncRange; 90 91 /* For power control */ 92 OMX_S32 power_fd; 93 OMX_BOOL bIsPowerControl; 94 OMX_S32 bIsHevc; 95 OMX_BOOL bIs10bit; 96 97 /* For debug */ 98 FILE *fp_in; 99 FILE *fp_out; 100 OMX_BOOL bPrintFps; 101 OMX_BOOL bPrintBufferPosition; 102 OMX_BOOL bGtsMediaTest; 103 OMX_U32 nVdecDebug; 104 105 // color aspects passed from the framework. 106 OMX_COLORASPECTS mDefaultColorAspects; 107 // color aspects parsed from the bitstream. 108 OMX_COLORASPECTS mBitstreamColorAspects; 109 // final color aspects after combining the above two aspects. 110 OMX_COLORASPECTS mFinalColorAspects; 111 112 /* For vpuapi */ 113 void *rkapi_hdl; 114 OMX_S32 (*rkvpu_open_cxt)(VpuCodecContext_t **ctx); 115 OMX_S32 (*rkvpu_close_cxt)(VpuCodecContext_t **ctx); 116 117 OMX_ERRORTYPE (*Rkvpu_codec_srcInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, ROCKCHIP_OMX_DATA *pInputData); 118 OMX_ERRORTYPE (*Rkvpu_codec_srcOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, ROCKCHIP_OMX_DATA *pInputData); 119 OMX_ERRORTYPE (*Rkvpu_codec_dstInputProcess) (OMX_COMPONENTTYPE *pOMXComponent, ROCKCHIP_OMX_DATA *pOutputData); 120 OMX_ERRORTYPE (*Rkvpu_codec_dstOutputProcess) (OMX_COMPONENTTYPE *pOMXComponent, ROCKCHIP_OMX_DATA *pOutputData); 121 } RKVPU_OMX_VIDEODEC_COMPONENT; 122 123 #ifdef __cplusplus 124 extern "C" { 125 #endif 126 127 int calc_plane(int width, int height); 128 void UpdateFrameSize(OMX_COMPONENTTYPE *pOMXComponent); 129 OMX_BOOL Rkvpu_Check_BufferProcess_State(ROCKCHIP_OMX_BASECOMPONENT *pRockchipComponent, OMX_U32 nPortIndex); 130 131 OMX_ERRORTYPE Rkvpu_OMX_InputBufferProcess(OMX_HANDLETYPE hComponent); 132 OMX_ERRORTYPE Rkvpu_OMX_OutputBufferProcess(OMX_HANDLETYPE hComponent); 133 OMX_ERRORTYPE Rkvpu_Dec_ComponentInit(OMX_COMPONENTTYPE *pOMXComponent); 134 OMX_ERRORTYPE Rkvpu_Dec_Terminate(OMX_COMPONENTTYPE *pOMXComponent); 135 136 OMX_ERRORTYPE Rockchip_OMX_ComponentConstructor(OMX_HANDLETYPE hComponent, OMX_STRING componentName); 137 OMX_ERRORTYPE Rockchip_OMX_ComponentDeInit(OMX_HANDLETYPE hComponent); 138 139 #ifdef __cplusplus 140 } 141 #endif 142 #endif