xref: /aosp_15_r20/external/crosvm/media/libvda/src/encode/bindings.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 /* automatically generated by tools/bindgen-all-the-things */
2 
3 #![allow(clippy::missing_safety_doc)]
4 #![allow(clippy::undocumented_unsafe_blocks)]
5 #![allow(clippy::upper_case_acronyms)]
6 #![allow(non_upper_case_globals)]
7 #![allow(non_camel_case_types)]
8 #![allow(non_snake_case)]
9 #![allow(dead_code)]
10 
11 pub use crate::bindings::*;
12 
13 pub const vea_impl_type_VEA_FAKE: vea_impl_type = 0;
14 pub const vea_impl_type_GAVEA: vea_impl_type = 1;
15 pub type vea_impl_type = ::std::os::raw::c_uint;
16 pub use self::vea_impl_type as vea_impl_type_t;
17 #[repr(C)]
18 pub struct vea_profile {
19     pub profile: video_codec_profile_t,
20     pub max_width: u32,
21     pub max_height: u32,
22     pub max_framerate_numerator: u32,
23     pub max_framerate_denominator: u32,
24 }
25 impl Default for vea_profile {
default() -> Self26     fn default() -> Self {
27         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
28         unsafe {
29             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
30             s.assume_init()
31         }
32     }
33 }
34 pub type vea_profile_t = vea_profile;
35 #[repr(C)]
36 #[derive(Debug, Copy, Clone)]
37 pub struct vea_capabilities {
38     pub num_input_formats: usize,
39     pub input_formats: *const video_pixel_format_t,
40     pub num_output_formats: usize,
41     pub output_formats: *const vea_profile_t,
42 }
43 impl Default for vea_capabilities {
default() -> Self44     fn default() -> Self {
45         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
46         unsafe {
47             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
48             s.assume_init()
49         }
50     }
51 }
52 pub type vea_capabilities_t = vea_capabilities;
53 pub const vea_bitrate_mode_VBR: vea_bitrate_mode = 0;
54 pub const vea_bitrate_mode_CBR: vea_bitrate_mode = 1;
55 pub type vea_bitrate_mode = ::std::os::raw::c_uint;
56 pub use self::vea_bitrate_mode as vea_bitrate_mode_t;
57 #[repr(C)]
58 #[derive(Debug, Copy, Clone)]
59 pub struct vea_bitrate {
60     pub mode: vea_bitrate_mode_t,
61     pub target: u32,
62     pub peak: u32,
63 }
64 impl Default for vea_bitrate {
default() -> Self65     fn default() -> Self {
66         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
67         unsafe {
68             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
69             s.assume_init()
70         }
71     }
72 }
73 pub type vea_bitrate_t = vea_bitrate;
74 #[repr(C)]
75 pub struct vea_config {
76     pub input_format: video_pixel_format_t,
77     pub input_visible_width: u32,
78     pub input_visible_height: u32,
79     pub output_profile: video_codec_profile_t,
80     pub bitrate: vea_bitrate_t,
81     pub initial_framerate: u32,
82     pub has_initial_framerate: u8,
83     pub h264_output_level: u8,
84     pub has_h264_output_level: u8,
85 }
86 impl Default for vea_config {
default() -> Self87     fn default() -> Self {
88         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
89         unsafe {
90             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
91             s.assume_init()
92         }
93     }
94 }
95 pub type vea_config_t = vea_config;
96 pub const vea_error_ILLEGAL_STATE_ERROR: vea_error = 0;
97 pub const vea_error_INVALID_ARGUMENT_ERROR: vea_error = 1;
98 pub const vea_error_PLATFORM_FAILURE_ERROR: vea_error = 2;
99 pub type vea_error = ::std::os::raw::c_uint;
100 pub use self::vea_error as vea_error_t;
101 #[repr(C)]
102 #[derive(Debug, Copy, Clone)]
103 pub struct vea_session_info {
104     pub ctx: *mut ::std::os::raw::c_void,
105     pub event_pipe_fd: ::std::os::raw::c_int,
106 }
107 impl Default for vea_session_info {
default() -> Self108     fn default() -> Self {
109         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
110         unsafe {
111             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
112             s.assume_init()
113         }
114     }
115 }
116 pub type vea_session_info_t = vea_session_info;
117 pub type vea_input_buffer_id_t = i32;
118 pub type vea_output_buffer_id_t = i32;
119 pub const vea_event_type_REQUIRE_INPUT_BUFFERS: vea_event_type = 0;
120 pub const vea_event_type_PROCESSED_INPUT_BUFFER: vea_event_type = 1;
121 pub const vea_event_type_PROCESSED_OUTPUT_BUFFER: vea_event_type = 2;
122 pub const vea_event_type_VEA_FLUSH_RESPONSE: vea_event_type = 3;
123 pub const vea_event_type_VEA_NOTIFY_ERROR: vea_event_type = 4;
124 pub type vea_event_type = ::std::os::raw::c_uint;
125 pub use self::vea_event_type as vea_event_type_t;
126 #[repr(C)]
127 #[derive(Debug, Default, Copy, Clone)]
128 pub struct vea_require_input_buffers_event_data {
129     pub input_count: u32,
130     pub input_frame_width: u32,
131     pub input_frame_height: u32,
132     pub output_buffer_size: u32,
133 }
134 pub type vea_require_input_buffers_event_data_t = vea_require_input_buffers_event_data;
135 #[repr(C)]
136 #[derive(Debug, Default, Copy, Clone)]
137 pub struct vea_processed_output_buffer_event_data {
138     pub output_buffer_id: vea_output_buffer_id_t,
139     pub payload_size: u32,
140     pub key_frame: u8,
141     pub timestamp: i64,
142 }
143 pub type vea_processed_output_buffer_event_data_t = vea_processed_output_buffer_event_data;
144 #[repr(C)]
145 #[derive(Copy, Clone)]
146 pub union vea_event_data {
147     pub require_input_buffers: vea_require_input_buffers_event_data_t,
148     pub processed_input_buffer_id: vea_input_buffer_id_t,
149     pub processed_output_buffer: vea_processed_output_buffer_event_data_t,
150     pub flush_done: u8,
151     pub error: vea_error_t,
152 }
153 impl Default for vea_event_data {
default() -> Self154     fn default() -> Self {
155         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
156         unsafe {
157             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
158             s.assume_init()
159         }
160     }
161 }
162 pub type vea_event_data_t = vea_event_data;
163 #[repr(C)]
164 #[derive(Copy, Clone)]
165 pub struct vea_event {
166     pub event_type: vea_event_type_t,
167     pub event_data: vea_event_data_t,
168 }
169 impl Default for vea_event {
default() -> Self170     fn default() -> Self {
171         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
172         unsafe {
173             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
174             s.assume_init()
175         }
176     }
177 }
178 pub type vea_event_t = vea_event;
179 extern "C" {
initialize_encode(type_: vea_impl_type_t) -> *mut ::std::os::raw::c_void180     pub fn initialize_encode(type_: vea_impl_type_t) -> *mut ::std::os::raw::c_void;
181 }
182 extern "C" {
deinitialize_encode(impl_: *mut ::std::os::raw::c_void)183     pub fn deinitialize_encode(impl_: *mut ::std::os::raw::c_void);
184 }
185 extern "C" {
get_vea_capabilities(impl_: *mut ::std::os::raw::c_void) -> *const vea_capabilities_t186     pub fn get_vea_capabilities(impl_: *mut ::std::os::raw::c_void) -> *const vea_capabilities_t;
187 }
188 extern "C" {
init_encode_session( impl_: *mut ::std::os::raw::c_void, config: *mut vea_config_t, ) -> *mut vea_session_info_t189     pub fn init_encode_session(
190         impl_: *mut ::std::os::raw::c_void,
191         config: *mut vea_config_t,
192     ) -> *mut vea_session_info_t;
193 }
194 extern "C" {
close_encode_session( impl_: *mut ::std::os::raw::c_void, session_info: *mut vea_session_info_t, )195     pub fn close_encode_session(
196         impl_: *mut ::std::os::raw::c_void,
197         session_info: *mut vea_session_info_t,
198     );
199 }
200 extern "C" {
vea_encode( ctx: *mut ::std::os::raw::c_void, input_buffer_id: vea_input_buffer_id_t, fd: ::std::os::raw::c_int, num_planes: usize, planes: *mut video_frame_plane_t, timestamp: i64, force_keyframe: u8, ) -> ::std::os::raw::c_int201     pub fn vea_encode(
202         ctx: *mut ::std::os::raw::c_void,
203         input_buffer_id: vea_input_buffer_id_t,
204         fd: ::std::os::raw::c_int,
205         num_planes: usize,
206         planes: *mut video_frame_plane_t,
207         timestamp: i64,
208         force_keyframe: u8,
209     ) -> ::std::os::raw::c_int;
210 }
211 extern "C" {
vea_use_output_buffer( ctx: *mut ::std::os::raw::c_void, output_buffer_id: vea_output_buffer_id_t, fd: ::std::os::raw::c_int, offset: u32, size: u32, ) -> ::std::os::raw::c_int212     pub fn vea_use_output_buffer(
213         ctx: *mut ::std::os::raw::c_void,
214         output_buffer_id: vea_output_buffer_id_t,
215         fd: ::std::os::raw::c_int,
216         offset: u32,
217         size: u32,
218     ) -> ::std::os::raw::c_int;
219 }
220 extern "C" {
vea_request_encoding_params_change( ctx: *mut ::std::os::raw::c_void, bitrate: vea_bitrate_t, framerate: u32, ) -> ::std::os::raw::c_int221     pub fn vea_request_encoding_params_change(
222         ctx: *mut ::std::os::raw::c_void,
223         bitrate: vea_bitrate_t,
224         framerate: u32,
225     ) -> ::std::os::raw::c_int;
226 }
227 extern "C" {
vea_flush(ctx: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int228     pub fn vea_flush(ctx: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int;
229 }
230