Extract CD Example
Hello!
I've been experimenting with this crate for a couple of days now, it is nice to work with. I was wondering if you could give an example of how to extract a CD based CHD into its separate tracks, much like the -sb flag in chdman. My use case would be to get just the data track .bin so that I can hash it and do comparisons.
My first guess was to check each metadata (let Ok(metadata) = Vec::<Metadata>::try_from(chd.metadata_refs())) for a track that had TYPE:MODE2_RAW or TYPE:MODE1, and then extract just that part of the CHD. But I don't see any way of associating a metadata to a set of hunks. I thought maybe the FRAMES:12345 count would help somehow, as frame count * 2352 seems to be the total size of the data I am looking for. But again, not sure how that relates to hunks and hunk size.
It's entirely possible that I am just not fully understanding the CHD file format. Any help with this would be greatly appreciated!
chd-rs only gives a low level interface to the CHD file structure. To extract a CD you would need to implement TOC parsing on top. You can see how chdman does this in chdman::tools::do_extract_cd. CDROM support is built on top of CHD in chdman::lib::util::cdrom.