1 /* 2 * Copyright 2020 Rockchip Electronics Co. LTD 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __HAL_INFO_H__ 18 #define __HAL_INFO_H__ 19 20 #include "mpp_enc_cfg.h" 21 #include "mpp_device.h" 22 23 typedef enum CodecInfoType_e { 24 /* ENC info */ 25 ENC_INFO_BASE = 0, 26 ENC_INFO_WIDTH = (ENC_INFO_BASE + 1), 27 ENC_INFO_HEIGHT = (ENC_INFO_BASE + 2), 28 ENC_INFO_FORMAT = (ENC_INFO_BASE + 3), 29 ENC_INFO_FPS_IN = (ENC_INFO_BASE + 4), 30 ENC_INFO_FPS_OUT = (ENC_INFO_BASE + 5), 31 ENC_INFO_RC_MODE = (ENC_INFO_BASE + 6), 32 ENC_INFO_BITRATE = (ENC_INFO_BASE + 7), 33 ENC_INFO_GOP_SIZE = (ENC_INFO_BASE + 8), 34 ENC_INFO_FPS_CALC = (ENC_INFO_BASE + 9), 35 ENC_INFO_PROFILE = (ENC_INFO_BASE + 10), 36 ENC_INFO_BUTT, 37 38 /* DEC info */ 39 DEC_INFO_BASE = 16, 40 DEC_INFO_WIDTH = (DEC_INFO_BASE + 1), 41 DEC_INFO_HEIGHT = (DEC_INFO_BASE + 2), 42 DEC_INFO_FORMAT = (DEC_INFO_BASE + 3), 43 DEC_INFO_BITDEPTH = (DEC_INFO_BASE + 4), 44 DEC_INFO_FPS = (DEC_INFO_BASE + 5), 45 DEC_INFO_BUTT, 46 } CodecInfoType; 47 48 enum CODEC_INFO_FLAGS { 49 CODEC_INFO_FLAG_NULL = 0, 50 CODEC_INFO_FLAG_NUMBER = 1, 51 CODEC_INFO_FLAG_STRING = 2, 52 CODEC_INFO_FLAG_BUTT, 53 }; 54 55 typedef void* HalInfo; 56 57 #ifdef __cplusplus 58 extern "C" { 59 #endif 60 61 MPP_RET hal_info_init(HalInfo *ctx, MppCtxType type, MppCodingType coding); 62 MPP_RET hal_info_deinit(HalInfo ctx); 63 MPP_RET hal_info_set(HalInfo ctx, RK_U32 type, RK_U32 flag, RK_U64 data); 64 MPP_RET hal_info_get(HalInfo ctx, MppDevInfoCfg *data, RK_S32 *size); 65 66 RK_U64 hal_info_to_string(HalInfo ctx, RK_U32 type, void *val); 67 RK_U64 hal_info_to_float(RK_S32 num, RK_S32 denom); 68 69 MPP_RET hal_info_from_enc_cfg(HalInfo ctx, MppEncCfgSet *cfg); 70 71 #ifdef __cplusplus 72 } 73 #endif 74 75 #endif /* __HAL_INFO_H__ */ 76