1 /****************************************************************************** 2 * 3 * Copyright (C) 2018 The Android Open Source Project 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 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19 */ 20 /*! 21 ****************************************************************************** 22 * \file ihevce_plugin.h 23 * 24 * \brief 25 * This file contains plugin interface definations and structures 26 * 27 * \date 28 * 15/04/2014 29 * 30 * \author 31 * Ittiam 32 * 33 * 34 * List of Functions 35 * 36 * 37 ****************************************************************************** 38 */ 39 #ifndef _IHEVCE_PLUGIN_H_ 40 #define _IHEVCE_PLUGIN_H_ 41 42 #ifdef __cplusplus 43 extern "C" 44 { 45 #endif 46 47 /*****************************************************************************/ 48 /* File Includes */ 49 /*****************************************************************************/ 50 51 /*****************************************************************************/ 52 /* Constant Macros */ 53 /*****************************************************************************/ 54 #define MAX_INP_PLANES 3 55 56 /*****************************************************************************/ 57 /* Typedefs */ 58 /*****************************************************************************/ 59 60 /*****************************************************************************/ 61 /* Enums */ 62 /*****************************************************************************/ 63 typedef enum 64 { 65 IHEVCE_EFAIL = 0xFFFFFFFF, 66 IHEVCE_EOK = 0 67 } IHEVCE_PLUGIN_STATUS_T; 68 69 /*****************************************************************************/ 70 /* Structure */ 71 /*****************************************************************************/ 72 typedef struct 73 { 74 /* input buffer pointers */ 75 void *apv_inp_planes[MAX_INP_PLANES]; 76 77 /* input buffer strides */ 78 WORD32 ai4_inp_strd[MAX_INP_PLANES]; 79 80 /* input buffer size */ 81 WORD32 ai4_inp_size[MAX_INP_PLANES]; 82 83 /* PTS of the input */ 84 ULWORD64 u8_pts; 85 86 /* Current bitrate*/ 87 WORD32 i4_curr_bitrate; 88 89 /* Current peak bitrate*/ 90 WORD32 i4_curr_peak_bitrate; 91 92 /* Unused variable retained for backward compatibility*/ 93 WORD32 i4_curr_rate_factor; 94 95 /* force idr flag */ 96 WORD32 i4_force_idr_flag; 97 } ihevce_inp_buf_t; 98 99 typedef struct 100 { 101 /* Output buffer pointer (if set to NULL then no output is sent out from encoder) */ 102 UWORD8 *pu1_output_buf; 103 104 /* Number of bytes generated in the buffer */ 105 WORD32 i4_bytes_generated; 106 107 /* Key frame flag */ 108 WORD32 i4_is_key_frame; 109 110 /* PTS of the output */ 111 ULWORD64 u8_pts; 112 113 /* DTS of the output */ 114 LWORD64 i8_dts; 115 116 /* Flag to check if last output buffer sent from encoder */ 117 WORD32 i4_end_flag; 118 119 } ihevce_out_buf_t; 120 121 /*****************************************************************************/ 122 /* Extern Variable Declarations */ 123 /*****************************************************************************/ 124 125 /*****************************************************************************/ 126 /* Extern Function Declarations */ 127 /*****************************************************************************/ 128 129 IHEVCE_PLUGIN_STATUS_T ihevce_set_def_params(ihevce_static_cfg_params_t *ps_params); 130 131 IHEVCE_PLUGIN_STATUS_T ihevce_init(ihevce_static_cfg_params_t *ps_params, void **ppv_ihevce_hdl); 132 133 IHEVCE_PLUGIN_STATUS_T ihevce_encode_header(void *pv_ihevce_hdl, ihevce_out_buf_t *ps_out); 134 135 IHEVCE_PLUGIN_STATUS_T 136 ihevce_encode(void *pv_ihevce_hdl, ihevce_inp_buf_t *ps_inp, ihevce_out_buf_t *ps_out); 137 138 IHEVCE_PLUGIN_STATUS_T ihevce_close(void *pv_ihevce_hdl); 139 140 void ihevce_init_sys_api(void *pv_cb_handle, ihevce_sys_api_t *ps_sys_api); 141 142 #ifdef __cplusplus 143 } 144 #endif 145 146 #endif /* _IHEVCE_PLUGIN_H_ */ 147