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: StringUDF 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: DiscFormatDisc format (BD, UHD, DVD)
capacity_sectors: u32Disc capacity in sectors
capacity_bytes: u64Disc capacity in bytes
layers: u8Number of layers (1 = single, 2 = dual)
titles: Vec<DiscTitle>Titles sorted by duration (longest first), then playlist name
region: DiscRegionDisc 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: boolWhether this disc requires decryption (AACS or CSS)
content_format: ContentFormatContent format (BD transport stream vs DVD program stream)
Implementations§
Source§impl Disc
impl Disc
Sourcepub fn identify(session: &mut Drive) -> Result<DiscId>
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.
Sourcepub fn capacity_gb(&self) -> f64
pub fn capacity_gb(&self) -> f64
Disc capacity in GB
Sourcepub fn scan(session: &mut Drive, opts: &ScanOptions) -> Result<Self>
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:
- Read capacity + UDF filesystem
- AACS handshake + key resolution
- Parse playlists + streams
- 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.
Sourcepub fn scan_image(
reader: &mut dyn SectorReader,
capacity: u32,
opts: &ScanOptions,
) -> Result<Self>
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
impl Disc
Sourcepub fn decrypt_keys(&self) -> DecryptKeys
pub fn decrypt_keys(&self) -> DecryptKeys
Get the resolved decryption keys for this disc. Used by disc-to-ISO and other full-disc operations.
Sourcepub fn copy(
&self,
reader: &mut dyn SectorReader,
path: &Path,
opts: &CopyOptions<'_>,
) -> Result<CopyResult>
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).
Sourcepub fn sweep(
&self,
reader: &mut dyn SectorReader,
path: &Path,
opts: &SweepOptions<'_>,
) -> Result<CopyResult>
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
impl Disc
Sourcepub fn mapfile_for(&self, path: &Path) -> PathBuf
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
impl Disc
Sourcepub fn bytes_bad_in_title(&self, mapfile_path: &Path, title: &DiscTitle) -> u64
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.
Sourcepub fn patch(
&self,
reader: &mut dyn SectorReader,
path: &Path,
opts: &PatchOptions<'_>,
) -> Result<PatchOutcome>
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.