libde265_sys2/bindings/
v1_0.rs

1// automatically generated by rust-bindgen 0.72.1
2
3#[repr(C)]
4#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
5pub struct __BindgenBitfieldUnit<Storage> {
6    storage: Storage,
7}
8impl<Storage> __BindgenBitfieldUnit<Storage> {
9    #[inline]
10    pub const fn new(storage: Storage) -> Self {
11        Self { storage }
12    }
13}
14impl<Storage> __BindgenBitfieldUnit<Storage>
15where
16    Storage: AsRef<[u8]> + AsMut<[u8]>,
17{
18    #[inline]
19    fn extract_bit(byte: u8, index: usize) -> bool {
20        let bit_index = if cfg!(target_endian = "big") {
21            7 - (index % 8)
22        } else {
23            index % 8
24        };
25        let mask = 1 << bit_index;
26        byte & mask == mask
27    }
28    #[inline]
29    pub fn get_bit(&self, index: usize) -> bool {
30        debug_assert!(index / 8 < self.storage.as_ref().len());
31        let byte_index = index / 8;
32        let byte = self.storage.as_ref()[byte_index];
33        Self::extract_bit(byte, index)
34    }
35    #[inline]
36    pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
37        debug_assert!(index / 8 < core::mem::size_of::<Storage>());
38        let byte_index = index / 8;
39        let byte = unsafe {
40            *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
41        };
42        Self::extract_bit(byte, index)
43    }
44    #[inline]
45    fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
46        let bit_index = if cfg!(target_endian = "big") {
47            7 - (index % 8)
48        } else {
49            index % 8
50        };
51        let mask = 1 << bit_index;
52        if val { byte | mask } else { byte & !mask }
53    }
54    #[inline]
55    pub fn set_bit(&mut self, index: usize, val: bool) {
56        debug_assert!(index / 8 < self.storage.as_ref().len());
57        let byte_index = index / 8;
58        let byte = &mut self.storage.as_mut()[byte_index];
59        *byte = Self::change_bit(*byte, index, val);
60    }
61    #[inline]
62    pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
63        debug_assert!(index / 8 < core::mem::size_of::<Storage>());
64        let byte_index = index / 8;
65        let byte = unsafe {
66            (core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
67        };
68        unsafe { *byte = Self::change_bit(*byte, index, val) };
69    }
70    #[inline]
71    pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
72        debug_assert!(bit_width <= 64);
73        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
74        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),);
75        let mut val = 0;
76        for i in 0..(bit_width as usize) {
77            if self.get_bit(i + bit_offset) {
78                let index = if cfg!(target_endian = "big") {
79                    bit_width as usize - 1 - i
80                } else {
81                    i
82                };
83                val |= 1 << index;
84            }
85        }
86        val
87    }
88    #[inline]
89    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
90        debug_assert!(bit_width <= 64);
91        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
92        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),);
93        let mut val = 0;
94        for i in 0..(bit_width as usize) {
95            if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
96                let index = if cfg!(target_endian = "big") {
97                    bit_width as usize - 1 - i
98                } else {
99                    i
100                };
101                val |= 1 << index;
102            }
103        }
104        val
105    }
106    #[inline]
107    pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
108        debug_assert!(bit_width <= 64);
109        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
110        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len(),);
111        for i in 0..(bit_width as usize) {
112            let mask = 1 << i;
113            let val_bit_is_set = val & mask == mask;
114            let index = if cfg!(target_endian = "big") {
115                bit_width as usize - 1 - i
116            } else {
117                i
118            };
119            self.set_bit(index + bit_offset, val_bit_is_set);
120        }
121    }
122    #[inline]
123    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
124        debug_assert!(bit_width <= 64);
125        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
126        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>(),);
127        for i in 0..(bit_width as usize) {
128            let mask = 1 << i;
129            let val_bit_is_set = val & mask == mask;
130            let index = if cfg!(target_endian = "big") {
131                bit_width as usize - 1 - i
132            } else {
133                i
134            };
135            unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
136        }
137    }
138}
139pub const LIBDE265_NUMERIC_VERSION: u32 = 16782848;
140pub const LIBDE265_VERSION: &::std::ffi::CStr = c"1.0.16";
141unsafe extern "C" {
142    /// version of linked libde265 library
143    pub fn de265_get_version() -> *const ::std::os::raw::c_char;
144}
145unsafe extern "C" {
146    /// returns the version number as a BCD number.
147    /// 0xAABBCCDD is interpreted as version AA.BB.CC.
148    /// For example: 0x02143000 is version 2.14.30
149    pub fn de265_get_version_number() -> u32;
150}
151unsafe extern "C" {
152    pub fn de265_get_version_number_major() -> ::std::os::raw::c_int;
153}
154unsafe extern "C" {
155    pub fn de265_get_version_number_minor() -> ::std::os::raw::c_int;
156}
157unsafe extern "C" {
158    pub fn de265_get_version_number_maintenance() -> ::std::os::raw::c_int;
159}
160pub mod de265_error {
161    pub type Type = ::std::os::raw::c_uint;
162    pub const DE265_OK: Type = 0;
163    pub const DE265_ERROR_NO_SUCH_FILE: Type = 1;
164    pub const DE265_ERROR_COEFFICIENT_OUT_OF_IMAGE_BOUNDS: Type = 4;
165    pub const DE265_ERROR_CHECKSUM_MISMATCH: Type = 5;
166    pub const DE265_ERROR_CTB_OUTSIDE_IMAGE_AREA: Type = 6;
167    pub const DE265_ERROR_OUT_OF_MEMORY: Type = 7;
168    pub const DE265_ERROR_CODED_PARAMETER_OUT_OF_RANGE: Type = 8;
169    pub const DE265_ERROR_IMAGE_BUFFER_FULL: Type = 9;
170    pub const DE265_ERROR_CANNOT_START_THREADPOOL: Type = 10;
171    pub const DE265_ERROR_LIBRARY_INITIALIZATION_FAILED: Type = 11;
172    pub const DE265_ERROR_LIBRARY_NOT_INITIALIZED: Type = 12;
173    pub const DE265_ERROR_WAITING_FOR_INPUT_DATA: Type = 13;
174    pub const DE265_ERROR_CANNOT_PROCESS_SEI: Type = 14;
175    pub const DE265_ERROR_PARAMETER_PARSING: Type = 15;
176    pub const DE265_ERROR_NO_INITIAL_SLICE_HEADER: Type = 16;
177    pub const DE265_ERROR_PREMATURE_END_OF_SLICE: Type = 17;
178    pub const DE265_ERROR_UNSPECIFIED_DECODING_ERROR: Type = 18;
179    pub const DE265_ERROR_NOT_IMPLEMENTED_YET: Type = 502;
180    pub const DE265_WARNING_NO_WPP_CANNOT_USE_MULTITHREADING: Type = 1000;
181    pub const DE265_WARNING_WARNING_BUFFER_FULL: Type = 1001;
182    pub const DE265_WARNING_PREMATURE_END_OF_SLICE_SEGMENT: Type = 1002;
183    pub const DE265_WARNING_INCORRECT_ENTRY_POINT_OFFSET: Type = 1003;
184    pub const DE265_WARNING_CTB_OUTSIDE_IMAGE_AREA: Type = 1004;
185    pub const DE265_WARNING_SPS_HEADER_INVALID: Type = 1005;
186    pub const DE265_WARNING_PPS_HEADER_INVALID: Type = 1006;
187    pub const DE265_WARNING_SLICEHEADER_INVALID: Type = 1007;
188    pub const DE265_WARNING_INCORRECT_MOTION_VECTOR_SCALING: Type = 1008;
189    pub const DE265_WARNING_NONEXISTING_PPS_REFERENCED: Type = 1009;
190    pub const DE265_WARNING_NONEXISTING_SPS_REFERENCED: Type = 1010;
191    pub const DE265_WARNING_BOTH_PREDFLAGS_ZERO: Type = 1011;
192    pub const DE265_WARNING_NONEXISTING_REFERENCE_PICTURE_ACCESSED: Type = 1012;
193    pub const DE265_WARNING_NUMMVP_NOT_EQUAL_TO_NUMMVQ: Type = 1013;
194    pub const DE265_WARNING_NUMBER_OF_SHORT_TERM_REF_PIC_SETS_OUT_OF_RANGE: Type = 1014;
195    pub const DE265_WARNING_SHORT_TERM_REF_PIC_SET_OUT_OF_RANGE: Type = 1015;
196    pub const DE265_WARNING_FAULTY_REFERENCE_PICTURE_LIST: Type = 1016;
197    pub const DE265_WARNING_EOSS_BIT_NOT_SET: Type = 1017;
198    pub const DE265_WARNING_MAX_NUM_REF_PICS_EXCEEDED: Type = 1018;
199    pub const DE265_WARNING_INVALID_CHROMA_FORMAT: Type = 1019;
200    pub const DE265_WARNING_SLICE_SEGMENT_ADDRESS_INVALID: Type = 1020;
201    pub const DE265_WARNING_DEPENDENT_SLICE_WITH_ADDRESS_ZERO: Type = 1021;
202    pub const DE265_WARNING_NUMBER_OF_THREADS_LIMITED_TO_MAXIMUM: Type = 1022;
203    pub const DE265_NON_EXISTING_LT_REFERENCE_CANDIDATE_IN_SLICE_HEADER: Type = 1023;
204    pub const DE265_WARNING_CANNOT_APPLY_SAO_OUT_OF_MEMORY: Type = 1024;
205    pub const DE265_WARNING_SPS_MISSING_CANNOT_DECODE_SEI: Type = 1025;
206    pub const DE265_WARNING_COLLOCATED_MOTION_VECTOR_OUTSIDE_IMAGE_AREA: Type = 1026;
207    pub const DE265_WARNING_PCM_BITDEPTH_TOO_LARGE: Type = 1027;
208    pub const DE265_WARNING_REFERENCE_IMAGE_BIT_DEPTH_DOES_NOT_MATCH: Type = 1028;
209    pub const DE265_WARNING_REFERENCE_IMAGE_SIZE_DOES_NOT_MATCH_SPS: Type = 1029;
210    pub const DE265_WARNING_CHROMA_OF_CURRENT_IMAGE_DOES_NOT_MATCH_SPS: Type = 1030;
211    pub const DE265_WARNING_BIT_DEPTH_OF_CURRENT_IMAGE_DOES_NOT_MATCH_SPS: Type = 1031;
212    pub const DE265_WARNING_REFERENCE_IMAGE_CHROMA_FORMAT_DOES_NOT_MATCH: Type = 1032;
213    pub const DE265_WARNING_INVALID_SLICE_HEADER_INDEX_ACCESS: Type = 1033;
214}
215unsafe extern "C" {
216    pub fn de265_get_error_text(err: de265_error::Type) -> *const ::std::os::raw::c_char;
217}
218unsafe extern "C" {
219    /// Returns true, if 'err' is DE265_OK or a warning.
220    pub fn de265_isOK(err: de265_error::Type) -> ::std::os::raw::c_int;
221}
222unsafe extern "C" {
223    pub fn de265_disable_logging();
224}
225unsafe extern "C" {
226    pub fn de265_set_verbosity(level: ::std::os::raw::c_int);
227}
228/// The image is currently always 3-channel YCbCr, with 4:2:0 chroma.
229/// But you may want to check the chroma format anyway for future compatibility.
230#[repr(C)]
231#[derive(Debug)]
232pub struct de265_image {
233    _unused: [u8; 0],
234}
235pub mod de265_chroma {
236    pub type Type = ::std::os::raw::c_uint;
237    pub const de265_chroma_mono: Type = 0;
238    pub const de265_chroma_420: Type = 1;
239    pub const de265_chroma_422: Type = 2;
240    pub const de265_chroma_444: Type = 3;
241}
242pub type de265_PTS = i64;
243unsafe extern "C" {
244    pub fn de265_get_image_width(
245        arg1: *const de265_image,
246        channel: ::std::os::raw::c_int,
247    ) -> ::std::os::raw::c_int;
248}
249unsafe extern "C" {
250    pub fn de265_get_image_height(
251        arg1: *const de265_image,
252        channel: ::std::os::raw::c_int,
253    ) -> ::std::os::raw::c_int;
254}
255unsafe extern "C" {
256    pub fn de265_get_chroma_format(arg1: *const de265_image) -> de265_chroma::Type;
257}
258unsafe extern "C" {
259    pub fn de265_get_bits_per_pixel(
260        arg1: *const de265_image,
261        channel: ::std::os::raw::c_int,
262    ) -> ::std::os::raw::c_int;
263}
264unsafe extern "C" {
265    /// The |out_stride| is returned as "bytes per line" if a non-NULL parameter is given.
266    pub fn de265_get_image_plane(
267        arg1: *const de265_image,
268        channel: ::std::os::raw::c_int,
269        out_stride: *mut ::std::os::raw::c_int,
270    ) -> *const u8;
271}
272unsafe extern "C" {
273    pub fn de265_get_image_plane_user_data(
274        arg1: *const de265_image,
275        channel: ::std::os::raw::c_int,
276    ) -> *mut ::std::os::raw::c_void;
277}
278unsafe extern "C" {
279    pub fn de265_get_image_PTS(arg1: *const de265_image) -> de265_PTS;
280}
281unsafe extern "C" {
282    pub fn de265_get_image_user_data(arg1: *const de265_image) -> *mut ::std::os::raw::c_void;
283}
284unsafe extern "C" {
285    pub fn de265_set_image_user_data(
286        arg1: *mut de265_image,
287        user_data: *mut ::std::os::raw::c_void,
288    );
289}
290unsafe extern "C" {
291    /// Get NAL-header information of this frame. You can pass in NULL pointers if you
292    /// do not need this piece of information.
293    pub fn de265_get_image_NAL_header(
294        arg1: *const de265_image,
295        nal_unit_type: *mut ::std::os::raw::c_int,
296        nal_unit_name: *mut *const ::std::os::raw::c_char,
297        nuh_layer_id: *mut ::std::os::raw::c_int,
298        nuh_temporal_id: *mut ::std::os::raw::c_int,
299    );
300}
301unsafe extern "C" {
302    pub fn de265_get_image_full_range_flag(arg1: *const de265_image) -> ::std::os::raw::c_int;
303}
304unsafe extern "C" {
305    pub fn de265_get_image_colour_primaries(arg1: *const de265_image) -> ::std::os::raw::c_int;
306}
307unsafe extern "C" {
308    pub fn de265_get_image_transfer_characteristics(
309        arg1: *const de265_image,
310    ) -> ::std::os::raw::c_int;
311}
312unsafe extern "C" {
313    pub fn de265_get_image_matrix_coefficients(arg1: *const de265_image) -> ::std::os::raw::c_int;
314}
315/// === decoder ===
316pub type de265_decoder_context = ::std::os::raw::c_void;
317unsafe extern "C" {
318    /// Get a new decoder context. Must be freed with de265_free_decoder().
319    pub fn de265_new_decoder() -> *mut de265_decoder_context;
320}
321unsafe extern "C" {
322    /// Initialize background decoding threads. If this function is not called,
323    /// all decoding is done in the main thread (no multi-threading).
324    pub fn de265_start_worker_threads(
325        arg1: *mut de265_decoder_context,
326        number_of_threads: ::std::os::raw::c_int,
327    ) -> de265_error::Type;
328}
329unsafe extern "C" {
330    /// Free decoder context. May only be called once on a context.
331    pub fn de265_free_decoder(arg1: *mut de265_decoder_context) -> de265_error::Type;
332}
333unsafe extern "C" {
334    /// Push more data into the decoder, must be raw h265.
335    /// All complete images in the data will be decoded, hence, do not push
336    /// too much data at once to prevent image buffer overflows.
337    /// The end of a picture can only be detected when the succeeding start-code
338    /// is read from the data.
339    /// If you want to flush the data and force decoding of the data so far
340    /// (e.g. at the end of a file), call de265_decode_data() with 'length' zero.
341    ///
342    /// NOTE: This method is deprecated and will be removed in a future version.
343    /// You should use "de265_push_data" or "de265_push_NAL" and "de265_decode"
344    /// instead.
345    pub fn de265_decode_data(
346        arg1: *mut de265_decoder_context,
347        data: *const ::std::os::raw::c_void,
348        length: ::std::os::raw::c_int,
349    ) -> de265_error::Type;
350}
351unsafe extern "C" {
352    /// Push more data into the decoder, must be a raw h265 bytestream with startcodes.
353    /// The PTS is assigned to all NALs whose start-code 0x000001 is contained in the data.
354    /// The bytestream must contain all stuffing-bytes.
355    /// This function only pushes data into the decoder, nothing will be decoded.
356    pub fn de265_push_data(
357        arg1: *mut de265_decoder_context,
358        data: *const ::std::os::raw::c_void,
359        length: ::std::os::raw::c_int,
360        pts: de265_PTS,
361        user_data: *mut ::std::os::raw::c_void,
362    ) -> de265_error::Type;
363}
364unsafe extern "C" {
365    /// Indicate that de265_push_data has just received data until the end of a NAL.
366    /// The remaining pending input data is put into a NAL package and forwarded to the decoder.
367    pub fn de265_push_end_of_NAL(arg1: *mut de265_decoder_context);
368}
369unsafe extern "C" {
370    /// Indicate that de265_push_data has just received data until the end of a frame.
371    /// All data pending at the decoder input will be pushed into the decoder and
372    /// the decoded picture is pushed to the output queue.
373    pub fn de265_push_end_of_frame(arg1: *mut de265_decoder_context);
374}
375unsafe extern "C" {
376    /// Push a complete NAL unit without startcode into the decoder. The data must still
377    /// contain all stuffing-bytes.
378    /// This function only pushes data into the decoder, nothing will be decoded.
379    pub fn de265_push_NAL(
380        arg1: *mut de265_decoder_context,
381        data: *const ::std::os::raw::c_void,
382        length: ::std::os::raw::c_int,
383        pts: de265_PTS,
384        user_data: *mut ::std::os::raw::c_void,
385    ) -> de265_error::Type;
386}
387unsafe extern "C" {
388    /// Indicate the end-of-stream. All data pending at the decoder input will be
389    /// pushed into the decoder and the decoded picture queue will be completely emptied.
390    pub fn de265_flush_data(arg1: *mut de265_decoder_context) -> de265_error::Type;
391}
392unsafe extern "C" {
393    /// Return number of bytes pending at the decoder input.
394    /// Can be used to avoid overflowing the decoder with too much data.
395    pub fn de265_get_number_of_input_bytes_pending(
396        arg1: *mut de265_decoder_context,
397    ) -> ::std::os::raw::c_int;
398}
399unsafe extern "C" {
400    /// Return number of NAL units pending at the decoder input.
401    /// Can be used to avoid overflowing the decoder with too much data.
402    pub fn de265_get_number_of_NAL_units_pending(
403        arg1: *mut de265_decoder_context,
404    ) -> ::std::os::raw::c_int;
405}
406unsafe extern "C" {
407    /// Do some decoding. Returns status whether it did perform some decoding or
408    /// why it could not do so. If 'more' is non-null, indicates whether de265_decode()
409    /// should be called again (possibly after resolving the indicated problem).
410    /// DE265_OK - decoding ok
411    /// DE265_ERROR_IMAGE_BUFFER_FULL - DPB full, extract some images before continuing
412    /// DE265_ERROR_WAITING_FOR_INPUT_DATA - insert more data before continuing
413    ///
414    /// You have to consider these cases:
415    /// - decoding successful   -> err  = DE265_OK, more=true
416    /// - decoding stalled      -> err != DE265_OK, more=true
417    /// - decoding finished     -> err  = DE265_OK, more=false
418    /// - unresolvable error    -> err != DE265_OK, more=false
419    pub fn de265_decode(
420        arg1: *mut de265_decoder_context,
421        more: *mut ::std::os::raw::c_int,
422    ) -> de265_error::Type;
423}
424unsafe extern "C" {
425    /// Clear decoder state. Call this when skipping in the stream.
426    pub fn de265_reset(arg1: *mut de265_decoder_context);
427}
428unsafe extern "C" {
429    /// Return next decoded picture, if there is any. If no complete picture has been
430    /// decoded yet, NULL is returned. You should call de265_release_next_picture() to
431    /// advance to the next picture.
432    pub fn de265_peek_next_picture(arg1: *mut de265_decoder_context) -> *const de265_image;
433}
434unsafe extern "C" {
435    /// Get next decoded picture and remove this picture from the decoder output queue.
436    /// Returns NULL is there is no decoded picture ready.
437    /// You can use the picture only until you call any other de265_* function.
438    pub fn de265_get_next_picture(arg1: *mut de265_decoder_context) -> *const de265_image;
439}
440unsafe extern "C" {
441    /// Release the current decoded picture for reuse in the decoder. You should not
442    /// use the data anymore after calling this function.
443    pub fn de265_release_next_picture(arg1: *mut de265_decoder_context);
444}
445unsafe extern "C" {
446    pub fn de265_get_warning(arg1: *mut de265_decoder_context) -> de265_error::Type;
447}
448pub mod de265_image_format {
449    pub type Type = ::std::os::raw::c_uint;
450    pub const de265_image_format_mono8: Type = 1;
451    pub const de265_image_format_YUV420P8: Type = 2;
452    pub const de265_image_format_YUV422P8: Type = 3;
453    pub const de265_image_format_YUV444P8: Type = 4;
454}
455#[repr(C)]
456#[derive(Debug, Copy, Clone)]
457pub struct de265_image_spec {
458    pub format: de265_image_format::Type,
459    pub width: ::std::os::raw::c_int,
460    pub height: ::std::os::raw::c_int,
461    pub alignment: ::std::os::raw::c_int,
462    /// conformance window
463    pub crop_left: ::std::os::raw::c_int,
464    pub crop_right: ::std::os::raw::c_int,
465    pub crop_top: ::std::os::raw::c_int,
466    pub crop_bottom: ::std::os::raw::c_int,
467    /// convenience, width  - crop_left - crop_right
468    pub visible_width: ::std::os::raw::c_int,
469    /// convenience, height - crop_top - crop_bottom
470    pub visible_height: ::std::os::raw::c_int,
471}
472#[repr(C)]
473#[derive(Debug, Copy, Clone)]
474pub struct de265_image_allocation {
475    /// first parameter deprecated
476    pub get_buffer: ::std::option::Option<
477        unsafe extern "C" fn(
478            ctx: *mut de265_decoder_context,
479            spec: *mut de265_image_spec,
480            img: *mut de265_image,
481            userdata: *mut ::std::os::raw::c_void,
482        ) -> ::std::os::raw::c_int,
483    >,
484    /// first parameter deprecated
485    pub release_buffer: ::std::option::Option<
486        unsafe extern "C" fn(
487            ctx: *mut de265_decoder_context,
488            img: *mut de265_image,
489            userdata: *mut ::std::os::raw::c_void,
490        ),
491    >,
492}
493unsafe extern "C" {
494    /// The user data pointer will be given to the get_buffer() and release_buffer() functions
495    /// in de265_image_allocation.
496    pub fn de265_set_image_allocation_functions(
497        arg1: *mut de265_decoder_context,
498        arg2: *mut de265_image_allocation,
499        userdata: *mut ::std::os::raw::c_void,
500    );
501}
502unsafe extern "C" {
503    pub fn de265_get_default_image_allocation_functions() -> *const de265_image_allocation;
504}
505unsafe extern "C" {
506    pub fn de265_set_image_plane(
507        img: *mut de265_image,
508        cIdx: ::std::os::raw::c_int,
509        mem: *mut ::std::os::raw::c_void,
510        stride: ::std::os::raw::c_int,
511        userdata: *mut ::std::os::raw::c_void,
512    );
513}
514unsafe extern "C" {
515    /// --- frame dropping API ---
516    ///
517    /// To limit decoding to a maximum temporal layer (TID), use de265_set_limit_TID().
518    /// The maximum layer ID in the stream can be queried with de265_get_highest_TID().
519    /// Note that the maximum layer ID can change throughout the stream.
520    ///
521    /// For a fine-grained selection of the frame-rate, use de265_set_framerate_ratio().
522    /// A percentage of 100% will decode all frames in all temporal layers. A lower percentage
523    /// will drop approximately as many frames. Note that this only accurate if the frames
524    /// are distributed evenly among the layers. Otherwise, the mapping is non-linear.
525    ///
526    /// The limit_TID has a higher precedence than framerate_ratio. Hence, setting a higher
527    /// framerate-ratio will decode at limit_TID without dropping.
528    ///
529    /// With change_framerate(), the output frame-rate can be increased/decreased to some
530    /// discrete preferable values. Currently, these are non-dropped decoding at various
531    /// TID layers.
532    pub fn de265_get_highest_TID(arg1: *mut de265_decoder_context) -> ::std::os::raw::c_int;
533}
534unsafe extern "C" {
535    pub fn de265_get_current_TID(arg1: *mut de265_decoder_context) -> ::std::os::raw::c_int;
536}
537unsafe extern "C" {
538    pub fn de265_set_limit_TID(arg1: *mut de265_decoder_context, max_tid: ::std::os::raw::c_int);
539}
540unsafe extern "C" {
541    pub fn de265_set_framerate_ratio(
542        arg1: *mut de265_decoder_context,
543        percent: ::std::os::raw::c_int,
544    );
545}
546unsafe extern "C" {
547    pub fn de265_change_framerate(
548        arg1: *mut de265_decoder_context,
549        more_vs_less: ::std::os::raw::c_int,
550    ) -> ::std::os::raw::c_int;
551}
552pub mod de265_param {
553    /// --- decoding parameters ---
554    pub type Type = ::std::os::raw::c_uint;
555    /// (bool) Perform SEI hash check on decoded pictures.
556    pub const DE265_DECODER_PARAM_BOOL_SEI_CHECK_HASH: Type = 0;
557    /// (int)  Dump headers to specified file-descriptor.
558    pub const DE265_DECODER_PARAM_DUMP_SPS_HEADERS: Type = 1;
559    pub const DE265_DECODER_PARAM_DUMP_VPS_HEADERS: Type = 2;
560    pub const DE265_DECODER_PARAM_DUMP_PPS_HEADERS: Type = 3;
561    pub const DE265_DECODER_PARAM_DUMP_SLICE_HEADERS: Type = 4;
562    /// (int)  enum de265_acceleration, default: AUTO
563    pub const DE265_DECODER_PARAM_ACCELERATION_CODE: Type = 5;
564    /// (bool)  do not output frames with decoding errors, default: no (output all images)
565    pub const DE265_DECODER_PARAM_SUPPRESS_FAULTY_PICTURES: Type = 6;
566    /// (bool)  disable deblocking
567    pub const DE265_DECODER_PARAM_DISABLE_DEBLOCKING: Type = 7;
568    /// (bool)  disable SAO filter
569    pub const DE265_DECODER_PARAM_DISABLE_SAO: Type = 8;
570}
571pub mod de265_acceleration {
572    /// sorted such that a large ID includes all optimizations from lower IDs
573    pub type Type = ::std::os::raw::c_uint;
574    /// only fallback implementation
575    pub const de265_acceleration_SCALAR: Type = 0;
576    pub const de265_acceleration_MMX: Type = 10;
577    pub const de265_acceleration_SSE: Type = 20;
578    pub const de265_acceleration_SSE2: Type = 30;
579    pub const de265_acceleration_SSE4: Type = 40;
580    /// not implemented yet
581    pub const de265_acceleration_AVX: Type = 50;
582    /// not implemented yet
583    pub const de265_acceleration_AVX2: Type = 60;
584    pub const de265_acceleration_ARM: Type = 70;
585    pub const de265_acceleration_NEON: Type = 80;
586    pub const de265_acceleration_AUTO: Type = 10000;
587}
588unsafe extern "C" {
589    /// Set decoding parameters.
590    pub fn de265_set_parameter_bool(
591        arg1: *mut de265_decoder_context,
592        param: de265_param::Type,
593        value: ::std::os::raw::c_int,
594    );
595}
596unsafe extern "C" {
597    pub fn de265_set_parameter_int(
598        arg1: *mut de265_decoder_context,
599        param: de265_param::Type,
600        value: ::std::os::raw::c_int,
601    );
602}
603unsafe extern "C" {
604    /// Get decoding parameters.
605    pub fn de265_get_parameter_bool(
606        arg1: *mut de265_decoder_context,
607        param: de265_param::Type,
608    ) -> ::std::os::raw::c_int;
609}
610unsafe extern "C" {
611    /// Static library initialization. Must be paired with de265_free().
612    /// Initialization is optional, since it will be done implicitly in de265_new_decoder().
613    /// Return value is false if initialization failed.
614    /// Only call de265_free() when initialization was successful.
615    /// Multiple calls to 'init' are allowed, but must be matched with an equal number of 'free' calls.
616    pub fn de265_init() -> de265_error::Type;
617}
618unsafe extern "C" {
619    /// Free global library data.
620    /// An implicit free call is made in de265_free_decoder().
621    /// Returns false if library was not initialized before, or if 'free' was called
622    /// more often than 'init'.
623    pub fn de265_free() -> de265_error::Type;
624}
625/// ========== encoder context ==========
626#[repr(C)]
627#[derive(Debug, Copy, Clone)]
628pub struct en265_encoder_context {
629    _unused: [u8; 0],
630}
631unsafe extern "C" {
632    /// Get a new encoder context. Must be freed with en265_free_encoder().
633    pub fn en265_new_encoder() -> *mut en265_encoder_context;
634}
635unsafe extern "C" {
636    /// Free encoder context. May only be called once on a context.
637    pub fn en265_free_encoder(arg1: *mut en265_encoder_context) -> de265_error::Type;
638}
639unsafe extern "C" {
640    /// ========== encoder parameters ==========
641    pub fn en265_set_parameter_bool(
642        arg1: *mut en265_encoder_context,
643        parametername: *const ::std::os::raw::c_char,
644        value: ::std::os::raw::c_int,
645    ) -> de265_error::Type;
646}
647unsafe extern "C" {
648    pub fn en265_set_parameter_int(
649        arg1: *mut en265_encoder_context,
650        parametername: *const ::std::os::raw::c_char,
651        value: ::std::os::raw::c_int,
652    ) -> de265_error::Type;
653}
654unsafe extern "C" {
655    pub fn en265_set_parameter_string(
656        arg1: *mut en265_encoder_context,
657        parametername: *const ::std::os::raw::c_char,
658        value: *const ::std::os::raw::c_char,
659    ) -> de265_error::Type;
660}
661unsafe extern "C" {
662    pub fn en265_set_parameter_choice(
663        arg1: *mut en265_encoder_context,
664        parametername: *const ::std::os::raw::c_char,
665        value: *const ::std::os::raw::c_char,
666    ) -> de265_error::Type;
667}
668unsafe extern "C" {
669    pub fn en265_list_parameters(
670        arg1: *mut en265_encoder_context,
671    ) -> *mut *const ::std::os::raw::c_char;
672}
673pub mod en265_parameter_type {
674    pub type Type = ::std::os::raw::c_uint;
675    pub const en265_parameter_bool: Type = 0;
676    pub const en265_parameter_int: Type = 1;
677    pub const en265_parameter_string: Type = 2;
678    pub const en265_parameter_choice: Type = 3;
679}
680unsafe extern "C" {
681    pub fn en265_get_parameter_type(
682        arg1: *mut en265_encoder_context,
683        parametername: *const ::std::os::raw::c_char,
684    ) -> en265_parameter_type::Type;
685}
686unsafe extern "C" {
687    pub fn en265_list_parameter_choices(
688        arg1: *mut en265_encoder_context,
689        parametername: *const ::std::os::raw::c_char,
690    ) -> *mut *const ::std::os::raw::c_char;
691}
692unsafe extern "C" {
693    /// --- convenience functions for command-line parameters ---
694    pub fn en265_parse_command_line_parameters(
695        arg1: *mut en265_encoder_context,
696        argc: *mut ::std::os::raw::c_int,
697        argv: *mut *mut ::std::os::raw::c_char,
698    ) -> de265_error::Type;
699}
700unsafe extern "C" {
701    pub fn en265_show_parameters(arg1: *mut en265_encoder_context);
702}
703unsafe extern "C" {
704    /// ========== encoding loop ==========
705    pub fn en265_start_encoder(
706        arg1: *mut en265_encoder_context,
707        number_of_threads: ::std::os::raw::c_int,
708    ) -> de265_error::Type;
709}
710unsafe extern "C" {
711    /// If we have provided our own memory release function, no image memory will be allocated.
712    pub fn en265_allocate_image(
713        arg1: *mut en265_encoder_context,
714        width: ::std::os::raw::c_int,
715        height: ::std::os::raw::c_int,
716        chroma: de265_chroma::Type,
717        pts: de265_PTS,
718        image_userdata: *mut ::std::os::raw::c_void,
719    ) -> *mut de265_image;
720}
721unsafe extern "C" {
722    pub fn de265_alloc_image_plane(
723        img: *mut de265_image,
724        cIdx: ::std::os::raw::c_int,
725        inputdata: *mut ::std::os::raw::c_void,
726        inputstride: ::std::os::raw::c_int,
727        userdata: *mut ::std::os::raw::c_void,
728    ) -> *mut ::std::os::raw::c_void;
729}
730unsafe extern "C" {
731    pub fn de265_free_image_plane(img: *mut de265_image, cIdx: ::std::os::raw::c_int);
732}
733unsafe extern "C" {
734    /// Request a specification of the image memory layout for an image of the specified dimensions.
735    pub fn en265_get_image_spec(
736        arg1: *mut en265_encoder_context,
737        width: ::std::os::raw::c_int,
738        height: ::std::os::raw::c_int,
739        chroma: de265_chroma::Type,
740        out_spec: *mut de265_image_spec,
741    );
742}
743unsafe extern "C" {
744    /// Image memory layout specification for an image returned by en265_allocate_image().
745    /// * TODO: do we need this?
746    /// LIBDE265_API void de265_get_image_spec_from_image(de265_image* img, struct de265_image_spec* spec);
747    /// */
748    pub fn en265_push_image(
749        arg1: *mut en265_encoder_context,
750        arg2: *mut de265_image,
751    ) -> de265_error::Type;
752}
753unsafe extern "C" {
754    pub fn en265_push_eof(arg1: *mut en265_encoder_context) -> de265_error::Type;
755}
756unsafe extern "C" {
757    /// block when there are more than max_input_images in the input queue
758    pub fn en265_block_on_input_queue_length(
759        arg1: *mut en265_encoder_context,
760        max_pending_images: ::std::os::raw::c_int,
761        timeout_ms: ::std::os::raw::c_int,
762    ) -> de265_error::Type;
763}
764unsafe extern "C" {
765    pub fn en265_trim_input_queue(
766        arg1: *mut en265_encoder_context,
767        max_pending_images: ::std::os::raw::c_int,
768    ) -> de265_error::Type;
769}
770unsafe extern "C" {
771    pub fn en265_current_input_queue_length(
772        arg1: *mut en265_encoder_context,
773    ) -> ::std::os::raw::c_int;
774}
775unsafe extern "C" {
776    /// Run encoder in main thread. Only use this when not using background threads.
777    pub fn en265_encode(arg1: *mut en265_encoder_context) -> de265_error::Type;
778}
779pub mod en265_encoder_state {
780    pub type Type = ::std::os::raw::c_uint;
781    pub const EN265_STATE_IDLE: Type = 0;
782    pub const EN265_STATE_WAITING_FOR_INPUT: Type = 1;
783    pub const EN265_STATE_WORKING: Type = 2;
784    pub const EN265_STATE_OUTPUT_QUEUE_FULL: Type = 3;
785    pub const EN265_STATE_EOS: Type = 4;
786}
787unsafe extern "C" {
788    pub fn en265_get_encoder_state(arg1: *mut en265_encoder_context) -> en265_encoder_state::Type;
789}
790pub mod en265_packet_content_type {
791    pub type Type = ::std::os::raw::c_uint;
792    pub const EN265_PACKET_VPS: Type = 0;
793    pub const EN265_PACKET_SPS: Type = 1;
794    pub const EN265_PACKET_PPS: Type = 2;
795    pub const EN265_PACKET_SEI: Type = 3;
796    pub const EN265_PACKET_SLICE: Type = 4;
797    pub const EN265_PACKET_SKIPPED_IMAGE: Type = 5;
798}
799pub mod en265_nal_unit_type {
800    pub type Type = ::std::os::raw::c_uint;
801    pub const EN265_NUT_TRAIL_N: Type = 0;
802    pub const EN265_NUT_TRAIL_R: Type = 1;
803    pub const EN265_NUT_TSA_N: Type = 2;
804    pub const EN265_NUT_TSA_R: Type = 3;
805    pub const EN265_NUT_STSA_N: Type = 4;
806    pub const EN265_NUT_STSA_R: Type = 5;
807    pub const EN265_NUT_RADL_N: Type = 6;
808    pub const EN265_NUT_RADL_R: Type = 7;
809    pub const EN265_NUT_RASL_N: Type = 8;
810    pub const EN265_NUT_RASL_R: Type = 9;
811    pub const EN265_NUT_BLA_W_LP: Type = 16;
812    pub const EN265_NUT_BLA_W_RADL: Type = 17;
813    pub const EN265_NUT_BLA_N_LP: Type = 18;
814    pub const EN265_NUT_IDR_W_RADL: Type = 19;
815    pub const EN265_NUT_IDR_N_LP: Type = 20;
816    pub const EN265_NUT_CRA: Type = 21;
817    pub const EN265_NUT_VPS: Type = 32;
818    pub const EN265_NUT_SPS: Type = 33;
819    pub const EN265_NUT_PPS: Type = 34;
820    pub const EN265_NUT_AUD: Type = 35;
821    pub const EN265_NUT_EOS: Type = 36;
822    pub const EN265_NUT_EOB: Type = 37;
823    pub const EN265_NUT_FD: Type = 38;
824    pub const EN265_NUT_PREFIX_SEI: Type = 39;
825    pub const EN265_NUT_SUFFIX_SEI: Type = 40;
826}
827#[repr(C)]
828#[derive(Debug)]
829pub struct en265_packet {
830    pub version: ::std::os::raw::c_int,
831    pub data: *const u8,
832    pub length: ::std::os::raw::c_int,
833    pub frame_number: ::std::os::raw::c_int,
834    pub content_type: en265_packet_content_type::Type,
835    pub _bitfield_align_1: [u8; 0],
836    pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize]>,
837    pub nal_unit_type: en265_nal_unit_type::Type,
838    pub nuh_layer_id: ::std::os::raw::c_uchar,
839    pub nuh_temporal_id: ::std::os::raw::c_uchar,
840    pub encoder_context: *mut en265_encoder_context,
841    pub input_image: *const de265_image,
842    pub reconstruction: *const de265_image,
843}
844impl en265_packet {
845    #[inline]
846    pub fn complete_picture(&self) -> ::std::os::raw::c_char {
847        unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u8) }
848    }
849    #[inline]
850    pub fn set_complete_picture(&mut self, val: ::std::os::raw::c_char) {
851        unsafe {
852            let val: u8 = ::std::mem::transmute(val);
853            self._bitfield_1.set(0usize, 1u8, val as u64)
854        }
855    }
856    #[inline]
857    pub unsafe fn complete_picture_raw(this: *const Self) -> ::std::os::raw::c_char {
858        unsafe {
859            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
860                ::std::ptr::addr_of!((*this)._bitfield_1),
861                0usize,
862                1u8,
863            ) as u8)
864        }
865    }
866    #[inline]
867    pub unsafe fn set_complete_picture_raw(this: *mut Self, val: ::std::os::raw::c_char) {
868        unsafe {
869            let val: u8 = ::std::mem::transmute(val);
870            <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
871                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
872                0usize,
873                1u8,
874                val as u64,
875            )
876        }
877    }
878    #[inline]
879    pub fn final_slice(&self) -> ::std::os::raw::c_char {
880        unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u8) }
881    }
882    #[inline]
883    pub fn set_final_slice(&mut self, val: ::std::os::raw::c_char) {
884        unsafe {
885            let val: u8 = ::std::mem::transmute(val);
886            self._bitfield_1.set(1usize, 1u8, val as u64)
887        }
888    }
889    #[inline]
890    pub unsafe fn final_slice_raw(this: *const Self) -> ::std::os::raw::c_char {
891        unsafe {
892            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
893                ::std::ptr::addr_of!((*this)._bitfield_1),
894                1usize,
895                1u8,
896            ) as u8)
897        }
898    }
899    #[inline]
900    pub unsafe fn set_final_slice_raw(this: *mut Self, val: ::std::os::raw::c_char) {
901        unsafe {
902            let val: u8 = ::std::mem::transmute(val);
903            <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
904                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
905                1usize,
906                1u8,
907                val as u64,
908            )
909        }
910    }
911    #[inline]
912    pub fn dependent_slice(&self) -> ::std::os::raw::c_char {
913        unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u8) }
914    }
915    #[inline]
916    pub fn set_dependent_slice(&mut self, val: ::std::os::raw::c_char) {
917        unsafe {
918            let val: u8 = ::std::mem::transmute(val);
919            self._bitfield_1.set(2usize, 1u8, val as u64)
920        }
921    }
922    #[inline]
923    pub unsafe fn dependent_slice_raw(this: *const Self) -> ::std::os::raw::c_char {
924        unsafe {
925            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 1usize]>>::raw_get(
926                ::std::ptr::addr_of!((*this)._bitfield_1),
927                2usize,
928                1u8,
929            ) as u8)
930        }
931    }
932    #[inline]
933    pub unsafe fn set_dependent_slice_raw(this: *mut Self, val: ::std::os::raw::c_char) {
934        unsafe {
935            let val: u8 = ::std::mem::transmute(val);
936            <__BindgenBitfieldUnit<[u8; 1usize]>>::raw_set(
937                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
938                2usize,
939                1u8,
940                val as u64,
941            )
942        }
943    }
944    #[inline]
945    pub fn new_bitfield_1(
946        complete_picture: ::std::os::raw::c_char,
947        final_slice: ::std::os::raw::c_char,
948        dependent_slice: ::std::os::raw::c_char,
949    ) -> __BindgenBitfieldUnit<[u8; 1usize]> {
950        let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize]> = Default::default();
951        __bindgen_bitfield_unit.set(0usize, 1u8, {
952            let complete_picture: u8 = unsafe { ::std::mem::transmute(complete_picture) };
953            complete_picture as u64
954        });
955        __bindgen_bitfield_unit.set(1usize, 1u8, {
956            let final_slice: u8 = unsafe { ::std::mem::transmute(final_slice) };
957            final_slice as u64
958        });
959        __bindgen_bitfield_unit.set(2usize, 1u8, {
960            let dependent_slice: u8 = unsafe { ::std::mem::transmute(dependent_slice) };
961            dependent_slice as u64
962        });
963        __bindgen_bitfield_unit
964    }
965}
966unsafe extern "C" {
967    /// timeout_ms - timeout in milliseconds. 0 - no timeout, -1 - block forever
968    pub fn en265_get_packet(
969        arg1: *mut en265_encoder_context,
970        timeout_ms: ::std::os::raw::c_int,
971    ) -> *mut en265_packet;
972}
973unsafe extern "C" {
974    pub fn en265_free_packet(arg1: *mut en265_encoder_context, arg2: *mut en265_packet);
975}
976unsafe extern "C" {
977    pub fn en265_number_of_queued_packets(
978        arg1: *mut en265_encoder_context,
979    ) -> ::std::os::raw::c_int;
980}