ref: fd8976d422a3dadf5db358ceb1ae2e2f5b07f6eb
parent: 7b49567af1fd5a600cf08b537c51b31de7d5b4b0
author: rrt <rrt>
date: Sat Feb 3 20:09:21 EST 2007
Detect sf_open_virtual and use as a marker for libsndfile >= 1.0.12, and hence for conditional support for CAF and FLAC.
--- a/m4/sndfile.m4
+++ b/m4/sndfile.m4
@@ -54,6 +54,7 @@
ifelse([$1], , :, [$1])
have_sndfile="yes"
])
+ AC_CHECK_FUNC([sf_open_virtual], AC_DEFINE([HAVE_SNDFILE_1_0_12], 1, [Define if you have libsndfile >= 1.0.12]))
])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
--- a/src/sndfile.c
+++ b/src/sndfile.c
@@ -161,8 +161,10 @@
{ "wav", 0, SF_FORMAT_WAV },
{ "au", 0, SF_FORMAT_AU },
{ "snd", 0, SF_FORMAT_AU },
+#ifdef HAVE_SNDFILE_1_0_12
{ "caf", 0, SF_FORMAT_CAF },
{ "flac", 0, SF_FORMAT_FLAC },
+#endif
{ "svx", 0, SF_FORMAT_SVX },
{ "8svx", 0, SF_FORMAT_SVX },
{ "paf", 0, SF_ENDIAN_BIG | SF_FORMAT_PAF },
@@ -240,6 +242,7 @@
case ST_ENCODING_SIGN2:
case ST_ENCODING_MP3:
case ST_ENCODING_VORBIS:
+#ifdef HAVE_SNDFILE_1_0_12
case ST_ENCODING_FLAC:
switch (size) {
case ST_SIZE_8BIT:
@@ -254,6 +257,7 @@
return 0;
}
break;
+#endif
case ST_ENCODING_FLOAT:
return SF_FORMAT_FLOAT;
case ST_ENCODING_GSM:
@@ -347,7 +351,9 @@
/* "aif", */
/* "wav", */
/* "au", */
+#ifdef HAVE_SNDFILE_1_0_12
"caf",
+#endif
/* "flac", */
/* "snd", */
/* "svx", */