Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/flac/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1500,6 +1500,8 @@ int encode_file(const char *infilename, FLAC__bool is_first_file, FLAC__bool is_
input_format = FORMAT_AIFF;
else if(infilename_length >= 5 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-5), ".aiff"))
input_format = FORMAT_AIFF;
else if(infilename_length >= 5 && 0 == FLAC__STRCASECMP(infilename + (infilename_length - 5), ".aifc"))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to add a test for this in test_flac.sh, and it turns out we already have this for aiff:

convert_to_aiff ()
{
	run_flac "$2" $1.raw || die "ERROR converting $1.raw to AIFF"
	run_flac "$3" $1.flac -o $1.aiff || die "ERROR converting $1.raw to AIFF"
}

However, adding .aifc here in the same way would still pass even without this commit, since there is nothing that checks that the actual output file is AIFF or AIFF-C; the test would still pass but we get a WAV file with a .aifc file extension.

Maybe there is a portable way to use file to check what format the output file actually is, I can try to add it in next commit. File would return one of IFF data, AIFF audio, IFF data, AIFF-C compressed audio, RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, stereo 44100 Hz, so grepping for "AIFF audio", "AIFF-C" or "WAVE audio" should do the trick.

input_format = FORMAT_AIFF_C;
else if(infilename_length >= 5 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-5), ".flac"))
input_format = FORMAT_FLAC;
else if(infilename_length >= 4 && 0 == FLAC__STRCASECMP(infilename+(infilename_length-4), ".oga"))
Expand Down Expand Up @@ -1877,6 +1879,13 @@ int decode_file(const char *infilename)
(strlen(outfilename) >= 5 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-5), ".aiff"))
)
output_format = FORMAT_AIFF;
else if(
option_values.force_aiff_c_none_format ||
option_values.force_aiff_c_sowt_format ||
(strlen(outfilename) >= 5 && 0 == FLAC__STRCASECMP(outfilename + (strlen(outfilename) - 5), ".aifc"))) {
output_format = FORMAT_AIFF_C;
output_subformat = SUBFORMAT_AIFF_C_NONE;
}
else if(
option_values.force_rf64_format ||
(strlen(outfilename) >= 5 && 0 == FLAC__STRCASECMP(outfilename+(strlen(outfilename)-5), ".rf64"))
Expand Down