1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
//! 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`]:
//! - [`DiscType::Cd`] - Compact Disc image or physical CD.
//! - [`DiscType::Dvd`] - Digital Versatile Disc image or physical DVD.
//! - [`DiscType::Gdi`] - Dreamcast GD-ROM image or physical GD-ROM.
//! - [`DiscType::HardDisk`] - Hard Disk raw storage dump.
//! - [`DiscType::LaserDisc`] - LaserDisc multimedia capture.
//! - [`DiscType::Unknown`] - Unrecognized format or non-media file.
//!
//! # Examples
//!
//! ### Inspecting an image on disk
//!
//! ```no_run
//! use disclady::{inspect_disc, DiscType};
//! use std::path::Path;
//!
//! # fn main() -> Result<(), disclady::DiscError> {
//! 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);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! ### Quick format detection
//!
//! ```no_run
//! use disclady::{detect_disc_type, DiscType};
//! use std::path::Path;
//!
//! # fn main() -> Result<(), disclady::DiscError> {
//! let disc_type = detect_disc_type(Path::new("game.iso"))?;
//! if disc_type == DiscType::Dvd {
//! println!("Detected DVD image");
//! }
//! # Ok(())
//! # }
//! ```
pub
pub
pub
pub use ;
pub use synthesize_cue_for_image;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
/// Extracts referenced child track files (such as `.bin`, `.wav`, `.raw`, `.img`, `.sub`, or `.mdf`)
/// from multi-file descriptor formats (`.cue`, `.gdi`, `.ccd`, `.mds`).
///
/// Returns an empty list if the path does not point to a supported descriptor format.
///
/// # Examples
///
/// ```no_run
/// use disclady::extract_referenced_files;
/// use std::path::Path;
///
/// let track_files = extract_referenced_files(Path::new("game.cue"));
/// for file in track_files {
/// println!("Referenced child file: {}", file.display());
/// }
/// ```