Commit 67bae335 authored by Josh Coalson's avatar Josh Coalson
Browse files

check that a cuesheet is legal before trying to encode with it so user will...

check that a cuesheet is legal before trying to encode with it so user will get a more useful error message; only warn about non-CDDA-compliant cuesheets instead of error
parent fe1d3113
......@@ -1859,6 +1859,17 @@ FLAC__bool parse_cuesheet_(FLAC__StreamMetadata **cuesheet, const char *cuesheet
return false;
}
if(!FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/false, &error_message)) {
flac__utils_printf(stderr, 1, "%s: ERROR parsing cuesheet \"%s\": %s\n", inbasefilename, cuesheet_filename, error_message);
return false;
}
/* if we're expecting CDDA, warn about non-compliance */
if(is_cdda && !FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/true, &error_message)) {
flac__utils_printf(stderr, 1, "%s: WARNING cuesheet \"%s\" is not audio CD compliant: %s\n", inbasefilename, cuesheet_filename, error_message);
(*cuesheet)->data.cue_sheet.is_cd = false;
}
return true;
}
......
......@@ -132,6 +132,17 @@ FLAC__bool import_cs_from(const char *filename, FLAC__StreamMetadata **cuesheet,
return false;
}
if(!FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/false, &error_message)) {
fprintf(stderr, "%s: ERROR parsing cuesheet \"%s\": %s\n", filename, cs_filename, error_message);
return false;
}
/* if we're expecting CDDA, warn about non-compliance */
if(is_cdda && !FLAC__format_cuesheet_is_legal(&(*cuesheet)->data.cue_sheet, /*check_cd_da_subset=*/true, &error_message)) {
fprintf(stderr, "%s: WARNING cuesheet \"%s\" is not audio CD compliant: %s\n", filename, cs_filename, error_message);
(*cuesheet)->data.cue_sheet.is_cd = false;
}
/* add seekpoints for each index point if required */
if(0 != seekpoint_specification) {
char spec[128];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment