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