Audit fixes (14 critical, 22 warnings): - UDF: bounds checks on all ICB/FID parsing from disc data - SCSI Linux: saturating_sub on residual, CDB length guard, buffer size guard - SCSI macOS: SCSITaskStatus u32 (was u8 — stack corruption) - AACS: EC mod_inv returns infinity instead of panic, key reduced mod n - AACS: do_handshake tries all host certs (was returning on first failure) - H.264: bounds check on SPS < 4 bytes - ContentReader: error on missing unit key (was zero-fill) - KEYDB: flat redirect loop (was recursive), 100MB response limit, Windows HOME fallback - ISO writer: AVDP extent order, partition length, allocation cap - Network: removed TCP_NODELAY on bulk stream - MKV: guard on u64::MAX seek - disc.rs: saturating_sub on extent offset, simplified dead region code - cargo fmt (610 violations), cargo clippy --fix (55 auto-fixes) DVD support (new files): - src/ifo.rs — IFO parser (VIDEO_TS.IFO, VTS_XX_0.IFO, PGC chains, cells, streams) — 13 tests - src/mux/ps.rs — MPEG-2 Program Stream demuxer (pack headers, PES, private stream 1) — 12 tests - src/mux/codec/mpeg2.rs — MPEG-2 video parser (sequence headers, I-frame detection) — 15 tests - src/css/crack.rs — split-attack algorithm (LFSR cipher needs verification — test ignored) 226 tests total (was 186), 1 ignored (CSS crack needs cipher verification).
46 lines
1.1 KiB
Rust
46 lines
1.1 KiB
Rust
//! Drive speed constants.
|
|
|
|
/// Common optical drive speeds with KB/s values for SET_CD_SPEED.
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
|
pub enum DriveSpeed {
|
|
BD1x,
|
|
BD2x,
|
|
BD4x,
|
|
BD6x,
|
|
BD8x,
|
|
BD10x,
|
|
BD12x,
|
|
DVD1x,
|
|
DVD2x,
|
|
DVD4x,
|
|
DVD8x,
|
|
DVD16x,
|
|
Max,
|
|
}
|
|
|
|
impl DriveSpeed {
|
|
pub fn to_kbps(self) -> u16 {
|
|
match self {
|
|
DriveSpeed::BD1x => 4_500,
|
|
DriveSpeed::BD2x => 9_000,
|
|
DriveSpeed::BD4x => 18_000,
|
|
DriveSpeed::BD6x => 27_000,
|
|
DriveSpeed::BD8x => 36_000,
|
|
DriveSpeed::BD10x => 45_000,
|
|
DriveSpeed::BD12x => 54_000,
|
|
DriveSpeed::DVD1x => 1_385,
|
|
DriveSpeed::DVD2x => 2_770,
|
|
DriveSpeed::DVD4x => 5_540,
|
|
DriveSpeed::DVD8x => 11_080,
|
|
DriveSpeed::DVD16x => 22_160,
|
|
DriveSpeed::Max => 0xFFFF,
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::fmt::Display for DriveSpeed {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "{:?} ({} KB/s)", self, self.to_kbps())
|
|
}
|
|
}
|