[xiph-commits] r3372 - in libfishsound/branches/1.0-stable: .
src/libfishsound
conrad at svn.annodex.net
conrad at svn.annodex.net
Sun Jan 20 20:05:22 PST 2008
Author: conrad
Date: 2008-01-20 20:05:21 -0800 (Sun, 20 Jan 2008)
New Revision: 3372
Modified:
libfishsound/branches/1.0-stable/AUTHORS
libfishsound/branches/1.0-stable/config.h.in
libfishsound/branches/1.0-stable/configure.ac
libfishsound/branches/1.0-stable/src/libfishsound/flac.c
Log:
add libFLAC 1.1.3 support. Adapted from patch by Michel Salim
Modified: libfishsound/branches/1.0-stable/AUTHORS
===================================================================
--- libfishsound/branches/1.0-stable/AUTHORS 2008-01-21 03:42:55 UTC (rev 3371)
+++ libfishsound/branches/1.0-stable/AUTHORS 2008-01-21 04:05:21 UTC (rev 3372)
@@ -4,6 +4,9 @@
Tobias Gehrig
- FLAC support
+
+Michel Salim
+ - libFLAC 1.1.3 support
Silvia Pfeiffer <silvia at annodex.net>
- MS Windows porting, general packaging.
Modified: libfishsound/branches/1.0-stable/config.h.in
===================================================================
--- libfishsound/branches/1.0-stable/config.h.in 2008-01-21 03:42:55 UTC (rev 3371)
+++ libfishsound/branches/1.0-stable/config.h.in 2008-01-21 04:05:21 UTC (rev 3372)
@@ -18,6 +18,9 @@
/* Define to 1 if you have libFLAC 1.1.2 */
#undef HAVE_FLAC_1_1_2
+/* Define to 1 if you have libFLAC 1.1.3 */
+#undef HAVE_FLAC_1_1_3
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
Modified: libfishsound/branches/1.0-stable/configure.ac
===================================================================
--- libfishsound/branches/1.0-stable/configure.ac 2008-01-21 03:42:55 UTC (rev 3371)
+++ libfishsound/branches/1.0-stable/configure.ac 2008-01-21 04:05:21 UTC (rev 3372)
@@ -249,6 +249,7 @@
HAVE_FLAC=no
HAVE_FLAC_1_1_2=no
+HAVE_FLAC_1_1_3=no
FLAC_SUPPORT=no
ac_enable_flac=yes
@@ -274,12 +275,20 @@
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $FLAC_CFLAGS"
- dnl Test for libFLAC 1.1.2
- AC_CHECK_LIB(FLAC, FLAC__stream_decoder_init, HAVE_FLAC_1_1_2="yes",
- HAVE_FLAC_1_1_2="no", [$FLAC_LIBS])
- if test "x$HAVE_FLAC_1_1_2" = xyes ; then
- AC_DEFINE(HAVE_FLAC_1_1_2, [1], [Define to 1 if you have libFLAC 1.1.2])
- FLAC_SUPPORT="yes (1.1.2)"
+ dnl Test for libFLAC 1.1.3
+ AC_CHECK_LIB(FLAC, FLAC__stream_decoder_init_stream, HAVE_FLAC_1_1_3="yes",
+ HAVE_FLAC_1_1_3="no", [$FLAC_LIBS])
+ if test "x$HAVE_FLAC_1_1_3" = xyes ; then
+ AC_DEFINE(HAVE_FLAC_1_1_3, [1], [Define to 1 if you have libFLAC 1.1.3])
+ FLAC_SUPPORT="yes (1.1.3)"
+ else
+ dnl Test for libFLAC 1.1.2
+ AC_CHECK_LIB(FLAC, FLAC__stream_decoder_init, HAVE_FLAC_1_1_2="yes",
+ HAVE_FLAC_1_1_2="no", [$FLAC_LIBS])
+ if test "x$HAVE_FLAC_1_1_2" = xyes ; then
+ AC_DEFINE(HAVE_FLAC_1_1_2, [1], [Define to 1 if you have libFLAC 1.1.2])
+ FLAC_SUPPORT="yes (1.1.2)"
+ fi
fi
CFLAGS="$saved_CFLAGS"
Modified: libfishsound/branches/1.0-stable/src/libfishsound/flac.c
===================================================================
--- libfishsound/branches/1.0-stable/src/libfishsound/flac.c 2008-01-21 03:42:55 UTC (rev 3371)
+++ libfishsound/branches/1.0-stable/src/libfishsound/flac.c 2008-01-21 04:05:21 UTC (rev 3372)
@@ -252,6 +252,7 @@
return NULL;
}
+#if defined (HAVE_FLAC_1_1_2)
FLAC__stream_decoder_set_read_callback(fi->fsd, fs_flac_read_callback);
FLAC__stream_decoder_set_write_callback(fi->fsd, fs_flac_write_callback);
FLAC__stream_decoder_set_metadata_callback(fi->fsd, fs_flac_meta_callback);
@@ -260,6 +261,21 @@
if (FLAC__stream_decoder_init(fi->fsd) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
return NULL;
+#elif defined (HAVE_FLAC_1_1_3)
+ if (FLAC__stream_decoder_init_stream
+ (fi->fsd,
+ fs_flac_read_callback,
+ NULL, /* seek callback */
+ NULL, /* tell callback */
+ NULL, /* length callback */
+ NULL, /* EOF callback */
+ fs_flac_write_callback,
+ fs_flac_meta_callback,
+ fs_flac_error_callback,
+ fsound
+ ) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
+ return NULL;
+#endif
return fi->fsd;
}
@@ -539,18 +555,35 @@
FLAC__stream_encoder_set_channels(fi->fse, fsound->info.channels);
FLAC__stream_encoder_set_sample_rate(fi->fse, fsound->info.samplerate);
FLAC__stream_encoder_set_bits_per_sample(fi->fse, BITS_PER_SAMPLE);
+
+#if defined (HAVE_FLAC_1_1_2)
FLAC__stream_encoder_set_write_callback(fi->fse, fs_flac_enc_write_callback);
FLAC__stream_encoder_set_metadata_callback(fi->fse, fs_flac_enc_meta_callback);
FLAC__stream_encoder_set_client_data(fi->fse, fsound);
+#endif
metadata = fs_flac_encode_vorbiscomments (fsound);
if (metadata != NULL)
FLAC__stream_encoder_set_metadata (fi->fse, &metadata, 1);
/* FLAC__stream_encoder_set_total_samples_estimate(fi->fse, ...);*/
+
+#if defined (HAVE_FLAC_1_1_2)
if (FLAC__stream_encoder_init(fi->fse) != FLAC__STREAM_ENCODER_OK)
return NULL;
+#elif defined (HAVE_FLAC_1_1_3)
+ if (FLAC__stream_encoder_init_stream
+ (fi->fse,
+ fs_flac_enc_write_callback,
+ NULL, /* seek callback */
+ NULL, /* tell callback */
+ fs_flac_enc_meta_callback,
+ fsound
+ ) != FLAC__STREAM_ENCODER_OK)
+ return NULL;
+#endif
+
return fsound;
}
More information about the commits
mailing list