libburn_sys/
lib.rs

1//! Low-level Rust bindings for libburn.
2//!
3//! You can find out more about the libburnia project, of which libburn is a part, by visiting
4//! <https://dev.lovelyhq.com/libburnia/web/wiki>
5//!
6//! This version of libburn-sys is based on libburn 1.5.6
7//!
8//! ## Requirements
9//!
10//! Currently, libburn-sys does not support statically linking libburn into your application, and may never do.
11//! Instead, **you must have libburn 1.5.6 or greater installed** on your system so libburn-sys can dynamically
12//! link to it.
13//!
14//! Bindings for libburn are pregenerated for libburn-sys, so you shouldn't need bindgen's dependencies
15//! installed to start using libburn-sys.
16
17#![allow(non_camel_case_types)]
18#![allow(clippy::useless_transmute)]
19
20/* automatically generated by rust-bindgen 0.72.1 */
21
22#[repr(C)]
23#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
24pub struct __BindgenBitfieldUnit<Storage> {
25    storage: Storage,
26}
27impl<Storage> __BindgenBitfieldUnit<Storage> {
28    #[inline]
29    pub const fn new(storage: Storage) -> Self {
30        Self { storage }
31    }
32}
33impl<Storage> __BindgenBitfieldUnit<Storage>
34where
35    Storage: AsRef<[u8]> + AsMut<[u8]>,
36{
37    #[inline]
38    fn extract_bit(byte: u8, index: usize) -> bool {
39        let bit_index = if cfg!(target_endian = "big") {
40            7 - (index % 8)
41        } else {
42            index % 8
43        };
44        let mask = 1 << bit_index;
45        byte & mask == mask
46    }
47    #[inline]
48    pub fn get_bit(&self, index: usize) -> bool {
49        debug_assert!(index / 8 < self.storage.as_ref().len());
50        let byte_index = index / 8;
51        let byte = self.storage.as_ref()[byte_index];
52        Self::extract_bit(byte, index)
53    }
54    #[inline]
55    pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
56        debug_assert!(index / 8 < core::mem::size_of::<Storage>());
57        let byte_index = index / 8;
58        let byte = unsafe {
59            *(core::ptr::addr_of!((*this).storage) as *const u8).add(byte_index)
60        };
61        Self::extract_bit(byte, index)
62    }
63    #[inline]
64    fn change_bit(byte: u8, index: usize, val: bool) -> u8 {
65        let bit_index = if cfg!(target_endian = "big") {
66            7 - (index % 8)
67        } else {
68            index % 8
69        };
70        let mask = 1 << bit_index;
71        if val { byte | mask } else { byte & !mask }
72    }
73    #[inline]
74    pub fn set_bit(&mut self, index: usize, val: bool) {
75        debug_assert!(index / 8 < self.storage.as_ref().len());
76        let byte_index = index / 8;
77        let byte = &mut self.storage.as_mut()[byte_index];
78        *byte = Self::change_bit(*byte, index, val);
79    }
80    #[inline]
81    pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
82        debug_assert!(index / 8 < core::mem::size_of::<Storage>());
83        let byte_index = index / 8;
84        let byte = unsafe {
85            (core::ptr::addr_of_mut!((*this).storage) as *mut u8).add(byte_index)
86        };
87        unsafe { *byte = Self::change_bit(*byte, index, val) };
88    }
89    #[inline]
90    pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
91        debug_assert!(bit_width <= 64);
92        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
93        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
94        let mut val = 0;
95        for i in 0..(bit_width as usize) {
96            if self.get_bit(i + bit_offset) {
97                let index = if cfg!(target_endian = "big") {
98                    bit_width as usize - 1 - i
99                } else {
100                    i
101                };
102                val |= 1 << index;
103            }
104        }
105        val
106    }
107    #[inline]
108    pub unsafe fn raw_get(this: *const Self, bit_offset: usize, bit_width: u8) -> u64 {
109        debug_assert!(bit_width <= 64);
110        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
111        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
112        let mut val = 0;
113        for i in 0..(bit_width as usize) {
114            if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
115                let index = if cfg!(target_endian = "big") {
116                    bit_width as usize - 1 - i
117                } else {
118                    i
119                };
120                val |= 1 << index;
121            }
122        }
123        val
124    }
125    #[inline]
126    pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
127        debug_assert!(bit_width <= 64);
128        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
129        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
130        for i in 0..(bit_width as usize) {
131            let mask = 1 << i;
132            let val_bit_is_set = val & mask == mask;
133            let index = if cfg!(target_endian = "big") {
134                bit_width as usize - 1 - i
135            } else {
136                i
137            };
138            self.set_bit(index + bit_offset, val_bit_is_set);
139        }
140    }
141    #[inline]
142    pub unsafe fn raw_set(this: *mut Self, bit_offset: usize, bit_width: u8, val: u64) {
143        debug_assert!(bit_width <= 64);
144        debug_assert!(bit_offset / 8 < core::mem::size_of::<Storage>());
145        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
146        for i in 0..(bit_width as usize) {
147            let mask = 1 << i;
148            let val_bit_is_set = val & mask == mask;
149            let index = if cfg!(target_endian = "big") {
150                bit_width as usize - 1 - i
151            } else {
152                i
153            };
154            unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
155        }
156    }
157}
158pub const BURN_CDROM: u32 = 0;
159pub const BURN_CDI: u32 = 16;
160pub const BURN_CDXA: u32 = 32;
161pub const BURN_POS_END: u32 = 100;
162pub const BURN_MODE_BITS: u32 = 127;
163pub const BURN_MODE0: u32 = 1;
164pub const BURN_MODE_RAW: u32 = 2;
165pub const BURN_MODE1: u32 = 4;
166pub const BURN_MODE2: u32 = 8;
167pub const BURN_FORM1: u32 = 16;
168pub const BURN_FORM2: u32 = 32;
169pub const BURN_AUDIO: u32 = 64;
170pub const BURN_4CH: u32 = 128;
171pub const BURN_COPY: u32 = 256;
172pub const BURN_PREEMPHASIS: u32 = 512;
173pub const BURN_SUBCODE_P16: u32 = 1024;
174pub const BURN_SUBCODE_P96: u32 = 2048;
175pub const BURN_SUBCODE_R96: u32 = 4096;
176pub const BURN_SCMS: u32 = 8192;
177pub const BURN_DRIVE_WHITELIST_LEN: u32 = 255;
178pub const BURN_DRIVE_ADR_LEN: u32 = 1024;
179pub const BURN_FORMAT_IS_UNFORMATTED: u32 = 1;
180pub const BURN_FORMAT_IS_FORMATTED: u32 = 2;
181pub const BURN_FORMAT_IS_UNKNOWN: u32 = 3;
182pub const BURN_REASONS_LEN: u32 = 4096;
183pub const BURN_CDTEXT_NUM_GENRES: u32 = 28;
184pub const BURN_HEADER_VERSION_MAJOR: u32 = 1;
185pub const BURN_HEADER_VERSION_MINOR: u32 = 5;
186pub const BURN_HEADER_VERSION_MICRO: u32 = 6;
187pub const BURN_MSGS_MESSAGE_LEN: u32 = 4096;
188pub const LIBDAX_AUDIOXTR_STRLEN: u32 = 4096;
189
190/// References a physical drive in the system
191#[repr(C)]
192#[derive(Debug, Copy, Clone)]
193pub struct burn_drive {
194    _unused: [u8; 0],
195}
196/// References a whole disc
197#[repr(C)]
198#[derive(Debug, Copy, Clone)]
199pub struct burn_disc {
200    _unused: [u8; 0],
201}
202/// References a single session on a disc
203#[repr(C)]
204#[derive(Debug, Copy, Clone)]
205pub struct burn_session {
206    _unused: [u8; 0],
207}
208/// References a single track on a disc
209#[repr(C)]
210#[derive(Debug, Copy, Clone)]
211pub struct burn_track {
212    _unused: [u8; 0],
213}
214/// References a set of write parameters
215#[repr(C)]
216#[derive(Debug, Copy, Clone)]
217pub struct burn_write_opts {
218    _unused: [u8; 0],
219}
220/// Packet writing.
221/// currently unsupported, (for DVD Incremental Streaming use TAO)
222pub const BURN_WRITE_TYPES_BURN_WRITE_PACKET: burn_write_types = 0;
223/// With CD:                     Track At Once recording
224/// 2s gaps between tracks, no fonky lead-ins
225///
226/// With sequential DVD-R[W]:    Incremental Streaming
227/// With DVD+R and BD-R:         Track of open size
228/// With DVD-RAM, DVD+RW, BD-RE: Random Writeable (used sequentially)
229/// With overwritable DVD-RW:    Rigid Restricted Overwrite
230pub const BURN_WRITE_TYPES_BURN_WRITE_TAO: burn_write_types = 1;
231/// With CD:                     Session At Once
232/// Block type MUST be BURN_BLOCK_SAO
233/// ts A70122: Currently not capable of mixing data and audio tracks.
234///
235/// With sequential DVD-R[W]:    Disc-at-once, DAO
236/// Single session, single track, fixed size mandatory, (-dvd-compat)
237/// With other DVD or BD media:  same as BURN_WRITE_TAO but may demand
238/// that track size is known in advance.
239pub const BURN_WRITE_TYPES_BURN_WRITE_SAO: burn_write_types = 2;
240/// With CD: Raw disc at once recording.
241/// all subcodes must be provided by lib or user
242/// only raw block types are supported
243/// With DVD and BD media: not supported.
244///
245/// ts A90901: This had been disabled because its implementation
246/// relied on code from cdrdao which is not understood
247/// currently.
248/// A burn run will abort with \"FATAL\" error message
249/// if this mode is attempted.
250///
251/// @since 0.7.2
252/// ts A91016: Re-implemented according to ECMA-130 Annex A and B.
253/// Now understood, explained and not stemming from cdrdao.
254///
255/// @since 0.7.4
256pub const BURN_WRITE_TYPES_BURN_WRITE_RAW: burn_write_types = 3;
257/// In replies this indicates that not any writing will work.
258/// As parameter for inquiries it indicates that no particular write
259/// mode shall is specified.
260/// Do not use for setting a write mode for burning. It will not work.
261pub const BURN_WRITE_TYPES_BURN_WRITE_NONE: burn_write_types = 4;
262/// Possible disc writing style/modes
263pub type burn_write_types = ::std::os::raw::c_uint;
264/// sync, headers, edc/ecc provided by lib/user
265pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW0: burn_block_types = 1;
266/// sync, headers, edc/ecc and p/q subs provided by lib/user
267pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW16: burn_block_types = 2;
268/// sync, headers, edc/ecc and packed p-w subs provided by lib/user
269pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW96P: burn_block_types = 4;
270/// sync, headers, edc/ecc and raw p-w subs provided by lib/user
271pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW96R: burn_block_types = 8;
272/// only 2048 bytes of user data provided by lib/user
273pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE1: burn_block_types = 256;
274/// 2336 bytes of user data provided by lib/user
275pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2R: burn_block_types = 512;
276/// 2048 bytes of user data provided by lib/user
277/// subheader provided in write parameters
278/// are we ever going to support this shit?  I vote no.
279/// (supposed to be supported on all drives...)
280pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_PATHETIC: burn_block_types = 1024;
281/// 2048 bytes of data + 8 byte subheader provided by lib/user
282/// hey, this is also dumb
283pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_LAME: burn_block_types = 2048;
284/// 2324 bytes of data provided by lib/user
285/// subheader provided in write parameters
286/// no sir, I don't like it.
287pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_OBSCURE: burn_block_types = 4096;
288/// 2332 bytes of data supplied by lib/user
289/// 8 bytes sub header provided in write parameters
290/// this is the second least suck mode2, and is mandatory for
291/// all drives to support.
292pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_OK: burn_block_types = 8192;
293/// SAO block sizes are based on cue sheet, so use this.
294pub const BURN_BLOCK_TYPES_BURN_BLOCK_SAO: burn_block_types = 16384;
295/// Data format to send to the drive
296pub type burn_block_types = ::std::os::raw::c_uint;
297/// The current status is not yet known
298pub const BURN_DISC_STATUS_BURN_DISC_UNREADY: burn_disc_status = 0;
299/// The drive holds a blank disc. It is ready for writing from scratch.
300/// Unused multi-session media:
301/// CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
302/// Blanked multi-session media (i.e. treated by burn_disc_erase())
303/// CD-RW, DVD-RW
304/// Overwritable media with or without valid data
305/// DVD-RAM, DVD+RW, formatted DVD-RW, BD-RE
306pub const BURN_DISC_STATUS_BURN_DISC_BLANK: burn_disc_status = 1;
307/// There is no disc at all in the drive
308pub const BURN_DISC_STATUS_BURN_DISC_EMPTY: burn_disc_status = 2;
309/// There is an incomplete disc in the drive. It is ready for appending
310/// another session.
311/// Written but not yet closed multi-session media
312/// CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
313pub const BURN_DISC_STATUS_BURN_DISC_APPENDABLE: burn_disc_status = 3;
314/// There is a disc with data on it in the drive. It is usable only for
315/// reading.
316/// Written and closed multi-session media
317/// CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
318/// Read-Only media
319/// CD-ROM, DVD-ROM, BD-ROM
320/// Note that many DVD-ROM drives report any written media
321/// as Read-Only media and not by their real media types.
322pub const BURN_DISC_STATUS_BURN_DISC_FULL: burn_disc_status = 4;
323/// The drive was not grabbed when the status was inquired
324pub const BURN_DISC_STATUS_BURN_DISC_UNGRABBED: burn_disc_status = 5;
325/// The media seems to be unsuitable for reading and for writing
326pub const BURN_DISC_STATUS_BURN_DISC_UNSUITABLE: burn_disc_status = 6;
327/// Possible status of the drive in regard to the disc in it.
328pub type burn_disc_status = ::std::os::raw::c_uint;
329/// The source is ok
330pub const BURN_SOURCE_STATUS_BURN_SOURCE_OK: burn_source_status = 0;
331/// The source is at end of file
332pub const BURN_SOURCE_STATUS_BURN_SOURCE_EOF: burn_source_status = 1;
333/// The source is unusable
334pub const BURN_SOURCE_STATUS_BURN_SOURCE_FAILED: burn_source_status = 2;
335/// Possible data source return values
336pub type burn_source_status = ::std::os::raw::c_uint;
337/// The drive is not in an operation
338pub const BURN_DRIVE_STATUS_BURN_DRIVE_IDLE: burn_drive_status = 0;
339/// The library is spawning the processes to handle a pending
340/// operation (A read/write/etc is about to start but hasn't quite
341/// yet)
342pub const BURN_DRIVE_STATUS_BURN_DRIVE_SPAWNING: burn_drive_status = 1;
343/// The drive is reading data from a disc
344pub const BURN_DRIVE_STATUS_BURN_DRIVE_READING: burn_drive_status = 2;
345/// The drive is writing data to a disc
346pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING: burn_drive_status = 3;
347/// The drive is writing Lead-In
348pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_LEADIN: burn_drive_status = 4;
349/// The drive is writing Lead-Out
350pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_LEADOUT: burn_drive_status = 5;
351/// The drive is erasing a disc
352pub const BURN_DRIVE_STATUS_BURN_DRIVE_ERASING: burn_drive_status = 6;
353/// The drive is being grabbed
354pub const BURN_DRIVE_STATUS_BURN_DRIVE_GRABBING: burn_drive_status = 7;
355/// The drive gets written zeroes before the track payload data
356pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_PREGAP: burn_drive_status = 8;
357/// The drive is told to close a track (TAO only)
358pub const BURN_DRIVE_STATUS_BURN_DRIVE_CLOSING_TRACK: burn_drive_status = 9;
359/// The drive is told to close a session (TAO only)
360pub const BURN_DRIVE_STATUS_BURN_DRIVE_CLOSING_SESSION: burn_drive_status = 10;
361/// The drive is formatting media
362pub const BURN_DRIVE_STATUS_BURN_DRIVE_FORMATTING: burn_drive_status = 11;
363/// The drive is busy in synchronous read (if you see this then it
364/// has been interrupted)
365pub const BURN_DRIVE_STATUS_BURN_DRIVE_READING_SYNC: burn_drive_status = 12;
366/// The drive is busy in synchronous write (if you see this then it
367/// has been interrupted)
368pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_SYNC: burn_drive_status = 13;
369/// Possible busy states for a drive
370pub type burn_drive_status = ::std::os::raw::c_uint;
371/// Information about a track on a disc - this is from the q sub channel of the
372/// lead-in area of a disc.  The documentation here is very terse.
373/// See a document such as mmc3 for proper information.
374///
375/// CAUTION : This structure is prone to future extension !
376///
377/// Do not restrict your application to unsigned char with any counter like
378/// \"session\", \"point\", \"pmin\", ...
379/// Do not rely on the current size of a burn_toc_entry.
380#[repr(C)]
381#[derive(Debug, Copy, Clone)]
382pub struct burn_toc_entry {
383    /// Session the track is in
384    pub session: ::std::os::raw::c_uchar,
385    /// Type of data.  for this struct to be valid, it must be 1
386    pub adr: ::std::os::raw::c_uchar,
387    /// Type of data in the track
388    pub control: ::std::os::raw::c_uchar,
389    /// Zero.  Always.  Really.
390    pub tno: ::std::os::raw::c_uchar,
391    /// Track number or special information
392    pub point: ::std::os::raw::c_uchar,
393    pub min: ::std::os::raw::c_uchar,
394    pub sec: ::std::os::raw::c_uchar,
395    pub frame: ::std::os::raw::c_uchar,
396    pub zero: ::std::os::raw::c_uchar,
397    /// Track start time minutes for normal tracks
398    pub pmin: ::std::os::raw::c_uchar,
399    /// Track start time seconds for normal tracks
400    pub psec: ::std::os::raw::c_uchar,
401    /// Track start time frames for normal tracks
402    pub pframe: ::std::os::raw::c_uchar,
403    pub extensions_valid: ::std::os::raw::c_uchar,
404    pub session_msb: ::std::os::raw::c_uchar,
405    pub point_msb: ::std::os::raw::c_uchar,
406    pub start_lba: ::std::os::raw::c_int,
407    pub track_blocks: ::std::os::raw::c_int,
408    pub last_recorded_address: ::std::os::raw::c_int,
409    pub track_status_bits: ::std::os::raw::c_int,
410}
411#[allow(clippy::unnecessary_operation, clippy::identity_op)]
412const _: () = {
413    ["Size of burn_toc_entry"][::std::mem::size_of::<burn_toc_entry>() - 32usize];
414    ["Alignment of burn_toc_entry"][::std::mem::align_of::<burn_toc_entry>() - 4usize];
415    ["Offset of field: burn_toc_entry::session"]
416        [::std::mem::offset_of!(burn_toc_entry, session) - 0usize];
417    ["Offset of field: burn_toc_entry::adr"][::std::mem::offset_of!(burn_toc_entry, adr) - 1usize];
418    ["Offset of field: burn_toc_entry::control"]
419        [::std::mem::offset_of!(burn_toc_entry, control) - 2usize];
420    ["Offset of field: burn_toc_entry::tno"][::std::mem::offset_of!(burn_toc_entry, tno) - 3usize];
421    ["Offset of field: burn_toc_entry::point"]
422        [::std::mem::offset_of!(burn_toc_entry, point) - 4usize];
423    ["Offset of field: burn_toc_entry::min"][::std::mem::offset_of!(burn_toc_entry, min) - 5usize];
424    ["Offset of field: burn_toc_entry::sec"][::std::mem::offset_of!(burn_toc_entry, sec) - 6usize];
425    ["Offset of field: burn_toc_entry::frame"]
426        [::std::mem::offset_of!(burn_toc_entry, frame) - 7usize];
427    ["Offset of field: burn_toc_entry::zero"]
428        [::std::mem::offset_of!(burn_toc_entry, zero) - 8usize];
429    ["Offset of field: burn_toc_entry::pmin"]
430        [::std::mem::offset_of!(burn_toc_entry, pmin) - 9usize];
431    ["Offset of field: burn_toc_entry::psec"]
432        [::std::mem::offset_of!(burn_toc_entry, psec) - 10usize];
433    ["Offset of field: burn_toc_entry::pframe"]
434        [::std::mem::offset_of!(burn_toc_entry, pframe) - 11usize];
435    ["Offset of field: burn_toc_entry::extensions_valid"]
436        [::std::mem::offset_of!(burn_toc_entry, extensions_valid) - 12usize];
437    ["Offset of field: burn_toc_entry::session_msb"]
438        [::std::mem::offset_of!(burn_toc_entry, session_msb) - 13usize];
439    ["Offset of field: burn_toc_entry::point_msb"]
440        [::std::mem::offset_of!(burn_toc_entry, point_msb) - 14usize];
441    ["Offset of field: burn_toc_entry::start_lba"]
442        [::std::mem::offset_of!(burn_toc_entry, start_lba) - 16usize];
443    ["Offset of field: burn_toc_entry::track_blocks"]
444        [::std::mem::offset_of!(burn_toc_entry, track_blocks) - 20usize];
445    ["Offset of field: burn_toc_entry::last_recorded_address"]
446        [::std::mem::offset_of!(burn_toc_entry, last_recorded_address) - 24usize];
447    ["Offset of field: burn_toc_entry::track_status_bits"]
448        [::std::mem::offset_of!(burn_toc_entry, track_status_bits) - 28usize];
449};
450/// Data source interface for tracks.
451/// This allows you to use arbitrary program code as provider of track input
452/// data.
453///
454/// Objects compliant to this interface are either provided by the application
455/// or by API calls of libburn: burn_fd_source_new() , burn_file_source_new(),
456/// and burn_fifo_source_new().
457///
458/// The API calls may use any file object as data source. Consider to feed
459/// an eventual custom data stream asynchronously into a pipe(2) and to let
460/// libburn handle the rest.
461/// In this case the following rule applies:
462/// Call burn_source_free() exactly once for every source obtained from
463/// libburn API. You MUST NOT otherwise use or manipulate its components.
464///
465/// In general, burn_source objects can be freed as soon as they are attached
466/// to track objects. The track objects will keep them alive and dispose them
467/// when they are no longer needed. With a fifo burn_source it makes sense to
468/// keep the own reference for inquiring its state while burning is in
469/// progress.
470///
471/// ---
472///
473/// The following description of burn_source applies only to application
474/// implemented burn_source objects. You need not to know it for API provided
475/// ones.
476///
477/// If you really implement an own passive data producer by this interface,
478/// then beware: it can do anything and it can spoil everything.
479///
480/// In this case the functions (*read), (*get_size), (*set_size), (*free_data)
481/// MUST be implemented by the application and attached to the object at
482/// creation time.
483/// Function (*read_sub) is allowed to be NULL or it MUST be implemented and
484/// attached.
485///
486/// burn_source.refcount MUST be handled properly: If not exactly as many
487/// references are freed as have been obtained, then either memory leaks or
488/// corrupted memory are the consequence.
489/// All objects which are referred to by *data must be kept existent until
490/// (*free_data) is called via burn_source_free() by the last referer.
491#[repr(C)]
492#[derive(Debug, Copy, Clone)]
493pub struct burn_source {
494    /// Reference count for the data source. MUST be 1 when a new source
495    /// is created and thus the first reference is handed out. Increment
496    /// it to take more references for yourself. Use burn_source_free()
497    /// to destroy your references to it.
498    pub refcount: ::std::os::raw::c_int,
499    /// Read data from the source. Semantics like with read(2), but MUST
500    /// either deliver the full buffer as defined by size or MUST deliver
501    /// EOF (return 0) or failure (return -1) at this call or at the
502    /// next following call. I.e. the only incomplete buffer may be the
503    /// last one from that source.
504    /// libburn will read a single sector by each call to (*read).
505    /// The size of a sector depends on BURN_MODE_*. The known range is
506    /// 2048 to 2352.
507    ///
508    /// If this call is reading from a pipe then it will learn
509    /// about the end of data only when that pipe gets closed on the
510    /// feeder side. So if the track size is not fixed or if the pipe
511    /// delivers less than the predicted amount or if the size is not
512    /// block aligned, then burning will halt until the input process
513    /// closes the pipe.
514    ///
515    /// IMPORTANT:
516    /// If this function pointer is NULL, then the struct burn_source is of
517    /// version >= 1 and the job of .(*read)() is done by .(*read_xt)().
518    /// See below, member .version.
519    pub read: ::std::option::Option<
520        unsafe extern "C" fn(
521            arg1: *mut burn_source,
522            buffer: *mut ::std::os::raw::c_uchar,
523            size: ::std::os::raw::c_int,
524        ) -> ::std::os::raw::c_int,
525    >,
526    /// Read subchannel data from the source (NULL if lib generated)
527    /// WARNING: This is an obscure feature with CD raw write modes.
528    /// Unless you checked the libburn code for correctness in that aspect
529    /// you should not rely on raw writing with own subchannels.
530    /// ADVICE: Set this pointer to NULL.
531    pub read_sub: ::std::option::Option<
532        unsafe extern "C" fn(
533            arg1: *mut burn_source,
534            buffer: *mut ::std::os::raw::c_uchar,
535            size: ::std::os::raw::c_int,
536        ) -> ::std::os::raw::c_int,
537    >,
538    /// Get the size of the source's data. Return 0 means unpredictable
539    /// size. If application provided (*get_size) might return 0, then
540    /// the application MUST provide a fully functional (*set_size).
541    pub get_size: ::std::option::Option<unsafe extern "C" fn(arg1: *mut burn_source) -> libc::off_t>,
542    /// Program the reply of (*get_size) to a fixed value. It is advised
543    /// to implement this by a attribute  off_t fixed_size;  in *data .
544    /// The read() function does not have to take into respect this fake
545    /// setting. It is rather a note of libburn to itself. Eventually
546    /// necessary truncation or padding is done in libburn. Truncation
547    /// is usually considered a misburn. Padding is considered ok.
548    ///
549    /// libburn is supposed to work even if (*get_size) ignores the
550    /// setting by (*set_size). But your application will not be able to
551    /// enforce fixed track sizes by  burn_track_set_size() and possibly
552    /// even padding might be left out.
553    pub set_size: ::std::option::Option<
554        unsafe extern "C" fn(source: *mut burn_source, size: libc::off_t) -> ::std::os::raw::c_int,
555    >,
556    /// Clean up the source specific data. This function will be called
557    /// once by burn_source_free() when the last referer disposes the
558    /// source.
559    pub free_data: ::std::option::Option<unsafe extern "C" fn(arg1: *mut burn_source)>,
560    /// Next source, for when a source runs dry and padding is disabled
561    /// WARNING: This is an obscure feature. Set to NULL at creation and
562    /// from then on leave untouched and uninterpreted.
563    pub next: *mut burn_source,
564    /// Source specific data. Here the various source classes express their
565    /// specific properties and the instance objects store their individual
566    /// management data.
567    /// E.g. data could point to a struct like this:
568    /// struct app_burn_source
569    /// {
570    /// struct my_app *app_handle;
571    /// ... other individual source parameters ...
572    /// off_t fixed_size;
573    /// };
574    ///
575    /// Function (*free_data) has to be prepared to clean up and free
576    /// the struct.
577    pub data: *mut ::std::os::raw::c_void,
578    /// Valid only if above member .(*read)() is NULL. This indicates a
579    /// version of struct burn_source younger than 0.
580    /// From then on, member .version tells which further members exist
581    /// in the memory layout of struct burn_source. libburn will only touch
582    /// those announced extensions.
583    ///
584    /// Versions:
585    /// 0  has .(*read)() != NULL, not even .version is present.
586    /// 1  has .version, .(*read_xt)(), .(*cancel)()
587    pub version: ::std::os::raw::c_int,
588    /// This substitutes for (*read)() in versions above 0.
589    pub read_xt: ::std::option::Option<
590        unsafe extern "C" fn(
591            arg1: *mut burn_source,
592            buffer: *mut ::std::os::raw::c_uchar,
593            size: ::std::os::raw::c_int,
594        ) -> ::std::os::raw::c_int,
595    >,
596    /// Informs the burn_source that the consumer of data prematurely
597    /// ended reading. This call may or may not be issued by libburn
598    /// before (*free_data)() is called.
599    pub cancel: ::std::option::Option<
600        unsafe extern "C" fn(source: *mut burn_source) -> ::std::os::raw::c_int,
601    >,
602}
603#[allow(clippy::unnecessary_operation, clippy::identity_op)]
604const _: () = {
605    ["Size of burn_source"][::std::mem::size_of::<burn_source>() - 88usize];
606    ["Alignment of burn_source"][::std::mem::align_of::<burn_source>() - 8usize];
607    ["Offset of field: burn_source::refcount"]
608        [::std::mem::offset_of!(burn_source, refcount) - 0usize];
609    ["Offset of field: burn_source::read"][::std::mem::offset_of!(burn_source, read) - 8usize];
610    ["Offset of field: burn_source::read_sub"]
611        [::std::mem::offset_of!(burn_source, read_sub) - 16usize];
612    ["Offset of field: burn_source::get_size"]
613        [::std::mem::offset_of!(burn_source, get_size) - 24usize];
614    ["Offset of field: burn_source::set_size"]
615        [::std::mem::offset_of!(burn_source, set_size) - 32usize];
616    ["Offset of field: burn_source::free_data"]
617        [::std::mem::offset_of!(burn_source, free_data) - 40usize];
618    ["Offset of field: burn_source::next"][::std::mem::offset_of!(burn_source, next) - 48usize];
619    ["Offset of field: burn_source::data"][::std::mem::offset_of!(burn_source, data) - 56usize];
620    ["Offset of field: burn_source::version"]
621        [::std::mem::offset_of!(burn_source, version) - 64usize];
622    ["Offset of field: burn_source::read_xt"]
623        [::std::mem::offset_of!(burn_source, read_xt) - 72usize];
624    ["Offset of field: burn_source::cancel"][::std::mem::offset_of!(burn_source, cancel) - 80usize];
625};
626/// Information on a drive in the system
627#[repr(C)]
628#[derive(Debug, Copy, Clone)]
629pub struct burn_drive_info {
630    /// Name of the vendor of the drive
631    pub vendor: [::std::os::raw::c_char; 9usize],
632    /// Name of the drive
633    pub product: [::std::os::raw::c_char; 17usize],
634    /// Revision of the drive
635    pub revision: [::std::os::raw::c_char; 5usize],
636    /// Invalid: Was: \"Location of the drive in the filesystem.\" */
637    /// /** This string has no meaning any more. Once it stored the drive
638    /// device file address. Now always use function burn_drive_d_get_adr()
639    /// to inquire a device file address.            ^^^^^ ALWAYS ^^^^^^^
640    pub location: [::std::os::raw::c_char; 17usize],
641    pub _bitfield_align_1: [u8; 0],
642    pub _bitfield_1: __BindgenBitfieldUnit<[u8; 2usize]>,
643    /// DEPRECATED: The size of the drive's buffer (in kilobytes)
644    pub buffer_size: ::std::os::raw::c_int,
645    /// The supported block types in tao mode.
646    /// They should be tested with the desired block type.
647    /// See also burn_block_types.
648    pub tao_block_types: ::std::os::raw::c_int,
649    /// The supported block types in sao mode.
650    /// They should be tested with the desired block type.
651    /// See also burn_block_types.
652    pub sao_block_types: ::std::os::raw::c_int,
653    /// The supported block types in raw mode.
654    /// They should be tested with the desired block type.
655    /// See also burn_block_types.
656    pub raw_block_types: ::std::os::raw::c_int,
657    /// The supported block types in packet mode.
658    /// They should be tested with the desired block type.
659    /// See also burn_block_types.
660    pub packet_block_types: ::std::os::raw::c_int,
661    /// The value by which this drive can be indexed when using functions
662    /// in the library. This is the value to pass to all libbburn functions
663    /// that operate on a drive.
664    pub drive: *mut burn_drive,
665}
666#[allow(clippy::unnecessary_operation, clippy::identity_op)]
667const _: () = {
668    ["Size of burn_drive_info"][::std::mem::size_of::<burn_drive_info>() - 80usize];
669    ["Alignment of burn_drive_info"][::std::mem::align_of::<burn_drive_info>() - 8usize];
670    ["Offset of field: burn_drive_info::vendor"]
671        [::std::mem::offset_of!(burn_drive_info, vendor) - 0usize];
672    ["Offset of field: burn_drive_info::product"]
673        [::std::mem::offset_of!(burn_drive_info, product) - 9usize];
674    ["Offset of field: burn_drive_info::revision"]
675        [::std::mem::offset_of!(burn_drive_info, revision) - 26usize];
676    ["Offset of field: burn_drive_info::location"]
677        [::std::mem::offset_of!(burn_drive_info, location) - 31usize];
678    ["Offset of field: burn_drive_info::buffer_size"]
679        [::std::mem::offset_of!(burn_drive_info, buffer_size) - 52usize];
680    ["Offset of field: burn_drive_info::tao_block_types"]
681        [::std::mem::offset_of!(burn_drive_info, tao_block_types) - 56usize];
682    ["Offset of field: burn_drive_info::sao_block_types"]
683        [::std::mem::offset_of!(burn_drive_info, sao_block_types) - 60usize];
684    ["Offset of field: burn_drive_info::raw_block_types"]
685        [::std::mem::offset_of!(burn_drive_info, raw_block_types) - 64usize];
686    ["Offset of field: burn_drive_info::packet_block_types"]
687        [::std::mem::offset_of!(burn_drive_info, packet_block_types) - 68usize];
688    ["Offset of field: burn_drive_info::drive"]
689        [::std::mem::offset_of!(burn_drive_info, drive) - 72usize];
690};
691impl burn_drive_info {
692    #[inline]
693    pub fn read_dvdram(&self) -> ::std::os::raw::c_uint {
694        unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) }
695    }
696    #[inline]
697    pub fn set_read_dvdram(&mut self, val: ::std::os::raw::c_uint) {
698        unsafe {
699            let val: u32 = ::std::mem::transmute(val);
700            self._bitfield_1.set(0usize, 1u8, val as u64)
701        }
702    }
703    #[inline]
704    pub unsafe fn read_dvdram_raw(this: *const Self) -> ::std::os::raw::c_uint {
705        unsafe {
706            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
707                ::std::ptr::addr_of!((*this)._bitfield_1),
708                0usize,
709                1u8,
710            ) as u32)
711        }
712    }
713    #[inline]
714    pub unsafe fn set_read_dvdram_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
715        unsafe {
716            let val: u32 = ::std::mem::transmute(val);
717            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
718                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
719                0usize,
720                1u8,
721                val as u64,
722            )
723        }
724    }
725    #[inline]
726    pub fn read_dvdr(&self) -> ::std::os::raw::c_uint {
727        unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) }
728    }
729    #[inline]
730    pub fn set_read_dvdr(&mut self, val: ::std::os::raw::c_uint) {
731        unsafe {
732            let val: u32 = ::std::mem::transmute(val);
733            self._bitfield_1.set(1usize, 1u8, val as u64)
734        }
735    }
736    #[inline]
737    pub unsafe fn read_dvdr_raw(this: *const Self) -> ::std::os::raw::c_uint {
738        unsafe {
739            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
740                ::std::ptr::addr_of!((*this)._bitfield_1),
741                1usize,
742                1u8,
743            ) as u32)
744        }
745    }
746    #[inline]
747    pub unsafe fn set_read_dvdr_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
748        unsafe {
749            let val: u32 = ::std::mem::transmute(val);
750            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
751                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
752                1usize,
753                1u8,
754                val as u64,
755            )
756        }
757    }
758    #[inline]
759    pub fn read_dvdrom(&self) -> ::std::os::raw::c_uint {
760        unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) }
761    }
762    #[inline]
763    pub fn set_read_dvdrom(&mut self, val: ::std::os::raw::c_uint) {
764        unsafe {
765            let val: u32 = ::std::mem::transmute(val);
766            self._bitfield_1.set(2usize, 1u8, val as u64)
767        }
768    }
769    #[inline]
770    pub unsafe fn read_dvdrom_raw(this: *const Self) -> ::std::os::raw::c_uint {
771        unsafe {
772            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
773                ::std::ptr::addr_of!((*this)._bitfield_1),
774                2usize,
775                1u8,
776            ) as u32)
777        }
778    }
779    #[inline]
780    pub unsafe fn set_read_dvdrom_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
781        unsafe {
782            let val: u32 = ::std::mem::transmute(val);
783            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
784                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
785                2usize,
786                1u8,
787                val as u64,
788            )
789        }
790    }
791    #[inline]
792    pub fn read_cdr(&self) -> ::std::os::raw::c_uint {
793        unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) }
794    }
795    #[inline]
796    pub fn set_read_cdr(&mut self, val: ::std::os::raw::c_uint) {
797        unsafe {
798            let val: u32 = ::std::mem::transmute(val);
799            self._bitfield_1.set(3usize, 1u8, val as u64)
800        }
801    }
802    #[inline]
803    pub unsafe fn read_cdr_raw(this: *const Self) -> ::std::os::raw::c_uint {
804        unsafe {
805            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
806                ::std::ptr::addr_of!((*this)._bitfield_1),
807                3usize,
808                1u8,
809            ) as u32)
810        }
811    }
812    #[inline]
813    pub unsafe fn set_read_cdr_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
814        unsafe {
815            let val: u32 = ::std::mem::transmute(val);
816            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
817                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
818                3usize,
819                1u8,
820                val as u64,
821            )
822        }
823    }
824    #[inline]
825    pub fn read_cdrw(&self) -> ::std::os::raw::c_uint {
826        unsafe { ::std::mem::transmute(self._bitfield_1.get(4usize, 1u8) as u32) }
827    }
828    #[inline]
829    pub fn set_read_cdrw(&mut self, val: ::std::os::raw::c_uint) {
830        unsafe {
831            let val: u32 = ::std::mem::transmute(val);
832            self._bitfield_1.set(4usize, 1u8, val as u64)
833        }
834    }
835    #[inline]
836    pub unsafe fn read_cdrw_raw(this: *const Self) -> ::std::os::raw::c_uint {
837        unsafe {
838            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
839                ::std::ptr::addr_of!((*this)._bitfield_1),
840                4usize,
841                1u8,
842            ) as u32)
843        }
844    }
845    #[inline]
846    pub unsafe fn set_read_cdrw_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
847        unsafe {
848            let val: u32 = ::std::mem::transmute(val);
849            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
850                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
851                4usize,
852                1u8,
853                val as u64,
854            )
855        }
856    }
857    #[inline]
858    pub fn write_dvdram(&self) -> ::std::os::raw::c_uint {
859        unsafe { ::std::mem::transmute(self._bitfield_1.get(5usize, 1u8) as u32) }
860    }
861    #[inline]
862    pub fn set_write_dvdram(&mut self, val: ::std::os::raw::c_uint) {
863        unsafe {
864            let val: u32 = ::std::mem::transmute(val);
865            self._bitfield_1.set(5usize, 1u8, val as u64)
866        }
867    }
868    #[inline]
869    pub unsafe fn write_dvdram_raw(this: *const Self) -> ::std::os::raw::c_uint {
870        unsafe {
871            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
872                ::std::ptr::addr_of!((*this)._bitfield_1),
873                5usize,
874                1u8,
875            ) as u32)
876        }
877    }
878    #[inline]
879    pub unsafe fn set_write_dvdram_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
880        unsafe {
881            let val: u32 = ::std::mem::transmute(val);
882            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
883                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
884                5usize,
885                1u8,
886                val as u64,
887            )
888        }
889    }
890    #[inline]
891    pub fn write_dvdr(&self) -> ::std::os::raw::c_uint {
892        unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 1u8) as u32) }
893    }
894    #[inline]
895    pub fn set_write_dvdr(&mut self, val: ::std::os::raw::c_uint) {
896        unsafe {
897            let val: u32 = ::std::mem::transmute(val);
898            self._bitfield_1.set(6usize, 1u8, val as u64)
899        }
900    }
901    #[inline]
902    pub unsafe fn write_dvdr_raw(this: *const Self) -> ::std::os::raw::c_uint {
903        unsafe {
904            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
905                ::std::ptr::addr_of!((*this)._bitfield_1),
906                6usize,
907                1u8,
908            ) as u32)
909        }
910    }
911    #[inline]
912    pub unsafe fn set_write_dvdr_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
913        unsafe {
914            let val: u32 = ::std::mem::transmute(val);
915            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
916                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
917                6usize,
918                1u8,
919                val as u64,
920            )
921        }
922    }
923    #[inline]
924    pub fn write_cdr(&self) -> ::std::os::raw::c_uint {
925        unsafe { ::std::mem::transmute(self._bitfield_1.get(7usize, 1u8) as u32) }
926    }
927    #[inline]
928    pub fn set_write_cdr(&mut self, val: ::std::os::raw::c_uint) {
929        unsafe {
930            let val: u32 = ::std::mem::transmute(val);
931            self._bitfield_1.set(7usize, 1u8, val as u64)
932        }
933    }
934    #[inline]
935    pub unsafe fn write_cdr_raw(this: *const Self) -> ::std::os::raw::c_uint {
936        unsafe {
937            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
938                ::std::ptr::addr_of!((*this)._bitfield_1),
939                7usize,
940                1u8,
941            ) as u32)
942        }
943    }
944    #[inline]
945    pub unsafe fn set_write_cdr_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
946        unsafe {
947            let val: u32 = ::std::mem::transmute(val);
948            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
949                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
950                7usize,
951                1u8,
952                val as u64,
953            )
954        }
955    }
956    #[inline]
957    pub fn write_cdrw(&self) -> ::std::os::raw::c_uint {
958        unsafe { ::std::mem::transmute(self._bitfield_1.get(8usize, 1u8) as u32) }
959    }
960    #[inline]
961    pub fn set_write_cdrw(&mut self, val: ::std::os::raw::c_uint) {
962        unsafe {
963            let val: u32 = ::std::mem::transmute(val);
964            self._bitfield_1.set(8usize, 1u8, val as u64)
965        }
966    }
967    #[inline]
968    pub unsafe fn write_cdrw_raw(this: *const Self) -> ::std::os::raw::c_uint {
969        unsafe {
970            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
971                ::std::ptr::addr_of!((*this)._bitfield_1),
972                8usize,
973                1u8,
974            ) as u32)
975        }
976    }
977    #[inline]
978    pub unsafe fn set_write_cdrw_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
979        unsafe {
980            let val: u32 = ::std::mem::transmute(val);
981            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
982                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
983                8usize,
984                1u8,
985                val as u64,
986            )
987        }
988    }
989    #[inline]
990    pub fn write_simulate(&self) -> ::std::os::raw::c_uint {
991        unsafe { ::std::mem::transmute(self._bitfield_1.get(9usize, 1u8) as u32) }
992    }
993    #[inline]
994    pub fn set_write_simulate(&mut self, val: ::std::os::raw::c_uint) {
995        unsafe {
996            let val: u32 = ::std::mem::transmute(val);
997            self._bitfield_1.set(9usize, 1u8, val as u64)
998        }
999    }
1000    #[inline]
1001    pub unsafe fn write_simulate_raw(this: *const Self) -> ::std::os::raw::c_uint {
1002        unsafe {
1003            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
1004                ::std::ptr::addr_of!((*this)._bitfield_1),
1005                9usize,
1006                1u8,
1007            ) as u32)
1008        }
1009    }
1010    #[inline]
1011    pub unsafe fn set_write_simulate_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
1012        unsafe {
1013            let val: u32 = ::std::mem::transmute(val);
1014            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
1015                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1016                9usize,
1017                1u8,
1018                val as u64,
1019            )
1020        }
1021    }
1022    #[inline]
1023    pub fn c2_errors(&self) -> ::std::os::raw::c_uint {
1024        unsafe { ::std::mem::transmute(self._bitfield_1.get(10usize, 1u8) as u32) }
1025    }
1026    #[inline]
1027    pub fn set_c2_errors(&mut self, val: ::std::os::raw::c_uint) {
1028        unsafe {
1029            let val: u32 = ::std::mem::transmute(val);
1030            self._bitfield_1.set(10usize, 1u8, val as u64)
1031        }
1032    }
1033    #[inline]
1034    pub unsafe fn c2_errors_raw(this: *const Self) -> ::std::os::raw::c_uint {
1035        unsafe {
1036            ::std::mem::transmute(<__BindgenBitfieldUnit<[u8; 2usize]>>::raw_get(
1037                ::std::ptr::addr_of!((*this)._bitfield_1),
1038                10usize,
1039                1u8,
1040            ) as u32)
1041        }
1042    }
1043    #[inline]
1044    pub unsafe fn set_c2_errors_raw(this: *mut Self, val: ::std::os::raw::c_uint) {
1045        unsafe {
1046            let val: u32 = ::std::mem::transmute(val);
1047            <__BindgenBitfieldUnit<[u8; 2usize]>>::raw_set(
1048                ::std::ptr::addr_of_mut!((*this)._bitfield_1),
1049                10usize,
1050                1u8,
1051                val as u64,
1052            )
1053        }
1054    }
1055    #[expect(clippy::too_many_arguments)]
1056    #[inline]
1057    pub fn new_bitfield_1(
1058        read_dvdram: ::std::os::raw::c_uint,
1059        read_dvdr: ::std::os::raw::c_uint,
1060        read_dvdrom: ::std::os::raw::c_uint,
1061        read_cdr: ::std::os::raw::c_uint,
1062        read_cdrw: ::std::os::raw::c_uint,
1063        write_dvdram: ::std::os::raw::c_uint,
1064        write_dvdr: ::std::os::raw::c_uint,
1065        write_cdr: ::std::os::raw::c_uint,
1066        write_cdrw: ::std::os::raw::c_uint,
1067        write_simulate: ::std::os::raw::c_uint,
1068        c2_errors: ::std::os::raw::c_uint,
1069    ) -> __BindgenBitfieldUnit<[u8; 2usize]> {
1070        let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 2usize]> = Default::default();
1071        __bindgen_bitfield_unit.set(0usize, 1u8, {
1072            let read_dvdram: u32 = unsafe { ::std::mem::transmute(read_dvdram) };
1073            read_dvdram as u64
1074        });
1075        __bindgen_bitfield_unit.set(1usize, 1u8, {
1076            let read_dvdr: u32 = unsafe { ::std::mem::transmute(read_dvdr) };
1077            read_dvdr as u64
1078        });
1079        __bindgen_bitfield_unit.set(2usize, 1u8, {
1080            let read_dvdrom: u32 = unsafe { ::std::mem::transmute(read_dvdrom) };
1081            read_dvdrom as u64
1082        });
1083        __bindgen_bitfield_unit.set(3usize, 1u8, {
1084            let read_cdr: u32 = unsafe { ::std::mem::transmute(read_cdr) };
1085            read_cdr as u64
1086        });
1087        __bindgen_bitfield_unit.set(4usize, 1u8, {
1088            let read_cdrw: u32 = unsafe { ::std::mem::transmute(read_cdrw) };
1089            read_cdrw as u64
1090        });
1091        __bindgen_bitfield_unit.set(5usize, 1u8, {
1092            let write_dvdram: u32 = unsafe { ::std::mem::transmute(write_dvdram) };
1093            write_dvdram as u64
1094        });
1095        __bindgen_bitfield_unit.set(6usize, 1u8, {
1096            let write_dvdr: u32 = unsafe { ::std::mem::transmute(write_dvdr) };
1097            write_dvdr as u64
1098        });
1099        __bindgen_bitfield_unit.set(7usize, 1u8, {
1100            let write_cdr: u32 = unsafe { ::std::mem::transmute(write_cdr) };
1101            write_cdr as u64
1102        });
1103        __bindgen_bitfield_unit.set(8usize, 1u8, {
1104            let write_cdrw: u32 = unsafe { ::std::mem::transmute(write_cdrw) };
1105            write_cdrw as u64
1106        });
1107        __bindgen_bitfield_unit.set(9usize, 1u8, {
1108            let write_simulate: u32 = unsafe { ::std::mem::transmute(write_simulate) };
1109            write_simulate as u64
1110        });
1111        __bindgen_bitfield_unit.set(10usize, 1u8, {
1112            let c2_errors: u32 = unsafe { ::std::mem::transmute(c2_errors) };
1113            c2_errors as u64
1114        });
1115        __bindgen_bitfield_unit
1116    }
1117}
1118/// Operation progress report. All values are 0 based indices.
1119#[repr(C)]
1120#[derive(Debug, Copy, Clone)]
1121pub struct burn_progress {
1122    /// The total number of sessions
1123    pub sessions: ::std::os::raw::c_int,
1124    /// Current session.
1125    pub session: ::std::os::raw::c_int,
1126    /// The total number of tracks
1127    pub tracks: ::std::os::raw::c_int,
1128    /// Current track.
1129    pub track: ::std::os::raw::c_int,
1130    /// The total number of indices
1131    pub indices: ::std::os::raw::c_int,
1132    /// Current index.
1133    pub index: ::std::os::raw::c_int,
1134    /// The starting logical block address
1135    pub start_sector: ::std::os::raw::c_int,
1136    /// On write: The number of sectors.
1137    /// On blank: 0x10000 as upper limit for relative progress steps
1138    pub sectors: ::std::os::raw::c_int,
1139    /// On write: The current sector being processed.
1140    /// On blank: Relative progress steps 0 to 0x10000
1141    pub sector: ::std::os::raw::c_int,
1142    /// The capacity of the drive buffer
1143    pub buffer_capacity: ::std::os::raw::c_uint,
1144    /// The free space in the drive buffer (might be slightly outdated)
1145    pub buffer_available: ::std::os::raw::c_uint,
1146    /// The number of bytes sent to the drive buffer
1147    pub buffered_bytes: libc::off_t,
1148    /// The minimum number of bytes stored in buffer during write.
1149    /// (Caution: Before surely one buffer size of bytes was processed,
1150    /// this value is 0xffffffff.)
1151    pub buffer_min_fill: ::std::os::raw::c_uint,
1152}
1153#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1154const _: () = {
1155    ["Size of burn_progress"][::std::mem::size_of::<burn_progress>() - 64usize];
1156    ["Alignment of burn_progress"][::std::mem::align_of::<burn_progress>() - 8usize];
1157    ["Offset of field: burn_progress::sessions"]
1158        [::std::mem::offset_of!(burn_progress, sessions) - 0usize];
1159    ["Offset of field: burn_progress::session"]
1160        [::std::mem::offset_of!(burn_progress, session) - 4usize];
1161    ["Offset of field: burn_progress::tracks"]
1162        [::std::mem::offset_of!(burn_progress, tracks) - 8usize];
1163    ["Offset of field: burn_progress::track"]
1164        [::std::mem::offset_of!(burn_progress, track) - 12usize];
1165    ["Offset of field: burn_progress::indices"]
1166        [::std::mem::offset_of!(burn_progress, indices) - 16usize];
1167    ["Offset of field: burn_progress::index"]
1168        [::std::mem::offset_of!(burn_progress, index) - 20usize];
1169    ["Offset of field: burn_progress::start_sector"]
1170        [::std::mem::offset_of!(burn_progress, start_sector) - 24usize];
1171    ["Offset of field: burn_progress::sectors"]
1172        [::std::mem::offset_of!(burn_progress, sectors) - 28usize];
1173    ["Offset of field: burn_progress::sector"]
1174        [::std::mem::offset_of!(burn_progress, sector) - 32usize];
1175    ["Offset of field: burn_progress::buffer_capacity"]
1176        [::std::mem::offset_of!(burn_progress, buffer_capacity) - 36usize];
1177    ["Offset of field: burn_progress::buffer_available"]
1178        [::std::mem::offset_of!(burn_progress, buffer_available) - 40usize];
1179    ["Offset of field: burn_progress::buffered_bytes"]
1180        [::std::mem::offset_of!(burn_progress, buffered_bytes) - 48usize];
1181    ["Offset of field: burn_progress::buffer_min_fill"]
1182        [::std::mem::offset_of!(burn_progress, buffer_min_fill) - 56usize];
1183};
1184/// Description of a speed capability as reported by the drive in conjunction
1185/// with eventually loaded media. There can be more than one such object per
1186/// drive. So they are chained via .next and .prev , where NULL marks the end
1187/// of the chain. This list is set up by burn_drive_scan() and gets updated
1188/// by burn_drive_grab().
1189/// A copy may be obtained by burn_drive_get_speedlist() and disposed by
1190/// burn_drive_free_speedlist().
1191/// For technical background info see SCSI specs MMC and SPC:
1192/// mode page 2Ah (from SPC 5Ah MODE SENSE) , mmc3r10g.pdf , 6.3.11 Table 364
1193/// ACh GET PERFORMANCE, Type 03h , mmc5r03c.pdf , 6.8.5.3 Table 312
1194#[repr(C)]
1195#[derive(Debug, Copy, Clone)]
1196pub struct burn_speed_descriptor {
1197    /// Where this info comes from :
1198    /// 0 = misc
1199    /// 1 = mode page 2Ah
1200    /// 2 = ACh GET PERFORMANCE Type 03h
1201    /// 3 = ACh GET PERFORMANCE Type 00h Data Type 10h (read speed)
1202    pub source: ::std::os::raw::c_int,
1203    /// The media type that was current at the time of report
1204    /// -2 = state unknown, -1 = no media was loaded , else see
1205    /// burn_disc_get_profile()
1206    pub profile_loaded: ::std::os::raw::c_int,
1207    pub profile_name: [::std::os::raw::c_char; 80usize],
1208    /// The attributed capacity of appropriate media in logical block units
1209    /// i.e. 2352 raw bytes or 2048 data bytes. -1 = capacity unknown.
1210    pub end_lba: ::std::os::raw::c_int,
1211    /// Speed is given in 1000 bytes/s , 0 = invalid. The numbers
1212    /// are supposed to be usable with burn_drive_set_speed()
1213    pub write_speed: ::std::os::raw::c_int,
1214    pub read_speed: ::std::os::raw::c_int,
1215    /// Expert info from ACh GET PERFORMANCE and/or mode page 2Ah.
1216    /// Expect values other than 0 or 1 to get a meaning in future.
1217    pub wrc: ::std::os::raw::c_int,
1218    pub exact: ::std::os::raw::c_int,
1219    pub mrw: ::std::os::raw::c_int,
1220    /// List chaining. Use .next until NULL to iterate over the list
1221    pub prev: *mut burn_speed_descriptor,
1222    pub next: *mut burn_speed_descriptor,
1223}
1224#[allow(clippy::unnecessary_operation, clippy::identity_op)]
1225const _: () = {
1226    ["Size of burn_speed_descriptor"][::std::mem::size_of::<burn_speed_descriptor>() - 128usize];
1227    ["Alignment of burn_speed_descriptor"]
1228        [::std::mem::align_of::<burn_speed_descriptor>() - 8usize];
1229    ["Offset of field: burn_speed_descriptor::source"]
1230        [::std::mem::offset_of!(burn_speed_descriptor, source) - 0usize];
1231    ["Offset of field: burn_speed_descriptor::profile_loaded"]
1232        [::std::mem::offset_of!(burn_speed_descriptor, profile_loaded) - 4usize];
1233    ["Offset of field: burn_speed_descriptor::profile_name"]
1234        [::std::mem::offset_of!(burn_speed_descriptor, profile_name) - 8usize];
1235    ["Offset of field: burn_speed_descriptor::end_lba"]
1236        [::std::mem::offset_of!(burn_speed_descriptor, end_lba) - 88usize];
1237    ["Offset of field: burn_speed_descriptor::write_speed"]
1238        [::std::mem::offset_of!(burn_speed_descriptor, write_speed) - 92usize];
1239    ["Offset of field: burn_speed_descriptor::read_speed"]
1240        [::std::mem::offset_of!(burn_speed_descriptor, read_speed) - 96usize];
1241    ["Offset of field: burn_speed_descriptor::wrc"]
1242        [::std::mem::offset_of!(burn_speed_descriptor, wrc) - 100usize];
1243    ["Offset of field: burn_speed_descriptor::exact"]
1244        [::std::mem::offset_of!(burn_speed_descriptor, exact) - 104usize];
1245    ["Offset of field: burn_speed_descriptor::mrw"]
1246        [::std::mem::offset_of!(burn_speed_descriptor, mrw) - 108usize];
1247    ["Offset of field: burn_speed_descriptor::prev"]
1248        [::std::mem::offset_of!(burn_speed_descriptor, prev) - 112usize];
1249    ["Offset of field: burn_speed_descriptor::next"]
1250        [::std::mem::offset_of!(burn_speed_descriptor, next) - 120usize];
1251};
1252unsafe extern "C" {
1253    /// Initialize the library.
1254    /// This must be called before using any other functions in the library. It
1255    /// may be called more than once with no effect.
1256    /// It is possible to 'restart' the library by shutting it down and
1257    /// re-initializing it. Once this was necessary if you follow the older and
1258    /// more general way of accessing a drive via burn_drive_scan() and
1259    /// burn_drive_grab(). See burn_drive_scan_and_grab() with its strong
1260    /// urges and its explanations.
1261    ///
1262    /// @return Nonzero if the library was able to initialize; zero if
1263    /// initialization failed.
1264    pub fn burn_initialize() -> ::std::os::raw::c_int;
1265}
1266unsafe extern "C" {
1267    /// Shutdown the library.
1268    /// This should be called before exiting your application. Make sure that all
1269    /// drives you have grabbed are released <i>before</i> calling this.
1270    pub fn burn_finish();
1271}
1272unsafe extern "C" {
1273    /// Abort any running drive operation and eventually call burn_finish().
1274    ///
1275    /// You MUST shut down the busy drives if an aborting event occurs during a
1276    /// burn run. For that you may call this function either from your own signal
1277    /// handling code or indirectly by activating the built-in signal handling:
1278    /// burn_set_signal_handling(\"my_app_name : \", NULL, 0);
1279    /// Else you may eventually call burn_drive_cancel() on the active drives and
1280    /// wait for them to assume state BURN_DRIVE_IDLE.
1281    ///
1282    /// @param patience      Maximum number of seconds to wait for drives to
1283    /// finish.
1284    ///
1285    /// @since 0.7.8 :
1286    /// If this is -1, then only the cancel operations will
1287    /// be performed and no burn_finish() will happen.
1288    ///
1289    /// @param pacifier_func If not NULL: a function to produce appeasing messages.
1290    /// See burn_abort_pacifier() for an example.
1291    ///
1292    /// @param handle        Opaque handle to be used with pacifier_func
1293    ///
1294    /// @return 1  ok, all went well
1295    /// 0  had to leave a drive in unclean state
1296    /// <0 severe error, do no use libburn again
1297    ///
1298    /// @since 0.2.6
1299    pub fn burn_abort(
1300        patience: ::std::os::raw::c_int,
1301        pacifier_func: ::std::option::Option<
1302            unsafe extern "C" fn(
1303                handle: *mut ::std::os::raw::c_void,
1304                patience: ::std::os::raw::c_int,
1305                elapsed: ::std::os::raw::c_int,
1306            ) -> ::std::os::raw::c_int,
1307        >,
1308        handle: *mut ::std::os::raw::c_void,
1309    ) -> ::std::os::raw::c_int;
1310}
1311unsafe extern "C" {
1312    /// A pacifier function suitable for burn_abort.
1313    ///
1314    /// @param handle If not NULL, a pointer to a text suitable for printf(\"%s\")
1315    ///
1316    /// @param patience Maximum number of seconds to wait
1317    ///
1318    /// @param elapsed  Elapsed number of seconds
1319    pub fn burn_abort_pacifier(
1320        handle: *mut ::std::os::raw::c_void,
1321        patience: ::std::os::raw::c_int,
1322        elapsed: ::std::os::raw::c_int,
1323    ) -> ::std::os::raw::c_int;
1324}
1325unsafe extern "C" {
1326    /// ts A61006 : This is for development only. Not suitable for applications.
1327    /// Set the verbosity level of the library. The default value is 0, which means
1328    /// that nothing is output on stderr. The more you increase this, the more
1329    /// debug output should be displayed on stderr for you.
1330    ///
1331    /// @param level The verbosity level desired. 0 for nothing, higher positive
1332    /// values for more information output.
1333    pub fn burn_set_verbosity(level: ::std::os::raw::c_int);
1334}
1335unsafe extern "C" {
1336    /// Enable or disable logging of SCSI commands.
1337    /// This call can be made at any time - even before burn_initialize().
1338    /// It is in effect for all active drives and currently not very thread
1339    /// safe for multiple drives.
1340    ///
1341    /// @param flag  Bitfield for control purposes. The default is 0.
1342    /// bit0= log to file /tmp/libburn_sg_command_log
1343    /// bit1= log to stderr
1344    /// bit2= flush output after each line
1345    ///
1346    /// @since 0.7.4
1347    pub fn burn_set_scsi_logging(flag: ::std::os::raw::c_int);
1348}
1349unsafe extern "C" {
1350    /// Set parameters for behavior on opening device files. To be called early
1351    /// after burn_initialize() and before any bus scan. But not mandatory at all.
1352    /// Parameter value 1 enables a feature, 0 disables.
1353    /// Default is (1,0,0). Have a good reason before you change it.
1354    ///
1355    /// @param exclusive
1356    /// 0 = no attempt to make drive access exclusive.
1357    /// 1 = Try to open only devices which are not marked as busy
1358    /// and try to mark them busy if opened successfully. (O_EXCL
1359    /// on GNU/Linux , flock(LOCK_EX) on FreeBSD.)
1360    /// 2 = in case of a SCSI device, also try to open exclusively
1361    /// the matching /dev/sr, /dev/scd and /dev/st .
1362    /// One may select a device SCSI file family by adding
1363    /// 0 = default family
1364    /// 4 = /dev/sr%d
1365    /// 8 = /dev/scd%d
1366    /// 16 = /dev/sg%d
1367    /// Do not use other values !
1368    /// Add 32 to demand on GNU/Linux an exclusive lock by
1369    /// fcntl(,F_SETLK,) after open() has succeeded.
1370    ///
1371    /// @param blocking  Try to wait for drives which do not open immediately but
1372    /// also do not return an error as well. (O_NONBLOCK)
1373    /// This might stall indefinitely with /dev/hdX hard disks.
1374    ///
1375    /// @param abort_on_busy  Unconditionally abort process when a non blocking
1376    /// exclusive opening attempt indicates a busy drive.
1377    /// Use this only after thorough tests with your app.
1378    ///
1379    /// @since 0.2.2
1380    pub fn burn_preset_device_open(
1381        exclusive: ::std::os::raw::c_int,
1382        blocking: ::std::os::raw::c_int,
1383        abort_on_busy: ::std::os::raw::c_int,
1384    );
1385}
1386unsafe extern "C" {
1387    /// Allows the use of media types which are implemented in libburn but not yet
1388    /// tested. The list of those untested profiles is subject to change.
1389    /// 
1390    /// Currently no media types are under test reservation
1391    /// 
1392    /// If you really test such media, then please report the outcome on
1393    /// libburn-hackers@pykix.org
1394    /// If ever then this call should be done soon after burn_initialize() before
1395    /// any drive scanning.
1396    ///
1397    /// @param yes 1=allow all implemented profiles, 0=only tested media (default)
1398    ///
1399    /// @since 0.3.4
1400    pub fn burn_allow_untested_profiles(yes: ::std::os::raw::c_int);
1401}
1402unsafe extern "C" {
1403    /// Acquire a drive with known device file address.
1404    ///
1405    /// This is the sysadmin friendly way to open one drive and to leave all
1406    /// others untouched. It bundles the following API calls to form a
1407    /// non-obtrusive way to use libburn:
1408    /// burn_drive_add_whitelist() , burn_drive_scan() , burn_drive_grab()
1409    /// You are *strongly urged* to use this call whenever you know the drive
1410    /// address in advance.
1411    ///
1412    /// If not, then you have to use directly above calls. In that case, you are
1413    /// strongly urged* to drop any unintended drive which will be exclusively
1414    /// occupied and not closed by burn_drive_scan().
1415    /// This can be done by shutting down the library including a call to
1416    /// burn_finish(). You may later start a new libburn session and should then
1417    /// use the function described here with an address obtained after
1418    /// burn_drive_scan() via burn_drive_d_get_adr(drive_infos[driveno].drive,adr).
1419    /// Another way is to drop the unwanted drives by burn_drive_info_forget().
1420    ///
1421    /// Operating on multiple drives:
1422    ///
1423    /// Different than with burn_drive_scan() it is allowed to call
1424    /// burn_drive_scan_and_grab() without giving up any other scanned drives. So
1425    /// this call can be used to get a collection of more than one acquired drives.
1426    /// The attempt to acquire the same drive twice will fail, though.
1427    ///
1428    /// Pseudo-drives:
1429    ///
1430    /// burn_drive_scan_and_grab() is able to acquire virtual drives which will
1431    /// accept options much like a MMC burner drive. Many of those options will not
1432    /// cause any effect, though. The address of a pseudo-drive begins with
1433    /// prefix \"stdio:\" followed by a path.
1434    /// Examples:  \"stdio:/tmp/pseudo_drive\" , \"stdio:/dev/null\" , \"stdio:-\"
1435    ///
1436    /// If the path is empty, the result is a null-drive = drive role 0.
1437    /// It pretends to have loaded no media and supports no reading or writing.
1438    ///
1439    /// If the path leads to an existing regular file, or to a not yet existing
1440    /// file, or to an existing block device, then the result is a random access
1441    /// stdio-drive capable of reading and writing = drive role 2.
1442    ///
1443    /// If the path leads to an existing file of any type other than directory,
1444    /// then the result is a sequential write-only stdio-drive = drive role 3.
1445    ///
1446    /// The special address form \"stdio:/dev/fd/{number}\" is interpreted literally
1447    /// as reference to open file descriptor {number}. This address form coincides
1448    /// with real files on some systems, but it is in fact hardcoded in libburn.
1449    /// Special address \"stdio:-\" means stdout = \"stdio:/dev/fd/1\".
1450    /// The role of such a drive is determined by the file type obtained via
1451    /// fstat({number}).
1452    ///
1453    /// Roles 2 and 3 perform all their eventual data transfer activities on a file
1454    /// via standard i/o functions open(2), lseek(2), read(2), write(2), close(2).
1455    /// The media profile is reported as 0xffff. Write space information from those
1456    /// media is not necessarily realistic.
1457    ///
1458    /// The capabilities of role 2 resemble DVD-RAM but it can simulate writing.
1459    /// If the path does not exist in the filesystem yet, it is attempted to create
1460    /// it as a regular file as soon as write operations are started.
1461    ///
1462    /// The capabilities of role 3 resemble a blank DVD-R. Nevertheless each
1463    /// burn_disc_write() run may only write a single track.
1464    ///
1465    /// One may distinguish pseudo-drives from MMC drives by call
1466    /// burn_drive_get_drive_role().
1467    ///
1468    ///
1469    /// @param drive_infos On success returns a one element array with the drive
1470    /// (cdrom/burner). Thus use with driveno 0 only. On failure
1471    /// the array has no valid elements at all.
1472    /// The returned array should be freed via burn_drive_info_free()
1473    /// when it is no longer needed.
1474    /// This is a result from call burn_drive_scan(). See there.
1475    /// Use with driveno 0 only.
1476    ///
1477    /// @param adr    The device file address of the desired drive. Either once
1478    /// obtained by burn_drive_d_get_adr() or composed skillfully by
1479    /// application or its user. E.g. \"/dev/sr0\".
1480    /// Consider to preprocess it by burn_drive_convert_fs_adr().
1481    ///
1482    /// @param load   Nonzero to make the drive attempt to load a disc (close its
1483    /// tray door, etc).
1484    ///
1485    /// @return       1 = success , 0 = drive not found , -1 = other error
1486    ///
1487    /// @since 0.2.2
1488    pub fn burn_drive_scan_and_grab(
1489        drive_infos: *mut *mut burn_drive_info,
1490        adr: *mut ::std::os::raw::c_char,
1491        load: ::std::os::raw::c_int,
1492    ) -> ::std::os::raw::c_int;
1493}
1494unsafe extern "C" {
1495    /// Add a device to the list of permissible drives. As soon as some entry is in
1496    /// the whitelist all non-listed drives are banned from scanning.
1497    ///
1498    /// @return 1 success, <=0 failure
1499    ///
1500    /// @since 0.2.2
1501    pub fn burn_drive_add_whitelist(
1502        device_address: *mut ::std::os::raw::c_char,
1503    ) -> ::std::os::raw::c_int;
1504}
1505unsafe extern "C" {
1506    /// Remove all drives from whitelist. This enables all possible drives.
1507    pub fn burn_drive_clear_whitelist();
1508}
1509unsafe extern "C" {
1510    /// Scan for drives. This function MUST be called until it returns nonzero.
1511    /// In case of re-scanning:
1512    /// All pointers to struct burn_drive and all struct burn_drive_info arrays
1513    /// are invalidated by using this function. Do NOT store drive pointers across
1514    /// calls to this function !
1515    /// To avoid invalid pointers one MUST free all burn_drive_info arrays
1516    /// by burn_drive_info_free() before calling burn_drive_scan() a second time.
1517    /// If there are drives left, then burn_drive_scan() will refuse to work.
1518    ///
1519    /// After this call all drives depicted by the returned array are subject
1520    /// to eventual (O_EXCL) locking. See burn_preset_device_open(). This state
1521    /// ends either with burn_drive_info_forget() or with burn_drive_release().
1522    /// It is unfriendly to other processes on the system to hold drives locked
1523    /// which one does not definitely plan to use soon.
1524    ///
1525    /// @param drive_infos Returns an array of drive info items (cdroms/burners).
1526    /// The returned array must be freed by burn_drive_info_free()
1527    /// before burn_finish(), and also before calling this function
1528    /// burn_drive_scan() again.
1529    ///
1530    /// @param n_drives Returns the number of drive items in drive_infos.
1531    ///
1532    /// @return 0 while scanning is not complete,
1533    /// \>0 when it is finished successfully,
1534    /// <0 when finished but failed.
1535    pub fn burn_drive_scan(
1536        drive_infos: *mut *mut burn_drive_info,
1537        n_drives: *mut ::std::os::raw::c_uint,
1538    ) -> ::std::os::raw::c_int;
1539}
1540unsafe extern "C" {
1541    /// Release memory about a single drive and any exclusive lock on it.
1542    /// Become unable to inquire or grab it. Expect FATAL consequences if you try.
1543    ///
1544    /// @param drive_info pointer to a single element out of the array
1545    /// obtained from burn_drive_scan() : &(drive_infos[driveno])
1546    ///
1547    /// @param force controls degree of permissible drive usage at the moment this
1548    /// function is called, and the amount of automatically provided
1549    /// drive shutdown :
1550    /// 0= drive must be ungrabbed and BURN_DRIVE_IDLE
1551    /// 1= try to release drive even if in state BURN_DRIVE_GRABBING
1552    /// Use these two only. Further values are to be defined.
1553    ///
1554    /// @return 1 on success, 2 if drive was already forgotten,
1555    /// 0 if not permissible, <0 on other failures,
1556    ///
1557    /// @since 0.2.2
1558    pub fn burn_drive_info_forget(
1559        drive_info: *mut burn_drive_info,
1560        force: ::std::os::raw::c_int,
1561    ) -> ::std::os::raw::c_int;
1562}
1563unsafe extern "C" {
1564    /// When no longer needed, free a whole burn_drive_info array which was
1565    /// returned by burn_drive_scan().
1566    /// For freeing single drive array elements use burn_drive_info_forget().
1567    pub fn burn_drive_info_free(drive_infos: *mut burn_drive_info);
1568}
1569unsafe extern "C" {
1570    /// Inquire the device file address of the given drive.
1571    ///
1572    /// @param drive The drive to inquire.
1573    ///
1574    /// @param adr   An application provided array of at least BURN_DRIVE_ADR_LEN
1575    /// characters size. The device file address gets copied to it.
1576    ///
1577    /// @return >0 success , <=0 error (due to libburn internal problem)
1578    ///
1579    /// @since 0.4.0
1580    pub fn burn_drive_d_get_adr(
1581        drive: *mut burn_drive,
1582        adr: *mut ::std::os::raw::c_char,
1583    ) -> ::std::os::raw::c_int;
1584}
1585unsafe extern "C" {
1586    /// Inquire the device file address of a drive via a given drive_info object.
1587    /// (Note: This is a legacy call.)
1588    ///
1589    /// @param drive_info The drive to inquire.Usually some &(drive_infos[driveno])
1590    ///
1591    /// @param adr   An application provided array of at least BURN_DRIVE_ADR_LEN
1592    /// characters size. The device file address gets copied to it.
1593    ///
1594    /// @return >0 success , <=0 error (due to libburn internal problem)
1595    ///
1596    /// @since 0.2.6
1597    pub fn burn_drive_get_adr(
1598        drive_info: *mut burn_drive_info,
1599        adr: *mut ::std::os::raw::c_char,
1600    ) -> ::std::os::raw::c_int;
1601}
1602unsafe extern "C" {
1603    /// Evaluate whether the given address would be a drive device file address
1604    /// which could be listed by a run of burn_drive_scan(). No check is made
1605    /// whether a device file with this address exists or whether it leads
1606    /// to a usable MMC drive.
1607    ///
1608    /// @return 1 means yes, 0 means no
1609    ///
1610    /// @since 0.2.6
1611    pub fn burn_drive_is_enumerable_adr(adr: *mut ::std::os::raw::c_char) -> ::std::os::raw::c_int;
1612}
1613unsafe extern "C" {
1614    /// Try to convert a given existing filesystem address into a drive device file
1615    /// address. This succeeds with symbolic links or if a hint about the drive's
1616    /// system address can be read from the filesystem object and a matching drive
1617    /// is found.
1618    ///
1619    /// @param path The address of an existing file system object
1620    ///
1621    /// @param adr  An application provided array of at least BURN_DRIVE_ADR_LEN
1622    /// characters size. The device file address gets copied to it.
1623    ///
1624    /// @return     1 = success , 0 = failure , -1 = severe error
1625    ///
1626    /// @since 0.2.6
1627    pub fn burn_drive_convert_fs_adr(
1628        path: *mut ::std::os::raw::c_char,
1629        adr: *mut ::std::os::raw::c_char,
1630    ) -> ::std::os::raw::c_int;
1631}
1632unsafe extern "C" {
1633    /// Try to convert a given SCSI address of bus,host,channel,target,lun into
1634    /// a drive device file address. If a SCSI address component parameter is < 0
1635    /// then it is not decisive and the first enumerated address which matches
1636    /// the >= 0 parameters is taken as result.
1637    /// Note: bus and (host,channel) are supposed to be redundant.
1638    ///
1639    /// @param bus_no \"Bus Number\" (something like a virtual controller)
1640    ///
1641    /// @param host_no \"Host Number\" (something like half a virtual controller)
1642    ///
1643    /// @param channel_no \"Channel Number\" (other half of \"Host Number\")
1644    ///
1645    /// @param target_no \"Target Number\" or \"SCSI Id\" (a device)
1646    ///
1647    /// @param lun_no \"Logical Unit Number\" (a sub device)
1648    ///
1649    /// @param adr  An application provided array of at least BURN_DRIVE_ADR_LEN
1650    /// characters size. The device file address gets copied to it.
1651    ///
1652    /// @return     1 = success , 0 = failure , -1 = severe error
1653    ///
1654    /// @since 0.2.6
1655    pub fn burn_drive_convert_scsi_adr(
1656        bus_no: ::std::os::raw::c_int,
1657        host_no: ::std::os::raw::c_int,
1658        channel_no: ::std::os::raw::c_int,
1659        target_no: ::std::os::raw::c_int,
1660        lun_no: ::std::os::raw::c_int,
1661        adr: *mut ::std::os::raw::c_char,
1662    ) -> ::std::os::raw::c_int;
1663}
1664unsafe extern "C" {
1665    /// Try to convert a given drive device file address into the address of a
1666    /// symbolic link that points to this drive address.
1667    /// Modern GNU/Linux systems may shuffle drive addresses from boot to boot.
1668    /// The udev daemon is supposed to create links which always point to the
1669    /// same drive, regardless of its system address.
1670    /// This call tries to find such links.
1671    ///
1672    /// @param dev_adr     Should contain a drive address as returned by
1673    /// burn_drive_scan().
1674    ///
1675    /// @param link_adr    An application provided array of at least
1676    /// BURN_DRIVE_ADR_LEN characters size. The found link
1677    /// address gets copied to it.
1678    ///
1679    /// @param dir_adr     The address of the directory where to look for links.
1680    /// Normally: \"/dev\"
1681    ///
1682    /// @param templ       An array of pointers to name templates, which
1683    /// links have to match. A symbolic link in dir_adr matches
1684    /// a name template if it begins by that text. E.g.
1685    /// link address \"/dev/dvdrw1\" matches template \"dvdrw\".
1686    /// If templ is NULL, then the default array gets used:
1687    /// {\"dvdrw\", \"cdrw\", \"dvd\", \"cdrom\", \"cd\"}
1688    /// If several links would match, then a link will win,
1689    /// which matches the template with the lowest array index.
1690    /// Among these candidates, the one with the lowest strcmp()
1691    /// rank will be chosen as link_adr.
1692    ///
1693    /// @param num_templ   Number of array elements in templ.
1694    ///
1695    /// @param flag        Bitfield for control purposes. Unused yet. Submit 0.
1696    ///
1697    /// @return            <0 severe error, 0 failed to search, 2 nothing found
1698    /// 1 success, link_adr is valid
1699    ///
1700    /// @since 1.1.4
1701    pub fn burn_lookup_device_link(
1702        dev_adr: *mut ::std::os::raw::c_char,
1703        link_adr: *mut ::std::os::raw::c_char,
1704        dir_adr: *mut ::std::os::raw::c_char,
1705        templ: *mut *mut ::std::os::raw::c_char,
1706        num_templ: ::std::os::raw::c_int,
1707        flag: ::std::os::raw::c_int,
1708    ) -> ::std::os::raw::c_int;
1709}
1710unsafe extern "C" {
1711    /// Try to obtain bus,host,channel,target,lun from path. If there is an SCSI
1712    /// address at all, then this call should succeed with a drive device file
1713    /// address obtained via burn_drive_d_get_adr(). It is also supposed to
1714    /// succeed with any device file of a (possibly emulated) SCSI device.
1715    ///
1716    /// @return     1 = success , 0 = failure , -1 = severe error
1717    ///
1718    /// @since 0.2.6
1719    pub fn burn_drive_obtain_scsi_adr(
1720        path: *mut ::std::os::raw::c_char,
1721        bus_no: *mut ::std::os::raw::c_int,
1722        host_no: *mut ::std::os::raw::c_int,
1723        channel_no: *mut ::std::os::raw::c_int,
1724        target_no: *mut ::std::os::raw::c_int,
1725        lun_no: *mut ::std::os::raw::c_int,
1726    ) -> ::std::os::raw::c_int;
1727}
1728unsafe extern "C" {
1729    /// Grab a drive. This must be done before the drive can be used (for reading,
1730    /// writing, etc).
1731    ///
1732    /// @param drive The drive to grab. This is found in a returned
1733    /// burn_drive_info struct.
1734    ///
1735    /// @param load Nonzero to make the drive attempt to load a disc (close its
1736    /// tray door, etc).
1737    ///
1738    /// @return 1 if it was possible to grab the drive, else 0
1739    pub fn burn_drive_grab(
1740        drive: *mut burn_drive,
1741        load: ::std::os::raw::c_int,
1742    ) -> ::std::os::raw::c_int;
1743}
1744unsafe extern "C" {
1745    pub fn burn_drive_probe_cd_write_modes(
1746        drive_info: *mut burn_drive_info,
1747    ) -> ::std::os::raw::c_int;
1748}
1749unsafe extern "C" {
1750    /// Calm down or alert a drive. Some drives stay alert after reading for
1751    /// quite some time. This saves time with the startup for the next read
1752    /// operation but also causes noise and consumes extra energy. It makes
1753    /// sense to calm down the drive if no read operation is expected for the
1754    /// next few seconds. The drive will get alert automatically if operations
1755    /// are required.
1756    ///
1757    /// @param d      The drive to influence.
1758    ///
1759    /// @param flag   Bitfield for control purposes
1760    /// bit0= become alert (else start snoozing)
1761    /// This is not mandatory for further drive operations
1762    ///
1763    /// @return       1= success , 0= drive role not suitable for calming
1764    ///
1765    /// @since 0.7.0
1766    pub fn burn_drive_snooze(
1767        d: *mut burn_drive,
1768        flag: ::std::os::raw::c_int,
1769    ) -> ::std::os::raw::c_int;
1770}
1771unsafe extern "C" {
1772    /// Re-assess drive and media status. This should be done after a drive
1773    /// underwent a status change and shall be further used without intermediate
1774    /// burn_drive_release(), burn_drive_grab(). E.g. after blanking or burning.
1775    ///
1776    /// @param d      The already grabbed drive to re-assess.
1777    ///
1778    /// @param flag   Unused yet. Submit 0.
1779    ///
1780    /// @return       1 success , <= 0 could not determine drive and media state
1781    ///
1782    /// @since 1.1.8
1783    pub fn burn_drive_re_assess(
1784        d: *mut burn_drive,
1785        flag: ::std::os::raw::c_int,
1786    ) -> ::std::os::raw::c_int;
1787}
1788unsafe extern "C" {
1789    /// Release a drive. This should not be done until the drive is no longer
1790    /// busy (see burn_drive_get_status).
1791    ///
1792    /// @param drive The drive to release.
1793    ///
1794    /// @param eject Nonzero to make the drive eject the disc in it.
1795    pub fn burn_drive_release(drive: *mut burn_drive, eject: ::std::os::raw::c_int);
1796}
1797unsafe extern "C" {
1798    /// Like burn_drive_release() but keeping the drive tray closed and its
1799    /// eject button disabled. This physically locked drive state will last until
1800    /// the drive is grabbed again and released via burn_drive_release().
1801    /// Programs like eject, cdrecord, growisofs will break that ban too.
1802    ///
1803    /// @param d    The drive to release and leave locked.
1804    ///
1805    /// @param flag Bitfield for control purposes (unused yet, submit 0)
1806    ///
1807    /// @return 1 means success, <=0 means failure
1808    ///
1809    /// @since 0.4.0
1810    pub fn burn_drive_leave_locked(
1811        d: *mut burn_drive,
1812        flag: ::std::os::raw::c_int,
1813    ) -> ::std::os::raw::c_int;
1814}
1815unsafe extern "C" {
1816    /// Returns what kind of disc a drive is holding. This function may need to be
1817    /// called more than once to get a proper status from it. See burn_disc_status
1818    /// for details.
1819    ///
1820    /// @param drive The drive to query for a disc.
1821    ///
1822    /// @return The status of the drive, or what kind of disc is in it.
1823    /// Note: BURN_DISC_UNGRABBED indicates wrong API usage
1824    pub fn burn_disc_get_status(drive: *mut burn_drive) -> burn_disc_status;
1825}
1826unsafe extern "C" {
1827    /// WARNING: This revives an old bug-like behavior that might be dangerous.
1828    /// Sets the drive status to BURN_DISC_BLANK if it is BURN_DISC_UNREADY
1829    /// or BURN_DISC_UNSUITABLE. Thus marking media as writable which actually
1830    /// failed to declare themselves either blank or (partially) filled.
1831    ///
1832    /// @return 1 drive status has been set , 0 = unsuitable drive status
1833    ///
1834    /// @since 0.2.6
1835    pub fn burn_disc_pretend_blank(drive: *mut burn_drive) -> ::std::os::raw::c_int;
1836}
1837unsafe extern "C" {
1838    /// WARNING: This overrides the safety measures against unsuitable media.
1839    /// Sets the drive status to BURN_DISC_FULL if it is BURN_DISC_UNREADY
1840    /// or BURN_DISC_UNSUITABLE. Thus marking media as blankable which actually
1841    /// failed to declare themselves either blank or (partially) filled.
1842    ///
1843    /// @since 0.2.6
1844    pub fn burn_disc_pretend_full(drive: *mut burn_drive) -> ::std::os::raw::c_int;
1845}
1846unsafe extern "C" {
1847    /// WARNING: This overrides the safety measures against unsuitable media.
1848    /// Sets the drive status to BURN_DISC_FULL unconditionally.
1849    ///
1850    /// @since 1.3.4
1851    pub fn burn_disc_pretend_full_uncond(drive: *mut burn_drive) -> ::std::os::raw::c_int;
1852}
1853unsafe extern "C" {
1854    /// Returns the Drive Serial Number as of MMC feature 108h.
1855    ///
1856    /// @param d        The drive to inquire.
1857    ///
1858    /// @param sno      Returns the bytes of the serial number. A trailing 0-byte
1859    /// is appended for convenience. MMC specifies ASCII 0x20 to
1860    /// 0x7h as possible byte values. But given drive firmware
1861    /// habits there is no warranty that *sno contains no other
1862    /// byte values.
1863    /// Submit *sno as NULL or pointing to free()-able memory.
1864    /// Apply free() to *sno when no longer needed.
1865    ///
1866    /// @param sno_len  Returns the number of valid bytes in returned *sno,
1867    /// not counting the appended trailing 0.
1868    ///
1869    /// @return         1= success (but maybe *sno_len is 0), <= 0 severe failure
1870    ///
1871    /// @since 1.4.2
1872    pub fn burn_drive_get_serial_no(
1873        d: *mut burn_drive,
1874        sno: *mut *mut ::std::os::raw::c_char,
1875        sno_len: *mut ::std::os::raw::c_int,
1876    ) -> ::std::os::raw::c_int;
1877}
1878unsafe extern "C" {
1879    /// Returns the Media Serial Number as of MMC feature 109h and command ABh
1880    /// READ MEDIA SERIAL NUMBER.
1881    ///
1882    /// Note: This call will return an empty result unless the macro
1883    /// Libburn_enable_scsi_cmd_ABh
1884    /// is defined at compile time.
1885    /// This is because the command READ MEDIA SERIAL NUMBER demands
1886    /// superuser authority on Linux, because no medium with serial number
1887    /// could be tested yet, and because this command made one of the test
1888    /// drives unusable until power cycle when it was executed despite
1889    /// feature 109h was not announced as \"current\".
1890    ///
1891    ///
1892    /// @param d        The drive to inquire.
1893    ///
1894    /// @param sno      Returns the bytes of the serial number. A trailing 0-byte
1895    /// is appended for convenience. There is no warranty that
1896    /// sno contains only non-zero printable bytes.
1897    /// Submit *sno as NULL or pointing to free()-able memory.
1898    /// Apply free() to *sno when no longer needed.
1899    ///
1900    /// @param sno_len  Returns the number of valid bytes in returned *sno,
1901    /// not counting the appended trailing 0.
1902    ///
1903    /// @return         1= success (but maybe *sno_len is 0), <= 0 severe failure
1904    ///
1905    /// @since 1.4.2
1906    pub fn burn_drive_get_media_sno(
1907        d: *mut burn_drive,
1908        sno: *mut *mut ::std::os::raw::c_char,
1909        sno_len: *mut ::std::os::raw::c_int,
1910    ) -> ::std::os::raw::c_int;
1911}
1912unsafe extern "C" {
1913    /// Reads ATIP information from inserted media. To be obtained via
1914    /// burn_drive_get_write_speed(), burn_drive_get_min_write_speed(),
1915    /// burn_drive_get_start_end_lba(). The drive must be grabbed for this call.
1916    ///
1917    /// @param drive The drive to query.
1918    ///
1919    /// @return 1=success, 0=no valid ATIP info read, -1 severe error
1920    ///
1921    /// @since 0.2.6
1922    pub fn burn_disc_read_atip(drive: *mut burn_drive) -> ::std::os::raw::c_int;
1923}
1924unsafe extern "C" {
1925    /// Tells whether a BD-R medium with Pseudo Overwrite (POW) formatting is in
1926    /// the drive. Such a formatting may have been applied by dvd+rw-tools. It
1927    /// prevents sequential multi-session.
1928    /// libburn will refuse to write to such a medium.
1929    ///
1930    /// @param drive The drive to query.
1931    ///
1932    /// @return 1 if BD-R Pseudo Overwrite , 0 if not BD-R or not POW
1933    ///
1934    /// @since 1.4.8
1935    pub fn burn_drive_get_bd_r_pow(drive: *mut burn_drive) -> ::std::os::raw::c_int;
1936}
1937unsafe extern "C" {
1938    /// Returns start and end lba of the media which is currently inserted
1939    /// in the given drive. The drive has to be grabbed to have hope for reply.
1940    /// Shortcoming (not a feature): unless burn_disc_read_atip() was called
1941    /// only blank media will return valid info.
1942    ///
1943    /// @param drive The drive to query.
1944    ///
1945    /// @param start_lba Returns the start lba value
1946    ///
1947    /// @param end_lba Returns the end lba value
1948    ///
1949    /// @param flag Bitfield for control purposes (unused yet, submit 0)
1950    ///
1951    /// @return 1 if lba values are valid , 0 if invalid
1952    ///
1953    /// @since 0.2.6
1954    pub fn burn_drive_get_start_end_lba(
1955        drive: *mut burn_drive,
1956        start_lba: *mut ::std::os::raw::c_int,
1957        end_lba: *mut ::std::os::raw::c_int,
1958        flag: ::std::os::raw::c_int,
1959    ) -> ::std::os::raw::c_int;
1960}
1961unsafe extern "C" {
1962    /// Guess the manufacturer name of CD media from the ATIP addresses of lead-in
1963    /// and lead-out. (Currently only lead-in is interpreted. Lead-out may in
1964    /// future be used to identify the media type in more detail.)
1965    /// The parameters of this call should be obtained by burn_disc_read_atip(d),
1966    /// burn_drive_get_start_end_lba(d, &start_lba, &end_lba, 0),
1967    /// burn_lba_to_msf(start_lba, &m_li, &s_li, &f_li) and
1968    /// burn_lba_to_msf(end_lba, &m_lo, &s_lo, &f_lo).
1969    ///
1970    /// @param m_li  \"minute\" part of ATIP lead-in or start_lba
1971    ///
1972    /// @param s_li  \"second\" of lead-in or start_lba
1973    ///
1974    /// @param f_li  \"frame\" of lead-in
1975    ///
1976    /// @param m_lo  \"minute\" part of ATIP lead-out
1977    ///
1978    /// @param s_lo  \"second\" of lead-out
1979    ///
1980    /// @param f_lo  \"frame\" of lead-out
1981    ///
1982    /// @param flag  Bitfield for control purposes,
1983    /// bit0= append a text \"(aka ...)\" to reply if other brands or
1984    /// vendor names are known.
1985    ///
1986    /// @return      Printable text or NULL on memory shortage.
1987    /// Dispose by free() when no longer needed.
1988    ///
1989    /// @since 0.7.2
1990    pub fn burn_guess_cd_manufacturer(
1991        m_li: ::std::os::raw::c_int,
1992        s_li: ::std::os::raw::c_int,
1993        f_li: ::std::os::raw::c_int,
1994        m_lo: ::std::os::raw::c_int,
1995        s_lo: ::std::os::raw::c_int,
1996        f_lo: ::std::os::raw::c_int,
1997        flag: ::std::os::raw::c_int,
1998    ) -> *mut ::std::os::raw::c_char;
1999}
2000unsafe extern "C" {
2001    /// Retrieve some media information which is mainly specific to CD. For other
2002    /// media only the bits in reply parameter valid are supposed to be meaningful.
2003    ///
2004    /// @param d         The drive to query.
2005    ///
2006    /// @param disc_type A string saying either \"CD-DA or CD-ROM\", or \"CD-I\",
2007    /// or \"\"CD-ROM XA\", or \"undefined\".
2008    ///
2009    /// @param disc_id   A 32 bit number read from the media. (Meaning unclear yet)
2010    ///
2011    /// @param bar_code  8 hex digits from a barcode on media read by the drive
2012    /// (if the drive has a bar code reader built in).
2013    ///
2014    /// @param app_code  The Host Application Code which must be set in the Write
2015    /// Parameters Page if the media is not unrestricted (URU==0).
2016    ///
2017    /// @param valid     Replies bits which indicate the validity of other reply
2018    /// parameters or the state of certain CD info bits:
2019    /// bit0= disc_type is valid
2020    /// bit1= disc_id is valid
2021    /// bit2= bar_code is valid
2022    /// bit3= disc_app_code is valid
2023    /// bit4= Disc is unrestricted (URU bit, 51h READ DISC INFO)
2024    /// This seems to be broken with my drives. The bit is
2025    /// 0 and the validity bit for disc_app_code is 0 too.
2026    /// bit5= Disc is nominally erasable (Erasable bit)
2027    /// This will be set with overwritable media which
2028    /// libburn normally considers to be unerasable blank.
2029    ///
2030    /// @return          1 success, <= 0 an error occurred
2031    ///
2032    /// @since 0.7.2
2033    pub fn burn_disc_get_cd_info(
2034        d: *mut burn_drive,
2035        disc_type: *mut ::std::os::raw::c_char,
2036        disc_id: *mut ::std::os::raw::c_uint,
2037        bar_code: *mut ::std::os::raw::c_char,
2038        app_code: *mut ::std::os::raw::c_int,
2039        valid: *mut ::std::os::raw::c_int,
2040    ) -> ::std::os::raw::c_int;
2041}
2042unsafe extern "C" {
2043    /// Read the array of CD-TEXT packs from the Lead-in of an audio CD.
2044    /// Each pack consists of 18 bytes, of which 4 are header. 12 bytes are pieces
2045    /// of 0-terminated texts or binary data. 2 bytes hold a CRC.
2046    /// For a description of the format of the array, see file doc/cdtext.txt.
2047    ///
2048    /// @param d          The drive to query.
2049    ///
2050    /// @param text_packs  Will point to an allocated memory buffer with CD-TEXT.
2051    /// It will only contain text packs, and not be prepended
2052    /// by the TOC header of four bytes, which gets stored with
2053    /// file cdtext.dat by cdrecord -vv -toc. (The first two of
2054    /// these bytes are supposed to hold the number of CD-TEXT
2055    /// bytes + 2. The other two bytes are supposed to be 0.)
2056    /// Dispose this buffer by free(), when no longer needed.
2057    ///
2058    /// @param num_packs  Will tell the number of text packs, i.e. the number of
2059    /// bytes in text_packs divided by 18.
2060    ///
2061    /// @param flag       Bitfield for control purposes,
2062    /// Unused yet. Submit 0.
2063    ///
2064    /// @return           1 success, 0= no CD-TEXT found, < 0 an error occurred
2065    ///
2066    /// @since 1.2.0
2067    pub fn burn_disc_get_leadin_text(
2068        d: *mut burn_drive,
2069        text_packs: *mut *mut ::std::os::raw::c_uchar,
2070        num_packs: *mut ::std::os::raw::c_int,
2071        flag: ::std::os::raw::c_int,
2072    ) -> ::std::os::raw::c_int;
2073}
2074unsafe extern "C" {
2075    /// Read the current usage of the eventual BD Spare Area. This area gets
2076    /// reserved on BD media during formatting. During writing it is used to
2077    /// host replacements of blocks which failed the checkread immediately after
2078    /// writing.
2079    /// This call applies only to recordable BD media. I.e. profiles 0x41 to 0x43.
2080    ///
2081    /// @param d            The drive to query.
2082    ///
2083    /// @param alloc_blocks Returns the number of blocks reserved as Spare Area
2084    ///
2085    /// @param free_blocks  Returns the number of yet unused blocks in that area
2086    ///
2087    /// @param flag         Bitfield for control purposes (unused yet, submit 0)
2088    ///
2089    /// @return             1 = reply prarameters are valid,
2090    /// <=0 = reply is invalid (e.g. because no BD profile)
2091    ///
2092    /// @since 0.8.8
2093    pub fn burn_disc_get_bd_spare_info(
2094        d: *mut burn_drive,
2095        alloc_blocks: *mut ::std::os::raw::c_int,
2096        free_blocks: *mut ::std::os::raw::c_int,
2097        flag: ::std::os::raw::c_int,
2098    ) -> ::std::os::raw::c_int;
2099}
2100unsafe extern "C" {
2101    /// Retrieve some media information which is mainly specific to media of
2102    /// the DVD-R family: DVD-R , DVD-RW , DVD-R DL , HD DVD-R
2103    /// Currently the information cannot be retrieved from other media types.
2104    ///
2105    /// @param d              The drive to query.
2106    ///
2107    /// @param disk_category  returns DVD Book to which the media complies
2108    ///
2109    /// @param book_name      returns a pointer to the book name of disk_category.
2110    /// This memory is static. Do not alter or free it !
2111    ///
2112    /// @param part_version   returns the Media Version in the DVD Book
2113    ///
2114    /// @param num_layers     returns the number of media layers
2115    ///
2116    /// @param num_blocks     returns the number of blocks between pysical start
2117    /// and physical end of the media
2118    ///
2119    /// @param flag           Bitfield for control purposes (unused yet, submit 0)
2120    ///
2121    /// @return               1 = reply prarameters are valid,
2122    /// <=0 = reply is invalid (e.g. because no DVD-R)
2123    ///
2124    /// @since 1.1.4
2125    pub fn burn_disc_get_phys_format_info(
2126        d: *mut burn_drive,
2127        disk_category: *mut ::std::os::raw::c_int,
2128        book_name: *mut *mut ::std::os::raw::c_char,
2129        part_version: *mut ::std::os::raw::c_int,
2130        num_layers: *mut ::std::os::raw::c_int,
2131        num_blocks: *mut ::std::os::raw::c_int,
2132        flag: ::std::os::raw::c_int,
2133    ) -> ::std::os::raw::c_int;
2134}
2135unsafe extern "C" {
2136    /// Read start lba and Next Writeable Address of a track from media.
2137    /// Usually a track lba is obtained from the result of burn_track_get_entry().
2138    /// This call retrieves an updated lba, eventual nwa, and can address the
2139    /// invisible track to come.
2140    /// The drive must be grabbed for this call. One may not issue this call
2141    /// during ongoing burn_disc_write() or burn_disc_erase().
2142    ///
2143    /// @param d The drive to query.
2144    ///
2145    /// @param o If not NULL: write parameters to be set on drive before query
2146    ///
2147    /// @param trackno 0=next track to come, >0 number of existing track
2148    /// The first existing track on a CD may have a number higher
2149    /// than 1. Use burn_session_get_start_tno() to inquire this
2150    /// start number.
2151    ///
2152    /// @param lba return value: start lba
2153    ///
2154    /// @param nwa return value: Next Writeable Address
2155    ///
2156    /// @return 1=nwa is valid , 0=nwa is not valid , -1=error
2157    ///
2158    /// @since 0.2.6
2159    pub fn burn_disc_track_lba_nwa(
2160        d: *mut burn_drive,
2161        o: *mut burn_write_opts,
2162        trackno: ::std::os::raw::c_int,
2163        lba: *mut ::std::os::raw::c_int,
2164        nwa: *mut ::std::os::raw::c_int,
2165    ) -> ::std::os::raw::c_int;
2166}
2167unsafe extern "C" {
2168    /// Tells whether a previous attempt to determine the Next Writeable Address
2169    /// of the upcoming track reveiled that the READ TRACK INFORMATION Damage Bit
2170    /// is set for this track and that no valid writable address is available.
2171    /// See MMC-5 6.27.3.7 Damage Bit, 6.27.3.11 NWA_V (NWA valid)
2172    ///
2173    /// @param d     The drive to query.
2174    ///
2175    /// @param flag  Bitfield for control purposes (unused yet, submit 0)
2176    ///
2177    /// @return      0= Looks ok: Damage Bit is not set, NWA_V is set
2178    /// 1= Damaged and theoretically writable (NWA_V is set)
2179    /// 2= Not writable: NWA_V is not set
2180    /// 3= Damaged and not writable (NWA_V is not set),
2181    ///
2182    /// @since 1.1.0
2183    pub fn burn_disc_next_track_is_damaged(
2184        d: *mut burn_drive,
2185        flag: ::std::os::raw::c_int,
2186    ) -> ::std::os::raw::c_int;
2187}
2188unsafe extern "C" {
2189    /// Try to close the last track and session of media which have bit0 set in
2190    /// the return value of call burn_disc_next_track_is_damaged().
2191    /// Whether it helps depends much on the reason why the media is reported
2192    /// as damaged by the drive.
2193    /// This call works only for profiles 0x09 CD-R, 0x0a CD-RW, 0x11 DVD-R,
2194    /// 0x14 DVD-RW sequential, 0x1b DVD+R, 0x2b DVD+R DL, 0x41 BD-R sequential.
2195    /// Note: After writing it is advised to give up the drive and to grab it again
2196    /// in order to learn about its view on the new media state.
2197    ///
2198    /// @param o     Write options created by burn_write_opts_new() and
2199    /// manipulated by burn_write_opts_set_multi().
2200    /// burn_write_opts_set_write_type() should be set to
2201    /// BURN_WRITE_TAO, burn_write_opts_set_simulate() should be
2202    /// set to 0.
2203    ///
2204    /// @param flag  Bitfield for control purposes
2205    /// bit0= force close, even if no damage was seen
2206    ///
2207    /// @return      <=0 media not marked as damaged, or media type not suitable,
2208    /// or closing attempted but failed
2209    /// 1= attempt finished without error indication
2210    ///
2211    /// @since 1.1.0
2212    pub fn burn_disc_close_damaged(
2213        o: *mut burn_write_opts,
2214        flag: ::std::os::raw::c_int,
2215    ) -> ::std::os::raw::c_int;
2216}
2217unsafe extern "C" {
2218    /// Read start lba of the first track in the last complete session.
2219    /// This is the first parameter of mkisofs option -C. The second parameter
2220    /// is nwa as obtained by burn_disc_track_lba_nwa() with trackno 0.
2221    ///
2222    /// @param d The drive to query.
2223    ///
2224    /// @param start_lba returns the start address of that track
2225    ///
2226    /// @return <= 0 : failure, 1 = ok
2227    ///
2228    /// @since 0.3.2
2229    pub fn burn_disc_get_msc1(
2230        d: *mut burn_drive,
2231        start_lba: *mut ::std::os::raw::c_int,
2232    ) -> ::std::os::raw::c_int;
2233}
2234unsafe extern "C" {
2235    /// Return the best possible estimation of the currently available capacity of
2236    /// the media. This might depend on particular write option settings. For
2237    /// inquiring the space with such a set of options, the drive has to be
2238    /// grabbed and BURN_DRIVE_IDLE. If not, then one will only get a canned value
2239    /// from the most recent automatic inquiry (e.g. during last drive grabbing).
2240    /// An eventual start address from burn_write_opts_set_start_byte() will be
2241    /// taken into respect with the capacity estimation. Negative results get
2242    /// defaulted to 0.
2243    /// If the drive is actually a file in a large filesystem or a large block
2244    /// device, then the capacity is curbed to a maximum of 0x7ffffff0 blocks
2245    /// = 4 TB - 32 KB.
2246    ///
2247    /// @param d The drive to query.
2248    ///
2249    /// @param o If not NULL: write parameters to be set on drive before query
2250    ///
2251    /// @return number of most probably available free bytes
2252    ///
2253    /// @since 0.3.4
2254    pub fn burn_disc_available_space(d: *mut burn_drive, o: *mut burn_write_opts) -> libc::off_t;
2255}
2256unsafe extern "C" {
2257    /// Tells the MMC Profile identifier of the loaded media. The drive must be
2258    /// grabbed in order to get a non-zero result.
2259    /// libburn currently writes only to profiles
2260    /// 0x09 \"CD-R\"
2261    /// 0x0a \"CD-RW\"
2262    /// 0x11 \"DVD-R sequential recording\"
2263    /// 0x12 \"DVD-RAM\"
2264    /// 0x13 \"DVD-RW restricted overwrite\"
2265    /// 0x14 \"DVD-RW sequential recording\",
2266    /// 0x15 \"DVD-R/DL sequential recording\",
2267    /// 0x1a \"DVD+RW\"
2268    /// 0x1b \"DVD+R\",
2269    /// 0x2b \"DVD+R/DL\",
2270    /// 0x41 \"BD-R sequential recording\",
2271    /// 0x43 \"BD-RE\",
2272    /// 0xffff \"stdio file\"
2273    /// Note: 0xffff is not a MMC profile but a libburn invention.
2274    /// Read-only are the profiles
2275    /// 0x08 \"CD-ROM\",
2276    /// 0x10 \"DVD-ROM\",
2277    /// 0x40 \"BD-ROM\",
2278    /// Read-only for now is this BD-R profile (testers wanted)
2279    /// 0x42 \"BD-R random recording\"
2280    /// Empty drives are supposed to report
2281    /// 0x00 \"\"
2282    ///
2283    /// @param d The drive where the media is inserted.
2284    ///
2285    /// @param pno Profile Number. See also mmc5r03c.pdf, table 89
2286    ///
2287    /// @param name Profile Name (see above list, unknown profiles have empty name)
2288    ///
2289    /// @return 1 profile is valid, 0 no profile info available
2290    ///
2291    /// @since 0.3.0
2292    pub fn burn_disc_get_profile(
2293        d: *mut burn_drive,
2294        pno: *mut ::std::os::raw::c_int,
2295        name: *mut ::std::os::raw::c_char,
2296    ) -> ::std::os::raw::c_int;
2297}
2298unsafe extern "C" {
2299    /// Obtain product id and standards defined media codes.
2300    /// The product id is a printable string which is supposed to be the same
2301    /// for identical media but should vary with non-identical media. Some media
2302    /// cannot provide such an id at all.
2303    /// The pair (profile_number, product_id) should be the best id to identify
2304    /// media with identical product specifications.
2305    /// The reply parameters media_code1 and media_code2 can be used with
2306    /// burn_guess_manufacturer()
2307    /// The reply parameters have to be disposed by free() when no longer needed.
2308    ///
2309    /// @param d           The drive where the media is inserted.
2310    ///
2311    /// @param product_id  Reply: Printable text depicting manufacturer and
2312    /// eventually media id.
2313    ///
2314    /// @param media_code1 Reply: The eventual manufacturer identification as read
2315    /// from DVD/BD media or a text \"XXmYYsZZf\" from CD media
2316    /// ATIP lead-in.
2317    ///
2318    /// @param media_code2 The eventual media id as read from DVD+/BD media or a
2319    /// text \"XXmYYsZZf\" from CD ATIP lead-out.
2320    ///
2321    /// @param book_type   Book type text for DVD and BD.
2322    /// Caution: is NULL with CD, even if return value says ok.
2323    ///
2324    /// @param flag        Bitfield for control purposes
2325    /// bit0= do not escape \" _/\" (not suitable for
2326    /// burn_guess_manufacturer())
2327    ///
2328    /// @return            1= ok, product_id and media codes are valid,
2329    /// 0= no product id_available, reply parameters are NULL
2330    /// <0= error
2331    ///
2332    /// @since 0.7.2
2333    pub fn burn_disc_get_media_id(
2334        d: *mut burn_drive,
2335        product_id: *mut *mut ::std::os::raw::c_char,
2336        media_code1: *mut *mut ::std::os::raw::c_char,
2337        media_code2: *mut *mut ::std::os::raw::c_char,
2338        book_type: *mut *mut ::std::os::raw::c_char,
2339        flag: ::std::os::raw::c_int,
2340    ) -> ::std::os::raw::c_int;
2341}
2342unsafe extern "C" {
2343    /// Guess the name of a manufacturer by profile number, manufacturer code
2344    /// and media code. The profile number can be obtained by
2345    /// burn_disc_get_profile(), the other two parameters can be obtained as
2346    /// media_code1 and media_code2 by burn_disc_get_media_id().
2347    ///
2348    /// @param profile_no   Profile number (submit -1 if not known)
2349    ///
2350    /// @param manuf_code   Manufacturer code from media (e.g. \"RICOHJPN\")
2351    ///
2352    /// @param media_code   Media ID code from media (e.g. \"W11\")
2353    ///
2354    /// @param flag  Bitfield for control purposes, submit 0
2355    ///
2356    /// @return      Printable text or NULL on memory shortage.
2357    /// If the text begins with \"Unknown \" then no item of the
2358    /// manufacturer list matched the codes.
2359    /// Dispose by free() when no longer needed.
2360    ///
2361    /// @since 0.7.2
2362    pub fn burn_guess_manufacturer(
2363        profile_no: ::std::os::raw::c_int,
2364        manuf_code: *mut ::std::os::raw::c_char,
2365        media_code: *mut ::std::os::raw::c_char,
2366        flag: ::std::os::raw::c_int,
2367    ) -> *mut ::std::os::raw::c_char;
2368}
2369unsafe extern "C" {
2370    /// Tells whether a disc can be erased or not
2371    ///
2372    /// @param d The drive to inquire.
2373    ///
2374    /// @return Non-zero means erasable
2375    pub fn burn_disc_erasable(d: *mut burn_drive) -> ::std::os::raw::c_int;
2376}
2377unsafe extern "C" {
2378    /// Returns the progress and status of a drive.
2379    ///
2380    /// @param drive The drive to query busy state for.
2381    ///
2382    /// @param p Returns the progress of the operation, NULL if you don't care
2383    ///
2384    /// @return the current status of the drive. See also burn_drive_status.
2385    pub fn burn_drive_get_status(
2386        drive: *mut burn_drive,
2387        p: *mut burn_progress,
2388    ) -> burn_drive_status;
2389}
2390unsafe extern "C" {
2391    /// Creates a write_opts struct for burning to the specified drive.
2392    /// The returned object must later be freed with burn_write_opts_free().
2393    ///
2394    /// @param drive The drive to write with
2395    ///
2396    /// @return The write_opts, NULL on error
2397    pub fn burn_write_opts_new(drive: *mut burn_drive) -> *mut burn_write_opts;
2398}
2399unsafe extern "C" {
2400    /// Inquires the drive associated with a burn_write_opts object.
2401    ///
2402    /// @param opts object to inquire
2403    ///
2404    /// @return pointer to drive
2405    ///
2406    /// @since 0.4.0
2407    pub fn burn_write_opts_get_drive(opts: *mut burn_write_opts) -> *mut burn_drive;
2408}
2409unsafe extern "C" {
2410    /// Frees a write_opts struct created with burn_write_opts_new
2411    ///
2412    /// @param opts write_opts to free
2413    pub fn burn_write_opts_free(opts: *mut burn_write_opts);
2414}
2415#[repr(C)]
2416#[derive(Debug, Copy, Clone)]
2417pub struct burn_read_opts {
2418    _unused: [u8; 0],
2419}
2420unsafe extern "C" {
2421    /// Creates a read_opts struct for reading from the specified drive
2422    /// must be freed with burn_read_opts_free
2423    ///
2424    /// @param drive The drive to read from
2425    ///
2426    /// @return The read_opts
2427    pub fn burn_read_opts_new(drive: *mut burn_drive) -> *mut burn_read_opts;
2428}
2429unsafe extern "C" {
2430    /// Frees a read_opts struct created with burn_read_opts_new
2431    ///
2432    /// @param opts write_opts to free
2433    pub fn burn_read_opts_free(opts: *mut burn_read_opts);
2434}
2435unsafe extern "C" {
2436    /// Erase a disc in the drive. The drive must be grabbed successfully BEFORE
2437    /// calling this functions. Always ensure that the drive reports a status of
2438    /// BURN_DISC_FULL before calling this function. An erase operation is not
2439    /// cancellable, as control of the operation is passed wholly to the drive and
2440    /// there is no way to interrupt it safely.
2441    ///
2442    /// @param drive The drive with which to erase a disc.
2443    /// Only drive roles 1 (MMC) and 5 (stdio random write-only)
2444    /// support erasing.
2445    ///
2446    /// @param fast Nonzero to do a fast erase, where only the disc's headers are
2447    /// erased; zero to erase the entire disc.
2448    /// With DVD-RW, fast blanking yields media capable only of DAO.
2449    pub fn burn_disc_erase(drive: *mut burn_drive, fast: ::std::os::raw::c_int);
2450}
2451unsafe extern "C" {
2452    /// Format media for use with libburn. This currently applies to DVD-RW
2453    /// in state \"Sequential Recording\" (profile 0014h) which get formatted to
2454    /// state \"Restricted Overwrite\" (profile 0013h). DVD+RW can be \"de-iced\"
2455    /// by setting bit4 of flag. DVD-RAM and BD-RE may get formatted initially
2456    /// or re-formatted to adjust their Defect Management.
2457    /// This function usually returns while the drive is still in the process
2458    /// of formatting. The formatting is done, when burn_drive_get_status()
2459    /// returns BURN_DRIVE_IDLE. This may be immediately after return or may
2460    /// need several thousand seconds to occur.
2461    ///
2462    /// @param drive The drive with the disc to format.
2463    ///
2464    /// @param size The size in bytes to be used with the format command. It should
2465    /// be divisible by 32*1024. The effect of this parameter may
2466    /// depend on the media profile and on parameter flag.
2467    ///
2468    /// @param flag Bitfield for control purposes:
2469    /// bit0= after formatting, write the given number of zero-bytes
2470    /// to the media and eventually perform preliminary closing.
2471    /// bit1+2: size mode
2472    /// 0 = use parameter size as far as it makes sense
2473    /// 1 = insist in size 0 even if there is a better default known
2474    /// (on DVD-RAM or BD-R identical to size mode 0,
2475    /// i.e. they never get formatted with payload size 0)
2476    /// 2 = without bit7: format to maximum available size
2477    /// with bit7   : take size from indexed format descriptor
2478    /// 3 = without bit7: format to default size
2479    /// with bit7   : take size from indexed format descriptor
2480    /// bit3= -reserved-
2481    /// bit4= enforce re-format of (partly) formatted media
2482    /// bit5= try to disable eventual defect management
2483    /// bit6= try to avoid lengthy media certification
2484    /// bit7, bit8 to bit15 =
2485    /// bit7 enables MMC expert application mode (else libburn
2486    /// tries to choose a suitable format type):
2487    /// If it is set then bit8 to bit15 contain the index of
2488    /// the format to use. See burn_disc_get_formats(),
2489    /// burn_disc_get_format_descr().
2490    /// Acceptable types are: 0x00, 0x01, 0x10, 0x11, 0x13,
2491    /// 0x15, 0x26, 0x30, 0x31, 0x32.
2492    /// If bit7 is set, then bit4 is set automatically.
2493    /// bit16= enable POW on blank BD-R
2494    ///
2495    /// @since 0.3.0
2496    pub fn burn_disc_format(drive: *mut burn_drive, size: libc::off_t, flag: ::std::os::raw::c_int);
2497}
2498unsafe extern "C" {
2499    /// Inquire the formatting status, the associated sizes and the number of
2500    /// available formats.  The info is media specific and stems from MMC command
2501    /// 23h READ FORMAT CAPACITY. See mmc5r03c.pdf 6.24 for background details.
2502    /// Media type can be determined via burn_disc_get_profile().
2503    ///
2504    /// @param drive The drive with the disc to format.
2505    ///
2506    /// @param status The current formatting status of the inserted media.
2507    /// See BURN_FORMAT_IS_* macros. Note: \"unknown\" is the
2508    /// legal status for quick formatted, yet unwritten DVD-RW.
2509    ///
2510    /// @param size The size in bytes associated with status.
2511    /// unformatted: the maximum achievable size of the media
2512    /// formatted:   the currently formatted capacity
2513    /// unknown:     maximum capacity of drive or of media
2514    ///
2515    /// @param bl_sas Additional info \"Block Length/Spare Area Size\".
2516    /// Expected to be constantly 2048 for non-BD media.
2517    ///
2518    /// @param num_formats The number of available formats. To be used with
2519    /// burn_disc_get_format_descr() to obtain such a format
2520    /// and eventually with burn_disc_format() to select one.
2521    ///
2522    /// @return 1 reply is valid , <=0 failure
2523    ///
2524    /// @since 0.3.0
2525    pub fn burn_disc_get_formats(
2526        drive: *mut burn_drive,
2527        status: *mut ::std::os::raw::c_int,
2528        size: *mut libc::off_t,
2529        bl_sas: *mut ::std::os::raw::c_uint,
2530        num_formats: *mut ::std::os::raw::c_int,
2531    ) -> ::std::os::raw::c_int;
2532}
2533unsafe extern "C" {
2534    /// Inquire parameters of an available media format.
2535    ///
2536    /// @param drive The drive with the disc to format.
2537    ///
2538    /// @param index The index of the format item. Beginning with 0 up to reply
2539    /// parameter from burn_disc_get_formats() : num_formats - 1
2540    ///
2541    /// @param type  The format type.  See mmc5r03c.pdf, 6.5, 04h FORMAT UNIT.
2542    /// 0x00=full, 0x10=CD-RW/DVD-RW full, 0x11=CD-RW/DVD-RW grow,
2543    /// 0x15=DVD-RW quick, 0x13=DVD-RW quick grow,
2544    /// 0x26=DVD+RW background, 0x30=BD-RE with spare areas,
2545    /// 0x31=BD-RE without spare areas
2546    ///
2547    /// @param size  The maximum size in bytes achievable with this format.
2548    ///
2549    /// @param tdp   Type Dependent Parameter. See mmc5r03c.pdf.
2550    ///
2551    /// @return 1 reply is valid , <=0 failure
2552    ///
2553    /// @since 0.3.0
2554    pub fn burn_disc_get_format_descr(
2555        drive: *mut burn_drive,
2556        index: ::std::os::raw::c_int,
2557        type_: *mut ::std::os::raw::c_int,
2558        size: *mut libc::off_t,
2559        tdp: *mut ::std::os::raw::c_uint,
2560    ) -> ::std::os::raw::c_int;
2561}
2562unsafe extern "C" {
2563    /// Read a disc from the drive and write it to an fd pair. The drive must be
2564    /// grabbed successfully BEFORE calling this function. Always ensure that the
2565    /// drive reports a status of BURN_DISC_FULL before calling this function.
2566    ///
2567    /// @param drive The drive from which to read a disc.
2568    ///
2569    /// @param o The options for the read operation.
2570    pub fn burn_disc_read(drive: *mut burn_drive, o: *const burn_read_opts);
2571}
2572unsafe extern "C" {
2573    /// Examines a completed setup for burn_disc_write() whether it is permissible
2574    /// with drive and media. This function is called by burn_disc_write() but
2575    /// an application might be interested in this check in advance.
2576    ///
2577    /// @param o The options for the writing operation.
2578    ///
2579    /// @param disc The description of the disc to be created
2580    ///
2581    /// @param reasons Eventually returns a list of rejection reason statements
2582    ///
2583    /// @param silent 1= do not issue error messages , 0= report problems
2584    ///
2585    /// @return 1 ok, -1= no recordable media detected, 0= other failure
2586    ///
2587    /// @since 0.3.4
2588    pub fn burn_precheck_write(
2589        o: *mut burn_write_opts,
2590        disc: *mut burn_disc,
2591        reasons: *mut ::std::os::raw::c_char,
2592        silent: ::std::os::raw::c_int,
2593    ) -> ::std::os::raw::c_int;
2594}
2595unsafe extern "C" {
2596    /// Write a disc in the drive. The drive must be grabbed successfully before
2597    /// calling this function. Always ensure that the drive reports a status of
2598    /// BURN_DISC_BLANK ot BURN_DISC_APPENDABLE before calling this function.
2599    /// Note: write_type BURN_WRITE_SAO is currently not capable of writing a mix
2600    /// of data and audio tracks. You must use BURN_WRITE_TAO for such sessions.
2601    /// To be set by burn_write_opts_set_write_type().
2602    /// Note: This function is not suitable for overwriting data in the middle of
2603    /// a valid data area because it is allowed to append trailing data.
2604    /// For exact random access overwriting use burn_random_access_write().
2605    /// Note: After writing it is advised to give up the drive and to grab it again
2606    /// in order to learn about its view on the new media state.
2607    /// Note: Before mounting the written media it might be necessary to eject
2608    /// and reload in order to allow the operating system to notice the new
2609    /// media state.
2610    ///
2611    /// @param o The options for the writing operation.
2612    ///
2613    /// @param disc The struct burn_disc * that described the disc to be created
2614    pub fn burn_disc_write(o: *mut burn_write_opts, disc: *mut burn_disc);
2615}
2616unsafe extern "C" {
2617    /// Control stream recording during the write run and eventually set the start
2618    /// LBA for stream recording.
2619    /// Stream recording is set from struct burn_write_opts when the write run
2620    /// gets started. See burn_write_opts_set_stream_recording().
2621    /// The call described here can be used later to override this setting and
2622    /// to program automatic switching at a given LBA. It also affects subsequent
2623    /// calls to burn_random_access_write().
2624    ///
2625    /// @param drive    The drive which performs the write operation.
2626    ///
2627    /// @param recmode  -1= disable stream recording
2628    /// 0= leave setting as is
2629    /// 1= enable stream recording
2630    ///
2631    /// @param start    The LBA where actual stream recording shall start.
2632    /// (0 means unconditional stream recording)
2633    ///
2634    /// @param flag     Bitfield for control purposes (unused yet, submit 0).
2635    ///
2636    /// @return         1=success , <=0 failure
2637    ///
2638    /// @since 0.6.4
2639    pub fn burn_drive_set_stream_recording(
2640        drive: *mut burn_drive,
2641        recmode: ::std::os::raw::c_int,
2642        start: ::std::os::raw::c_int,
2643        flag: ::std::os::raw::c_int,
2644    ) -> ::std::os::raw::c_int;
2645}
2646unsafe extern "C" {
2647    /// Enable or disable use of the Immed bit with long running SCSI commands.
2648    /// If the Immed bit is used, then those SCSI commands end early and leave
2649    /// the drive in not-ready state. libburn then tries periodically whether
2650    /// the drive became ready again. Only then it assumes the command to be
2651    /// completely done.
2652    /// The default setting may depend on the operating system on which libburn
2653    /// was compiled.
2654    ///
2655    /// @param drive    The drive which will be affected.
2656    ///
2657    /// @param enable   1= use Immed bit.
2658    /// 0= use no Immed bit. Affected commands can last very long.
2659    ///
2660    /// @return         1=success , <=0 failure
2661    ///
2662    /// @since 1.4.6
2663    pub fn burn_drive_set_immed(
2664        drive: *mut burn_drive,
2665        enable: ::std::os::raw::c_int,
2666    ) -> ::std::os::raw::c_int;
2667}
2668unsafe extern "C" {
2669    /// Inquire the current setting of usage of the Immed bit. Either the still set
2670    /// system dependent default or the value set by call burn_drive_set_immed().
2671    ///
2672    /// @return         The current value.
2673    ///
2674    /// @since 1.4.6
2675    pub fn burn_drive_get_immed(drive: *mut burn_drive) -> ::std::os::raw::c_int;
2676}
2677unsafe extern "C" {
2678    /// Cancel an operation on a drive.
2679    /// This will only work when the drive's busy state is BURN_DRIVE_READING or
2680    /// BURN_DRIVE_WRITING.
2681    ///
2682    /// @param drive The drive on which to cancel the current operation.
2683    pub fn burn_drive_cancel(drive: *mut burn_drive);
2684}
2685unsafe extern "C" {
2686    /// Inquire whether the most recent asynchronous media job was successful.
2687    /// This applies to burn_disc_erase(), burn_disc_format(), burn_disc_write().
2688    /// Reasons for non-success may be: rejection of burn parameters, abort due to
2689    /// fatal errors during write, blank or format, a call to burn_drive_cancel()
2690    /// by the application thread.
2691    ///
2692    /// @param d The drive to inquire.
2693    ///
2694    /// @return 1=burn seems to have went well, 0=burn failed
2695    ///
2696    /// @since 0.2.6
2697    pub fn burn_drive_wrote_well(d: *mut burn_drive) -> ::std::os::raw::c_int;
2698}
2699unsafe extern "C" {
2700    /// Inquire whether a write error occurred which is suspected to have happened
2701    /// due to a false report about DVD-RW capability to be written in write type
2702    /// BURN_WRITE_TAO.
2703    ///
2704    /// @param d The drive to inquire.
2705    ///
2706    /// @return 1= it seems that BURN_WRITE_TAO on DVD-RW caused error,
2707    /// 0= it does not seem so
2708    ///
2709    /// @since 1.3.4
2710    pub fn burn_drive_was_feat21_failure(d: *mut burn_drive) -> ::std::os::raw::c_int;
2711}
2712unsafe extern "C" {
2713    /// Convert a minute-second-frame (MSF) value to sector count
2714    ///
2715    /// @param m Minute component
2716    ///
2717    /// @param s Second component
2718    ///
2719    /// @param f Frame component
2720    ///
2721    /// @return The sector count
2722    pub fn burn_msf_to_sectors(
2723        m: ::std::os::raw::c_int,
2724        s: ::std::os::raw::c_int,
2725        f: ::std::os::raw::c_int,
2726    ) -> ::std::os::raw::c_int;
2727}
2728unsafe extern "C" {
2729    /// Convert a sector count to minute-second-frame (MSF)
2730    ///
2731    /// @param sectors The sector count
2732    ///
2733    /// @param m Returns the minute component
2734    ///
2735    /// @param s Returns the second component
2736    ///
2737    /// @param f Returns the frame component
2738    pub fn burn_sectors_to_msf(
2739        sectors: ::std::os::raw::c_int,
2740        m: *mut ::std::os::raw::c_int,
2741        s: *mut ::std::os::raw::c_int,
2742        f: *mut ::std::os::raw::c_int,
2743    );
2744}
2745unsafe extern "C" {
2746    /// Convert a minute-second-frame (MSF) value to an lba
2747    ///
2748    /// @param m Minute component
2749    ///
2750    /// @param s Second component
2751    ///
2752    /// @param f Frame component
2753    ///
2754    /// @return The lba
2755    pub fn burn_msf_to_lba(
2756        m: ::std::os::raw::c_int,
2757        s: ::std::os::raw::c_int,
2758        f: ::std::os::raw::c_int,
2759    ) -> ::std::os::raw::c_int;
2760}
2761unsafe extern "C" {
2762    /// Convert an lba to minute-second-frame (MSF)
2763    ///
2764    /// @param lba The lba
2765    ///
2766    /// @param m Returns the minute component
2767    ///
2768    /// @param s Returns the second component
2769    ///
2770    /// @param f Returns the frame component
2771    pub fn burn_lba_to_msf(
2772        lba: ::std::os::raw::c_int,
2773        m: *mut ::std::os::raw::c_int,
2774        s: *mut ::std::os::raw::c_int,
2775        f: *mut ::std::os::raw::c_int,
2776    );
2777}
2778unsafe extern "C" {
2779    /// Create a new disc
2780    ///
2781    /// @return Pointer to a burn_disc object or NULL on failure.
2782    pub fn burn_disc_create() -> *mut burn_disc;
2783}
2784unsafe extern "C" {
2785    /// Delete disc and decrease the reference count on all its sessions
2786    ///
2787    /// @param d The disc to be freed
2788    pub fn burn_disc_free(d: *mut burn_disc);
2789}
2790unsafe extern "C" {
2791    /// Create a new session
2792    ///
2793    /// @return Pointer to a burn_session object or NULL on failure.
2794    pub fn burn_session_create() -> *mut burn_session;
2795}
2796unsafe extern "C" {
2797    /// Free a session (and decrease reference count on all tracks inside)
2798    ///
2799    /// @param s Session to be freed
2800    pub fn burn_session_free(s: *mut burn_session);
2801}
2802unsafe extern "C" {
2803    /// Add a session to a disc at a specific position, increasing the
2804    /// sessions's reference count.
2805    ///
2806    /// @param d Disc to add the session to
2807    ///
2808    /// @param s Session to add to the disc
2809    ///
2810    /// @param pos position to add at (BURN_POS_END is \"at the end\")
2811    ///
2812    /// @return 0 for failure, 1 for success
2813    pub fn burn_disc_add_session(
2814        d: *mut burn_disc,
2815        s: *mut burn_session,
2816        pos: ::std::os::raw::c_uint,
2817    ) -> ::std::os::raw::c_int;
2818}
2819unsafe extern "C" {
2820    /// Remove a session from a disc
2821    ///
2822    /// @param d Disc to remove session from
2823    ///
2824    /// @param s Session pointer to find and remove
2825    pub fn burn_disc_remove_session(
2826        d: *mut burn_disc,
2827        s: *mut burn_session,
2828    ) -> ::std::os::raw::c_int;
2829}
2830unsafe extern "C" {
2831    /// Read a CDRWIN cue sheet file and equip the session object by tracks and
2832    /// CD-TEXT according to the content of the file.
2833    /// For a description of CDRWIN file format see
2834    /// http://digitalx.org/cue-sheet/syntax/
2835    /// Fully supported commands are:
2836    /// CATALOG , CDTEXTFILE , FLAGS , INDEX , ISRC , PERFORMER ,
2837    /// POSTGAP , PREGAP , REM , SONGWRITER , TITLE
2838    /// Further supported commands introduced by cdrecord (usage like PERFORMER):
2839    /// ARRANGER , COMPOSER , MESSAGE
2840    /// Partly supported commands are:
2841    /// FILE which supports only types BINARY , MOTOROLA , WAVE
2842    /// TRACK which supports only datatypes AUDIO , MODE1/2048
2843    /// Unsupported types of FILE or TRACK lead to failure of the call.
2844    /// libburn does not yet support mixing of AUDIO and MODE1/2048. So this call
2845    /// will fail if such a mix is found.
2846    /// CD-TEXT information is allowed only if all tracks are of datatype AUDIO.
2847    /// Empty lines and lines which start by '#' are ignored.
2848    ///
2849    /// @param session     Session where to attach tracks. It must not yet have
2850    /// tracks or else this call will fail.
2851    ///
2852    /// @param path        Filesystem address of the CDRWIN cue sheet file.
2853    /// Normally with suffix .cue
2854    ///
2855    /// @param fifo_size   Number of bytes in fifo. This will be rounded up by
2856    /// the block size of the track mode. <= 0 means no fifo.
2857    ///
2858    /// @param fifo        Returns a reference to the burn_source object that
2859    /// was installed as fifo between FILE and the track
2860    /// burn sources. One may use this to inquire the fifo
2861    /// state. Dispose it by burn_source_free() when no longer
2862    /// needed. It is permissible to pass this parameter to
2863    /// libburn as NULL, in order to immediately drop ownership
2864    /// on the fifo.
2865    ///
2866    /// @param text_packs  Returns pre-formatted CD-TEXT packs resulting from
2867    /// cue sheet command CDTEXTFILE. To be used with call
2868    /// burn_write_opts_set_leadin_text().
2869    /// It is permissible to pass this parameter to libburn
2870    /// as NULL, in order to disable CDTEXTFILE.
2871    ///
2872    /// @param num_packs   Returns the number of 18 byte records in text_packs.
2873    ///
2874    /// @param flag        Bitfield for control purposes.
2875    /// bit0= Do not attach CD-TEXT information to session and
2876    /// tracks. Do not load text_packs.
2877    /// bit1= Do not use media catalog string of session or ISRC
2878    /// strings of tracks for writing to Q sub-channel.
2879    ///
2880    /// @return            > 0 indicates success, <= 0 indicates failure
2881    ///
2882    /// @since 1.2.0
2883    pub fn burn_session_by_cue_file(
2884        session: *mut burn_session,
2885        path: *mut ::std::os::raw::c_char,
2886        fifo_size: ::std::os::raw::c_int,
2887        fifo: *mut *mut burn_source,
2888        text_packs: *mut *mut ::std::os::raw::c_uchar,
2889        num_packs: *mut ::std::os::raw::c_int,
2890        flag: ::std::os::raw::c_int,
2891    ) -> ::std::os::raw::c_int;
2892}
2893unsafe extern "C" {
2894    /// Create a track
2895    pub fn burn_track_create() -> *mut burn_track;
2896}
2897unsafe extern "C" {
2898    /// Free a track
2899    ///
2900    /// @param t Track to free
2901    pub fn burn_track_free(t: *mut burn_track);
2902}
2903unsafe extern "C" {
2904    /// Add a track to a session at specified position
2905    ///
2906    /// @param s Session to add to
2907    ///
2908    /// @param t Track to insert in session
2909    ///
2910    /// @param pos position to add at (BURN_POS_END is \"at the end\")
2911    ///
2912    /// @return 0 for failure, 1 for success
2913    pub fn burn_session_add_track(
2914        s: *mut burn_session,
2915        t: *mut burn_track,
2916        pos: ::std::os::raw::c_uint,
2917    ) -> ::std::os::raw::c_int;
2918}
2919unsafe extern "C" {
2920    /// Remove a track from a session
2921    ///
2922    /// @param s Session to remove track from
2923    ///
2924    /// @param t Track pointer to find and remove
2925    ///
2926    /// @return 0 for failure, 1 for success
2927    pub fn burn_session_remove_track(
2928        s: *mut burn_session,
2929        t: *mut burn_track,
2930    ) -> ::std::os::raw::c_int;
2931}
2932unsafe extern "C" {
2933    /// Set the number which shall be written as CD track number with the first
2934    /// track of the session. The following tracks will then get written with
2935    /// consecutive CD track numbers. The resulting number of the last track
2936    /// must not exceed 99. The lowest possible start number is 1, which is also
2937    /// the default. This setting applies only to CD SAO writing.
2938    ///
2939    /// @param session   The session to be manipulated
2940    ///
2941    /// @param tno       A number between 1 and 99
2942    ///
2943    /// @param flag      Bitfield for control purposes. Unused yet. Submit 0.
2944    ///
2945    /// @return          > 0 indicates success, <= 0 indicates failure
2946    ///
2947    /// @since 1.2.0
2948    pub fn burn_session_set_start_tno(
2949        session: *mut burn_session,
2950        tno: ::std::os::raw::c_int,
2951        flag: ::std::os::raw::c_int,
2952    ) -> ::std::os::raw::c_int;
2953}
2954unsafe extern "C" {
2955    /// Inquire the CD track start number, as set by default or by
2956    /// burn_session_set_start_tno().
2957    ///
2958    /// @param session   The session to be inquired
2959    ///
2960    /// @param flag      Bitfield for control purposes. Unused yet. Submit 0.
2961    ///
2962    /// @return          > 0 is the currently set CD track start number
2963    /// <= 0 indicates failure
2964    ///
2965    /// @since 1.2.0
2966    pub fn burn_session_get_start_tno(
2967        session: *mut burn_session,
2968        flag: ::std::os::raw::c_int,
2969    ) -> ::std::os::raw::c_int;
2970}
2971unsafe extern "C" {
2972    /// Set the Character Codes, the Copyright bytes, and the Language Codes
2973    /// for CD-TEXT blocks 0 to 7. They will be used in the block summaries
2974    /// of text packs which get generated from text or binary data submitted
2975    /// by burn_session_set_cdtext() and burn_track_set_cdtext().
2976    /// Character Code value can be
2977    /// 0x00 = ISO-8859-1
2978    /// 0x01 = 7 bit ASCII
2979    /// 0x80 = MS-JIS (japanesei Kanji, double byte characters)
2980    /// Copyright byte value can be
2981    /// 0x00 = not copyrighted
2982    /// 0x03 = copyrighted
2983    /// Language Code value will typically be 0x09 = English or 0x69 = Japanese.
2984    /// See below macros BURN_CDTEXT_LANGUAGES_0X00 and BURN_CDTEXT_LANGUAGES_0X45,
2985    /// but be aware that many of these codes have never been seen on CD, and that
2986    /// many of them do not have a character representation among the above
2987    /// Character Codes.
2988    /// Default is 0x09 = English for block 0 and 0x00 = Unknown for block 1 to 7.
2989    /// Copyright and Character Code are 0x00 for all blocks by default.
2990    /// See also file doc/cdtext.txt, \"Format of a CD-TEXT packs array\",
2991    /// \"Pack type 0x8f\".
2992    ///
2993    /// Parameter value -1 leaves the current setting of the session parameter
2994    /// unchanged.
2995    ///
2996    /// @param s            Session where to change settings
2997    ///
2998    /// @param char_codes   Character Codes for block 0 to 7
2999    ///
3000    /// @param copyrights   Copyright bytes for block 0 to 7
3001    ///
3002    /// @param languages    Language Codes for block 0 to 7
3003    ///
3004    /// @param flag         Bitfiled for control purposes. Unused yet. Submit 0.
3005    ///
3006    /// @return             <=0 failure, > 0 success
3007    ///
3008    /// @since 1.2.0
3009    pub fn burn_session_set_cdtext_par(
3010        s: *mut burn_session,
3011        char_codes: *mut ::std::os::raw::c_int,
3012        copyrights: *mut ::std::os::raw::c_int,
3013        languages: *mut ::std::os::raw::c_int,
3014        flag: ::std::os::raw::c_int,
3015    ) -> ::std::os::raw::c_int;
3016}
3017unsafe extern "C" {
3018    /// Obtain the current settings as of burn_session_set_cdtext_par()
3019    ///
3020    /// @param s            Session which to inquire
3021    ///
3022    /// @param char_codes   Will return Character Codes for block 0 to 7
3023    ///
3024    /// @param copyrights   Will return Copyright bytes for block 0 to 7
3025    ///
3026    /// @param block_languages  Will return Language Codes for block 0 to 7
3027    ///
3028    /// @param flag         Bitfiled for control purposes. Unused yet. Submit 0.
3029    ///
3030    /// @return             <=0 failure, reply invalid, > 0 success, reply valid
3031    ///
3032    /// @since 1.2.0
3033    pub fn burn_session_get_cdtext_par(
3034        s: *mut burn_session,
3035        char_codes: *mut ::std::os::raw::c_int,
3036        copyrights: *mut ::std::os::raw::c_int,
3037        block_languages: *mut ::std::os::raw::c_int,
3038        flag: ::std::os::raw::c_int,
3039    ) -> ::std::os::raw::c_int;
3040}
3041unsafe extern "C" {
3042    /// Attach text or binary data as CD-TEXT attributes to a session.
3043    /// They can be used to generate CD-TEXT packs by burn_cdtext_from_session()
3044    /// or to write CD-TEXT packs into the lead-in of a CD SAO session.
3045    /// The latter happens only if no array of CD-TEXT packs is attached to
3046    /// the write options by burn_write_opts_set_leadin_text().
3047    /// For details of the CD-TEXT format and of the payload content, see file
3048    /// doc/cdtext.txt .
3049    ///
3050    /// @param s            Session where to attach CD-TEXT attribute
3051    ///
3052    /// @param block        Number of the language block in which the attribute
3053    /// shall appear. Possible values: 0 to 7.
3054    ///
3055    /// @param pack_type    Pack type number. 0x80 to 0x8e. Used if pack_type_name
3056    /// is NULL or empty text. Else submit 0 and a name.
3057    /// Pack type 0x8f is generated automatically and may not
3058    /// be set by applications.
3059    ///
3060    /// @param pack_type_name  The pack type by name. Defined names are:
3061    /// 0x80 = \"TITLE\"         0x81 = \"PERFORMER\"
3062    /// 0x82 = \"SONGWRITER\"    0x83 = \"COMPOSER\"
3063    /// 0x84 = \"ARRANGER\"      0x85 = \"MESSAGE\"
3064    /// 0x86 = \"DISCID\"        0x87 = \"GENRE\"
3065    /// 0x88 = \"TOC\"           0x89 = \"TOC2\"
3066    /// 0x8d = \"CLOSED\"        0x8e = \"UPC_ISRC\"
3067    /// Names are recognized uppercase and lowercase.
3068    ///
3069    /// @param payload      Text or binary bytes. The data will be copied to
3070    /// session-internal memory.
3071    /// Pack types 0x80 to 0x85 contain 0-terminated cleartext
3072    /// encoded according to the block's Character Code.
3073    /// If double byte characters are used, then two 0-bytes
3074    /// terminate the cleartext.
3075    /// Pack type 0x86 is 0-terminated ASCII cleartext.
3076    /// Pack type 0x87 consists of two byte big-endian
3077    /// Genre code (see below BURN_CDTEXT_GENRE_LIST), and
3078    /// 0-terminated ASCII cleartext of genre description.
3079    /// Pack type 0x88 mirrors the session table-of-content.
3080    /// Pack type 0x89 is not understood yet.
3081    /// Pack types 0x8a to 0x8c are reserved.
3082    /// Pack type 0x8d contains ISO-8859-1 cleartext which is
3083    /// not to be shown by commercial audio CD players.
3084    /// Pack type 0x8e is ASCII cleartext with UPC/EAN code.
3085    ///
3086    /// @param length       Number of bytes in payload. Including terminating
3087    /// 0-bytes.
3088    ///
3089    /// @param flag         Bitfield for control purposes.
3090    /// bit0= payload contains double byte characters
3091    /// (with character code 0x80 MS-JIS japanese Kanji)
3092    ///
3093    /// @return             > 0 indicates success , <= 0 is failure
3094    ///
3095    /// @since 1.2.0
3096    pub fn burn_session_set_cdtext(
3097        s: *mut burn_session,
3098        block: ::std::os::raw::c_int,
3099        pack_type: ::std::os::raw::c_int,
3100        pack_type_name: *mut ::std::os::raw::c_char,
3101        payload: *mut ::std::os::raw::c_uchar,
3102        length: ::std::os::raw::c_int,
3103        flag: ::std::os::raw::c_int,
3104    ) -> ::std::os::raw::c_int;
3105}
3106unsafe extern "C" {
3107    /// Obtain a CD-TEXT attribute that was set by burn_session_set_cdtext()
3108    ///
3109    /// @param s            Session to inquire
3110    ///
3111    /// @param block        Number of the language block to inquire.
3112    ///
3113    /// @param pack_type    Pack type number to inquire. Used if pack_type_name
3114    /// is NULL or empty text. Else submit 0 and a name.
3115    /// Pack type 0x8f is generated automatically and may not
3116    /// be inquire in advance. Use burn_cdtext_from_session()
3117    /// to generate all packs including type 0x8f packs.
3118    ///
3119    /// @param pack_type_name  The pack type by name.
3120    /// See above burn_session_set_cdtext().
3121    ///
3122    /// @param payload      Will return a pointer to text or binary bytes.
3123    /// Not a copy of data. Do not free() this address.
3124    /// If no text attribute is attached for pack type and
3125    /// block, then payload is returned as NULL. The return
3126    /// value will not indicate error in this case.
3127    ///
3128    /// @param length       Will return the number of bytes pointed to by payload.
3129    /// Including terminating 0-bytes.
3130    ///
3131    /// @param flag         Bitfield for control purposes. Unused yet. Submit 0.
3132    ///
3133    /// @return             1 single byte char, 2 double byte char, <=0 error
3134    ///
3135    /// @since 1.2.0
3136    pub fn burn_session_get_cdtext(
3137        s: *mut burn_session,
3138        block: ::std::os::raw::c_int,
3139        pack_type: ::std::os::raw::c_int,
3140        pack_type_name: *mut ::std::os::raw::c_char,
3141        payload: *mut *mut ::std::os::raw::c_uchar,
3142        length: *mut ::std::os::raw::c_int,
3143        flag: ::std::os::raw::c_int,
3144    ) -> ::std::os::raw::c_int;
3145}
3146unsafe extern "C" {
3147    /// Read a Sony CD-TEXT Input Sheet Version 0.7T file and attach its text
3148    /// attributes to the given session and its tracks for the given CD-TEXT
3149    /// block number. This overrides previous settings made by
3150    /// burn_session_set_cdtext(), burn_track_set_cdtext(), burn_track_set_isrc(),
3151    /// burn_session_set_start_tno(). It can later be overridden by said function
3152    /// calls.
3153    /// The media catalog number from purpose specifier \"UPC / EAN\" gets into
3154    /// effect only if burn_write_opts_set_has_mediacatalog() is set to 0.
3155    /// The format of a v07t sheet file is documented in doc/cdtext.txt.
3156    ///
3157    /// @param session     Session where to attach CD-TEXT attributes
3158    ///
3159    /// @param path        Local filesystem address of the sheet file which
3160    /// shall be read and interpreted.
3161    ///
3162    /// @param block       Number of the language block in which the attributes
3163    /// shall appear. Possible values: 0 to 7.
3164    ///
3165    /// @param flag        Bitfield for control purposes.
3166    /// bit0= Permission to read multiple blocks from the
3167    /// given sheet file. Each block is supposed to begin
3168    /// by a line \"Input Sheet Version = 0.7T\". Therefore
3169    /// this permission is only valid if the input file
3170    /// begins by such a line.
3171    ///
3172    /// @since 1.3.2
3173    /// bit1= Do not use media catalog string of session or ISRC
3174    /// strings of tracks for writing to Q sub-channel.
3175    ///
3176    /// @since 1.2.0
3177    ///
3178    /// @return              > 0 indicates success and the number of interpreted
3179    /// blocks (1 if not flag bit0 is set).
3180    /// <= 0 indicates failure
3181    ///
3182    /// @since 1.2.0
3183    pub fn burn_session_input_sheet_v07t(
3184        session: *mut burn_session,
3185        path: *mut ::std::os::raw::c_char,
3186        block: ::std::os::raw::c_int,
3187        flag: ::std::os::raw::c_int,
3188    ) -> ::std::os::raw::c_int;
3189}
3190unsafe extern "C" {
3191    /// Produce an array of CD-TEXT packs that could be submitted to
3192    /// burn_write_opts_set_leadin_text(), or stored as *.cdt file,
3193    /// or submitted to burn_make_input_sheet_v07t().
3194    /// For a description of the format of the array, see file doc/cdtext.txt.
3195    /// The input data stem from burn_session_set_cdtext_par(),
3196    /// burn_session_set_cdtext(), and burn_track_set_cdtext().
3197    ///
3198    /// @param s            Session from which to produce CD-TEXT packs.
3199    ///
3200    /// @param text_packs   Will return the buffer with the CD-TEXT packs.
3201    /// Dispose by free() when no longer needed.
3202    ///
3203    /// @param num_packs    Will return the number of 18 byte text packs.
3204    ///
3205    /// @param flag         Bitfield for control purposes.
3206    /// bit0= do not return generated CD-TEXT packs,
3207    /// but check whether production would work and
3208    /// indicate the number of packs by the call return
3209    /// value. This happens also if
3210    /// (text_packs == NULL || num_packs == NULL).
3211    ///
3212    /// @return             Without flag bit0: > 0 is success, <= 0 failure
3213    /// With flag bit0: > 0 is number of packs,
3214    /// 0 means no packs will be generated,
3215    /// < 0 means failure
3216    ///
3217    /// @since 1.2.0
3218    pub fn burn_cdtext_from_session(
3219        s: *mut burn_session,
3220        text_packs: *mut *mut ::std::os::raw::c_uchar,
3221        num_packs: *mut ::std::os::raw::c_int,
3222        flag: ::std::os::raw::c_int,
3223    ) -> ::std::os::raw::c_int;
3224}
3225unsafe extern "C" {
3226    /// Convert an array of CD-TEXT packs into the text format of
3227    /// Sony CD-TEXT Input Sheet Version 0.7T .
3228    ///
3229    ///
3230    /// @param text_packs  Array of bytes which form CD-TEXT packs of 18 bytes
3231    /// each. For a description of the format of the array,
3232    /// see file doc/cdtext.txt.
3233    /// No header of 4 bytes must be prepended which would
3234    /// tell the number of pack bytes + 2.
3235    /// This parameter may be NULL if the currently attached
3236    /// array of packs shall be removed.
3237    ///
3238    /// @param num_packs   The number of 18 byte packs in text_packs.
3239    ///
3240    /// @param start_tno   The start number of track counting, if known from
3241    /// CD table-of-content or other sources.
3242    /// Submit 0 to enable the attempt to read it and the
3243    /// track_count from pack type 0x8f.
3244    ///
3245    /// @param track_count The number of tracks, if known from CD table-of-content
3246    /// or orther sources.
3247    ///
3248    /// @param result      Will return the buffer with Sheet text.
3249    /// Dispose by free() when no longer needed.
3250    /// It will be filled by the text for the v07t sheet file
3251    /// plus a trailing 0-byte. (Be aware that double-byte
3252    /// characters might contain 0-bytes, too.)
3253    /// Each CD-TEXT language block starts by the line
3254    /// \"Input Sheet Version = 0.7T\"
3255    /// and a \"Remarks\" line that tells the block number.
3256    ///
3257    /// @param char_code   Returns the character code of the pack array:
3258    /// 0x00 = ISO-8859-1
3259    /// 0x01 = 7 bit ASCII
3260    /// 0x80 = MS-JIS (japanese Kanji, double byte characters)
3261    /// The presence of a code value that is not in this list
3262    /// will cause this function to fail.
3263    ///
3264    /// @param flag        Bitfield for control purposes. Unused yet. Submit 0.
3265    ///
3266    /// @return            > 0 tells the number of valid text bytes in result.
3267    /// This does not include the trailing 0-byte.
3268    /// <= 0 indicates failure.
3269    ///
3270    /// @since 1.3.2
3271    pub fn burn_make_input_sheet_v07t(
3272        text_packs: *mut ::std::os::raw::c_uchar,
3273        num_packs: ::std::os::raw::c_int,
3274        start_tno: ::std::os::raw::c_int,
3275        track_count: ::std::os::raw::c_int,
3276        result: *mut *mut ::std::os::raw::c_char,
3277        char_code: *mut ::std::os::raw::c_int,
3278        flag: ::std::os::raw::c_int,
3279    ) -> ::std::os::raw::c_int;
3280}
3281unsafe extern "C" {
3282    /// Remove all CD-TEXT attributes of the given block from the session.
3283    /// They were attached by burn_session_set_cdtext().
3284    ///
3285    /// @param s            Session where to remove the CD-TEXT attribute
3286    ///
3287    /// @param block        Number of the language block in which the attribute
3288    /// shall appear. Possible values: 0 to 7.
3289    /// -1 causes text packs of all blocks to be removed.
3290    ///
3291    /// @return             > 0 is success, <= 0 failure
3292    ///
3293    /// @since 1.2.0
3294    pub fn burn_session_dispose_cdtext(
3295        s: *mut burn_session,
3296        block: ::std::os::raw::c_int,
3297    ) -> ::std::os::raw::c_int;
3298}
3299unsafe extern "C" {
3300    /// Read an array of CD-TEXT packs from a file. This array should be suitable
3301    /// for burn_write_opts_set_leadin_text().
3302    /// The function tolerates and removes 4-byte headers as produced by
3303    /// cdrecord -vv -toc, if this header tells the correct number of bytes which
3304    /// matches the file size. If no 4-byte header is present, then the function
3305    /// tolerates and removes a trailing 0-byte as of Sony specs.
3306    ///
3307    /// @param path         Filesystem address of the CD-TEXT pack file.
3308    /// Normally with suffix .cdt or .dat
3309    ///
3310    /// @param text_packs   Will return the buffer with the CD-TEXT packs.
3311    /// Dispose by free() when no longer needed.
3312    ///
3313    /// @param num_packs    Will return the number of 18 byte text packs.
3314    ///
3315    /// @param flag         Bitfield for control purposes. Unused yet.Submit 0.
3316    ///
3317    /// @return             0 is success, <= 0 failure
3318    ///
3319    /// @since 1.2.0
3320    pub fn burn_cdtext_from_packfile(
3321        path: *mut ::std::os::raw::c_char,
3322        text_packs: *mut *mut ::std::os::raw::c_uchar,
3323        num_packs: *mut ::std::os::raw::c_int,
3324        flag: ::std::os::raw::c_int,
3325    ) -> ::std::os::raw::c_int;
3326}
3327unsafe extern "C" {
3328    /// Define the data in a track
3329    ///
3330    /// @param t the track to define
3331    ///
3332    /// @param offset The lib will write this many 0s before start of data
3333    ///
3334    /// @param tail The number of extra 0s to write after data
3335    ///
3336    /// @param pad 1 means the lib should pad the last sector with 0s if the
3337    /// track isn't exactly sector sized.  (otherwise the lib will
3338    /// begin reading from the next track)
3339    ///
3340    /// @param mode data format (bitfield)
3341    pub fn burn_track_define_data(
3342        t: *mut burn_track,
3343        offset: ::std::os::raw::c_int,
3344        tail: ::std::os::raw::c_int,
3345        pad: ::std::os::raw::c_int,
3346        mode: ::std::os::raw::c_int,
3347    );
3348}
3349unsafe extern "C" {
3350    /// Attach text or binary data as CD-TEXT attributes to a track.
3351    /// The payload will be used to generate CD-TEXT packs by
3352    /// burn_cdtext_from_session() or to write CD-TEXT packs into the lead-in
3353    /// of a CD SAO session. This happens if the CD-TEXT attribute of the session
3354    /// gets generated, which has the same block number and pack type. In this
3355    /// case, each track should have such a CD-TEXT attribute, too.
3356    /// See burn_session_set_cdtext().
3357    /// Be cautious not to exceed the maximum number of 253 payload packs per
3358    /// language block. Use burn_cdtext_from_session() to learn whether a valid
3359    /// array of CD-TEXT packs can be generated from your attributes.
3360    ///
3361    /// @param t            Track where to attach CD-TEXT attribute.
3362    ///
3363    /// @param block        Number of the language block in which the attribute
3364    /// shall appear. Possible values: 0 to 7.
3365    ///
3366    /// @param pack_type    Pack type number. 0x80 to 0x85 or 0x8e. Used if
3367    /// pack_type_name is NULL or empty text. Else submit 0
3368    /// and a name.
3369    ///
3370    /// @param pack_type_name  The pack type by name. Applicable names are:
3371    /// 0x80 = \"TITLE\"         0x81 = \"PERFORMER\"
3372    /// 0x82 = \"SONGWRITER\"    0x83 = \"COMPOSER\"
3373    /// 0x84 = \"ARRANGER\"      0x85 = \"MESSAGE\"
3374    /// 0x8e = \"UPC_ISRC\"
3375    ///
3376    /// @param payload      0-terminated cleartext. If double byte characters
3377    /// are used, then two 0-bytes terminate the cleartext.
3378    ///
3379    /// @param length       Number of bytes in payload. Including terminating
3380    /// 0-bytes.
3381    ///
3382    /// @param flag         Bitfield for control purposes.
3383    /// bit0= payload contains double byte characters
3384    /// (with character code 0x80 MS-JIS japanese Kanji)
3385    ///
3386    /// @return             > 0 indicates success , <= 0 is failure
3387    ///
3388    /// @since 1.2.0
3389    pub fn burn_track_set_cdtext(
3390        t: *mut burn_track,
3391        block: ::std::os::raw::c_int,
3392        pack_type: ::std::os::raw::c_int,
3393        pack_type_name: *mut ::std::os::raw::c_char,
3394        payload: *mut ::std::os::raw::c_uchar,
3395        length: ::std::os::raw::c_int,
3396        flag: ::std::os::raw::c_int,
3397    ) -> ::std::os::raw::c_int;
3398}
3399unsafe extern "C" {
3400    /// Obtain a CD-TEXT attribute that was set by burn_track_set_cdtext().
3401    ///
3402    /// @param t            Track to inquire
3403    ///
3404    /// @param block        Number of the language block to inquire.
3405    ///
3406    /// @param pack_type    Pack type number to inquire. Used if pack_type_name
3407    /// is NULL or empty text. Else submit 0 and a name.
3408    ///
3409    /// @param pack_type_name  The pack type by name.
3410    /// See above burn_track_set_cdtext().
3411    ///
3412    /// @param payload      Will return a pointer to text bytes.
3413    /// Not a copy of data. Do not free() this address.
3414    /// If no text attribute is attached for pack type and
3415    /// block, then payload is returned as NULL. The return
3416    /// value will not indicate error in this case.
3417    ///
3418    /// @param length       Will return the number of bytes pointed to by payload.
3419    /// Including terminating 0-bytes.
3420    ///
3421    /// @param flag         Bitfield for control purposes. Unused yet. Submit 0.
3422    ///
3423    /// @return             1=single byte char , 2= double byte char , <=0 error
3424    ///
3425    /// @since 1.2.0
3426    pub fn burn_track_get_cdtext(
3427        t: *mut burn_track,
3428        block: ::std::os::raw::c_int,
3429        pack_type: ::std::os::raw::c_int,
3430        pack_type_name: *mut ::std::os::raw::c_char,
3431        payload: *mut *mut ::std::os::raw::c_uchar,
3432        length: *mut ::std::os::raw::c_int,
3433        flag: ::std::os::raw::c_int,
3434    ) -> ::std::os::raw::c_int;
3435}
3436unsafe extern "C" {
3437    /// Remove all CD-TEXT attributes of the given block from the track.
3438    /// They were attached by burn_track_set_cdtext().
3439    ///
3440    /// @param t            Track where to remove the CD-TEXT attribute.
3441    ///
3442    /// @param block        Number of the language block in which the attribute
3443    /// shall appear. Possible values: 0 to 7.
3444    /// -1 causes text packs of all blocks to be removed.
3445    ///
3446    /// @return             > 0 is success, <= 0 failure
3447    ///
3448    /// @since 1.2.0
3449    pub fn burn_track_dispose_cdtext(
3450        t: *mut burn_track,
3451        block: ::std::os::raw::c_int,
3452    ) -> ::std::os::raw::c_int;
3453}
3454unsafe extern "C" {
3455    /// Activates CD XA compatibility modes.
3456    /// libburn currently writes data only in CD mode 1. Some programs insist in
3457    /// sending data with additional management bytes. These bytes have to be
3458    /// stripped in order to make the input suitable for BURN_MODE1.
3459    ///
3460    /// @param t     The track to manipulate
3461    ///
3462    /// @param value 0= no conversion
3463    /// 1= strip 8 byte sector headers of CD-ROM XA mode 2 form 1
3464    /// see MMC-5 4.2.3.8.5.3 Block Format for Mode 2 form 1 Data
3465    /// all other values are reserved
3466    ///
3467    /// @return 1=success , 0=unacceptable value
3468    ///
3469    /// @since 0.7.2
3470    pub fn burn_track_set_cdxa_conv(
3471        t: *mut burn_track,
3472        value: ::std::os::raw::c_int,
3473    ) -> ::std::os::raw::c_int;
3474}
3475unsafe extern "C" {
3476    /// Set the ISRC details for a track. When writing to CD media, ISRC will get
3477    /// written into the Q sub-channel.
3478    ///
3479    /// @param t The track to change
3480    ///
3481    /// @param country the 2 char country code. Each character must be
3482    /// only numbers or letters.
3483    ///
3484    /// @param owner 3 char owner code. Each character must be only numbers
3485    /// or letters.
3486    ///
3487    /// @param year 2 digit year. A number in 0-99 (Yep, not Y2K friendly).
3488    ///
3489    /// @param serial 5 digit serial number. A number in 0-99999.
3490    pub fn burn_track_set_isrc(
3491        t: *mut burn_track,
3492        country: *mut ::std::os::raw::c_char,
3493        owner: *mut ::std::os::raw::c_char,
3494        year: ::std::os::raw::c_uchar,
3495        serial: ::std::os::raw::c_uint,
3496    );
3497}
3498unsafe extern "C" {
3499    /// Set the composed ISRC string for a track. This is an alternative to
3500    /// burn_track_set_isrc().
3501    ///
3502    /// @param t      The track to be manipulated
3503    ///
3504    /// @param isrc   12 characters which are composed from ISRC details.
3505    /// Format is CCOOOYYSSSSS, terminated by a 0-byte:
3506    /// Country, Owner, Year(decimal digits), Serial(decimal digits).
3507    ///
3508    /// @param flag   Bitfield for control purposes. Unused yet. Submit 0.
3509    ///
3510    /// @return       > 0 indicates success, <= 0 means failure
3511    ///
3512    /// @since 1.2.0
3513    pub fn burn_track_set_isrc_string(
3514        t: *mut burn_track,
3515        isrc: *mut ::std::os::raw::c_char,
3516        flag: ::std::os::raw::c_int,
3517    ) -> ::std::os::raw::c_int;
3518}
3519unsafe extern "C" {
3520    /// Disable ISRC parameters for a track
3521    ///
3522    /// @param t The track to change
3523    pub fn burn_track_clear_isrc(t: *mut burn_track);
3524}
3525unsafe extern "C" {
3526    /// Define an index start address within a track. The index numbers inside a
3527    /// track have to form sequence starting at 0 or 1 with no gaps up to the
3528    /// highest number used. They affect only writing of CD SAO sessions.
3529    /// The first index start address of a track must be 0.
3530    /// Blocks between index 0 and index 1 are considered to be located before the
3531    /// track start as of the table-of-content.
3532    ///
3533    /// @param t             The track to be manipulated
3534    ///
3535    /// @param index_number  A number between 0 and 99
3536    ///
3537    /// @param relative_lba  The start address relative to the start of the
3538    /// burn_source of the track. It will get mapped to the
3539    /// appropriate absolute block address.
3540    ///
3541    /// @param flag          Bitfield for control purposes. Unused yet. Submit 0.
3542    ///
3543    /// @return              > 0 indicates success, <= 0 means failure
3544    ///
3545    /// @since 1.2.0
3546    pub fn burn_track_set_index(
3547        t: *mut burn_track,
3548        index_number: ::std::os::raw::c_int,
3549        relative_lba: ::std::os::raw::c_uint,
3550        flag: ::std::os::raw::c_int,
3551    ) -> ::std::os::raw::c_int;
3552}
3553unsafe extern "C" {
3554    /// Remove all index start addresses and reset to the default indexing of
3555    /// CD SAO sessions. This means index 0 of track 1 reaches from LBA -150
3556    /// to LBA -1. Index 1 of track 1 reaches from LBA 0 to track end. Index 1
3557    /// of track 2 follows immediately. The same happens for all further tracks
3558    /// after the end of their predecessor.
3559    ///
3560    /// @param t             The track to be manipulated
3561    ///
3562    /// @param flag          Bitfield for control purposes. Unused yet. Submit 0.
3563    ///
3564    /// @return              > 0 indicates success, <= 0 means failure
3565    ///
3566    /// @since 1.2.0
3567    pub fn burn_track_clear_indice(
3568        t: *mut burn_track,
3569        flag: ::std::os::raw::c_int,
3570    ) -> ::std::os::raw::c_int;
3571}
3572unsafe extern "C" {
3573    /// Define whether a pre-gap shall be written before the track and how many
3574    /// sectors this pre-gap shall have. A pre-gap is written in the range of track
3575    /// index 0 and contains zeros (audio silence). No bytes from the track source
3576    /// will be read for writing the pre-gap.
3577    /// This setting affects only CD SAO write runs.
3578    /// The first track automatically gets a pre-gap of at least 150 sectors. Its
3579    /// size may be enlarged by this call. Further pre-gaps are demanded by MMC
3580    /// for tracks which follow tracks of a different mode. (But Mode mixing in
3581    /// CD SAO sessions is currently not supported by libburn.)
3582    ///
3583    /// @param t             The track to change
3584    ///
3585    /// @param size          Number of sectors in the pre-gap.
3586    /// -1 disables pre-gap, except for the first track.
3587    /// libburn allows 0, but MMC does not propose this.
3588    ///
3589    /// @param flag          Bitfield for control purposes. Unused yet. Submit 0.
3590    ///
3591    /// @return              > 0 indicates success, <= 0 means failure
3592    ///
3593    /// @since 1.2.0
3594    pub fn burn_track_set_pregap_size(
3595        t: *mut burn_track,
3596        size: ::std::os::raw::c_int,
3597        flag: ::std::os::raw::c_int,
3598    ) -> ::std::os::raw::c_int;
3599}
3600unsafe extern "C" {
3601    /// Define whether a post-gap shall be written at the end of the track and
3602    /// how many sectors this gap shall have. A post-gap occupies the range of
3603    /// an additional index of the track. It contains zeros. No bytes from the
3604    /// track source will be read for writing the post-gap.
3605    /// This setting affects only CD SAO write runs.
3606    /// MMC prescribes to add a post-gap to a data track which is followed by
3607    /// a non-data track. (But libburn does not yet support mixed mode CD SAO
3608    /// sessions.)
3609    ///
3610    /// @param t             The track to change
3611    ///
3612    /// @param size          Number of sectors in the post-gap.
3613    /// -1 disables post-gap.
3614    /// libburn allows 0, but MMC does not propose this.
3615    ///
3616    /// @param flag          Bitfield for control purposes. Unused yet. Submit 0.
3617    ///
3618    /// @return              > 0 indicates success, <= 0 means failure
3619    ///
3620    /// @since 1.2.0
3621    pub fn burn_track_set_postgap_size(
3622        t: *mut burn_track,
3623        size: ::std::os::raw::c_int,
3624        flag: ::std::os::raw::c_int,
3625    ) -> ::std::os::raw::c_int;
3626}
3627unsafe extern "C" {
3628    /// Define whether a track shall swap bytes of its input stream.
3629    ///
3630    /// @param t The track to change
3631    ///
3632    /// @param swap_source_bytes 0=do not swap, 1=swap byte pairs
3633    ///
3634    /// @return 1=success , 0=unacceptable value
3635    ///
3636    /// @since 0.2.6
3637    pub fn burn_track_set_byte_swap(
3638        t: *mut burn_track,
3639        swap_source_bytes: ::std::os::raw::c_int,
3640    ) -> ::std::os::raw::c_int;
3641}
3642unsafe extern "C" {
3643    /// Hide the first track in the \"pre gap\" of the disc
3644    ///
3645    /// @param s session to change
3646    ///
3647    /// @param onoff 1 to enable hiding, 0 to disable
3648    pub fn burn_session_hide_first_track(s: *mut burn_session, onoff: ::std::os::raw::c_int);
3649}
3650unsafe extern "C" {
3651    /// Get the drive's disc struct - free when done
3652    ///
3653    /// @param d drive to query
3654    ///
3655    /// @return the disc struct or NULL on failure
3656    pub fn burn_drive_get_disc(d: *mut burn_drive) -> *mut burn_disc;
3657}
3658unsafe extern "C" {
3659    /// Set the track's data source
3660    ///
3661    /// @param t The track to set the data source for
3662    ///
3663    /// @param s The data source to use for the contents of the track
3664    ///
3665    /// @return An error code stating if the source is ready for use for
3666    /// writing the track, or if an error occurred
3667    pub fn burn_track_set_source(t: *mut burn_track, s: *mut burn_source) -> burn_source_status;
3668}
3669unsafe extern "C" {
3670    /// Set a default track size to be used only if the track turns out to be of
3671    /// unpredictable length and if the effective write type demands a fixed size.
3672    /// This can be useful to enable write types CD SAO or DVD DAO together with
3673    /// a track source like stdin. If the track source delivers fewer bytes than
3674    /// announced then the track will be padded up with zeros.
3675    ///
3676    /// @param t The track to change
3677    ///
3678    /// @param size The size to set
3679    ///
3680    /// @return 0=failure 1=success
3681    ///
3682    /// @since 0.3.4
3683    pub fn burn_track_set_default_size(t: *mut burn_track, size: libc::off_t) -> ::std::os::raw::c_int;
3684}
3685unsafe extern "C" {
3686    /// Free a burn_source (decrease its refcount and maybe free it)
3687    ///
3688    /// @param s Source to free
3689    pub fn burn_source_free(s: *mut burn_source);
3690}
3691unsafe extern "C" {
3692    /// Creates a data source for an image file (and maybe subcode file)
3693    ///
3694    /// @param path The file address for the main channel payload.
3695    ///
3696    /// @param subpath Eventual address for subchannel data. Only used in exotic
3697    /// raw write modes. Submit NULL for normal tasks.
3698    ///
3699    /// @return Pointer to a burn_source object, NULL indicates failure
3700    pub fn burn_file_source_new(
3701        path: *const ::std::os::raw::c_char,
3702        subpath: *const ::std::os::raw::c_char,
3703    ) -> *mut burn_source;
3704}
3705unsafe extern "C" {
3706    /// Opens a file with eventual acceleration preparations which may depend
3707    /// on the operating system and on compile time options of libburn.
3708    /// You may use this call instead of open(2) for opening file descriptors
3709    /// which shall be handed to burn_fd_source_new().
3710    /// This should only be done for tracks with BURN_BLOCK_MODE1 (2048 bytes
3711    /// per block).
3712    ///
3713    /// If you use this call then you MUST allocate the buffers which you use
3714    /// with read(2) by call burn_os_alloc_buffer(). Read sizes MUST be a multiple
3715    /// of a safe buffer amount. Else you risk that track data get altered during
3716    /// transmission.
3717    /// burn_disk_write() will allocate a suitable read/write buffer for its own
3718    /// operations. A fifo created by burn_fifo_source_new() will allocate
3719    /// suitable memory for its buffer if called with flag bit0 and a multiple
3720    /// of a safe buffer amount.
3721    ///
3722    /// @param path       The file address to open
3723    ///
3724    /// @param open_flags The flags as of man 2 open. Normally just O_RDONLY.
3725    ///
3726    /// @param flag       Bitfield for control purposes (unused yet, submit 0).
3727    ///
3728    /// @return           A file descriptor as of open(2). Finally to be disposed
3729    /// by close(2).
3730    /// -1 indicates failure.
3731    ///
3732    /// @since 0.7.4
3733    pub fn burn_os_open_track_src(
3734        path: *mut ::std::os::raw::c_char,
3735        open_flags: ::std::os::raw::c_int,
3736        flag: ::std::os::raw::c_int,
3737    ) -> ::std::os::raw::c_int;
3738}
3739unsafe extern "C" {
3740    /// Allocate a memory area that is suitable for reading with a file descriptor
3741    /// opened by burn_os_open_track_src().
3742    ///
3743    /// @param amount     Number of bytes to allocate. This should be a multiple
3744    /// of the operating system's i/o block size. 32 KB is
3745    /// guaranteed by libburn to be safe.
3746    ///
3747    /// @param flag       Bitfield for control purposes (unused yet, submit 0).
3748    ///
3749    /// @return           The address of the allocated memory, or NULL on failure.
3750    /// A non-NULL return value has finally to be disposed via
3751    /// burn_os_free_buffer().
3752    ///
3753    /// @since 0.7.4
3754    pub fn burn_os_alloc_buffer(
3755        amount: usize,
3756        flag: ::std::os::raw::c_int,
3757    ) -> *mut ::std::os::raw::c_void;
3758}
3759unsafe extern "C" {
3760    /// Dispose a memory area which was obtained by burn_os_alloc_buffer(),
3761    ///
3762    /// @param buffer     Memory address to be freed.
3763    ///
3764    /// @param amount     The number of bytes which was allocated at that
3765    /// address.
3766    ///
3767    /// @param flag       Bitfield for control purposes (unused yet, submit 0).
3768    ///
3769    /// @return           1 success , <=0 failure
3770    ///
3771    /// @since 0.7.4
3772    pub fn burn_os_free_buffer(
3773        buffer: *mut ::std::os::raw::c_void,
3774        amount: usize,
3775        flag: ::std::os::raw::c_int,
3776    ) -> ::std::os::raw::c_int;
3777}
3778unsafe extern "C" {
3779    /// Creates a data source for an image file (a track) from an open
3780    /// readable filedescriptor, an eventually open readable subcodes file
3781    /// descriptor and eventually a fixed size in bytes.
3782    ///
3783    /// @param datafd The source of data.
3784    ///
3785    /// @param subfd The eventual source of subchannel data. Only used in exotic
3786    /// raw write modes. Submit -1 for normal tasks.
3787    ///
3788    /// @param size The eventual fixed size of eventually both fds.
3789    /// If this value is 0, the size will be determined from datafd.
3790    ///
3791    /// @return Pointer to a burn_source object, NULL indicates failure
3792    pub fn burn_fd_source_new(
3793        datafd: ::std::os::raw::c_int,
3794        subfd: ::std::os::raw::c_int,
3795        size: libc::off_t,
3796    ) -> *mut burn_source;
3797}
3798unsafe extern "C" {
3799    /// Creates an offset source which shall provide a byte interval of a stream
3800    /// to its consumer. It is supposed to be chain-linked with other offset
3801    /// sources which serve neighboring consumers. The chronological sequence
3802    /// of consumers and the sequence of offset sources must match. The intervals
3803    /// of the sources must not overlap.
3804    ///
3805    /// A chain of these burn_source objects may be used to feed multiple tracks
3806    /// from one single stream of input bytes.
3807    /// Each of the offset sources will skip the bytes up to its start address and
3808    /// provide the prescribed number of bytes to the track. Skipping takes into
3809    /// respect the bytes which have been processed by eventual predecessors in the
3810    /// chain.
3811    /// Important: It is not allowed to free an offset source before its successor
3812    /// has ended its work. Best is to keep them all until all tracks
3813    /// are done.
3814    ///
3815    ///
3816    /// @param inp   The burn_source object from which to read stream data.
3817    /// E.g. created by burn_file_source_new().
3818    ///
3819    /// @param prev  The eventual offset source object which shall read data from
3820    /// inp before the new offset source will begin its own work.
3821    /// This must either be a result of  burn_offst_source_new()  or
3822    /// it must be NULL.
3823    ///
3824    /// @param start The byte address where to start reading bytes for the
3825    /// consumer. inp bytes may get skipped to reach this address.
3826    ///
3827    /// @param size  The number of bytes to be delivered to the consumer.
3828    /// If size is <= 0 then it may be set later by a call of method
3829    /// set_size(). If it is >= 0, then it can only be changed if
3830    /// flag bit0 was set with burn_offst_source_new().
3831    ///
3832    /// @param flag  Bitfield for control purposes
3833    /// bit0 = Prevent set_size() from overriding interval sizes > 0.
3834    /// If such a size is already set, then the new one will
3835    /// only affect the reply of get_size().
3836    /// See also above struct burn_source.
3837    ///
3838    /// @since 1.2.0
3839    ///
3840    /// @return      Pointer to a burn_source object, later to be freed by
3841    /// burn_source_free(). NULL indicates failure.
3842    ///
3843    /// @since 0.8.8
3844    pub fn burn_offst_source_new(
3845        inp: *mut burn_source,
3846        prev: *mut burn_source,
3847        start: libc::off_t,
3848        size: libc::off_t,
3849        flag: ::std::os::raw::c_int,
3850    ) -> *mut burn_source;
3851}
3852unsafe extern "C" {
3853    /// Creates a fifo which acts as proxy for an already existing data source.
3854    /// The fifo provides a ring buffer which shall smoothen the data stream
3855    /// between burn_source and writer thread. Each fifo serves only for one
3856    /// data source. It may be attached to one track as its only data source
3857    /// by burn_track_set_source(), or it may be used as input for other burn
3858    /// sources.
3859    /// A fifo starts its life in \"standby\" mode with no buffer space allocated.
3860    /// As soon as its consumer requires bytes, the fifo establishes a worker
3861    /// thread and allocates its buffer. After input has ended and all buffer
3862    /// content is consumed, the buffer space gets freed and the worker thread
3863    /// ends. This happens asynchronously. So expect two buffers and worker threads
3864    /// to exist for a short time between tracks. Be modest in your size demands if
3865    /// multiple tracks are to be expected.
3866    ///
3867    /// @param inp        The burn_source for which the fifo shall act as proxy.
3868    /// It can be disposed by burn_source_free() immediately
3869    /// after this call.
3870    ///
3871    /// @param chunksize  The size in bytes of a chunk.
3872    /// Use 2048 for sources suitable for BURN_BLOCK_MODE1,
3873    /// 2352 for sources which deliver for BURN_BLOCK_AUDIO,
3874    /// 2056 for sources which shall get treated by
3875    /// burn_track_set_cdxa_conv(track, 1).
3876    /// Some variations of burn_source might work only with
3877    /// a particular chunksize. E.g. libisofs demands 2048.
3878    ///
3879    /// @param chunks     The number of chunks to be allocated in ring buffer.
3880    /// This value must be >= 2.
3881    ///
3882    /// @param flag       Bitfield for control purposes:
3883    /// bit0= The read method of inp is capable of delivering
3884    /// arbitrary amounts of data per call. Not only one
3885    /// sector.
3886    /// Suitable for inp from burn_file_source_new()
3887    /// and burn_fd_source_new() if not the fd has
3888    /// exotic limitations on read size.
3889    /// You MUST use this on inp which uses an fd opened
3890    /// with burn_os_open_track_src().
3891    /// Better do not use with other inp types.
3892    ///
3893    /// @since 0.7.4
3894    ///
3895    /// @return           A pointer to the newly created burn_source.
3896    /// Later both burn_sources, inp and the returned fifo, have
3897    /// to be disposed by calling burn_source_free() for each.
3898    /// inp can be freed immediately, the returned fifo may be
3899    /// kept as handle for burn_fifo_inquire_status().
3900    ///
3901    /// @since 0.4.0
3902    pub fn burn_fifo_source_new(
3903        inp: *mut burn_source,
3904        chunksize: ::std::os::raw::c_int,
3905        chunks: ::std::os::raw::c_int,
3906        flag: ::std::os::raw::c_int,
3907    ) -> *mut burn_source;
3908}
3909unsafe extern "C" {
3910    /// Inquires state and fill parameters of a fifo burn_source which was created
3911    /// by burn_fifo_source_new() . Do not use with other burn_source variants.
3912    ///
3913    /// @param fifo  The fifo object to inquire
3914    ///
3915    /// @param size  The total size of the fifo
3916    ///
3917    /// @param free_bytes  The current free capacity of the fifo
3918    ///
3919    /// @param status_text  Returns a pointer to a constant text, see below
3920    ///
3921    /// @return  <0 reply invalid, >=0 fifo status code:
3922    /// bit0+1=input status, bit2=consumption status, i.e:
3923    /// 0=\"standby\"   : data processing not started yet
3924    /// 1=\"active\"    : input and consumption are active
3925    /// 2=\"ending\"    : input has ended without error
3926    /// 3=\"failing\"   : input had error and ended,
3927    /// 4=\"unused\"    : ( consumption has ended before processing start )
3928    /// 5=\"abandoned\" : consumption has ended prematurely
3929    /// 6=\"ended\"     : consumption has ended without input error
3930    /// 7=\"aborted\"   : consumption has ended after input error
3931    ///
3932    /// @since 0.4.0
3933    pub fn burn_fifo_inquire_status(
3934        fifo: *mut burn_source,
3935        size: *mut ::std::os::raw::c_int,
3936        free_bytes: *mut ::std::os::raw::c_int,
3937        status_text: *mut *mut ::std::os::raw::c_char,
3938    ) -> ::std::os::raw::c_int;
3939}
3940unsafe extern "C" {
3941    /// Inquire various counters which reflect the fifo operation.
3942    ///
3943    /// @param fifo              The fifo object to inquire
3944    ///
3945    /// @param total_min_fill    The minimum number of bytes in the fifo. Beginning
3946    /// from the moment when fifo consumption is enabled.
3947    ///
3948    /// @param interval_min_fill The minimum byte number beginning from the moment
3949    /// when fifo consumption is enabled or from the
3950    /// most recent moment when burn_fifo_next_interval()
3951    /// was called.
3952    ///
3953    /// @param put_counter       The number of data transactions into the fifo.
3954    ///
3955    /// @param get_counter       The number of data transactions out of the fifo.
3956    ///
3957    /// @param empty_counter     The number of times the fifo was empty.
3958    ///
3959    /// @param full_counter      The number of times the fifo was full.
3960    ///
3961    /// @since 0.7.4
3962    pub fn burn_fifo_get_statistics(
3963        fifo: *mut burn_source,
3964        total_min_fill: *mut ::std::os::raw::c_int,
3965        interval_min_fill: *mut ::std::os::raw::c_int,
3966        put_counter: *mut ::std::os::raw::c_int,
3967        get_counter: *mut ::std::os::raw::c_int,
3968        empty_counter: *mut ::std::os::raw::c_int,
3969        full_counter: *mut ::std::os::raw::c_int,
3970    );
3971}
3972unsafe extern "C" {
3973    /// Inquire the fifo minimum fill counter for intervals and reset that counter.
3974    ///
3975    /// @param fifo              The fifo object to inquire
3976    ///
3977    /// @param interval_min_fill The minimum number of bytes in the fifo. Beginning
3978    /// from the moment when fifo consumption is enabled
3979    /// or from the most recent moment when
3980    /// burn_fifo_next_interval() was called.
3981    ///
3982    /// @since 0.7.4
3983    pub fn burn_fifo_next_interval(
3984        fifo: *mut burn_source,
3985        interval_min_fill: *mut ::std::os::raw::c_int,
3986    );
3987}
3988unsafe extern "C" {
3989    /// Obtain a preview of the first input data of a fifo which was created
3990    /// by burn_fifo_source_new(). The data will later be delivered normally to
3991    /// the consumer track of the fifo.
3992    /// bufsize may not be larger than the fifo size (chunk_size * chunks) - 32k.
3993    /// This call will succeed only if data consumption by the track has not
3994    /// started yet, i.e. best before the call to burn_disc_write().
3995    /// It will start the worker thread of the fifo with the expectable side
3996    /// effects on the external data source. Then it waits either until enough
3997    /// data have arrived or until it becomes clear that this will not happen.
3998    /// The call may be repeated with increased bufsize. It will always yield
3999    /// the bytes beginning from the first one in the fifo.
4000    ///
4001    /// @param fifo     The fifo object to start and to inquire
4002    ///
4003    /// @param buf      Pointer to memory of at least bufsize bytes where to
4004    /// deliver the peeked data.
4005    ///
4006    /// @param bufsize  Number of bytes to peek from the start of the fifo data
4007    ///
4008    /// @param flag     Bitfield for control purposes (unused yet, submit 0).
4009    ///
4010    /// @return <0 on severe error, 0 if not enough data, 1 if bufsize bytes read
4011    ///
4012    /// @since 0.5.0
4013    pub fn burn_fifo_peek_data(
4014        fifo: *mut burn_source,
4015        buf: *mut ::std::os::raw::c_char,
4016        bufsize: ::std::os::raw::c_int,
4017        flag: ::std::os::raw::c_int,
4018    ) -> ::std::os::raw::c_int;
4019}
4020unsafe extern "C" {
4021    /// Start the fifo worker thread and wait either until the requested number
4022    /// of bytes have arrived or until it becomes clear that this will not happen.
4023    /// Filling will go on asynchronously after burn_fifo_fill() returned.
4024    /// This call and burn_fifo_peek_data() do not disturb each other.
4025    ///
4026    /// @param fifo     The fifo object to start
4027    ///
4028    /// @param fill     Number of bytes desired. Expect to get return 1 if
4029    /// at least fifo size - 32k were read.
4030    ///
4031    /// @param flag     Bitfield for control purposes.
4032    /// bit0= fill fifo to maximum size
4033    ///
4034    /// @return <0 on severe error, 0 if not enough data,
4035    /// 1 if desired amount or fifo full
4036    ///
4037    /// @since 0.7.4
4038    pub fn burn_fifo_fill(
4039        fifo: *mut burn_source,
4040        fill: ::std::os::raw::c_int,
4041        flag: ::std::os::raw::c_int,
4042    ) -> ::std::os::raw::c_int;
4043}
4044unsafe extern "C" {
4045    /// Sets a fixed track size after the data source object has already been
4046    /// created.
4047    ///
4048    /// @param t The track to operate on
4049    ///
4050    /// @param size the number of bytes to use as track size
4051    ///
4052    /// @return <=0 indicates failure , >0 success
4053    ///
4054    /// @since 0.3.6
4055    pub fn burn_track_set_size(t: *mut burn_track, size: libc::off_t) -> ::std::os::raw::c_int;
4056}
4057unsafe extern "C" {
4058    /// Tells how many sectors a track will have on disc, or already has on
4059    /// disc. This includes offset, payload, tail, and post-gap, but not pre-gap.
4060    /// The result is NOT RELIABLE with tracks of undefined length
4061    pub fn burn_track_get_sectors(arg1: *mut burn_track) -> ::std::os::raw::c_int;
4062}
4063unsafe extern "C" {
4064    /// Tells how many source bytes have been read and how many data bytes have
4065    /// been written by the track during burn.
4066    ///
4067    /// @param t The track to inquire
4068    ///
4069    /// @param read_bytes Number of bytes read from the track source
4070    ///
4071    /// @param written_bytes Number of bytes written to track
4072    ///
4073    /// @since 0.2.6
4074    pub fn burn_track_get_counters(
4075        t: *mut burn_track,
4076        read_bytes: *mut libc::off_t,
4077        written_bytes: *mut libc::off_t,
4078    ) -> ::std::os::raw::c_int;
4079}
4080unsafe extern "C" {
4081    /// Sets drive read and write speed.
4082    /// Note: \"k\" is 1000, not 1024.
4083    /// 1xCD = 176.4 k/s, 1xDVD = 1385 k/s, 1xBD = 4496 k/s.
4084    /// Fractional speeds should be rounded up. Like 4xCD = 706.
4085    ///
4086    /// @param d The drive to set speed for
4087    ///
4088    /// @param read Read speed in k/s (0 is max, -1 is min).
4089    ///
4090    /// @param write Write speed in k/s (0 is max, -1 is min).
4091    pub fn burn_drive_set_speed(
4092        d: *mut burn_drive,
4093        read: ::std::os::raw::c_int,
4094        write: ::std::os::raw::c_int,
4095    );
4096}
4097unsafe extern "C" {
4098    /// Sets drive read and write speed using the \"Exact\" bit of SCSI command
4099    /// SET STREAMING. This command will be used even if a CD medium is present.
4100    /// MMC specifies that with the Exact bit the desired speed settings shall
4101    /// either be obeyed by the drive exactly, or that the drive shall indicate
4102    /// failure and not accept the settings.
4103    /// But many drives reply no error and nevertheless adjust their read speed
4104    /// only coarsly or ignore the setting after a few MB of fast read attempts.
4105    ///
4106    /// The call parameters have the same meaning as with burn_drive_set_speed().
4107    ///
4108    /// @param d The drive to set speed for. It must be a role 1 drive.
4109    ///
4110    /// @param read Read speed in k/s (0 is max, -1 is min).
4111    ///
4112    /// @param write Write speed in k/s (0 is max, -1 is min).
4113    ///
4114    /// @return 1=success , 0=failure
4115    ///
4116    /// @since 1.5.4
4117    pub fn burn_drive_set_speed_exact(
4118        d: *mut burn_drive,
4119        read: ::std::os::raw::c_int,
4120        write: ::std::os::raw::c_int,
4121    ) -> ::std::os::raw::c_int;
4122}
4123unsafe extern "C" {
4124    /// Waits until the time has elapsed since the given previous time to transmit
4125    /// the given byte count with the given speed in KB/second (KB = 1000 bytes).
4126    /// This call may be used between random access read operations like
4127    /// burn_read_data() in order to force a slower speed than the drive is
4128    /// willing to use if it gets read requests as fast as it delivers data.
4129    ///
4130    /// The parameter us_corr carries microseconds of time deviations from one
4131    /// call to the next one. Such deviations may happen because of small
4132    /// inexactnesses of the sleeper function and because of temporary delays
4133    /// in the data supply so that sleeping for a negative time span would have
4134    /// been necessary. The next call will reduce or enlarge its own sleeping
4135    /// period by this value.
4136    ///
4137    ///
4138    /// @param kb_per_second   the desired speed in 1000 bytes per second.
4139    /// Supplied by the caller.
4140    ///
4141    /// @max_corr              the maximum backlog in microseconds which shall
4142    /// be compensated by the next call. Supplied by the
4143    /// caller. Not more than 1 billion = 1000 seconds.
4144    ///
4145    /// @param prev_time       time keeper updated by burn_nominal_slowdown().
4146    /// The caller provides the memory and elsewise should
4147    /// carry it unchanged from call to call.
4148    ///
4149    /// @param us_corr         updated by burn_nominal_slowdown(). See above.
4150    /// The caller provides the memory and elsewise should
4151    /// carry it unchanged from call to call.
4152    ///
4153    /// @param b_since_prev    byte count since the previous call. This number
4154    /// has to be counted and supplied by the caller.
4155    ///
4156    /// @param flag            Bitfield for control purposes:
4157    /// bit0= initialize *prev_time and *us_corr,
4158    /// ignore other parameters, do not wait
4159    ///
4160    /// @return 2=no wait because no usable kb_per_second , 1=success , 0=failure
4161    ///
4162    /// @since 1.5.4
4163    pub fn burn_nominal_slowdown(
4164        kb_per_second: ::std::os::raw::c_int,
4165        max_corr: ::std::os::raw::c_int,
4166        prev_time: *mut libc::timeval,
4167        us_corr: *mut ::std::os::raw::c_int,
4168        b_since_prev: libc::off_t,
4169        flag: ::std::os::raw::c_int,
4170    ) -> ::std::os::raw::c_int;
4171}
4172unsafe extern "C" {
4173    /// Controls the behavior with writing when the drive buffer is suspected to
4174    /// be full. To check and wait for enough free buffer space before writing
4175    /// will move the task of waiting from the operating system's device driver
4176    /// to libburn. While writing is going on and waiting is enabled, any write
4177    /// operation will be checked whether it will fill the drive buffer up to
4178    /// more than max_percent. If so, then waiting will happen until the buffer
4179    /// fill is predicted with at most min_percent.
4180    /// Thus: if min_percent < max_percent then transfer rate will oscillate.
4181    /// This may allow the driver to operate on other devices, e.g. a disk from
4182    /// which to read the input for writing. On the other hand, this checking might
4183    /// reduce maximum throughput to the drive or even get misled by faulty buffer
4184    /// fill replies from the drive.
4185    /// If a setting parameter is < 0, then this setting will stay unchanged
4186    /// by the call.
4187    /// Known burner or media specific pitfalls:
4188    /// To have max_percent larger than the burner's best reported buffer fill has
4189    /// the same effect as min_percent==max_percent. Some burners do not report
4190    /// their full buffer with all media types. Some are not suitable because
4191    /// they report their buffer fill with delay. Some do not go to full speed
4192    /// unless their buffer is full.
4193    ///
4194    ///
4195    /// @param d The drive to control
4196    ///
4197    /// @param enable 0= disable , 1= enable waiting , (-1 = do not change setting)
4198    ///
4199    /// @param min_usec Shortest possible sleeping period (given in micro seconds)
4200    ///
4201    /// @param max_usec Longest possible sleeping period (given in micro seconds)
4202    ///
4203    /// @param timeout_sec If a single write has to wait longer than this number
4204    /// of seconds, then waiting gets disabled and mindless
4205    /// writing starts. A value of 0 disables this timeout.
4206    ///
4207    /// @param min_percent Minimum of desired buffer oscillation: 25 to 100
4208    ///
4209    /// @param max_percent Maximum of desired buffer oscillation: 25 to 100
4210    ///
4211    /// @return 1=success , 0=failure
4212    ///
4213    /// @since 0.3.8
4214    pub fn burn_drive_set_buffer_waiting(
4215        d: *mut burn_drive,
4216        enable: ::std::os::raw::c_int,
4217        min_usec: ::std::os::raw::c_int,
4218        max_usec: ::std::os::raw::c_int,
4219        timeout_sec: ::std::os::raw::c_int,
4220        min_percent: ::std::os::raw::c_int,
4221        max_percent: ::std::os::raw::c_int,
4222    ) -> ::std::os::raw::c_int;
4223}
4224unsafe extern "C" {
4225    /// Control the write simulation mode before or after burn_write_opts get
4226    /// into effect.
4227    /// Beginning with version 1.4.8 a burn run by burn_disc_write() brings the
4228    /// burn_drive object in the simulation state as set to the burn_write_opts
4229    /// by burn_write_opts_set_simulate(). This state is respected by call
4230    /// burn_random_access_write() until a new call of burn_disc_write() happens
4231    /// or until burn_drive_reset_simulate() is called.
4232    /// This call may only be made when burn_drive_get_status() returns
4233    /// BURN_DRIVE_IDLE.
4234    ///
4235    ///
4236    /// @param d         The drive to control
4237    ///
4238    /// @param simulate  1 enables simulation, 0 enables real writing
4239    ///
4240    /// @return 1=success , 0=failure
4241    ///
4242    /// @since 1.4.8
4243    pub fn burn_drive_reset_simulate(
4244        d: *mut burn_drive,
4245        simulate: ::std::os::raw::c_int,
4246    ) -> ::std::os::raw::c_int;
4247}
4248unsafe extern "C" {
4249    pub fn burn_structure_print_disc(d: *mut burn_disc);
4250}
4251unsafe extern "C" {
4252    pub fn burn_structure_print_session(s: *mut burn_session);
4253}
4254unsafe extern "C" {
4255    pub fn burn_structure_print_track(t: *mut burn_track);
4256}
4257unsafe extern "C" {
4258    /// Sets the write type for the write_opts struct.
4259    /// Note: write_type BURN_WRITE_SAO is currently not capable of writing a mix
4260    /// of data and audio tracks. You must use BURN_WRITE_TAO for such sessions.
4261    ///
4262    /// @param opts The write opts to change
4263    ///
4264    /// @param write_type The write type to use
4265    ///
4266    /// @param block_type The block type to use
4267    ///
4268    /// @return Returns 1 on success and 0 on failure.
4269    pub fn burn_write_opts_set_write_type(
4270        opts: *mut burn_write_opts,
4271        write_type: burn_write_types,
4272        block_type: ::std::os::raw::c_int,
4273    ) -> ::std::os::raw::c_int;
4274}
4275unsafe extern "C" {
4276    /// As an alternative to burn_write_opts_set_write_type() this function tries
4277    /// to find a suitable write type and block type for a given write job
4278    /// described by opts and disc. To be used after all other setups have been
4279    /// made, i.e. immediately before burn_disc_write().
4280    ///
4281    /// @param opts The nearly complete write opts to change
4282    ///
4283    /// @param disc The already composed session and track model
4284    ///
4285    /// @param reasons This text string collects reasons for decision or failure
4286    ///
4287    /// @param flag Bitfield for control purposes:
4288    /// bit0= do not choose type but check the one that is already set
4289    /// bit1= do not issue error messages via burn_msgs queue
4290    /// (is automatically set with bit0)
4291    ///
4292    /// @return Chosen write type. BURN_WRITE_NONE on failure.
4293    ///
4294    /// @since 0.3.2
4295    pub fn burn_write_opts_auto_write_type(
4296        opts: *mut burn_write_opts,
4297        disc: *mut burn_disc,
4298        reasons: *mut ::std::os::raw::c_char,
4299        flag: ::std::os::raw::c_int,
4300    ) -> burn_write_types;
4301}
4302unsafe extern "C" {
4303    /// Supplies toc entries for writing - not normally required for cd mastering
4304    ///
4305    /// @param opts The write opts to change
4306    ///
4307    /// @param count The number of entries
4308    ///
4309    /// @param toc_entries
4310    pub fn burn_write_opts_set_toc_entries(
4311        opts: *mut burn_write_opts,
4312        count: ::std::os::raw::c_int,
4313        toc_entries: *mut burn_toc_entry,
4314    );
4315}
4316unsafe extern "C" {
4317    /// Sets the session format for a disc
4318    ///
4319    /// @param opts The write opts to change
4320    ///
4321    /// @param format The session format to set
4322    pub fn burn_write_opts_set_format(opts: *mut burn_write_opts, format: ::std::os::raw::c_int);
4323}
4324unsafe extern "C" {
4325    /// Sets the simulate value for the write_opts struct .
4326    /// This corresponds to the Test Write bit in MMC mode page 05h. Several media
4327    /// types do not support this. See struct burn_multi_caps.might_simulate for
4328    /// actual availability of this feature.
4329    /// If the media is suitable, the drive will perform burn_disc_write() as a
4330    /// simulation instead of effective write operations. This means that the
4331    /// media content and burn_disc_get_status() stay unchanged.
4332    /// Note: With stdio-drives, the target file gets eventually created, opened,
4333    /// lseeked, and closed, but not written. So there are effects on it.
4334    /// Note: Up to version 1.4.6 the call burn_random_access_write() after
4335    /// burn_disc_write() did not simulate because it does not get any
4336    /// burn_write_opts and the drive did not memorize the simulation state.
4337    /// This has changed now. burn_random_access_write() will not write after
4338    /// a simulated burn run.
4339    /// Use burn_drive_reset_simulate(drive, 0) if you really want to end
4340    /// simulation before you call burn_disc_write() with new write options.
4341    ///
4342    /// @param opts The write opts to change
4343    ///
4344    /// @param sim  Non-zero enables simulation, 0 enables real writing
4345    ///
4346    /// @return Returns 1 on success and 0 on failure.
4347    pub fn burn_write_opts_set_simulate(
4348        opts: *mut burn_write_opts,
4349        sim: ::std::os::raw::c_int,
4350    ) -> ::std::os::raw::c_int;
4351}
4352unsafe extern "C" {
4353    /// Controls buffer underrun prevention. This is only needed with CD media
4354    /// and possibly with old DVD-R drives. All other media types are not
4355    /// vulnerable to burn failure due to buffer underrun.
4356    ///
4357    /// @param opts The write opts to change
4358    ///
4359    /// @param underrun_proof if non-zero, buffer underrun protection is enabled
4360    ///
4361    /// @return Returns 1 if the drive announces to be capable of underrun
4362    /// prevention,
4363    /// Returns 0 if not.
4364    pub fn burn_write_opts_set_underrun_proof(
4365        opts: *mut burn_write_opts,
4366        underrun_proof: ::std::os::raw::c_int,
4367    ) -> ::std::os::raw::c_int;
4368}
4369unsafe extern "C" {
4370    /// Sets whether to use opc or not with the write_opts struct
4371    ///
4372    /// @param opts The write opts to change
4373    ///
4374    /// @param opc If non-zero, optical power calibration will be performed at
4375    /// start of burn
4376    pub fn burn_write_opts_set_perform_opc(opts: *mut burn_write_opts, opc: ::std::os::raw::c_int);
4377}
4378unsafe extern "C" {
4379    /// The Q sub-channel of a CD may contain a Media Catalog Number of 13 decimal
4380    /// digits. This call sets the string of digits, but does not yet activate it
4381    /// for writing.
4382    ///
4383    /// @param opts          The write opts to change
4384    ///
4385    /// @param mediacatalog  The 13 decimal digits as ASCII bytes. I.e. '0' = 0x30.
4386    pub fn burn_write_opts_set_mediacatalog(
4387        opts: *mut burn_write_opts,
4388        mediacatalog: *mut ::std::os::raw::c_uchar,
4389    );
4390}
4391unsafe extern "C" {
4392    /// This call activates the Media Catalog Number for writing. The digits of
4393    /// that number have to be set by call burn_write_opts_set_mediacatalog().
4394    ///
4395    /// @param opts             The write opts to change
4396    ///
4397    /// @param has_mediacatalog 1= activate writing of catalog to Q sub-channel
4398    /// 0= deactivate it
4399    pub fn burn_write_opts_set_has_mediacatalog(
4400        opts: *mut burn_write_opts,
4401        has_mediacatalog: ::std::os::raw::c_int,
4402    );
4403}
4404unsafe extern "C" {
4405    /// Sets the multi flag which eventually marks the emerging session as not
4406    /// being the last one and thus creating a BURN_DISC_APPENDABLE media.
4407    /// Note: DVD-R[W] in write mode BURN_WRITE_SAO are not capable of this.
4408    /// DVD-R DL are not capable of this at all.
4409    /// libburn will refuse to write if burn_write_opts_set_multi() is
4410    /// enabled under such conditions.
4411    ///
4412    /// @param opts The option object to be manipulated
4413    ///
4414    /// @param multi 1=media will be appendable, 0=media will be closed (default)
4415    ///
4416    /// @since 0.2.6
4417    pub fn burn_write_opts_set_multi(opts: *mut burn_write_opts, multi: ::std::os::raw::c_int);
4418}
4419unsafe extern "C" {
4420    /// Set the severity to be used with write error messages which are potentially
4421    /// caused by not using write type BURN_WRITE_SAO on fast blanked DVD-RW.
4422    ///
4423    /// Normally the call burn_write_opts_auto_write_type() can prevent such
4424    /// errors by looking for MMC feature 21h \"Incremental Streaming Writable\"
4425    /// which anounnces the capability for BURN_WRITE_TAO and multi session.
4426    /// Regrettable many drives announce feature 21h even if they only can do
4427    /// BURN_WRITE_SAO. This mistake becomes obvious by an early write error.
4428    ///
4429    /// If you plan to call burn_drive_was_feat21_failure() and to repeat the
4430    /// burn attempt with BURN_WRITE_SAO, then set the severity of the error
4431    /// message low enough, so that the application does not see reason to abort.
4432    ///
4433    ///
4434    /// @param opts      The option object to be manipulated
4435    ///
4436    /// @param severity  Severity as with burn_msgs_set_severities().
4437    /// \"ALL\" or empty text means the default severity that
4438    /// is attributed to other kinds of write errors.
4439    pub fn burn_write_opts_set_fail21h_sev(
4440        opts: *mut burn_write_opts,
4441        severity: *mut ::std::os::raw::c_char,
4442    );
4443}
4444unsafe extern "C" {
4445    /// Submit an array of CD-TEXT packs which shall be written to the Lead-in
4446    /// of a SAO write run on CD.
4447    ///
4448    /// @param opts        The option object to be manipulated
4449    ///
4450    /// @param text_packs  Array of bytes which form CD-TEXT packs of 18 bytes
4451    /// each. For a description of the format of the array,
4452    /// see file doc/cdtext.txt.
4453    /// No header of 4 bytes must be prepended which would
4454    /// tell the number of pack bytes + 2.
4455    /// This parameter may be NULL if the currently attached
4456    /// array of packs shall be removed.
4457    ///
4458    /// @param num_packs   The number of 18 byte packs in text_packs.
4459    /// This parameter may be 0 if the currently attached
4460    /// array of packs shall be removed.
4461    ///
4462    /// @param flag        Bitfield for control purposes.
4463    /// bit0= do not verify checksums
4464    /// bit1= repair mismatching checksums
4465    /// bit2= repair checksums if they are 00 00 with each pack
4466    ///
4467    /// @return            1 on success, <= 0 on failure
4468    ///
4469    /// @since 1.2.0
4470    pub fn burn_write_opts_set_leadin_text(
4471        opts: *mut burn_write_opts,
4472        text_packs: *mut ::std::os::raw::c_uchar,
4473        num_packs: ::std::os::raw::c_int,
4474        flag: ::std::os::raw::c_int,
4475    ) -> ::std::os::raw::c_int;
4476}
4477unsafe extern "C" {
4478    /// Sets a start address for writing to media and write modes which are able
4479    /// to choose this address at all (for now: DVD+RW, DVD-RAM, formatted DVD-RW).
4480    /// now). The address is given in bytes. If it is not -1 then a write run
4481    /// will fail if choice of start address is not supported or if the block
4482    /// alignment of the address is not suitable for media and write mode.
4483    /// Alignment to 32 kB blocks is supposed to be safe with DVD media.
4484    /// Call burn_disc_get_multi_caps() can obtain the necessary media info. See
4485    /// resulting struct burn_multi_caps elements .start_adr , .start_alignment ,
4486    /// .start_range_low , .start_range_high .
4487    ///
4488    /// @param opts The write opts to change
4489    ///
4490    /// @param value The address in bytes (-1 = start at default address)
4491    ///
4492    /// @since 0.3.0
4493    pub fn burn_write_opts_set_start_byte(opts: *mut burn_write_opts, value: libc::off_t);
4494}
4495unsafe extern "C" {
4496    /// Caution: still immature and likely to change. Problems arose with
4497    /// sequential DVD-RW on one drive.
4498    ///
4499    /// Controls whether the whole available space of the media shall be filled up
4500    /// by the last track of the last session.
4501    ///
4502    /// @param opts The write opts to change
4503    ///
4504    /// @param fill_up_media If 1 : fill up by last track, if 0 = do not fill up
4505    ///
4506    /// @since 0.3.4
4507    pub fn burn_write_opts_set_fillup(
4508        opts: *mut burn_write_opts,
4509        fill_up_media: ::std::os::raw::c_int,
4510    );
4511}
4512unsafe extern "C" {
4513    /// Lets libburn ignore the failure of some conformance checks:
4514    /// - the check whether CD write+block type is supported by the drive
4515    /// - the check whether the media profile supports simulated burning
4516    /// - @since 1.5.6
4517    /// 
4518    /// The check whether a write operation exceeds the size of the medium
4519    /// as announced by the drive. This is known as \"overburn\" and may work
4520    /// for a few thousand additional blocks on CD media with write type SAO.
4521    ///
4522    /// @param opts The write opts to change
4523    ///
4524    /// @param use_force 1=ignore above checks, 0=refuse work on failed check
4525    ///
4526    /// @since 0.3.4
4527    pub fn burn_write_opts_set_force(opts: *mut burn_write_opts, use_force: ::std::os::raw::c_int);
4528}
4529unsafe extern "C" {
4530    /// Eventually makes use of the more modern write command AAh WRITE12 and
4531    /// sets the Streaming bit. With DVD-RAM and BD this can override the
4532    /// traditional slowdown to half nominal speed. But if it speeds up writing
4533    /// then it also disables error management and correction. Weigh your
4534    /// priorities. This affects the write operations of burn_disc_write()
4535    /// and subsequent calls of burn_random_access_write().
4536    ///
4537    /// @param opts The write opts to change
4538    ///
4539    /// @param value  0=use 2Ah WRITE10, 1=use AAh WRITE12 with Streaming bit
4540    ///
4541    /// @since 0.6.4:
4542    /// >=16 use WRITE12 but not before the LBA given by value
4543    ///
4544    /// @since 0.4.6
4545    pub fn burn_write_opts_set_stream_recording(
4546        opts: *mut burn_write_opts,
4547        value: ::std::os::raw::c_int,
4548    );
4549}
4550unsafe extern "C" {
4551    /// Overrides the write chunk size for DVD and BD media which is normally
4552    /// determined according to media type and setting of stream recording.
4553    /// A chunk size of 64 KB may improve throughput with bus systems which show
4554    /// latency problems.
4555    ///
4556    /// @param opts The write opts to change
4557    ///
4558    /// @param obs  Number of bytes which shall be sent by a single write command.
4559    /// 0 means automatic size, 32768 and 65336 are the only other
4560    /// accepted sizes for now.
4561    ///
4562    /// @since 0.7.4
4563    pub fn burn_write_opts_set_dvd_obs(opts: *mut burn_write_opts, obs: ::std::os::raw::c_int);
4564}
4565unsafe extern "C" {
4566    /// Overrides the automatic decision whether to pad up the last write chunk to
4567    /// its full size. This applies to DVD, BD and stdio: pseudo-drives.
4568    /// Note: This override may get enabled fixely already at compile time by
4569    /// defining macro  Libburn_dvd_always_obs_paD .
4570    ///
4571    /// @param opts The write opts to change
4572    ///
4573    /// @param pad  1 means to pad up in any case, 0 means automatic decision.
4574    ///
4575    /// @since 1.2.4
4576    pub fn burn_write_opts_set_obs_pad(opts: *mut burn_write_opts, pad: ::std::os::raw::c_int);
4577}
4578unsafe extern "C" {
4579    /// Exempts BD-R media from the elsewise unavoidable automatic padding of the
4580    /// last write chunk to its full size.
4581    /// Even if this exempt is granted it gets into effect only if stream recording
4582    /// is disabled and burn_write_opts_set_obs_pad() is set to 0.
4583    ///
4584    /// @param opts The write opts to change
4585    ///
4586    /// @param value  1= possibly exempt BD-R from end chunk padding.
4587    /// 0= always act on BD-R as if
4588    /// burn_write_opts_set_obs_pad(opts, 1) is in effect.
4589    ///
4590    /// @since 1.5.6
4591    pub fn burn_write_opts_set_bdr_obs_exempt(
4592        opts: *mut burn_write_opts,
4593        value: ::std::os::raw::c_int,
4594    );
4595}
4596unsafe extern "C" {
4597    /// Sets the rhythm by which stdio pseudo drives force their output data to
4598    /// be consumed by the receiving storage device. This forcing keeps the memory
4599    /// from being clogged with lots of pending data for slow devices.
4600    ///
4601    /// @param opts   The write opts to change
4602    ///
4603    /// @param rhythm Number of 2KB output blocks after which fsync(2) is
4604    /// performed.
4605    /// -1 means no fsync()
4606    /// 0 means default
4607    /// 1 means fsync() only at end, @since 1.3.8 (noop before 1.3.8)
4608    /// elsewise the value must be >= 32.
4609    /// Default is currently 8192 = 16 MB.
4610    ///
4611    /// @since 0.7.4
4612    pub fn burn_write_opts_set_stdio_fsync(
4613        opts: *mut burn_write_opts,
4614        rhythm: ::std::os::raw::c_int,
4615    );
4616}
4617unsafe extern "C" {
4618    /// Sets whether to read in raw mode or not
4619    ///
4620    /// @param opts The read opts to change
4621    ///
4622    /// @param raw_mode If non-zero, reading will be done in raw mode, so that everything in the data tracks on the
4623    /// disc is read, including headers.
4624    pub fn burn_read_opts_set_raw(opts: *mut burn_read_opts, raw_mode: ::std::os::raw::c_int);
4625}
4626unsafe extern "C" {
4627    /// Sets whether to report c2 errors or not
4628    ///
4629    /// @param opts The read opts to change
4630    ///
4631    /// @param c2errors If non-zero, report c2 errors.
4632    pub fn burn_read_opts_set_c2errors(opts: *mut burn_read_opts, c2errors: ::std::os::raw::c_int);
4633}
4634unsafe extern "C" {
4635    /// Sets whether to read subcodes from audio tracks or not
4636    ///
4637    /// @param opts The read opts to change
4638    ///
4639    /// @param subcodes_audio If non-zero, read subcodes from audio tracks on the disc.
4640    pub fn burn_read_opts_read_subcodes_audio(
4641        opts: *mut burn_read_opts,
4642        subcodes_audio: ::std::os::raw::c_int,
4643    );
4644}
4645unsafe extern "C" {
4646    /// Sets whether to read subcodes from data tracks or not
4647    ///
4648    /// @param opts The read opts to change
4649    ///
4650    /// @param subcodes_data If non-zero, read subcodes from data tracks on the disc.
4651    pub fn burn_read_opts_read_subcodes_data(
4652        opts: *mut burn_read_opts,
4653        subcodes_data: ::std::os::raw::c_int,
4654    );
4655}
4656unsafe extern "C" {
4657    /// Sets whether to recover errors if possible
4658    ///
4659    /// @param opts The read opts to change
4660    ///
4661    /// @param hardware_error_recovery If non-zero, attempt to recover errors if possible.
4662    pub fn burn_read_opts_set_hardware_error_recovery(
4663        opts: *mut burn_read_opts,
4664        hardware_error_recovery: ::std::os::raw::c_int,
4665    );
4666}
4667unsafe extern "C" {
4668    /// Sets whether to report recovered errors or not
4669    ///
4670    /// @param opts The read opts to change
4671    ///
4672    /// @param report_recovered_errors If non-zero, recovered errors will be reported.
4673    pub fn burn_read_opts_report_recovered_errors(
4674        opts: *mut burn_read_opts,
4675        report_recovered_errors: ::std::os::raw::c_int,
4676    );
4677}
4678unsafe extern "C" {
4679    /// Sets whether blocks with unrecoverable errors should be read or not
4680    ///
4681    /// @param opts The read opts to change
4682    ///
4683    /// @param transfer_damaged_blocks If non-zero, blocks with unrecoverable errors will still be read.
4684    pub fn burn_read_opts_transfer_damaged_blocks(
4685        opts: *mut burn_read_opts,
4686        transfer_damaged_blocks: ::std::os::raw::c_int,
4687    );
4688}
4689unsafe extern "C" {
4690    /// Sets the number of retries to attempt when trying to correct an error
4691    ///
4692    /// @param opts The read opts to change
4693    ///
4694    /// @param hardware_error_retries The number of retries to attempt when correcting an error.
4695    pub fn burn_read_opts_set_hardware_error_retries(
4696        opts: *mut burn_read_opts,
4697        hardware_error_retries: ::std::os::raw::c_uchar,
4698    );
4699}
4700unsafe extern "C" {
4701    /// Gets the list of profile codes supported by the drive.
4702    /// Profiles depict the feature sets which constitute media types. For
4703    /// known profile codes and names see burn_disc_get_profile().
4704    ///
4705    /// @param d            is the drive to query
4706    ///
4707    /// @param num_profiles returns the number of supported profiles
4708    ///
4709    /// @param profiles     returns the profile codes
4710    ///
4711    /// @param is_current   returns the status of the corresponding profile code:
4712    /// 1= current, i.e. the matching media is loaded
4713    /// 0= not current, i.e. the matching media is not loaded
4714    ///
4715    /// @return  always 1 for now
4716    ///
4717    /// @since 0.7.0
4718    pub fn burn_drive_get_all_profiles(
4719        d: *mut burn_drive,
4720        num_profiles: *mut ::std::os::raw::c_int,
4721        profiles: *mut ::std::os::raw::c_int,
4722        is_current: *mut ::std::os::raw::c_char,
4723    ) -> ::std::os::raw::c_int;
4724}
4725unsafe extern "C" {
4726    /// Obtains the profile name associated with a profile code.
4727    ///
4728    /// @param profile_code the profile code to be translated
4729    ///
4730    /// @param name         returns the profile name (e.g. \"DVD+RW\")
4731    ///
4732    /// @return             1= known profile code , 0= unknown profile code
4733    ///
4734    /// @since 0.7.0
4735    pub fn burn_obtain_profile_name(
4736        profile_code: ::std::os::raw::c_int,
4737        name: *mut ::std::os::raw::c_char,
4738    ) -> ::std::os::raw::c_int;
4739}
4740unsafe extern "C" {
4741    /// Obtains the list of SCSI Feature Codes from feature descriptors which
4742    /// were obtained from the drive when it was most recently acquired or
4743    /// re-assessed.
4744    ///
4745    /// @param d      Drive to query
4746    ///
4747    /// @param count  Returns the number of allocated elements in feature_codes
4748    ///
4749    /// @param feature_codes  Returns the allocated array of feature codes.
4750    /// If returned *feature_codes is not NULL, dispose it
4751    /// by free() when it is no longer needed.
4752    ///
4753    /// @since 1.5.2
4754    pub fn burn_drive_get_feature_codes(
4755        d: *mut burn_drive,
4756        count: *mut ::std::os::raw::c_int,
4757        feature_codes: *mut *mut ::std::os::raw::c_uint,
4758    );
4759}
4760unsafe extern "C" {
4761    /// Obtains the fields and data of a particular feature which were obtained
4762    /// from the drive when it was last acquired or re-assessed. See MMC specs
4763    /// for full detail.
4764    ///
4765    /// @param d             Drive to query
4766    ///
4767    /// @param feature_code  A number as learned by burn_drive_get_feature_codes()
4768    ///
4769    /// @param flags         Returns byte 2 of the feature descriptor:
4770    /// bit0=   Current
4771    /// bit1=   Persistent
4772    /// bit2-5= Version
4773    ///
4774    /// @param additional_length  Returns byte 3 of descriptor.
4775    /// This is the size of feature_data.
4776    ///
4777    /// @param feature_data  Returns further bytes of descriptor.
4778    /// If returned *feature_data is not NULL, dispose it
4779    /// by free() when it is no longer needed.
4780    ///
4781    /// @param feature_text  Returns text representation of the feature descriptor:
4782    /// Code +/- : Name : Version,P/N : Hex bytes : Parsed info
4783    /// Current features are marked by \"+\", others by \"-\".
4784    /// Persistent features are marked by \"P\", others by \"N\".
4785    /// feature_text may be submitted as NULL. In this case
4786    /// no text is generated and returned.
4787    /// If returned *feature_text is not NULL, dispose it
4788    /// by free() when it is no longer needed.
4789    ///
4790    /// @return               0 feature descriptor is not present
4791    /// -1 out of memory
4792    /// >0 success
4793    ///
4794    /// @since 1.5.2
4795    pub fn burn_drive_get_feature(
4796        d: *mut burn_drive,
4797        feature_code: ::std::os::raw::c_uint,
4798        flags: *mut ::std::os::raw::c_uchar,
4799        additional_length: *mut ::std::os::raw::c_uchar,
4800        feature_data: *mut *mut ::std::os::raw::c_uchar,
4801        feature_text: *mut *mut ::std::os::raw::c_char,
4802    ) -> ::std::os::raw::c_int;
4803}
4804unsafe extern "C" {
4805    /// Gets the maximum write speed for a drive and eventually loaded media.
4806    /// The return value might change by the media type of already loaded media,
4807    /// again by call burn_drive_grab() and again by call burn_disc_read_atip().
4808    ///
4809    /// @param d Drive to query
4810    ///
4811    /// @return Maximum write speed in K/s
4812    pub fn burn_drive_get_write_speed(d: *mut burn_drive) -> ::std::os::raw::c_int;
4813}
4814unsafe extern "C" {
4815    /// Gets the minimum write speed for a drive and eventually loaded media.
4816    /// The return value might change by the media type of already loaded media,
4817    /// again by call burn_drive_grab() and again by call burn_disc_read_atip().
4818    ///
4819    /// @param d Drive to query
4820    ///
4821    /// @return Minimum write speed in K/s
4822    ///
4823    /// @since 0.2.6
4824    pub fn burn_drive_get_min_write_speed(d: *mut burn_drive) -> ::std::os::raw::c_int;
4825}
4826unsafe extern "C" {
4827    /// Gets the maximum read speed for a drive
4828    ///
4829    /// @param d Drive to query
4830    ///
4831    /// @return Maximum read speed in K/s
4832    pub fn burn_drive_get_read_speed(d: *mut burn_drive) -> ::std::os::raw::c_int;
4833}
4834unsafe extern "C" {
4835    /// Obtain a copy of the current speed descriptor list. The drive's list gets
4836    /// updated on various occasions such as burn_drive_grab() but the copy
4837    /// obtained here stays untouched. It has to be disposed via
4838    /// burn_drive_free_speedlist() when it is not longer needed. Speeds
4839    /// may appear several times in the list. The list content depends much on
4840    /// drive and media type. It seems that .source == 1 applies mostly to CD media
4841    /// whereas .source == 2 applies to any media.
4842    ///
4843    /// @param d Drive to query
4844    ///
4845    /// @param speed_list The copy. If empty, *speed_list gets returned as NULL.
4846    ///
4847    /// @return 1=success , 0=list empty , <0 severe error
4848    ///
4849    /// @since 0.3.0
4850    pub fn burn_drive_get_speedlist(
4851        d: *mut burn_drive,
4852        speed_list: *mut *mut burn_speed_descriptor,
4853    ) -> ::std::os::raw::c_int;
4854}
4855unsafe extern "C" {
4856    /// Look up the fastest speed descriptor which is not faster than the given
4857    /// speed_goal. If it is 0, then the fastest one is chosen among the
4858    /// descriptors with the highest end_lba. If it is -1 then the slowest speed
4859    /// descriptor is chosen regardless of end_lba. Parameter flag decides whether
4860    /// the speed goal means write speed or read speed.
4861    ///
4862    /// @param d Drive to query
4863    ///
4864    /// @param speed_goal Upper limit for speed,
4865    /// 0=search for maximum speed , -1 search for minimum speed
4866    ///
4867    /// @param best_descr Result of the search, NULL if no match
4868    ///
4869    /// @param flag Bitfield for control purposes
4870    /// bit0= look for best read speed rather than write speed
4871    /// bit1= look for any source type (else look for source==2 first
4872    /// and for any other source type only with CD media)
4873    ///
4874    /// @return >0 indicates a valid best_descr, 0 = no valid best_descr
4875    ///
4876    /// @since 0.3.8
4877    pub fn burn_drive_get_best_speed(
4878        d: *mut burn_drive,
4879        speed_goal: ::std::os::raw::c_int,
4880        best_descr: *mut *mut burn_speed_descriptor,
4881        flag: ::std::os::raw::c_int,
4882    ) -> ::std::os::raw::c_int;
4883}
4884unsafe extern "C" {
4885    /// Dispose a speed descriptor list copy which was obtained by
4886    /// burn_drive_get_speedlist().
4887    ///
4888    /// @param speed_list The list copy. *speed_list gets set to NULL.
4889    ///
4890    /// @return 1=list disposed , 0= *speedlist was already NULL
4891    ///
4892    /// @since 0.3.0
4893    pub fn burn_drive_free_speedlist(
4894        speed_list: *mut *mut burn_speed_descriptor,
4895    ) -> ::std::os::raw::c_int;
4896}
4897/// The reply structure for burn_disc_get_multi_caps()
4898#[repr(C)]
4899#[derive(Debug, Copy, Clone)]
4900pub struct burn_multi_caps {
4901    pub multi_session: ::std::os::raw::c_int,
4902    pub multi_track: ::std::os::raw::c_int,
4903    pub start_adr: ::std::os::raw::c_int,
4904    /// The alignment for start addresses.
4905    /// ( start_address % start_alignment ) must be 0.
4906    pub start_alignment: libc::off_t,
4907    /// The lowest permissible start address.
4908    pub start_range_low: libc::off_t,
4909    /// The highest addressable start address.
4910    pub start_range_high: libc::off_t,
4911    /// Potential availability of write modes
4912    /// 4= needs no size prediction, not to be chosen automatically
4913    /// 3= needs size prediction, not to be chosen automatically
4914    /// 2= available, no size prediction necessary
4915    /// 1= available, needs exact size prediction
4916    /// 0= not available
4917    /// With CD media (profiles 0x09 and 0x0a) check also the elements
4918    /// _block_types of the according write mode.
4919    pub might_do_tao: ::std::os::raw::c_int,
4920    pub might_do_sao: ::std::os::raw::c_int,
4921    pub might_do_raw: ::std::os::raw::c_int,
4922    /// Generally advised write mode.
4923    /// Not necessarily the one chosen by burn_write_opts_auto_write_type()
4924    /// because the burn_disc structure might impose particular demands.
4925    pub advised_write_mode: burn_write_types,
4926    /// Write mode as given by parameter wt of burn_disc_get_multi_caps().
4927    pub selected_write_mode: burn_write_types,
4928    /// Profile number which was current when the reply was generated
4929    pub current_profile: ::std::os::raw::c_int,
4930    /// Whether the current profile indicates CD media. 1=yes, 0=no
4931    pub current_is_cd_profile: ::std::os::raw::c_int,
4932    /// Whether the current profile is able to perform simulated write
4933    pub might_simulate: ::std::os::raw::c_int,
4934}
4935#[allow(clippy::unnecessary_operation, clippy::identity_op)]
4936const _: () = {
4937    ["Size of burn_multi_caps"][::std::mem::size_of::<burn_multi_caps>() - 72usize];
4938    ["Alignment of burn_multi_caps"][::std::mem::align_of::<burn_multi_caps>() - 8usize];
4939    ["Offset of field: burn_multi_caps::multi_session"]
4940        [::std::mem::offset_of!(burn_multi_caps, multi_session) - 0usize];
4941    ["Offset of field: burn_multi_caps::multi_track"]
4942        [::std::mem::offset_of!(burn_multi_caps, multi_track) - 4usize];
4943    ["Offset of field: burn_multi_caps::start_adr"]
4944        [::std::mem::offset_of!(burn_multi_caps, start_adr) - 8usize];
4945    ["Offset of field: burn_multi_caps::start_alignment"]
4946        [::std::mem::offset_of!(burn_multi_caps, start_alignment) - 16usize];
4947    ["Offset of field: burn_multi_caps::start_range_low"]
4948        [::std::mem::offset_of!(burn_multi_caps, start_range_low) - 24usize];
4949    ["Offset of field: burn_multi_caps::start_range_high"]
4950        [::std::mem::offset_of!(burn_multi_caps, start_range_high) - 32usize];
4951    ["Offset of field: burn_multi_caps::might_do_tao"]
4952        [::std::mem::offset_of!(burn_multi_caps, might_do_tao) - 40usize];
4953    ["Offset of field: burn_multi_caps::might_do_sao"]
4954        [::std::mem::offset_of!(burn_multi_caps, might_do_sao) - 44usize];
4955    ["Offset of field: burn_multi_caps::might_do_raw"]
4956        [::std::mem::offset_of!(burn_multi_caps, might_do_raw) - 48usize];
4957    ["Offset of field: burn_multi_caps::advised_write_mode"]
4958        [::std::mem::offset_of!(burn_multi_caps, advised_write_mode) - 52usize];
4959    ["Offset of field: burn_multi_caps::selected_write_mode"]
4960        [::std::mem::offset_of!(burn_multi_caps, selected_write_mode) - 56usize];
4961    ["Offset of field: burn_multi_caps::current_profile"]
4962        [::std::mem::offset_of!(burn_multi_caps, current_profile) - 60usize];
4963    ["Offset of field: burn_multi_caps::current_is_cd_profile"]
4964        [::std::mem::offset_of!(burn_multi_caps, current_is_cd_profile) - 64usize];
4965    ["Offset of field: burn_multi_caps::might_simulate"]
4966        [::std::mem::offset_of!(burn_multi_caps, might_simulate) - 68usize];
4967};
4968unsafe extern "C" {
4969    /// Allocates a struct burn_multi_caps (see above) and fills it with values
4970    /// which are appropriate for the drive and the loaded media. The drive
4971    /// must be grabbed for this call. The returned structure has to be disposed
4972    /// via burn_disc_free_multi_caps() when no longer needed.
4973    ///
4974    /// @param d The drive to inquire
4975    ///
4976    /// @param wt With BURN_WRITE_NONE the best capabilities of all write modes
4977    /// get returned. If set to a write mode like BURN_WRITE_SAO the
4978    /// capabilities with that particular mode are returned and the
4979    /// return value is 0 if the desired mode is not possible.
4980    ///
4981    /// @param caps returns the info structure
4982    ///
4983    /// @param flag Bitfield for control purposes (unused yet, submit 0)
4984    ///
4985    /// @return < 0 : error , 0 : writing seems impossible , 1 : writing possible
4986    ///
4987    /// @since 0.3.2
4988    pub fn burn_disc_get_multi_caps(
4989        d: *mut burn_drive,
4990        wt: burn_write_types,
4991        caps: *mut *mut burn_multi_caps,
4992        flag: ::std::os::raw::c_int,
4993    ) -> ::std::os::raw::c_int;
4994}
4995unsafe extern "C" {
4996    /// Removes from memory a multi session info structure which was returned by
4997    /// burn_disc_get_multi_caps(). The pointer *caps gets set to NULL.
4998    ///
4999    /// @param caps the info structure to dispose (note: pointer to pointer)
5000    ///
5001    /// @return 0 : *caps was already NULL, 1 : memory object was disposed
5002    ///
5003    /// @since 0.3.2
5004    pub fn burn_disc_free_multi_caps(caps: *mut *mut burn_multi_caps) -> ::std::os::raw::c_int;
5005}
5006unsafe extern "C" {
5007    /// Gets a copy of the toc_entry structure associated with a track
5008    ///
5009    /// @param t Track to get the entry from
5010    ///
5011    /// @param entry Struct for the library to fill out
5012    pub fn burn_track_get_entry(t: *mut burn_track, entry: *mut burn_toc_entry);
5013}
5014unsafe extern "C" {
5015    /// Gets a copy of the toc_entry structure associated with a session's lead out
5016    ///
5017    /// @param s Session to get the entry from
5018    ///
5019    /// @param entry Struct for the library to fill out
5020    pub fn burn_session_get_leadout_entry(s: *mut burn_session, entry: *mut burn_toc_entry);
5021}
5022unsafe extern "C" {
5023    /// Gets an array of all complete sessions for the disc
5024    /// THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A SESSION
5025    /// The result array contains *num + burn_disc_get_incomplete_sessions()
5026    /// elements. All above *num are incomplete sessions.
5027    /// Typically there is at most one incomplete session with one empty track.
5028    /// DVD+R and BD-R seem support more than one track with even readable data.
5029    ///
5030    /// @param d Disc to get session array for
5031    ///
5032    /// @param num Returns the number of sessions in the array
5033    ///
5034    /// @return array of sessions
5035    pub fn burn_disc_get_sessions(
5036        d: *mut burn_disc,
5037        num: *mut ::std::os::raw::c_int,
5038    ) -> *mut *mut burn_session;
5039}
5040unsafe extern "C" {
5041    /// Obtains the number of incomplete sessions which are recorded in the
5042    /// result array of burn_disc_get_sessions() after the complete sessions.
5043    /// See above.
5044    ///
5045    /// @param d Disc object to inquire
5046    ///
5047    /// @return  Number of incomplete sessions
5048    pub fn burn_disc_get_incomplete_sessions(d: *mut burn_disc) -> ::std::os::raw::c_int;
5049}
5050unsafe extern "C" {
5051    pub fn burn_disc_get_sectors(d: *mut burn_disc) -> ::std::os::raw::c_int;
5052}
5053unsafe extern "C" {
5054    /// Gets an array of all the tracks for a session
5055    /// THIS IS NO LONGER VALID AFTER YOU ADD OR REMOVE A TRACK
5056    ///
5057    /// @param s session to get track array for
5058    ///
5059    /// @param num Returns the number of tracks in the array
5060    ///
5061    /// @return array of tracks
5062    pub fn burn_session_get_tracks(
5063        s: *mut burn_session,
5064        num: *mut ::std::os::raw::c_int,
5065    ) -> *mut *mut burn_track;
5066}
5067unsafe extern "C" {
5068    pub fn burn_session_get_sectors(s: *mut burn_session) -> ::std::os::raw::c_int;
5069}
5070unsafe extern "C" {
5071    /// Gets the mode of a track
5072    ///
5073    /// @param track the track to query
5074    ///
5075    /// @return the track's mode
5076    pub fn burn_track_get_mode(track: *mut burn_track) -> ::std::os::raw::c_int;
5077}
5078unsafe extern "C" {
5079    /// Returns whether the first track of a session is hidden in the pregap
5080    ///
5081    /// @param session the session to query
5082    ///
5083    /// @return non-zero means the first track is hidden
5084    pub fn burn_session_get_hidefirst(session: *mut burn_session) -> ::std::os::raw::c_int;
5085}
5086unsafe extern "C" {
5087    /// Returns the library's version in its parts.
5088    /// This is the runtime counterpart of the three build time macros
5089    /// burn_header_version_* below.
5090    ///
5091    /// @param major The major version number
5092    ///
5093    /// @param minor The minor version number
5094    ///
5095    /// @param micro The micro version number
5096    pub fn burn_version(
5097        major: *mut ::std::os::raw::c_int,
5098        minor: *mut ::std::os::raw::c_int,
5099        micro: *mut ::std::os::raw::c_int,
5100    );
5101}
5102unsafe extern "C" {
5103    /// Obtain the id string of the SCSI transport interface.
5104    /// This interface may be a system specific adapter module of libburn or
5105    /// an adapter to a supporting library like libcdio.
5106    ///
5107    /// @param flag  Bitfield for control puposes, submit 0 for now
5108    ///
5109    /// @return      A pointer to the id string. Do not alter the string content.
5110    ///
5111    /// @since 0.7.6
5112    pub fn burn_scsi_transport_id(flag: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char;
5113}
5114unsafe extern "C" {
5115    /// Control queueing and stderr printing of messages from libburn.
5116    /// Severity may be one of \"NEVER\", \"ABORT\", \"FATAL\", \"FAILURE\", \"SORRY\",
5117    /// \"WARNING\", \"HINT\", \"NOTE\", \"UPDATE\", \"DEBUG\", \"ALL\".
5118    ///
5119    /// @param queue_severity Gives the minimum limit for messages to be queued.
5120    /// Default: \"NEVER\". If you queue messages then you
5121    /// must consume them by burn_msgs_obtain().
5122    ///
5123    /// @param print_severity Does the same for messages to be printed directly
5124    /// to stderr. Default: \"FATAL\".
5125    ///
5126    /// @param print_id       A text prefix to be printed before the message.
5127    ///
5128    /// @return               >0 for success, <=0 for error
5129    ///
5130    /// @since 0.2.6
5131    pub fn burn_msgs_set_severities(
5132        queue_severity: *mut ::std::os::raw::c_char,
5133        print_severity: *mut ::std::os::raw::c_char,
5134        print_id: *mut ::std::os::raw::c_char,
5135    ) -> ::std::os::raw::c_int;
5136}
5137unsafe extern "C" {
5138    /// Obtain the oldest pending libburn message from the queue which has at
5139    /// least the given minimum_severity. This message and any older message of
5140    /// lower severity will get discarded from the queue and is then lost forever.
5141    ///
5142    /// @param minimum_severity  may be one of \"NEVER\", \"ABORT\", \"FATAL\",
5143    /// \"FAILURE\", \"SORRY\", \"WARNING\", \"HINT\", \"NOTE\", \"UPDATE\",
5144    /// \"DEBUG\", \"ALL\".
5145    /// To call with minimum_severity \"NEVER\" will discard the
5146    /// whole queue.
5147    ///
5148    /// @param error_code Will become a unique error code as listed in
5149    /// libburn/libdax_msgs.h
5150    ///
5151    /// @param msg_text   Must provide at least BURN_MSGS_MESSAGE_LEN bytes.
5152    ///
5153    /// @param os_errno   Will become the eventual errno related to the message
5154    ///
5155    /// @param severity   Will become the severity related to the message and
5156    /// should provide at least 80 bytes.
5157    ///
5158    /// @return 1 if a matching item was found, 0 if not, <0 for severe errors
5159    ///
5160    /// @since 0.2.6
5161    pub fn burn_msgs_obtain(
5162        minimum_severity: *mut ::std::os::raw::c_char,
5163        error_code: *mut ::std::os::raw::c_int,
5164        msg_text: *mut ::std::os::raw::c_char,
5165        os_errno: *mut ::std::os::raw::c_int,
5166        severity: *mut ::std::os::raw::c_char,
5167    ) -> ::std::os::raw::c_int;
5168}
5169unsafe extern "C" {
5170    /// Submit a message to the libburn queueing system. It will be queued or
5171    /// printed as if it was generated by libburn itself.
5172    ///
5173    /// @param error_code The unique error code of your message.
5174    /// Submit 0 if you do not have reserved error codes within
5175    /// the libburnia project.
5176    ///
5177    /// @param msg_text   Not more than BURN_MSGS_MESSAGE_LEN characters of
5178    /// message text.
5179    ///
5180    /// @param os_errno   Eventual errno related to the message. Submit 0 if
5181    /// the message is not related to a operating system error.
5182    ///
5183    /// @param severity   One of \"ABORT\", \"FATAL\", \"FAILURE\", \"SORRY\", \"WARNING\",
5184    /// \"HINT\", \"NOTE\", \"UPDATE\", \"DEBUG\". Defaults to \"FATAL\".
5185    ///
5186    /// @param d          An eventual drive to which the message shall be related.
5187    /// Submit NULL if the message is not specific to a
5188    /// particular drive object.
5189    ///
5190    /// @return           1 if message was delivered, <=0 if failure
5191    ///
5192    /// @since 0.4.0
5193    pub fn burn_msgs_submit(
5194        error_code: ::std::os::raw::c_int,
5195        msg_text: *mut ::std::os::raw::c_char,
5196        os_errno: ::std::os::raw::c_int,
5197        severity: *mut ::std::os::raw::c_char,
5198        d: *mut burn_drive,
5199    ) -> ::std::os::raw::c_int;
5200}
5201unsafe extern "C" {
5202    /// Convert a severity name into a severity number, which gives the severity
5203    /// rank of the name.
5204    ///
5205    /// @param severity_name A name as with burn_msgs_submit(), e.g. \"SORRY\".
5206    ///
5207    /// @param severity_number The rank number: the higher, the more severe.
5208    ///
5209    /// @param flag Bitfield for control purposes (unused yet, submit 0)
5210    ///
5211    /// @return >0 success, <=0 failure
5212    ///
5213    /// @since 0.4.0
5214    pub fn burn_text_to_sev(
5215        severity_name: *mut ::std::os::raw::c_char,
5216        severity_number: *mut ::std::os::raw::c_int,
5217        flag: ::std::os::raw::c_int,
5218    ) -> ::std::os::raw::c_int;
5219}
5220unsafe extern "C" {
5221    /// Convert a severity number into a severity name
5222    ///
5223    /// @param severity_number The rank number: the higher, the more severe.
5224    ///
5225    /// @param severity_name A name as with burn_msgs_submit(), e.g. \"SORRY\".
5226    ///
5227    /// @param flag Bitfield for control purposes (unused yet, submit 0)
5228    ///
5229    /// @return >0 success, <=0 failure
5230    ///
5231    /// @since 0.4.4
5232    pub fn burn_sev_to_text(
5233        severity_number: ::std::os::raw::c_int,
5234        severity_name: *mut *mut ::std::os::raw::c_char,
5235        flag: ::std::os::raw::c_int,
5236    ) -> ::std::os::raw::c_int;
5237}
5238unsafe extern "C" {
5239    /// Return a blank separated list of severity names. Sorted from low
5240    /// to high severity.
5241    ///
5242    /// @param flag Bitfield for control purposes (unused yet, submit 0)
5243    ///
5244    /// @return  A constant string with the severity names
5245    ///
5246    /// @since 1.2.6
5247    pub fn burn_list_sev_texts(flag: ::std::os::raw::c_int) -> *mut ::std::os::raw::c_char;
5248}
5249unsafe extern "C" {
5250    /// Replace the messenger object handle of libburn by a compatible handle
5251    /// obtained from a related library.
5252    /// See also: libisofs, API function iso_get_messenger().
5253    ///
5254    /// @param messenger The foreign but compatible message handle.
5255    ///
5256    /// @return 1 : success, <=0 : failure
5257    ///
5258    /// @since 0.4.0
5259    pub fn burn_set_messenger(messenger: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int;
5260}
5261/// The prototype of a handler function suitable for burn_set_signal_handling()
5262/// Such a function has to return -2 if it does not want the process to
5263/// exit with value 1.
5264pub type burn_abort_handler_t = ::std::option::Option<
5265    unsafe extern "C" fn(
5266        handle: *mut ::std::os::raw::c_void,
5267        signum: ::std::os::raw::c_int,
5268        flag: ::std::os::raw::c_int,
5269    ) -> ::std::os::raw::c_int,
5270>;
5271unsafe extern "C" {
5272    /// Control built-in signal handling. Either by setting an own handler or
5273    /// by activating the built-in signal handler.
5274    ///
5275    /// A function parameter handle of NULL activates the built-in abort handler.
5276    /// Depending on mode it may cancel all drive operations, wait for all drives
5277    /// to become idle, exit(1). It may also prepare function
5278    /// burn_drive_get_status() for waiting and performing exit(1).
5279    /// Parameter handle may be NULL or a text that shall be used as prefix for
5280    /// pacifier messages of burn_abort_pacifier(). Other than with an application
5281    /// provided handler, the prefix char array does not have to be kept existing
5282    /// until the eventual signal event.
5283    /// Before version 0.7.8 only action 0 was available. I.e. the built-in handler
5284    /// waited for the drives to become idle and then performed exit(1) directly.
5285    /// But during burn_disc_write() onto real CD or DVD, FreeBSD 8.0 pauses the
5286    /// other threads until the signal handler returns.
5287    /// The new actions try to avoid this deadlock. It is advised to use action 3
5288    /// at least during burn_disc_write(), burn_disc_erase(), burn_disc_format():
5289    /// burn_set_signal_handling(text, NULL, 0x30);
5290    /// and to call burn_is_aborting(0) when the drive is BURN_DRIVE_IDLE.
5291    /// If burn_is_aborting(0) returns 1, then call burn_abort() and exit(1).
5292    ///
5293    ///
5294    /// @param handle Opaque handle eventually pointing to an application
5295    /// provided memory object
5296    ///
5297    /// @param handler A function to be called on signals, if the handling bits
5298    /// in parameter mode are set 0.
5299    /// It will get parameter handle as argument. flag will be 0.
5300    /// It should finally call burn_abort(). See there.
5301    /// If the handler function returns 2 or -2, then the wrapping
5302    /// signal handler of libburn will return and let the program
5303    /// continue its operations. Any other return value causes
5304    /// exit(1).
5305    ///
5306    /// @param mode : bit0 - bit3: Handling of received signals:
5307    /// 0 Install libburn wrapping signal handler, which will call
5308    /// handler(handle, signum, 0) on nearly all signals
5309    /// 1 Enable system default reaction on all signals
5310    /// 2 Try to ignore nearly all signals
5311    /// 10 like mode 2 but handle SIGABRT like with mode 0
5312    /// bit4 - bit7: With handler == NULL :
5313    /// Action of built-in handler. \"control thread\" is the one
5314    /// which called burn_set_signal_handling().
5315    /// All actions activate receive mode 2 to ignore further
5316    /// signals.
5317    /// 0 Same as 1 (for pre-0.7.8 backward compatibility)
5318    ///
5319    /// @since 0.7.8
5320    /// 1 Catch the control thread in abort handler, call
5321    /// burn_abort() with a patience value > 0 and
5322    /// finally exit(1). Does not always work with FreeBSD.
5323    /// 2 Call burn_abort() with patience -1 and return from
5324    /// handler. When the control thread calls
5325    /// burn_drive_get_status(), then call burn_abort()
5326    /// with patience 1 instead, and finally exit(1).
5327    /// Does not always work with FreeBSD.
5328    /// 3 Call burn_abort() with patience -1, return from handler.
5329    /// It is duty of the application to detect a pending abort
5330    /// condition by calling burn_is_aborting() and to wait for
5331    /// all drives to become idle. E.g. by calling burn_abort()
5332    /// with patience >0.
5333    /// 4 Like 3, but without calling burn_abort() with -1. Only
5334    /// the indicator of burn_is_aborting() gets set.
5335    /// bit8: @since 1.3.2
5336    /// try to ignore SIGPIPE (regardless of bit0 - bit3)
5337    ///
5338    ///
5339    /// @since 0.2.6
5340    pub fn burn_set_signal_handling(
5341        handle: *mut ::std::os::raw::c_void,
5342        handler: burn_abort_handler_t,
5343        mode: ::std::os::raw::c_int,
5344    );
5345}
5346unsafe extern "C" {
5347    pub fn burn_is_aborting(flag: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
5348}
5349unsafe extern "C" {
5350    /// Write data in random access mode.
5351    /// The drive must be grabbed successfully before calling this function which
5352    /// circumvents usual libburn session processing and rather writes data without
5353    /// preparations or finalizing. This will work only with overwritable media
5354    /// which are also suitable for burn_write_opts_set_start_byte(). The same
5355    /// address alignment restrictions as with this function apply. I.e. for DVD
5356    /// it is best to align to 32 KiB blocks (= 16 LBA units). The amount of data
5357    /// to be written is subject to the same media dependent alignment rules.
5358    /// Again, 32 KiB is most safe.
5359    /// Call burn_disc_get_multi_caps() can obtain the necessary media info. See
5360    /// resulting struct burn_multi_caps elements .start_adr , .start_alignment ,
5361    /// .start_range_low , .start_range_high .
5362    /// Other than burn_disc_write() this is a synchronous call which returns
5363    /// only after the write transaction has ended (successfully or not). So it is
5364    /// wise not to transfer giant amounts of data in a single call.
5365    /// Important: Data have to fit into the already formatted area of the media.
5366    ///
5367    /// If the burn_drive object is in simulation mode, then no actual write
5368    /// operation or synchronization of the drive buffer will happen.
5369    /// See burn_drive_reset_simulate().
5370    ///
5371    ///
5372    /// @param d            The drive to which to write
5373    ///
5374    /// @param byte_address The start address of the write in byte
5375    /// (1 LBA unit = 2048 bytes) (do respect media alignment)
5376    ///
5377    /// @param data         The bytes to be written
5378    ///
5379    /// @param data_count   The number of those bytes (do respect media alignment)
5380    /// data_count == 0 is permitted (e.g. to flush the
5381    /// drive buffer without further data transfer).
5382    ///
5383    /// @param flag         Bitfield for control purposes:
5384    /// bit0 = flush the drive buffer after eventual writing
5385    ///
5386    /// @return 1=successful , <=0 : number of transferred bytes * -1
5387    ///
5388    /// @since 0.4.0
5389    pub fn burn_random_access_write(
5390        d: *mut burn_drive,
5391        byte_address: libc::off_t,
5392        data: *mut ::std::os::raw::c_char,
5393        data_count: libc::off_t,
5394        flag: ::std::os::raw::c_int,
5395    ) -> ::std::os::raw::c_int;
5396}
5397unsafe extern "C" {
5398    /// Inquire the maximum amount of readable data.
5399    /// On DVD and BD it is supposed that all LBAs in the range from 0 to
5400    /// capacity - 1 can be read via burn_read_data() although some of them may
5401    /// never have been recorded. With multi-session CD there have to be
5402    /// expected unreadable TAO Run-out blocks.
5403    /// If tracks are recognizable then it is better to only read LBAs which
5404    /// are part of some track and on CD to be cautious about the last two blocks
5405    /// of each track which might be TAO Run-out blocks.
5406    /// If the drive is actually a large file or block device, then the capacity
5407    /// is curbed to a maximum of 0x7ffffff0 blocks = 4 TB - 32 KB.
5408    ///
5409    /// @param d            The drive from which to read
5410    ///
5411    /// @param capacity     Will return the result if valid
5412    ///
5413    /// @param flag         Bitfield for control purposes: Unused yet, submit 0.
5414    ///
5415    /// @return 1=successful , <=0 an error occurred
5416    ///
5417    /// @since 0.6.0
5418    pub fn burn_get_read_capacity(
5419        d: *mut burn_drive,
5420        capacity: *mut ::std::os::raw::c_int,
5421        flag: ::std::os::raw::c_int,
5422    ) -> ::std::os::raw::c_int;
5423}
5424unsafe extern "C" {
5425    /// Read data in random access mode.
5426    /// The drive must be grabbed successfully before calling this function.
5427    /// With all currently supported drives and media the byte_address has to
5428    /// be aligned to 2048 bytes. Only data tracks with 2048 bytes per sector
5429    /// can be read this way. I.e. not CD-audio, not CD-video-stream ...
5430    /// This is a synchronous call which returns only after the full read job
5431    /// has ended (successfully or not). So it is wise not to read giant amounts
5432    /// of data in a single call.
5433    ///
5434    /// @param d            The drive from which to read
5435    ///
5436    /// @param byte_address The start address of the read in byte (aligned to 2048)
5437    ///
5438    /// @param data         A memory buffer capable of taking data_size bytes
5439    ///
5440    /// @param data_size    The amount of data to be read. This does not have to
5441    /// be aligned to any block size.
5442    ///
5443    /// @param data_count   The amount of data actually read (interesting on error)
5444    /// The counted bytes are supposed to be valid.
5445    ///
5446    /// @param flag         Bitfield for control purposes:
5447    /// bit0= - reserved -
5448    /// bit1= do not submit error message if read error
5449    /// bit2= on error do not try to read a second time
5450    /// with single block steps.
5451    ///
5452    /// @since 0.5.2
5453    /// bit3= return -2 on permission denied error rather than
5454    /// issuing a warning message.
5455    ///
5456    /// @since 1.0.6
5457    /// bit4= return -3 on SCSI error
5458    /// 5 64 00 ILLEGAL MODE FOR THIS TRACK
5459    /// and prevent this error from being reported as
5460    /// event message. Do not retry reading in this case.
5461    /// (Useful to try the last two blocks of a CD
5462    /// track which might be non-data because of TAO.)
5463    ///
5464    /// @since 1.2.6
5465    /// bit5= issue messages with severity DEBUG if they would
5466    /// be suppressed by bit1.
5467    ///
5468    /// @since 1.4.0
5469    ///
5470    /// @return 1=successful , <=0 an error occurred
5471    /// with bit3:  -2= permission denied error
5472    ///
5473    /// @since 0.4.0
5474    pub fn burn_read_data(
5475        d: *mut burn_drive,
5476        byte_address: libc::off_t,
5477        data: *mut ::std::os::raw::c_char,
5478        data_size: libc::off_t,
5479        data_count: *mut libc::off_t,
5480        flag: ::std::os::raw::c_int,
5481    ) -> ::std::os::raw::c_int;
5482}
5483unsafe extern "C" {
5484    /// Read CD audio sectors in random access mode.
5485    /// The drive must be grabbed successfully before calling this function.
5486    /// Only CD audio tracks with 2352 bytes per sector can be read this way.
5487    /// I.e. not data tracks, not CD-video-stream, ...
5488    ///
5489    /// Note that audio data do not have exact block addressing. If you read a
5490    /// sequence of successive blocks then you will get a seamless stream
5491    /// of data. But the actual start and end position of this audio stream
5492    /// will differ by a few dozens of milliseconds, depending on individual
5493    /// CD and individual drive.
5494    /// Expect leading and trailing zeros, as well as slight truncation.
5495    ///
5496    ///
5497    /// @param d            The drive from which to read.
5498    /// It must be a real MMC drive (i.e. not a stdio file)
5499    /// and it must have a CD loaded (i.e. not DVD or BD).
5500    ///
5501    /// @param sector_no    The sector number (Logical Block Address)
5502    /// It may be slightly below 0, depending on drive and
5503    /// medium. -150 is a lower limit.
5504    ///
5505    /// @param data         A memory buffer capable of taking data_size bytes
5506    ///
5507    /// @param data_size    The amount of data to be read. This must be aligned
5508    /// to full multiples of 2352.
5509    ///
5510    /// @param data_count   The amount of data actually read (interesting on error)
5511    ///
5512    /// @param flag         Bitfield for control purposes:
5513    /// bit0= - reserved -
5514    /// bit1= do not submit error message if read error
5515    /// bit2= on error do not try to read a second time
5516    /// with single block steps.
5517    /// bit3= Enable DAP : \"flaw obscuring mechanisms like
5518    /// audio data mute and interpolate\"
5519    /// bit4= return -3 on SCSI error
5520    /// 5 64 00 ILLEGAL MODE FOR THIS TRACK
5521    /// and prevent this error from being reported as
5522    /// event message. Do not retry reading in this case.
5523    /// (Useful to try the last two blocks of a CD
5524    /// track which might be non-audio because of TAO.)
5525    /// bit5= issue messages with severity DEBUG if they would
5526    /// be suppressed by bit1.
5527    ///
5528    /// @since 1.4.0
5529    ///
5530    /// @return 1=successful , <=0 an error occurred
5531    /// with bit3:  -2= permission denied error
5532    ///
5533    /// @since 1.2.6
5534    pub fn burn_read_audio(
5535        d: *mut burn_drive,
5536        sector_no: ::std::os::raw::c_int,
5537        data: *mut ::std::os::raw::c_char,
5538        data_size: libc::off_t,
5539        data_count: *mut libc::off_t,
5540        flag: ::std::os::raw::c_int,
5541    ) -> ::std::os::raw::c_int;
5542}
5543unsafe extern "C" {
5544    /// Extract an interval of audio sectors from CD and store it as a WAVE
5545    /// audio file on hard disk.
5546    ///
5547    ///
5548    /// @param drive        The drive from which to read.
5549    ///
5550    /// @param start_sector The logical block address of the first audio sector
5551    /// which shall be read.
5552    ///
5553    /// @param sector_count The number of audio sectors to be read.
5554    /// Each sector consists of 2352 bytes.
5555    ///
5556    /// @param target_path  The address of the file where to store the extracted
5557    /// audio data. Will be opened O_WRONLY | O_CREAT.
5558    /// The file name should have suffix \".wav\".
5559    ///
5560    /// @param flag         Bitfield for control purposes:
5561    /// bit0= Report about progress by UPDATE messages
5562    /// bit3= Enable DAP : \"flaw obscuring mechanisms like
5563    /// audio data mute and interpolate\"
5564    ///
5565    /// @since 1.3.2
5566    pub fn burn_drive_extract_audio(
5567        drive: *mut burn_drive,
5568        start_sector: ::std::os::raw::c_int,
5569        sector_count: ::std::os::raw::c_int,
5570        target_path: *mut ::std::os::raw::c_char,
5571        flag: ::std::os::raw::c_int,
5572    ) -> ::std::os::raw::c_int;
5573}
5574unsafe extern "C" {
5575    /// Extract all audio sectors of a track from CD and store them as a WAVE
5576    /// audio file on hard disk.
5577    ///
5578    ///
5579    /// @param drive        The drive from which to read.
5580    ///
5581    /// @param track        The track which shall be extracted.
5582    ///
5583    /// @param target_path  The address of the file where to store the extracted
5584    /// audio data. Will be opened O_WRONLY | O_CREAT.
5585    /// The file name should have suffix \".wav\".
5586    ///
5587    /// @param flag         Bitfield for control purposes:
5588    /// bit0= Report about progress by UPDATE messages
5589    /// bit3= Enable DAP : \"flaw obscuring mechanisms like
5590    /// audio data mute and interpolate\"
5591    ///
5592    /// @since 1.3.2
5593    pub fn burn_drive_extract_audio_track(
5594        drive: *mut burn_drive,
5595        track: *mut burn_track,
5596        target_path: *mut ::std::os::raw::c_char,
5597        flag: ::std::os::raw::c_int,
5598    ) -> ::std::os::raw::c_int;
5599}
5600unsafe extern "C" {
5601    /// Inquire whether the drive object is a real MMC drive or a pseudo-drive
5602    /// created by a stdio: address.
5603    ///
5604    /// @param d      The drive to inquire
5605    ///
5606    /// @return       0= null-drive
5607    /// 1= real MMC drive
5608    /// 2= stdio-drive, random access, read-write
5609    /// 3= stdio-drive, sequential, write-only
5610    /// 4= stdio-drive, random access, read-only
5611    /// (only if enabled by burn_allow_drive_role_4())
5612    /// 5= stdio-drive, random access, write-only
5613    /// (only if enabled by burn_allow_drive_role_4())
5614    ///
5615    /// @since 0.4.0
5616    pub fn burn_drive_get_drive_role(d: *mut burn_drive) -> ::std::os::raw::c_int;
5617}
5618unsafe extern "C" {
5619    /// Allow drive role 4 \"random access read-only\"
5620    /// and drive role 5 \"random access write-only\".
5621    /// By default a random access file assumes drive role 2 \"read-write\"
5622    /// regardless whether it is actually readable or writeable.
5623    /// If enabled, random-access file objects which recognizably permit no
5624    /// writing will be classified as role 4 and those which permit no reading
5625    /// will get role 5.
5626    /// Candidates are drive addresses of the form stdio:/dev/fd/# , where # is
5627    /// the integer number of an open file descriptor. If this descriptor was
5628    /// opened read-only or write-only, then it gets role 4 or role 5,
5629    /// respectively.
5630    /// Other paths may get tested by an attempt to open them for read-write
5631    /// (role 2) or read-only (role 4) or write-only (role 5). See bit1.
5632    ///
5633    /// @param allowed      Bitfield for control purposes:
5634    /// bit0= Enable roles 4 and 5 for drives which get
5635    /// acquired after this call
5636    /// bit1= with bit0:
5637    /// Test whether the file can be opened for
5638    /// read-write, read-only, or write-only.
5639    /// Classify as roles 2, 4, 5.
5640    /// bit2= with bit0 and bit1:
5641    /// Classify files which cannot be opened at all
5642    /// as role 0 : useless dummy.
5643    /// Else classify as role 2.
5644    /// bit3= Classify non-empty role 5 drives as
5645    /// BURN_DISC_APPENDABLE with Next Writeable Address
5646    /// after the end of the file. It is nevertheless
5647    /// possible to change this address by call
5648    /// burn_write_opts_set_start_byte().
5649    ///
5650    /// @since 1.0.6
5651    pub fn burn_allow_drive_role_4(allowed: ::std::os::raw::c_int);
5652}
5653unsafe extern "C" {
5654    /// Find out whether a given address string would lead to the given drive
5655    /// object. This should be done in advance for track source addresses
5656    /// with parameter drive_role set to 2.
5657    /// Although a real MMC drive should hardly exist as two drive objects at
5658    /// the same time, this can easily happen with stdio-drives. So if more than
5659    /// one drive is used by the application, then this gesture is advised:
5660    /// burn_drive_d_get_adr(d2, adr2);
5661    /// if (burn_drive_equals_adr(d1, adr2, burn_drive_get_drive_role(d2)))
5662    /// ... Both drive objects point to the same storage facility ...
5663    ///
5664    ///
5665    /// @param d1      Existing drive object
5666    ///
5667    /// @param adr2    Address string to be tested. Prefix \"stdio:\" overrides
5668    /// parameter drive_role2 by either 0 or 2 as appropriate.
5669    /// The string must be shorter than BURN_DRIVE_ADR_LEN.
5670    ///
5671    /// @param drive_role2  Role as burn_drive_get_drive_role() would attribute
5672    /// to adr2 if it was a drive. Use value 2 for checking track
5673    /// sources or pseudo-drive addresses without \"stdio:\".
5674    /// Use 1 for checking drive addresses including those with
5675    /// prefix \"stdio:\".
5676    ///
5677    /// @return        1= adr2 leads to d1 , 0= adr2 seems not to lead to d1,
5678    /// -1 = adr2 is bad
5679    ///
5680    /// @since 0.4.0
5681    pub fn burn_drive_equals_adr(
5682        d1: *mut burn_drive,
5683        adr2: *mut ::std::os::raw::c_char,
5684        drive_role2: ::std::os::raw::c_int,
5685    ) -> ::std::os::raw::c_int;
5686}
5687/// Extractor object encapsulating intermediate states of extraction.
5688/// The clients of libdax_audioxtr shall only allocate pointers to this
5689/// struct and get a storage object via libdax_audioxtr_new().
5690/// Appropriate initial value for the pointer is NULL.
5691#[repr(C)]
5692#[derive(Debug, Copy, Clone)]
5693pub struct libdax_audioxtr {
5694    _unused: [u8; 0],
5695}
5696unsafe extern "C" {
5697    /// Open an audio file, check whether suitable, create extractor object.
5698    ///
5699    /// @param xtr Opaque handle to extractor. Gets attached extractor object.
5700    ///
5701    /// @param path Address of the audio file to extract. \"-\" is stdin (but might
5702    /// be not suitable for all futurely supported formats).
5703    ///
5704    /// @param flag Bitfield for control purposes (unused yet, submit 0)
5705    ///
5706    /// @return >0 success
5707    /// 0 unsuitable format
5708    /// -1 severe error
5709    /// -2 path not found
5710    ///
5711    /// @since 0.2.4
5712    pub fn libdax_audioxtr_new(
5713        xtr: *mut *mut libdax_audioxtr,
5714        path: *mut ::std::os::raw::c_char,
5715        flag: ::std::os::raw::c_int,
5716    ) -> ::std::os::raw::c_int;
5717}
5718unsafe extern "C" {
5719    /// Obtain identification parameters of opened audio source.
5720    ///
5721    /// @param xtr Opaque handle to extractor
5722    ///
5723    /// @param fmt Gets pointed to the audio file format id text: \".wav\" , \".au\"
5724    ///
5725    /// @param fmt_info Gets pointed to a format info text telling parameters
5726    ///
5727    /// @param num_channels     e.g. 1=mono, 2=stereo, etc
5728    ///
5729    /// @param sample_rate      e.g. 11025, 44100
5730    ///
5731    /// @param bits_per_sample  e.g. 8= 8 bits per sample, 16= 16 bits ...
5732    ///
5733    /// @param msb_first Byte order of samples: 0= Intel    = Little Endian
5734    /// 1= Motorola = Big Endian
5735    ///
5736    /// @param flag Bitfield for control purposes (unused yet, submit 0)
5737    ///
5738    /// @return >0 success, <=0 failure
5739    ///
5740    /// @since 0.2.4
5741    pub fn libdax_audioxtr_get_id(
5742        xtr: *mut libdax_audioxtr,
5743        fmt: *mut *mut ::std::os::raw::c_char,
5744        fmt_info: *mut *mut ::std::os::raw::c_char,
5745        num_channels: *mut ::std::os::raw::c_int,
5746        sample_rate: *mut ::std::os::raw::c_int,
5747        bits_per_sample: *mut ::std::os::raw::c_int,
5748        msb_first: *mut ::std::os::raw::c_int,
5749        flag: ::std::os::raw::c_int,
5750    ) -> ::std::os::raw::c_int;
5751}
5752unsafe extern "C" {
5753    /// Obtain a prediction about the extracted size based on internal information
5754    /// of the formatted file.
5755    ///
5756    /// @param o    Opaque handle to extractor
5757    ///
5758    /// @param size Gets filled with the predicted size
5759    ///
5760    /// @param flag Bitfield for control purposes (unused yet, submit 0)
5761    ///
5762    /// @return 1 prediction was possible , 0 no prediction could be made
5763    ///
5764    /// @since 0.2.4
5765    pub fn libdax_audioxtr_get_size(
5766        o: *mut libdax_audioxtr,
5767        size: *mut libc::off_t,
5768        flag: ::std::os::raw::c_int,
5769    ) -> ::std::os::raw::c_int;
5770}
5771unsafe extern "C" {
5772    /// Obtain next buffer full of extracted data in desired format (only raw audio
5773    /// for now).
5774    ///
5775    /// @param xtr Opaque handle to extractor
5776    ///
5777    /// @param buffer Gets filled with extracted data
5778    ///
5779    /// @param buffer_size Maximum number of bytes to be filled into buffer
5780    ///
5781    /// @param flag Bitfield for control purposes
5782    /// bit0= do not stop at predicted end of data
5783    ///
5784    /// @return >0 number of valid buffer bytes,
5785    /// 0 End of file
5786    /// -1 operating system reports error
5787    /// -2 usage error by application
5788    ///
5789    /// @since 0.2.4
5790    pub fn libdax_audioxtr_read(
5791        xtr: *mut libdax_audioxtr,
5792        buffer: *mut ::std::os::raw::c_char,
5793        buffer_size: ::std::os::raw::c_int,
5794        flag: ::std::os::raw::c_int,
5795    ) -> ::std::os::raw::c_int;
5796}
5797unsafe extern "C" {
5798    /// Try to obtain a file descriptor which will deliver extracted data
5799    /// to normal calls of read(2). This may fail because the format is
5800    /// unsuitable for that, but WAVE (.wav) is ok. If this call succeeds the xtr
5801    /// object will have forgotten its file descriptor and libdax_audioxtr_read()
5802    /// will return a usage error. One may use *fd after libdax_audioxtr_destroy()
5803    /// and will have to close it via close(2) when done with it.
5804    ///
5805    /// @param o    Opaque handle to extractor
5806    ///
5807    /// @param fd   Returns the file descriptor number
5808    ///
5809    /// @param flag Bitfield for control purposes
5810    /// bit0= do not dup(2) and close(2) but hand out original fd
5811    ///
5812    /// @return 1 success, 0 cannot hand out fd , -1 severe error
5813    ///
5814    /// @since 0.2.4
5815    pub fn libdax_audioxtr_detach_fd(
5816        o: *mut libdax_audioxtr,
5817        fd: *mut ::std::os::raw::c_int,
5818        flag: ::std::os::raw::c_int,
5819    ) -> ::std::os::raw::c_int;
5820}
5821unsafe extern "C" {
5822    /// Clean up after extraction and destroy extractor object.
5823    ///
5824    /// @param xtr Opaque handle to extractor, *xtr is allowed to be NULL,
5825    /// xtr is set to NULL by this function
5826    ///
5827    /// @param flag Bitfield for control purposes (unused yet, submit 0)
5828    ///
5829    /// @return 1 = destroyed object, 0 = was already destroyed
5830    ///
5831    /// @since 0.2.4
5832    pub fn libdax_audioxtr_destroy(
5833        xtr: *mut *mut libdax_audioxtr,
5834        flag: ::std::os::raw::c_int,
5835    ) -> ::std::os::raw::c_int;
5836}