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
/* automatically generated by tools/bindgen-all-the-things */

#![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 __int32_t = ::std::os::raw::c_int;
pub type __uint32_t = ::std::os::raw::c_uint;
pub type __uint64_t = ::std::os::raw::c_ulong;
pub const vda_impl_type_FAKE: vda_impl_type = 0;
pub const vda_impl_type_GAVDA: vda_impl_type = 1;
pub const vda_impl_type_GAVD: vda_impl_type = 2;
pub type vda_impl_type = ::std::os::raw::c_uint;
pub use self::vda_impl_type as vda_impl_type_t;
pub const vda_result_SUCCESS: vda_result = 0;
pub const vda_result_ILLEGAL_STATE: vda_result = 1;
pub const vda_result_INVALID_ARGUMENT: vda_result = 2;
pub const vda_result_UNREADABLE_INPUT: vda_result = 3;
pub const vda_result_PLATFORM_FAILURE: vda_result = 4;
pub const vda_result_INSUFFICIENT_RESOURCES: vda_result = 5;
pub const vda_result_CANCELLED: vda_result = 6;
pub type vda_result = ::std::os::raw::c_uint;
pub use self::vda_result as vda_result_t;
pub use self::video_codec_profile_t as vda_profile_t;
pub use self::video_pixel_format_t as vda_pixel_format_t;
pub const vda_event_type_UNKNOWN: vda_event_type = 0;
pub const vda_event_type_PROVIDE_PICTURE_BUFFERS: vda_event_type = 1;
pub const vda_event_type_PICTURE_READY: vda_event_type = 2;
pub const vda_event_type_NOTIFY_END_OF_BITSTREAM_BUFFER: vda_event_type = 3;
pub const vda_event_type_NOTIFY_ERROR: vda_event_type = 4;
pub const vda_event_type_RESET_RESPONSE: vda_event_type = 5;
pub const vda_event_type_FLUSH_RESPONSE: vda_event_type = 6;
pub type vda_event_type = ::std::os::raw::c_uint;
pub use self::vda_event_type as vda_event_type_t;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct provide_picture_buffers_event_data {
    pub min_num_buffers: u32,
    pub width: i32,
    pub height: i32,
    pub visible_rect_left: i32,
    pub visible_rect_top: i32,
    pub visible_rect_right: i32,
    pub visible_rect_bottom: i32,
}
pub type provide_picture_buffers_event_data_t = provide_picture_buffers_event_data;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct picture_ready_event_data {
    pub picture_buffer_id: i32,
    pub bitstream_id: i32,
    pub crop_left: i32,
    pub crop_top: i32,
    pub crop_right: i32,
    pub crop_bottom: i32,
}
pub type picture_ready_event_data_t = picture_ready_event_data;
#[repr(C)]
#[derive(Copy, Clone)]
pub union vda_event_data {
    pub provide_picture_buffers: provide_picture_buffers_event_data_t,
    pub picture_ready: picture_ready_event_data_t,
    pub bitstream_id: i32,
    pub result: vda_result_t,
}
impl Default for vda_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 vda_event_data_t = vda_event_data;
#[repr(C)]
pub struct vda_input_format {
    pub profile: vda_profile_t,
    pub min_width: u32,
    pub min_height: u32,
    pub max_width: u32,
    pub max_height: u32,
}
impl Default for vda_input_format {
    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 vda_input_format_t = vda_input_format;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct vda_event {
    pub event_type: vda_event_type_t,
    pub event_data: vda_event_data_t,
}
impl Default for vda_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 vda_event_t = vda_event;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct vda_capabilities {
    pub num_input_formats: usize,
    pub input_formats: *const vda_input_format_t,
    pub num_output_formats: usize,
    pub output_formats: *const vda_pixel_format_t,
}
impl Default for vda_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 vda_capabilities_t = vda_capabilities;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct vda_session_info {
    pub ctx: *mut ::std::os::raw::c_void,
    pub event_pipe_fd: ::std::os::raw::c_int,
}
impl Default for vda_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 vda_session_info_t = vda_session_info;
extern "C" {
    pub fn initialize(impl_type: vda_impl_type_t) -> *mut ::std::os::raw::c_void;
}
extern "C" {
    pub fn deinitialize(impl_: *mut ::std::os::raw::c_void);
}
extern "C" {
    pub fn get_vda_capabilities(impl_: *mut ::std::os::raw::c_void) -> *const vda_capabilities_t;
}
extern "C" {
    pub fn init_decode_session(
        impl_: *mut ::std::os::raw::c_void,
        profile: vda_profile_t,
    ) -> *mut vda_session_info_t;
}
extern "C" {
    pub fn close_decode_session(
        impl_: *mut ::std::os::raw::c_void,
        session_info: *mut vda_session_info_t,
    );
}
extern "C" {
    pub fn vda_decode(
        ctx: *mut ::std::os::raw::c_void,
        bitstream_id: i32,
        fd: ::std::os::raw::c_int,
        offset: u32,
        bytes_used: u32,
    ) -> vda_result_t;
}
extern "C" {
    pub fn vda_set_output_buffer_count(
        ctx: *mut ::std::os::raw::c_void,
        num_output_buffers: usize,
    ) -> vda_result_t;
}
extern "C" {
    pub fn vda_use_output_buffer(
        ctx: *mut ::std::os::raw::c_void,
        picture_buffer_id: i32,
        format: vda_pixel_format_t,
        fd: ::std::os::raw::c_int,
        num_planes: usize,
        planes: *mut video_frame_plane_t,
        modifier: u64,
    ) -> vda_result_t;
}
extern "C" {
    pub fn vda_reuse_output_buffer(
        ctx: *mut ::std::os::raw::c_void,
        picture_buffer_id: i32,
    ) -> vda_result_t;
}
extern "C" {
    pub fn vda_flush(ctx: *mut ::std::os::raw::c_void) -> vda_result_t;
}
extern "C" {
    pub fn vda_reset(ctx: *mut ::std::os::raw::c_void) -> vda_result_t;
}