Compare commits

...

3 commits

2 changed files with 53 additions and 45 deletions

View file

@ -5,6 +5,9 @@ edition = "2024"
description = "Low-level unsafe bindings to libburn, a library for working with optical drives" description = "Low-level unsafe bindings to libburn, a library for working with optical drives"
license = "GPL-2.0-or-later" license = "GPL-2.0-or-later"
repository = "https://forgejo.zacjw.com/zac/libburn-sys"
links = "burn"
[dependencies] [dependencies]
libc = "0.2.177" libc = "0.2.177"

View file

@ -15,6 +15,7 @@
//! installed to start using libburn-sys. //! installed to start using libburn-sys.
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![allow(clippy::useless_transmute)]
/* automatically generated by rust-bindgen 0.72.1 */ /* automatically generated by rust-bindgen 0.72.1 */
@ -55,7 +56,7 @@ where
debug_assert!(index / 8 < core::mem::size_of::<Storage>()); debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8; let byte_index = index / 8;
let byte = unsafe { let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize) *(core::ptr::addr_of!((*this).storage) as *const u8).add(byte_index)
}; };
Self::extract_bit(byte, index) Self::extract_bit(byte, index)
} }
@ -81,7 +82,7 @@ where
debug_assert!(index / 8 < core::mem::size_of::<Storage>()); debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8; let byte_index = index / 8;
let byte = unsafe { let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize) (core::ptr::addr_of_mut!((*this).storage) as *mut u8).add(byte_index)
}; };
unsafe { *byte = Self::change_bit(*byte, index, val) }; unsafe { *byte = Self::change_bit(*byte, index, val) };
} }
@ -218,7 +219,7 @@ pub struct burn_write_opts {
} }
/// Packet writing. /// Packet writing.
/// currently unsupported, (for DVD Incremental Streaming use TAO) /// currently unsupported, (for DVD Incremental Streaming use TAO)
pub const burn_write_types_BURN_WRITE_PACKET: burn_write_types = 0; pub const BURN_WRITE_TYPES_BURN_WRITE_PACKET: burn_write_types = 0;
/// With CD: Track At Once recording /// With CD: Track At Once recording
/// 2s gaps between tracks, no fonky lead-ins /// 2s gaps between tracks, no fonky lead-ins
/// ///
@ -226,7 +227,7 @@ pub const burn_write_types_BURN_WRITE_PACKET: burn_write_types = 0;
/// With DVD+R and BD-R: Track of open size /// With DVD+R and BD-R: Track of open size
/// With DVD-RAM, DVD+RW, BD-RE: Random Writeable (used sequentially) /// With DVD-RAM, DVD+RW, BD-RE: Random Writeable (used sequentially)
/// With overwritable DVD-RW: Rigid Restricted Overwrite /// With overwritable DVD-RW: Rigid Restricted Overwrite
pub const burn_write_types_BURN_WRITE_TAO: burn_write_types = 1; pub const BURN_WRITE_TYPES_BURN_WRITE_TAO: burn_write_types = 1;
/// With CD: Session At Once /// With CD: Session At Once
/// Block type MUST be BURN_BLOCK_SAO /// Block type MUST be BURN_BLOCK_SAO
/// ts A70122: Currently not capable of mixing data and audio tracks. /// ts A70122: Currently not capable of mixing data and audio tracks.
@ -235,7 +236,7 @@ pub const burn_write_types_BURN_WRITE_TAO: burn_write_types = 1;
/// Single session, single track, fixed size mandatory, (-dvd-compat) /// Single session, single track, fixed size mandatory, (-dvd-compat)
/// With other DVD or BD media: same as BURN_WRITE_TAO but may demand /// With other DVD or BD media: same as BURN_WRITE_TAO but may demand
/// that track size is known in advance. /// that track size is known in advance.
pub const burn_write_types_BURN_WRITE_SAO: burn_write_types = 2; pub const BURN_WRITE_TYPES_BURN_WRITE_SAO: burn_write_types = 2;
/// With CD: Raw disc at once recording. /// With CD: Raw disc at once recording.
/// all subcodes must be provided by lib or user /// all subcodes must be provided by lib or user
/// only raw block types are supported /// only raw block types are supported
@ -252,49 +253,49 @@ pub const burn_write_types_BURN_WRITE_SAO: burn_write_types = 2;
/// Now understood, explained and not stemming from cdrdao. /// Now understood, explained and not stemming from cdrdao.
/// ///
/// @since 0.7.4 /// @since 0.7.4
pub const burn_write_types_BURN_WRITE_RAW: burn_write_types = 3; pub const BURN_WRITE_TYPES_BURN_WRITE_RAW: burn_write_types = 3;
/// In replies this indicates that not any writing will work. /// In replies this indicates that not any writing will work.
/// As parameter for inquiries it indicates that no particular write /// As parameter for inquiries it indicates that no particular write
/// mode shall is specified. /// mode shall is specified.
/// Do not use for setting a write mode for burning. It will not work. /// Do not use for setting a write mode for burning. It will not work.
pub const burn_write_types_BURN_WRITE_NONE: burn_write_types = 4; pub const BURN_WRITE_TYPES_BURN_WRITE_NONE: burn_write_types = 4;
/// Possible disc writing style/modes /// Possible disc writing style/modes
pub type burn_write_types = ::std::os::raw::c_uint; pub type burn_write_types = ::std::os::raw::c_uint;
/// sync, headers, edc/ecc provided by lib/user /// sync, headers, edc/ecc provided by lib/user
pub const burn_block_types_BURN_BLOCK_RAW0: burn_block_types = 1; pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW0: burn_block_types = 1;
/// sync, headers, edc/ecc and p/q subs provided by lib/user /// sync, headers, edc/ecc and p/q subs provided by lib/user
pub const burn_block_types_BURN_BLOCK_RAW16: burn_block_types = 2; pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW16: burn_block_types = 2;
/// sync, headers, edc/ecc and packed p-w subs provided by lib/user /// sync, headers, edc/ecc and packed p-w subs provided by lib/user
pub const burn_block_types_BURN_BLOCK_RAW96P: burn_block_types = 4; pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW96P: burn_block_types = 4;
/// sync, headers, edc/ecc and raw p-w subs provided by lib/user /// sync, headers, edc/ecc and raw p-w subs provided by lib/user
pub const burn_block_types_BURN_BLOCK_RAW96R: burn_block_types = 8; pub const BURN_BLOCK_TYPES_BURN_BLOCK_RAW96R: burn_block_types = 8;
/// only 2048 bytes of user data provided by lib/user /// only 2048 bytes of user data provided by lib/user
pub const burn_block_types_BURN_BLOCK_MODE1: burn_block_types = 256; pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE1: burn_block_types = 256;
/// 2336 bytes of user data provided by lib/user /// 2336 bytes of user data provided by lib/user
pub const burn_block_types_BURN_BLOCK_MODE2R: burn_block_types = 512; pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2R: burn_block_types = 512;
/// 2048 bytes of user data provided by lib/user /// 2048 bytes of user data provided by lib/user
/// subheader provided in write parameters /// subheader provided in write parameters
/// are we ever going to support this shit? I vote no. /// are we ever going to support this shit? I vote no.
/// (supposed to be supported on all drives...) /// (supposed to be supported on all drives...)
pub const burn_block_types_BURN_BLOCK_MODE2_PATHETIC: burn_block_types = 1024; pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_PATHETIC: burn_block_types = 1024;
/// 2048 bytes of data + 8 byte subheader provided by lib/user /// 2048 bytes of data + 8 byte subheader provided by lib/user
/// hey, this is also dumb /// hey, this is also dumb
pub const burn_block_types_BURN_BLOCK_MODE2_LAME: burn_block_types = 2048; pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_LAME: burn_block_types = 2048;
/// 2324 bytes of data provided by lib/user /// 2324 bytes of data provided by lib/user
/// subheader provided in write parameters /// subheader provided in write parameters
/// no sir, I don't like it. /// no sir, I don't like it.
pub const burn_block_types_BURN_BLOCK_MODE2_OBSCURE: burn_block_types = 4096; pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_OBSCURE: burn_block_types = 4096;
/// 2332 bytes of data supplied by lib/user /// 2332 bytes of data supplied by lib/user
/// 8 bytes sub header provided in write parameters /// 8 bytes sub header provided in write parameters
/// this is the second least suck mode2, and is mandatory for /// this is the second least suck mode2, and is mandatory for
/// all drives to support. /// all drives to support.
pub const burn_block_types_BURN_BLOCK_MODE2_OK: burn_block_types = 8192; pub const BURN_BLOCK_TYPES_BURN_BLOCK_MODE2_OK: burn_block_types = 8192;
/// SAO block sizes are based on cue sheet, so use this. /// SAO block sizes are based on cue sheet, so use this.
pub const burn_block_types_BURN_BLOCK_SAO: burn_block_types = 16384; pub const BURN_BLOCK_TYPES_BURN_BLOCK_SAO: burn_block_types = 16384;
/// Data format to send to the drive /// Data format to send to the drive
pub type burn_block_types = ::std::os::raw::c_uint; pub type burn_block_types = ::std::os::raw::c_uint;
/// The current status is not yet known /// The current status is not yet known
pub const burn_disc_status_BURN_DISC_UNREADY: burn_disc_status = 0; pub const BURN_DISC_STATUS_BURN_DISC_UNREADY: burn_disc_status = 0;
/// The drive holds a blank disc. It is ready for writing from scratch. /// The drive holds a blank disc. It is ready for writing from scratch.
/// Unused multi-session media: /// Unused multi-session media:
/// CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R /// CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
@ -302,14 +303,14 @@ pub const burn_disc_status_BURN_DISC_UNREADY: burn_disc_status = 0;
/// CD-RW, DVD-RW /// CD-RW, DVD-RW
/// Overwritable media with or without valid data /// Overwritable media with or without valid data
/// DVD-RAM, DVD+RW, formatted DVD-RW, BD-RE /// DVD-RAM, DVD+RW, formatted DVD-RW, BD-RE
pub const burn_disc_status_BURN_DISC_BLANK: burn_disc_status = 1; pub const BURN_DISC_STATUS_BURN_DISC_BLANK: burn_disc_status = 1;
/// There is no disc at all in the drive /// There is no disc at all in the drive
pub const burn_disc_status_BURN_DISC_EMPTY: burn_disc_status = 2; pub const BURN_DISC_STATUS_BURN_DISC_EMPTY: burn_disc_status = 2;
/// There is an incomplete disc in the drive. It is ready for appending /// There is an incomplete disc in the drive. It is ready for appending
/// another session. /// another session.
/// Written but not yet closed multi-session media /// Written but not yet closed multi-session media
/// CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R /// CD-R, CD-RW, DVD-R, DVD-RW, DVD+R, BD-R
pub const burn_disc_status_BURN_DISC_APPENDABLE: burn_disc_status = 3; pub const BURN_DISC_STATUS_BURN_DISC_APPENDABLE: burn_disc_status = 3;
/// There is a disc with data on it in the drive. It is usable only for /// There is a disc with data on it in the drive. It is usable only for
/// reading. /// reading.
/// Written and closed multi-session media /// Written and closed multi-session media
@ -318,53 +319,53 @@ pub const burn_disc_status_BURN_DISC_APPENDABLE: burn_disc_status = 3;
/// CD-ROM, DVD-ROM, BD-ROM /// CD-ROM, DVD-ROM, BD-ROM
/// Note that many DVD-ROM drives report any written media /// Note that many DVD-ROM drives report any written media
/// as Read-Only media and not by their real media types. /// as Read-Only media and not by their real media types.
pub const burn_disc_status_BURN_DISC_FULL: burn_disc_status = 4; pub const BURN_DISC_STATUS_BURN_DISC_FULL: burn_disc_status = 4;
/// The drive was not grabbed when the status was inquired /// The drive was not grabbed when the status was inquired
pub const burn_disc_status_BURN_DISC_UNGRABBED: burn_disc_status = 5; pub const BURN_DISC_STATUS_BURN_DISC_UNGRABBED: burn_disc_status = 5;
/// The media seems to be unsuitable for reading and for writing /// The media seems to be unsuitable for reading and for writing
pub const burn_disc_status_BURN_DISC_UNSUITABLE: burn_disc_status = 6; pub const BURN_DISC_STATUS_BURN_DISC_UNSUITABLE: burn_disc_status = 6;
/// Possible status of the drive in regard to the disc in it. /// Possible status of the drive in regard to the disc in it.
pub type burn_disc_status = ::std::os::raw::c_uint; pub type burn_disc_status = ::std::os::raw::c_uint;
/// The source is ok /// The source is ok
pub const burn_source_status_BURN_SOURCE_OK: burn_source_status = 0; pub const BURN_SOURCE_STATUS_BURN_SOURCE_OK: burn_source_status = 0;
/// The source is at end of file /// The source is at end of file
pub const burn_source_status_BURN_SOURCE_EOF: burn_source_status = 1; pub const BURN_SOURCE_STATUS_BURN_SOURCE_EOF: burn_source_status = 1;
/// The source is unusable /// The source is unusable
pub const burn_source_status_BURN_SOURCE_FAILED: burn_source_status = 2; pub const BURN_SOURCE_STATUS_BURN_SOURCE_FAILED: burn_source_status = 2;
/// Possible data source return values /// Possible data source return values
pub type burn_source_status = ::std::os::raw::c_uint; pub type burn_source_status = ::std::os::raw::c_uint;
/// The drive is not in an operation /// The drive is not in an operation
pub const burn_drive_status_BURN_DRIVE_IDLE: burn_drive_status = 0; pub const BURN_DRIVE_STATUS_BURN_DRIVE_IDLE: burn_drive_status = 0;
/// The library is spawning the processes to handle a pending /// The library is spawning the processes to handle a pending
/// operation (A read/write/etc is about to start but hasn't quite /// operation (A read/write/etc is about to start but hasn't quite
/// yet) /// yet)
pub const burn_drive_status_BURN_DRIVE_SPAWNING: burn_drive_status = 1; pub const BURN_DRIVE_STATUS_BURN_DRIVE_SPAWNING: burn_drive_status = 1;
/// The drive is reading data from a disc /// The drive is reading data from a disc
pub const burn_drive_status_BURN_DRIVE_READING: burn_drive_status = 2; pub const BURN_DRIVE_STATUS_BURN_DRIVE_READING: burn_drive_status = 2;
/// The drive is writing data to a disc /// The drive is writing data to a disc
pub const burn_drive_status_BURN_DRIVE_WRITING: burn_drive_status = 3; pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING: burn_drive_status = 3;
/// The drive is writing Lead-In /// The drive is writing Lead-In
pub const burn_drive_status_BURN_DRIVE_WRITING_LEADIN: burn_drive_status = 4; pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_LEADIN: burn_drive_status = 4;
/// The drive is writing Lead-Out /// The drive is writing Lead-Out
pub const burn_drive_status_BURN_DRIVE_WRITING_LEADOUT: burn_drive_status = 5; pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_LEADOUT: burn_drive_status = 5;
/// The drive is erasing a disc /// The drive is erasing a disc
pub const burn_drive_status_BURN_DRIVE_ERASING: burn_drive_status = 6; pub const BURN_DRIVE_STATUS_BURN_DRIVE_ERASING: burn_drive_status = 6;
/// The drive is being grabbed /// The drive is being grabbed
pub const burn_drive_status_BURN_DRIVE_GRABBING: burn_drive_status = 7; pub const BURN_DRIVE_STATUS_BURN_DRIVE_GRABBING: burn_drive_status = 7;
/// The drive gets written zeroes before the track payload data /// The drive gets written zeroes before the track payload data
pub const burn_drive_status_BURN_DRIVE_WRITING_PREGAP: burn_drive_status = 8; pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_PREGAP: burn_drive_status = 8;
/// The drive is told to close a track (TAO only) /// The drive is told to close a track (TAO only)
pub const burn_drive_status_BURN_DRIVE_CLOSING_TRACK: burn_drive_status = 9; pub const BURN_DRIVE_STATUS_BURN_DRIVE_CLOSING_TRACK: burn_drive_status = 9;
/// The drive is told to close a session (TAO only) /// The drive is told to close a session (TAO only)
pub const burn_drive_status_BURN_DRIVE_CLOSING_SESSION: burn_drive_status = 10; pub const BURN_DRIVE_STATUS_BURN_DRIVE_CLOSING_SESSION: burn_drive_status = 10;
/// The drive is formatting media /// The drive is formatting media
pub const burn_drive_status_BURN_DRIVE_FORMATTING: burn_drive_status = 11; pub const BURN_DRIVE_STATUS_BURN_DRIVE_FORMATTING: burn_drive_status = 11;
/// The drive is busy in synchronous read (if you see this then it /// The drive is busy in synchronous read (if you see this then it
/// has been interrupted) /// has been interrupted)
pub const burn_drive_status_BURN_DRIVE_READING_SYNC: burn_drive_status = 12; pub const BURN_DRIVE_STATUS_BURN_DRIVE_READING_SYNC: burn_drive_status = 12;
/// The drive is busy in synchronous write (if you see this then it /// The drive is busy in synchronous write (if you see this then it
/// has been interrupted) /// has been interrupted)
pub const burn_drive_status_BURN_DRIVE_WRITING_SYNC: burn_drive_status = 13; pub const BURN_DRIVE_STATUS_BURN_DRIVE_WRITING_SYNC: burn_drive_status = 13;
/// Possible busy states for a drive /// Possible busy states for a drive
pub type burn_drive_status = ::std::os::raw::c_uint; pub type burn_drive_status = ::std::os::raw::c_uint;
/// Information about a track on a disc - this is from the q sub channel of the /// Information about a track on a disc - this is from the q sub channel of the
@ -1051,6 +1052,7 @@ impl burn_drive_info {
) )
} }
} }
#[expect(clippy::too_many_arguments)]
#[inline] #[inline]
pub fn new_bitfield_1( pub fn new_bitfield_1(
read_dvdram: ::std::os::raw::c_uint, read_dvdram: ::std::os::raw::c_uint,
@ -1384,7 +1386,9 @@ unsafe extern "C" {
unsafe extern "C" { unsafe extern "C" {
/// Allows the use of media types which are implemented in libburn but not yet /// Allows the use of media types which are implemented in libburn but not yet
/// tested. The list of those untested profiles is subject to change. /// tested. The list of those untested profiles is subject to change.
/// - Currently no media types are under test reservation - ///
/// Currently no media types are under test reservation
///
/// If you really test such media, then please report the outcome on /// If you really test such media, then please report the outcome on
/// libburn-hackers@pykix.org /// libburn-hackers@pykix.org
/// If ever then this call should be done soon after burn_initialize() before /// If ever then this call should be done soon after burn_initialize() before
@ -1525,8 +1529,8 @@ unsafe extern "C" {
/// ///
/// @param n_drives Returns the number of drive items in drive_infos. /// @param n_drives Returns the number of drive items in drive_infos.
/// ///
/// @return 0 while scanning is not complete /// @return 0 while scanning is not complete,
/// >0 when it is finished successfully, /// \>0 when it is finished successfully,
/// <0 when finished but failed. /// <0 when finished but failed.
pub fn burn_drive_scan( pub fn burn_drive_scan(
drive_infos: *mut *mut burn_drive_info, drive_infos: *mut *mut burn_drive_info,
@ -4510,6 +4514,7 @@ unsafe extern "C" {
/// - the check whether CD write+block type is supported by the drive /// - the check whether CD write+block type is supported by the drive
/// - the check whether the media profile supports simulated burning /// - the check whether the media profile supports simulated burning
/// - @since 1.5.6 /// - @since 1.5.6
///
/// The check whether a write operation exceeds the size of the medium /// The check whether a write operation exceeds the size of the medium
/// as announced by the drive. This is known as \"overburn\" and may work /// as announced by the drive. This is known as \"overburn\" and may work
/// for a few thousand additional blocks on CD media with write type SAO. /// for a few thousand additional blocks on CD media with write type SAO.