Skip to main content

Disc

Struct Disc 

Source
pub struct Disc {
    pub volume_id: String,
    pub meta_title: Option<String>,
    pub format: DiscFormat,
    pub capacity_sectors: u32,
    pub capacity_bytes: u64,
    pub layers: u8,
    pub titles: Vec<DiscTitle>,
    pub region: DiscRegion,
    pub aacs: Option<AacsState>,
    pub css: Option<CssState>,
    pub encrypted: bool,
    pub content_format: ContentFormat,
}
Expand description

A scanned Blu-ray disc.

Fields§

§volume_id: String

UDF Volume Identifier from Primary Volume Descriptor (always present)

§meta_title: Option<String>

Disc title from META/DL/bdmt_eng.xml (None if disc has no metadata)

§format: DiscFormat

Disc format (BD, UHD, DVD)

§capacity_sectors: u32

Disc capacity in sectors

§capacity_bytes: u64

Disc capacity in bytes

§layers: u8

Number of layers (1 = single, 2 = dual)

§titles: Vec<DiscTitle>

Titles sorted by duration (longest first), then playlist name

§region: DiscRegion

Disc region

§aacs: Option<AacsState>

AACS state – None if disc is unencrypted or keys unavailable

§css: Option<CssState>

CSS state – None if not a CSS-encrypted DVD

§encrypted: bool

Whether this disc requires decryption (AACS or CSS)

§content_format: ContentFormat

Content format (BD transport stream vs DVD program stream)

Implementations§

Source§

impl Disc

Source

pub fn identify(session: &mut Drive) -> Result<DiscId>

Fast disc identification — reads only UDF metadata for name and format. No AACS handshake, no playlist parsing, no CLPI, no labels. Typically completes in 2-3 seconds on USB drives.

Source

pub fn capacity_gb(&self) -> f64

Disc capacity in GB

Source

pub fn scan(session: &mut Drive, opts: &ScanOptions) -> Result<Self>

Scan a disc – parse filesystem, playlists, streams, and set up AACS decryption.

This is the main entry point. After scan(), the Disc is ready:

  • titles are populated with streams
  • AACS keys are derived (if KEYDB available)
  • content can be read and decrypted transparently

Scan a disc. One pipeline, one order:

  1. Read capacity + UDF filesystem
  2. AACS handshake + key resolution
  3. Parse playlists + streams
  4. Apply labels

The session must be open and unlocked (Drive::open handles this). All disc reads use standard READ(10) via UDF – no vendor SCSI commands.

Source

pub fn scan_image( reader: &mut dyn SectorReader, capacity: u32, opts: &ScanOptions, ) -> Result<Self>

Scan a disc image (ISO or any SectorReader). No SCSI, no handshake. AACS resolution uses KEYDB VUK lookup only.

Source§

impl Disc

Source

pub fn decrypt_keys(&self) -> DecryptKeys

Get the resolved decryption keys for this disc. Used by disc-to-ISO and other full-disc operations.

Source

pub fn copy( &self, reader: &mut dyn SectorReader, path: &Path, opts: &CopyOptions<'_>, ) -> Result<CopyResult>

Copy disc sectors to an ISO image file.

NOT a stream operation. Copies sectors byte-for-byte producing a valid ISO/UDF image. Records progress in a ddrescue-format mapfile at path + ".mapfile" — flushed every block for crash-safe resume.

Auto-detects the pass based on mapfile state:

  • No mapfile → Pass 1 (sweep): sequential read of the entire disc, ECC-aligned batches, damage-jump on contiguous failures, marks bad blocks as NonTrimmed. No drive-level recovery — fast.
  • Mapfile with bad ranges → Pass N (patch): re-reads only bad ranges sector-by-sector with full drive-level recovery. Marks recovered sectors as Finished, failed as Unreadable (terminal).
  • Mapfile clean → no-op: all sectors are Finished.

Without multipass: aborts on the first read error (legacy single-pass).

Source

pub fn sweep( &self, reader: &mut dyn SectorReader, path: &Path, opts: &SweepOptions<'_>, ) -> Result<CopyResult>

Pass 1 of a multipass rip: walk the disc forward, write every readable sector into path, and record the result in the sidecar mapfile. With skip_on_error: true, a bad sector zero-fills + marks NonTrimmed and the sweep keeps going (jumping ahead through dense damage); without it, the first read failure aborts.

0.18: this is one of the two flat verbs the library exposes for rip orchestration. Multipass + retry decisions are the caller’s job — see PatchOptions for the retry primitive.

Source§

impl Disc

Source

pub fn mapfile_for(&self, path: &Path) -> PathBuf

Path to the mapfile for a given output path.

For /dev/null output, returns /tmp/{volume_id_or_title}.mapfile. For regular files, returns {path}.mapfile.

Source§

impl Disc

Source

pub fn bytes_bad_in_title(&self, mapfile_path: &Path, title: &DiscTitle) -> u64

Bytes of bad/unreadable data in a title’s extents, from a mapfile.

Consumers (CLI, autorip) call this after a rip pass to determine how much damage affects a particular title — useful for showing “42s lost (12s in main movie)” in the UI.

Source

pub fn patch( &self, reader: &mut dyn SectorReader, path: &Path, opts: &PatchOptions<'_>, ) -> Result<PatchOutcome>

Pass 2..N of a multipass rip: re-read the bad ranges recorded in the sidecar mapfile and try to recover them. With reverse: true (the default for the recovery walker), the bad-range walk runs end-to-start so escalating skips converge on the actual bad sub-zones inside any NonTrimmed block. Returns a PatchOutcome with recovered byte counts and wedge-detection signals.

0.18: paired with Disc::sweep as the library’s other flat rip-phase verb. Caller drives the retry loop and the sweep-vs-patch dispatch.

Trait Implementations§

Source§

impl Debug for Disc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Disc

§

impl RefUnwindSafe for Disc

§

impl Send for Disc

§

impl Sync for Disc

§

impl Unpin for Disc

§

impl UnsafeUnpin for Disc

§

impl UnwindSafe for Disc

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more