Skip to main content

Crate disclady

Crate disclady 

Source
Expand description

Heuristic inspection, format classification, and metadata extraction library for optical discs and storage images.

disclady parses raw byte layouts, sector headers, partition structures, filesystem descriptors, container metadata, and physical optical drive transports without needing external CLI utilities or complete image decompression.

§Supported Formats and Transports

  • Compact Disc: CUE sheets (.cue), CloneCD descriptors (.ccd with .img/.sub), Alcohol 120% descriptors (.mds v1 and v2 with .mdf), DAEMON Tools containers (.mdx), Nero Burning ROM containers (.nrg), standalone raw binary tracks (.bin, .img, 2352 or 2448 bytes per sector), and ISO 9660 images.
  • DVD: Standard ISO images (.iso), ISO 9660 Primary Volume Descriptors, UDF Volume Recognition Sequences, DVD-Video (VIDEO_TS), and DVD-Audio (AUDIO_TS).
  • Dreamcast GD-ROM: .gdi multi-track descriptors with low-density and high-density partition boundaries (LBA 45000).
  • Hard Disk: Raw storage dumps (.img, .raw, 512 bytes per sector), MBR/GPT partition tables, and arcade drive headers.
  • LaserDisc: Uncompressed video captures (.avi) with PCM audio and YUY2/UYVY frames.
  • CHD Containers: Reverse inspection of CHD v3, v4, and v5 containers without decompressing data hunks.
  • Physical Optical Discs: Direct drive hardware inspection via SCSI/MMC pass-through on Linux (/dev/sr0, /dev/cdrom) and Windows (\\.\D:).

§Metadata Extraction Pipeline

The library includes a Tiered Fallback Pipeline for extracting human-readable game titles and canonical alphanumeric product IDs across 16+ console and computer platforms, including:

  • Sony PlayStation, PlayStation 2, PlayStation Portable (UMD)
  • Sega Mega-CD / Sega CD, Sega Saturn, Sega Dreamcast
  • Nintendo GameCube, Nintendo Wii
  • Microsoft Xbox, Xbox 360
  • 3DO Interactive Multiplayer, SNK Neo Geo CD, NEC PC Engine CD, NEC PC-FX, Commodore Amiga CD32

§Online Database Matching

When built with the optional online feature, disclady can match extracted disc metadata against a remote compressed TSV database (lib.db.zst) to suggest standardized filenames and resolve canonical game titles and serial IDs.

§Media Classification

Discs and storage images resolve to one of the primary variants in DiscType:

§Examples

§Inspecting an image on disk

use disclady::{inspect_disc, DiscType};
use std::path::Path;

let descriptor = inspect_disc(Path::new("game.cue"))?;
println!("Media: {}", descriptor.disc_type);
if let Some(title) = descriptor.title() {
    println!("Title: {title}");
}
if let Some(disc_id) = descriptor.disc_id() {
    println!("Serial ID: {disc_id}");
}
for track in &descriptor.tracks {
    println!("Track {}: {} sectors", track.track_number, track.sector_size);
}

§Quick format detection

use disclady::{detect_disc_type, DiscType};
use std::path::Path;

let disc_type = detect_disc_type(Path::new("game.iso"))?;
if disc_type == DiscType::Dvd {
    println!("Detected DVD image");
}

Re-exports§

pub use chd::inspect_chd;
pub use chd::ChdExtractionPlan;
pub use cue::synthesize_cue_for_image;
pub use metadata::DiscMetadata;
pub use metadata::DiscReader;
pub use metadata::GameId;
pub use metadata::MetadataSource;
pub use metadata::PlatformKind;
pub use online::normalize_serial_key;
pub use online::suggest_filename;
pub use online::OnlineDatabase;
pub use online::OnlineDbEntry;
pub use online::OnlineMatch;
pub use online::DEFAULT_ONLINE_DB_URL;
pub use physical::inspect_physical_disc;
pub use physical::inspect_physical_transport;
pub use physical::is_physical_disc_path;
pub use physical::list_optical_drives;
pub use types::Confidence;
pub use types::DiscDescriptor;
pub use types::DiscError;
pub use types::DiscType;
pub use types::Platform;
pub use types::TrackDescriptor;
pub use types::TrackType;
pub use types::VolumeInfo;

Modules§

ccd
CloneCD (.ccd) descriptor parser and analyzer.
chd
Reverse heuristics and inspection for MAME CHD (Compressed Hunks of Data) containers.
console
Console and platform-specific media signatures.
cue
Cue sheet (.cue) parser and optical disc analyzer.
gdi
Dreamcast GDI (.gdi) descriptor parser and analyzer.
iso
ISO 9660 Primary Volume Descriptor (PVD), Volume Recognition Sequence (VRS), and UDF parsing.
mds
Alcohol 120% (.mds) descriptor parser and analyzer.
mdx
DAEMON Tools (.mdx) disc container parser and analyzer.
metadata
Optical media metadata extraction module adhering to the Tiered Fallback Pipeline specification.
nrg
Nero Burning ROM (.nrg) container parser and analyzer.
online
physical
SCSI/MMC physical optical media identification and topology inspection.
raw
Raw CD sector heuristics and synchronization pattern detection.
types
Core types and descriptors for optical disc image inspection.

Constants§

CD_MAX_PHYSICAL_BYTES
900 MiB threshold in bytes; any optical image exceeding this cannot physically be a standard CD.

Functions§

detect_disc_from_reader
Inspects a disc or storage image from a seekable byte stream.
detect_disc_type
Examines an image file and returns its detected DiscType.
extract_referenced_files
Extracts referenced child track files (such as .bin, .wav, .raw, .img, .sub, or .mdf) from multi-file descriptor formats (.cue, .gdi, .ccd, .mds).
inspect_disc
Inspects an image file and returns a detailed DiscDescriptor.