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 /* Current rate factor*/ 93 WORD32 i4_curr_rate_factor; 94 95 } ihevce_inp_buf_t; 96 97 typedef struct 98 { 99 /* Output buffer pointer (if set to NULL then no output is sent out from encoder) */ 100 UWORD8 *pu1_output_buf; 101 102 /* Number of bytes generated in the buffer */ 103 WORD32 i4_bytes_generated; 104 105 /* Key frame flag */ 106 WORD32 i4_is_key_frame; 107 108 /* PTS of the output */ 109 ULWORD64 u8_pts; 110 111 /* DTS of the output */ 112 LWORD64 i8_dts; 113 114 /* Flag to check if last output buffer sent from encoder */ 115 WORD32 i4_end_flag; 116 117 } ihevce_out_buf_t; 118 119 /*****************************************************************************/ 120 /* Extern Variable Declarations */ 121 /*****************************************************************************/ 122 123 /*****************************************************************************/ 124 /* Extern Function Declarations */ 125 /*****************************************************************************/ 126 127 IHEVCE_PLUGIN_STATUS_T ihevce_set_def_params(ihevce_static_cfg_params_t *ps_params); 128 129 IHEVCE_PLUGIN_STATUS_T ihevce_init(ihevce_static_cfg_params_t *ps_params, void **ppv_ihevce_hdl); 130 131 IHEVCE_PLUGIN_STATUS_T ihevce_encode_header(void *pv_ihevce_hdl, ihevce_out_buf_t *ps_out); 132 133 IHEVCE_PLUGIN_STATUS_T 134 ihevce_encode(void *pv_ihevce_hdl, ihevce_inp_buf_t *ps_inp, ihevce_out_buf_t *ps_out); 135 136 IHEVCE_PLUGIN_STATUS_T ihevce_close(void *pv_ihevce_hdl); 137 138 void ihevce_init_sys_api(void *pv_cb_handle, ihevce_sys_api_t *ps_sys_api); 139 140 #ifdef __cplusplus 141 } 142 #endif 143 144 #endif /* _IHEVCE_PLUGIN_H_ */ 145