Commit Graph

47 Commits

Author SHA1 Message Date
Matteo Cypriani 21ab587686 Update copyright dates 2018-05-06 00:10:23 +02:00
Matteo Cypriani 9f741a4bd0 README: rework into a Ronn manpage 2018-05-06 00:10:23 +02:00
Matteo Cypriani 93248eb611 Display basename in usage message 2018-05-05 23:39:54 +02:00
Matteo Cypriani 9f29662cbf Implement --no-strip-subchannel 2018-05-05 23:39:54 +02:00
Matteo Cypriani 924dd3c8c7 Implement --version switch 2018-05-05 23:39:54 +02:00
Matteo Cypriani 88fc07a478 cargo update 2018-05-05 23:39:47 +02:00
Matteo Cypriani e22af5b392 metadata: structs now derive Copy & Clone 2018-05-04 17:23:45 +02:00
Matteo Cypriani b2df80c3c5 lib: enable compile-time warnings 2018-05-04 17:22:16 +02:00
Matteo Cypriani 56c7003468 Improve "unhandled chunks" message 2016-12-22 14:28:52 -05:00
Matteo Cypriani 76c2a9201f Cue sheet: use FILE "*.raw" instead of "*.nrg" 2016-12-22 14:26:39 -05:00
Matteo Cypriani bdca31c3fd main: fix bad usage error handling 2016-12-22 14:10:53 -05:00
Matteo Cypriani 20f4e61f26 README: update Usage & title 2016-12-08 21:24:05 -05:00
Matteo Cypriani 3faf42e2a7 Read track number & index as BCD-encoded bytes
The track number and track index from the CUEX chunk are BCD-encoded
(Binary-Coded Decimal). Reading them as binary led to wrong track
numbers starting with track 10.

There is doubt whereas the index number is BCD or not, but two-digit
indices are seldom seen.
2016-12-08 20:57:28 -05:00
Matteo Cypriani 3a970c3e33 main: exit() only at the end
std::process::exit() was used mainly to be able to return an error code,
but it's pretty brutal (no destructors calls). This commit works around
the lack of return value for main() and calls exit() only at the very
end.
2016-12-08 20:57:28 -05:00
Matteo Cypriani c3c2726537 Pass &str instead of &String 2016-12-08 20:57:28 -05:00
Matteo Cypriani 76b895e4c1 main: a few style improvements 2016-12-08 20:57:28 -05:00
Matteo Cypriani 2b8f4a98d3 Use getopts to parse command-line 2016-12-08 20:57:28 -05:00
Matteo Cypriani d5d83ab03e metadata: simplify read_nrg_chunks() 2016-12-08 20:57:28 -05:00
Matteo Cypriani e801140625 Handle 2448-byte sectors
Handle images that have 2448-byte sectors, i.e. 2352 audio bytes + 96
sub-channel bytes.
2016-12-08 20:57:28 -05:00
Matteo Cypriani 6ee363064b Refactoring: add copy_raw_audio() 2016-12-08 20:57:16 -05:00
Matteo Cypriani ff00ad6097 Cue sheet: use BINARY, not RAW
RAW is not a valid cue sheet keyword.
2016-12-08 13:03:33 -05:00
Matteo Cypriani 0f42459d7b Add minimalistic integration tests 2016-12-08 13:03:33 -05:00
Matteo Cypriani 5a6feec1d6 Add description strings for some errors 2016-12-08 13:03:33 -05:00
Matteo Cypriani 2bf7a1db2d Refactor {first,last}_audio_byte() 2016-12-08 13:03:33 -05:00
Matteo Cypriani 90cf6b8ed8 Read audio data up to last track's end if possible
The audio data is now read up to the last track's end, rather than to
the NRG footer ("first chunk offset"), unless there are no DAOX tracks.
This should be strictly equivalent in normal cases.
2016-12-08 13:03:33 -05:00
Matteo Cypriani 5604778455 Fix audio data extraction
The audio data was initially read and written by chunks of 2352 bytes,
which is the usual sector size for audio CDs. However, this didn't work
on images with a 2448-byte sector size (2352 bytes data + 96 bytes
sub-channel data): we would end up reading data from the NRG footer.

The data is now read/written by 4 MiB (which is faster anyway), and we
make sure to read the remaining bytes if the audio data size is not a
multiple of 4 MiB.
2016-12-08 12:27:34 -05:00
Matteo Cypriani 00c88153b2 Rework read_sized_string(): truncate null bytes 2016-12-07 17:51:59 -05:00
Matteo Cypriani 4b92eb0239 Improve handling of output file names
* Use PathBuf operations to generate output file names.
* Output files are now written to the working directory.
* The cue sheet contains only the image's base name, not the full path.
2016-12-07 16:06:10 -05:00
Matteo Cypriani 5d0973f5ae Add README.md 2016-12-06 22:54:05 -05:00
Matteo Cypriani 3f03a6c37b Add copyright & license 2016-12-06 22:52:31 -05:00
Matteo Cypriani 5aa1f24554 Rename cue_sheet module 2016-12-06 21:34:44 -05:00
Matteo Cypriani 2e74951628 Audio data extraction 2016-12-06 21:32:51 -05:00
Matteo Cypriani 15c5a5fb04 Fix potential pre-gap bug in cue sheet
If an index #0 is present for a track but not for the next track, it
could be written for the following track (i.e. two tracks from where it
appeared), which would lead to an incoherent cue sheet.

In theory, this was a non-issue because in NRG, a track always has an
index #0, but you never know.
2016-12-06 19:31:27 -05:00
Matteo Cypriani 54b5967411 Write cue sheet to file 2016-12-06 19:27:07 -05:00
Matteo Cypriani 5973a06c1b Add basic cue sheet handling
The cue sheet is printed to stdout.
2016-12-06 18:06:13 -05:00
Matteo Cypriani 00ed1196d6 Improve rustdoc comments
Also, mark the binary "doc = false" in Cargo.toml.
2016-12-06 15:53:09 -05:00
Matteo Cypriani c3584042cc Open fd in main()
main() now opens the NRG image, instead of letting parse_nrg_metadata()
do it.

parse_nrg_metadata() was renamed read_nrg_metadata().
2016-12-06 15:06:45 -05:00
Matteo Cypriani 423aec0a63 Better handling of unknown chunks 2016-12-06 15:06:45 -05:00
Matteo Cypriani e2a41e6282 Move metadata-related modules into metadata 2016-12-06 15:06:45 -05:00
Matteo Cypriani 1a029d44a4 Split lib.rs into modules 2016-12-06 15:06:45 -05:00
Matteo Cypriani 8652b455be Add .gitignore 2016-12-06 15:06:35 -05:00
Matteo Cypriani 87b0527783 Handle MTYP chunk 2016-12-05 15:57:23 -05:00
Matteo Cypriani 6cad02d13c Handle SINF chunk 2016-12-05 15:43:21 -05:00
Matteo Cypriani c340f30493 Handle DAOX chunk 2016-12-05 15:43:21 -05:00
Matteo Cypriani 4b638a88d5 Don't use explicit &mut for fd 2016-12-05 13:08:45 -05:00
Matteo Cypriani 9c4a93e72e Add read_sized_string() 2016-12-05 12:52:31 -05:00
Matteo Cypriani f22f7fdbc3 Cue sheet display working
Initial commit with only cue sheet reading and display.
2016-12-05 12:29:03 -05:00