mirror of https://github.com/xiph/flac
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
This commit is contained in:
parent
fe1d311369
commit
67bae335ee
|
@ -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];
|
||||
|
|
Loading…
Reference in New Issue