From b25f7f3bb3b9fcf73316b042395def33add5d40a Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Thu, 3 Jul 2014 21:26:11 +1000 Subject: Revert "src/sndfile.c : Make WAV/GSM610 with sample rates other than 8kHz invalid." Commit was a0be1713b534a3ed3d02c0750669dc6d560b46d6. Also revert the related commits: * e4253e1609a7ab3f117427312c4d53a5bc7412c4 * 77504d6abde21d73505d32359ea0e5693835fda3 --- programs/sndfile-convert.c | 16 +++------------- src/sndfile.c | 4 ++-- tests/floating_point_test.tpl | 4 ++-- tests/lossy_comp_test.c | 10 +++++----- 4 files changed, 12 insertions(+), 22 deletions(-) diff --git a/programs/sndfile-convert.c b/programs/sndfile-convert.c index 28a30f6..547d01c 100644 --- a/programs/sndfile-convert.c +++ b/programs/sndfile-convert.c @@ -113,21 +113,11 @@ report_format_error_exit (const char * argv0, SF_INFO * sfinfo) exit (1) ; } ; - if ((sfinfo->format & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610) - printf ("\n" + printf ("\n" "Error : output file format is invalid.\n" - "The '%s' container does not support '%s' data at %d Hz.\n" + "The '%s' container does not support '%s' codec data.\n" "Run '%s --help' for clues.\n\n", - sfe_container_name (sfinfo->format), sfe_codec_name (sfinfo->format), - sfinfo->samplerate, program_name (argv0)) ; - else - printf ("\n" - "Error : output file format is invalid.\n" - "The '%s' container does not support '%s' data.\n" - "Run '%s --help' for clues.\n\n", - sfe_container_name (sfinfo->format), sfe_codec_name (sfinfo->format), - program_name (argv0)) ; - + sfe_container_name (sfinfo->format), sfe_codec_name (sfinfo->format), program_name (argv0)) ; exit (1) ; } /* report_format_error_exit */ diff --git a/src/sndfile.c b/src/sndfile.c index bf69dd4..c048aea 100644 --- a/src/sndfile.c +++ b/src/sndfile.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 1999-2014 Erik de Castro Lopo +** Copyright (C) 1999-2013 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU Lesser General Public License as published by @@ -658,7 +658,7 @@ sf_format_check (const SF_INFO *info) if ((subformat == SF_FORMAT_DWVW_12 || subformat == SF_FORMAT_DWVW_16 || subformat == SF_FORMAT_DWVW_24) && info-> channels == 1) return 1 ; - if (subformat == SF_FORMAT_GSM610 && info->channels == 1 && info->samplerate == 8000) + if (subformat == SF_FORMAT_GSM610 && info->channels == 1) return 1 ; if (subformat == SF_FORMAT_VOX_ADPCM && info->channels == 1) return 1 ; diff --git a/tests/floating_point_test.tpl b/tests/floating_point_test.tpl index ba79691..ab6c95b 100644 --- a/tests/floating_point_test.tpl +++ b/tests/floating_point_test.tpl @@ -204,7 +204,7 @@ float_scaled_test (const char *filename, int allow_exit, int replace_float, int gen_windowed_sine_float (float_data, DFT_DATA_LENGTH, 1.0) ; - sfinfo.samplerate = (filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610 ? 8000 : SAMPLE_RATE ; + sfinfo.samplerate = SAMPLE_RATE ; sfinfo.frames = DFT_DATA_LENGTH ; sfinfo.channels = 1 ; sfinfo.format = filetype ; @@ -256,7 +256,7 @@ double_scaled_test (const char *filename, int allow_exit, int replace_float, int gen_windowed_sine_double (double_data, DFT_DATA_LENGTH, 0.95) ; - sfinfo.samplerate = (filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610 ? 8000 : SAMPLE_RATE ; + sfinfo.samplerate = SAMPLE_RATE ; sfinfo.frames = DFT_DATA_LENGTH ; sfinfo.channels = 1 ; sfinfo.format = filetype ; diff --git a/tests/lossy_comp_test.c b/tests/lossy_comp_test.c index 5444e73..5f9f593 100644 --- a/tests/lossy_comp_test.c +++ b/tests/lossy_comp_test.c @@ -1,5 +1,5 @@ /* -** Copyright (C) 1999-2014 Erik de Castro Lopo +** Copyright (C) 1999-2012 Erik de Castro Lopo ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -1346,7 +1346,7 @@ channels = 1 ; for (k = 0 ; k < datalen ; k++) orig [k] = lrint (orig_buffer.d [k]) ; - sfinfo.samplerate = (filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610 ? 8000 : SAMPLE_RATE ; + sfinfo.samplerate = SAMPLE_RATE ; sfinfo.frames = 123456789 ; /* Ridiculous value. */ sfinfo.channels = channels ; sfinfo.format = filetype ; @@ -1554,7 +1554,7 @@ channels = 1 ; for (k = 0 ; k < datalen ; k++) orig [k] = lrint (orig_buffer.d [k]) ; - sfinfo.samplerate = (filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610 ? 8000 : SAMPLE_RATE ; + sfinfo.samplerate = SAMPLE_RATE ; sfinfo.frames = 123456789 ; /* Ridiculous value. */ sfinfo.channels = channels ; sfinfo.format = filetype ; @@ -1767,7 +1767,7 @@ printf ("** fix this ** ") ; for (k = 0 ; k < datalen ; k++) orig [k] = lrint (orig_buffer.d [k]) ; - sfinfo.samplerate = (filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610 ? 8000 : SAMPLE_RATE ; + sfinfo.samplerate = SAMPLE_RATE ; sfinfo.frames = 123456789 ; /* Ridiculous value. */ sfinfo.channels = channels ; sfinfo.format = filetype ; @@ -1958,7 +1958,7 @@ channels = 1 ; gen_signal_double (orig_buffer.d, 32000.0, channels, datalen) ; - sfinfo.samplerate = (filetype & SF_FORMAT_SUBMASK) == SF_FORMAT_GSM610 ? 8000 : SAMPLE_RATE ; + sfinfo.samplerate = SAMPLE_RATE ; sfinfo.frames = 123456789 ; /* Ridiculous value. */ sfinfo.channels = channels ; sfinfo.format = filetype ; -- cgit v1.2.3