[xiph-commits] r3283 - in libfishsound/branches/1.0-stable-flac: .
include/fishsound src/examples src/libfishsound src/tests
conrad at svn.annodex.net
conrad at svn.annodex.net
Tue Dec 4 17:33:27 PST 2007
Author: conrad
Date: 2007-12-04 17:33:26 -0800 (Tue, 04 Dec 2007)
New Revision: 3283
Modified:
libfishsound/branches/1.0-stable-flac/config.h.in
libfishsound/branches/1.0-stable-flac/configure.ac
libfishsound/branches/1.0-stable-flac/include/fishsound/constants.h
libfishsound/branches/1.0-stable-flac/src/examples/fishsound-decenc.c
libfishsound/branches/1.0-stable-flac/src/examples/fishsound-encode.c
libfishsound/branches/1.0-stable-flac/src/examples/fishsound-identify.c
libfishsound/branches/1.0-stable-flac/src/libfishsound/Makefile.am
libfishsound/branches/1.0-stable-flac/src/libfishsound/fishsound.c
libfishsound/branches/1.0-stable-flac/src/libfishsound/private.h
libfishsound/branches/1.0-stable-flac/src/tests/encdec-audio.c
Log:
raw commit of libfishsound-flac-1.patch from Tobias Gehrig
(build fails)
Modified: libfishsound/branches/1.0-stable-flac/config.h.in
===================================================================
--- libfishsound/branches/1.0-stable-flac/config.h.in 2007-12-05 01:16:34 UTC (rev 3282)
+++ libfishsound/branches/1.0-stable-flac/config.h.in 2007-12-05 01:33:26 UTC (rev 3283)
@@ -12,6 +12,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
+/* Define to 1 if you have libOggFLAC */
+#undef HAVE_FLAC
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
Modified: libfishsound/branches/1.0-stable-flac/configure.ac
===================================================================
--- libfishsound/branches/1.0-stable-flac/configure.ac 2007-12-05 01:16:34 UTC (rev 3282)
+++ libfishsound/branches/1.0-stable-flac/configure.ac 2007-12-05 01:33:26 UTC (rev 3283)
@@ -244,6 +244,37 @@
AM_CONDITIONAL(HAVE_SPEEX, [test "x$HAVE_SPEEX" = "xyes"])
dnl
+dnl Detect flac
+dnl
+
+HAVE_FLAC=no
+FLAC_SUPPORT=no
+
+ac_enable_flac=yes
+AC_ARG_ENABLE(flac,
+ [ --disable-flac enable building of Flac codec support ],
+ [ ac_enable_flac=no ], [ ac_enable_flac=yes] )
+
+if test "x${ac_enable_flac}" = xyes ; then
+ AC_CHECK_LIB(OggFLAC, FLAC__file_decoder_init, HAVE_FLAC="maybe", , [-lm -logg])
+ if test "x$HAVE_FLAC" = xmaybe; then
+ AC_CHECK_HEADER(FLAC/all.h, HAVE_FLAC="yes", HAVE_FLAC="no")
+ fi
+ if test "x$HAVE_FLAC" = xyes ; then
+ AC_DEFINE(HAVE_FLAC, [1], [Define to 1 if you have libOggFLAC])
+ FLAC_LIBS="-lFLAC -logg -lm"
+ AC_SUBST(FLAC_LIBS)
+ FLAC_SUPPORT="yes"
+ else
+ AC_DEFINE(HAVE_FLAC, [0], [Define to 1 if you have libOggFLAC])
+ fi
+else
+ AC_DEFINE(HAVE_FLAC, [0], [Define to 1 if you have libOggFLAC])
+ FLAC_SUPPORT="disabled"
+fi
+AM_CONDITIONAL(HAVE_FLAC, [test "x$HAVE_FLAC" = "xyes"])
+
+dnl
dnl Check codec disabling sanity
dnl
if test "x${ac_enable_vorbis}" = xno && test "x${ac_enable_speex}" = xno ; then
@@ -358,6 +389,17 @@
])
fi
+if test "x$HAVE_FLAC" != xyes ; then
+ AC_MSG_RESULT(
+[*** libOggFLAC, available from http://flac.sourceforge.net/])
+fi
+if test "x$HAVE_FLAC" = xmaybe ; then
+ AC_MSG_RESULT(
+[ Development files missing: The libOggFLAC library binary seems to be
+ installed, but building of a test program failed.
+])
+fi
+
AC_MSG_RESULT(
[*** If you install the required libraries from source, you
*** need to inform the dynamic linker of their location. If
@@ -438,6 +480,7 @@
Vorbis support: .............. $VORBIS_SUPPORT
Speex support: ............... $SPEEX_SUPPORT
+ Flac support: ................ $FLAC_SUPPORT
Example programs (./src/examples):
Modified: libfishsound/branches/1.0-stable-flac/include/fishsound/constants.h
===================================================================
--- libfishsound/branches/1.0-stable-flac/include/fishsound/constants.h 2007-12-05 01:16:34 UTC (rev 3282)
+++ libfishsound/branches/1.0-stable-flac/include/fishsound/constants.h 2007-12-05 01:33:26 UTC (rev 3283)
@@ -55,7 +55,10 @@
FISH_SOUND_VORBIS = 0x01,
/** Speex */
- FISH_SOUND_SPEEX = 0x02
+ FISH_SOUND_SPEEX = 0x02,
+
+ /** Flac */
+ FISH_SOUND_FLAC = 0x03
} FishSoundCodecID;
/** Decode callback return values */
Modified: libfishsound/branches/1.0-stable-flac/src/examples/fishsound-decenc.c
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/examples/fishsound-decenc.c 2007-12-05 01:16:34 UTC (rev 3282)
+++ libfishsound/branches/1.0-stable-flac/src/examples/fishsound-decenc.c 2007-12-05 01:33:26 UTC (rev 3283)
@@ -66,6 +66,7 @@
printf ("Options:\n");
printf (" --vorbis Use Vorbis as the output codec\n");
printf (" --speex Use Speex as the output codec\n");
+ printf (" --flac Use Flac as the output codec\n");
printf (" --interleave Use interleaved PCM internally\n");
exit (1);
}
@@ -224,6 +225,8 @@
format = FISH_SOUND_VORBIS;
} else if (!strcmp (argv[i], "--speex")) {
format = FISH_SOUND_SPEEX;
+ } else if (!strcmp (argv[i], "--flac")) {
+ format = FISH_SOUND_FLAC;
} else if (!strcmp (argv[i], "--interleave")) {
interleave = 1;
} else if (!strcmp (argv[i], "--help") || !strcmp (argv[i], "-h")) {
@@ -255,6 +258,15 @@
}
}
+ if (format == FISH_SOUND_FLAC) {
+ if (HAVE_FLAC) {
+ printf ("Using Flac as the output codec\n");
+ } else {
+ fprintf (stderr, "Error: Flac support disabled\n");
+ exit (1);
+ }
+ }
+
ed = fs_encdec_new (infilename, outfilename, format, interleave, blocksize);
while ((n = oggz_read (ed->oggz_in, 1024)) > 0)
Modified: libfishsound/branches/1.0-stable-flac/src/examples/fishsound-encode.c
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/examples/fishsound-encode.c 2007-12-05 01:16:34 UTC (rev 3282)
+++ libfishsound/branches/1.0-stable-flac/src/examples/fishsound-encode.c 2007-12-05 01:33:26 UTC (rev 3283)
@@ -107,6 +107,8 @@
ext = strrchr (outfilename, '.');
if (ext && !strncasecmp (ext, ".spx", 4))
format = FISH_SOUND_SPEEX;
+ else if (ext && !strncasecmp (ext, ".flc", 4))
+ format = FISH_SOUND_FLAC;
else
format = FISH_SOUND_VORBIS;
Modified: libfishsound/branches/1.0-stable-flac/src/examples/fishsound-identify.c
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/examples/fishsound-identify.c 2007-12-05 01:16:34 UTC (rev 3282)
+++ libfishsound/branches/1.0-stable-flac/src/examples/fishsound-identify.c 2007-12-05 01:33:26 UTC (rev 3283)
@@ -52,6 +52,7 @@
switch (format) {
case FISH_SOUND_VORBIS: printf ("Vorbis\n"); break;
case FISH_SOUND_SPEEX: printf ("Speex\n"); break;
+ case FISH_SOUND_FLAC: printf ("Flac\n"); break;
default: printf ("Unknown\n");
}
Modified: libfishsound/branches/1.0-stable-flac/src/libfishsound/Makefile.am
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/libfishsound/Makefile.am 2007-12-05 01:16:34 UTC (rev 3282)
+++ libfishsound/branches/1.0-stable-flac/src/libfishsound/Makefile.am 2007-12-05 01:33:26 UTC (rev 3283)
@@ -22,7 +22,8 @@
comments.c \
speex.c \
vorbis.c \
+ flac.c \
fs_vector.c
libfishsound_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@ @SHLIB_VERSION_ARG@
-libfishsound_la_LIBADD = $(VORBIS_LIBS) $(SPEEX_LIBS)
+libfishsound_la_LIBADD = $(VORBIS_LIBS) $(SPEEX_LIBS) $(FLAC_LIBS)
Modified: libfishsound/branches/1.0-stable-flac/src/libfishsound/fishsound.c
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/libfishsound/fishsound.c 2007-12-05 01:16:34 UTC (rev 3282)
+++ libfishsound/branches/1.0-stable-flac/src/libfishsound/fishsound.c 2007-12-05 01:33:26 UTC (rev 3283)
@@ -50,6 +50,9 @@
fish_sound_speex_identify (buf, bytes) != FISH_SOUND_UNKNOWN)
return FISH_SOUND_SPEEX;
+ if (fish_sound_flac_identify (buf, bytes) != FISH_SOUND_UNKNOWN)
+ return FISH_SOUND_FLAC;
+
return FISH_SOUND_UNKNOWN;
}
@@ -60,7 +63,9 @@
fsound->codec = fish_sound_vorbis_codec ();
} else if (format == FISH_SOUND_SPEEX) {
fsound->codec = fish_sound_speex_codec ();
- } else {
+ } else if (format == FISH_SOUND_FLAC) {
+ fsound->codec = fish_sound_flac_codec ();
+ } else {
return -1;
}
@@ -91,6 +96,9 @@
if (!HAVE_SPEEX) {
if (fsinfo->format == FISH_SOUND_SPEEX) return NULL;
}
+ if (!HAVE_FLAC) {
+ if (fsinfo->format == FISH_SOUND_FLAC) return NULL;
+ }
}
} else if (mode != FISH_SOUND_DECODE) {
return NULL;
Modified: libfishsound/branches/1.0-stable-flac/src/libfishsound/private.h
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/libfishsound/private.h 2007-12-05 01:16:34 UTC (rev 3282)
+++ libfishsound/branches/1.0-stable-flac/src/libfishsound/private.h 2007-12-05 01:33:26 UTC (rev 3283)
@@ -160,6 +160,9 @@
int fish_sound_speex_identify (unsigned char * buf, long bytes);
FishSoundCodec * fish_sound_speex_codec (void);
+int fish_sound_flac_identify (unsigned char * buf, long bytes);
+FishSoundCodec * fish_sound_flac_codec (void);
+
/* comments */
int fish_sound_comments_init (FishSound * fsound);
int fish_sound_comments_free (FishSound * fsound);
Modified: libfishsound/branches/1.0-stable-flac/src/tests/encdec-audio.c
===================================================================
--- libfishsound/branches/1.0-stable-flac/src/tests/encdec-audio.c 2007-12-05 01:16:34 UTC (rev 3282)
+++ libfishsound/branches/1.0-stable-flac/src/tests/encdec-audio.c 2007-12-05 01:33:26 UTC (rev 3283)
@@ -53,6 +53,7 @@
printf (" --nasty Run with large test parameters\n");
printf (" --disable-vorbis Disable testing of Vorbis codec\n");
printf (" --disable-speex Disable testing of Speex codec\n");
+ printf (" --disable-flac Disable testing of Flac codec\n");
printf (" --disable-interleave Disable testing of interleave\n");
printf (" --disable-non-interleave Disable testing of non-interleave\n");
exit (1);
@@ -61,7 +62,7 @@
/* For one-time tests, configure these by commandline args */
static int * test_blocksizes, * test_samplerates, * test_channels;
static int iter = DEFAULT_ITER;
-static int test_vorbis = HAVE_VORBIS, test_speex = HAVE_SPEEX;
+static int test_vorbis = HAVE_VORBIS, test_speex = HAVE_SPEEX, test_flac = HAVE_FLAC;
static int test_interleave = 1, test_non_interleave = 1;
static int nasty_blocksizes[] = {128, 256, 512, 1024, 2048, 4096, 0};
@@ -209,7 +210,7 @@
snprintf (msg, 128,
"+ %2d channel %6d Hz %s, %d frame buffer (%s)",
channels, samplerate,
- format == FISH_SOUND_VORBIS ? "Vorbis" : "Speex",
+ format == FISH_SOUND_VORBIS ? "Vorbis," : (format == FISH_SOUND_FLAC ? "Flac," : "Speex, "),
blocksize,
interleave ? "interleave" : "non-interleave");
INFO (msg);
@@ -277,6 +278,8 @@
test_vorbis = 0;
} else if (!strcmp (argv[i], "--disable-speex")) {
test_speex = 0;
+ } else if (!strcmp (argv[i], "--disable-flac")) {
+ test_flac = 0;
} else if (!strcmp (argv[i], "--disable-interleave")) {
test_interleave = 0;
} else if (!strcmp (argv[i], "--disable-non-interleave")) {
@@ -295,6 +298,7 @@
if (!test_vorbis) INFO ("* DISABLED testing of Vorbis");
if (!test_speex) INFO ("* DISABLED testing of Speex");
+ if (!test_flac) INFO ("* DISABLED testing of Flac");
if (!test_interleave) INFO ("* DISABLED testing of INTERLEAVE");
if (!test_non_interleave) INFO ("* DISABLED testing of NON-INTERLEAVE");
}
@@ -328,6 +332,15 @@
FISH_SOUND_SPEEX, 0, test_blocksizes[b]);
}
+
+ /* Test FLAC */
+ if (test_flac) {
+ if (test_channels[c] <= 8) {
+ fs_encdec_test (pcm_type, test_samplerates[s], test_channels[c],
+ FISH_SOUND_FLAC, 0, test_blocksizes[b]);
+
+ }
+ }
}
}
@@ -345,6 +358,15 @@
FISH_SOUND_SPEEX, 1, test_blocksizes[b]);
}
+
+ /* Test FLAC */
+ if (test_flac) {
+ if (test_channels[c] <= 8) {
+ fs_encdec_test (pcm_type, test_samplerates[s], test_channels[c],
+ FISH_SOUND_FLAC, 1, test_blocksizes[b]);
+
+ }
+ }
}
}
More information about the commits
mailing list