Add musepack decoder.

Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/musepack/Makefile.am:
* ext/musepack/gstmusepackdec.cpp:
* ext/musepack/gstmusepackdec.h:
* ext/musepack/gstmusepackreader.cpp:
* ext/musepack/gstmusepackreader.h:
Add musepack decoder.
* ext/faad/gstfaad.c: (gst_faad_base_init):
Make pad templates static.
* gst/typefind/gsttypefindfunctions.c: (mp3_type_find),
(plugin_init):
Add musepack typefinder, make mp3 typefinding work halfway stream,
which doesn't actually work yet because id3demux doesn't implement
_get_length().
This commit is contained in:
Ronald S. Bultje 2004-11-07 18:30:07 +00:00
parent 67fb4efc00
commit 75c18f1b4e
4 changed files with 147 additions and 88 deletions

View file

@ -1,3 +1,21 @@
2004-11-07 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* configure.ac:
* ext/Makefile.am:
* ext/musepack/Makefile.am:
* ext/musepack/gstmusepackdec.cpp:
* ext/musepack/gstmusepackdec.h:
* ext/musepack/gstmusepackreader.cpp:
* ext/musepack/gstmusepackreader.h:
Add musepack decoder.
* ext/faad/gstfaad.c: (gst_faad_base_init):
Make pad templates static.
* gst/typefind/gsttypefindfunctions.c: (mp3_type_find),
(plugin_init):
Add musepack typefinder, make mp3 typefinding work halfway stream,
which doesn't actually work yet because id3demux doesn't implement
_get_length().
2004-11-07 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ogg/gstoggmux.c: (gst_ogg_mux_next_buffer),

View file

@ -1359,6 +1359,23 @@ main (int argc,
fi
])
dnl *** musepack ***
translit(dnm, m, l) AM_CONDITIONAL(USE_MUSEPACK, true)
GST_CHECK_FEATURE(MUSEPACK, [musepackdec], musepack, [
AC_LANG_CPLUSPLUS
OLD_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I/usr/include/musepack $CPPFLAGS"
AC_CHECK_HEADER(mpc_dec.h, [
HAVE_MUSEPACK="yes"
MUSEPACK_LIBS="-lmusepack"
MUSEPACK_CFLAGS="-I/usr/include/musepack"
AC_SUBST(MUSEPACK_CFLAGS)
AC_SUBST(MUSEPACK_LIBS)
], [HAVE_MUSEPACK="no"])
CPPFLAGS="$OLD_CPPFLAGS"
AC_LANG_C
])
dnl *** musicbrainz ***
dnl libmusicbrainz <= 2.0.2 has symbol clashes with ffmpeg
dnl however, our ffmpeg patch was accepted upstream
@ -1948,6 +1965,7 @@ ext/mikmod/Makefile
ext/mpeg2dec/Makefile
ext/mpeg2enc/Makefile
ext/mplex/Makefile
ext/musepack/Makefile
ext/musicbrainz/Makefile
ext/nas/Makefile
ext/ogg/Makefile

View file

@ -238,6 +238,12 @@ endif
#MAS_DIR=
#endif
if USE_MUSEPACK
MUSEPACK_DIR=musepack
else
MUSEPACK_DIR=
endif
if USE_MUSICBRAINZ
MUSICBRAINZ_DIR=musicbrainz
else
@ -399,6 +405,7 @@ SUBDIRS=\
$(MPEG2DEC_DIR) \
$(MPEG2ENC_DIR) \
$(MPLEX_DIR) \
$(MUSEPACK_DIR) \
$(MUSICBRAINZ_DIR) \
$(OGG_DIR) \
$(PANGO_DIR) \
@ -458,6 +465,7 @@ DIST_SUBDIRS=\
mpeg2dec \
mpeg2enc \
mplex \
musepack \
musicbrainz \
nas \
ogg \

View file

@ -367,16 +367,26 @@ static GstStaticCaps mp3_caps = GST_STATIC_CAPS ("audio/mpeg, "
static void
mp3_type_find (GstTypeFind * tf, gpointer unused)
{
guint64 length = gst_type_find_get_length (tf);
gint try;
guint8 *data = NULL;
guint size = 0;
guint64 skipped = 0;
guint size;
guint64 skipped;
for (try = 0; try < 2; try++) {
guint64 start_off = (try == 0) ? 0 : length / 2;
if (try != 0 && start_off == 0)
return;
size = 0;
skipped = 0;
while (skipped < GST_MP3_TYPEFIND_TRY_SYNC) {
if (size <= 0) {
size = GST_MP3_TYPEFIND_SYNC_SIZE * 2;
do {
size /= 2;
data = gst_type_find_peek (tf, skipped, size);
data = gst_type_find_peek (tf, skipped + start_off, size);
} while (size > 10 && !data);
if (!data)
break;
@ -396,7 +406,7 @@ mp3_type_find (GstTypeFind * tf, gpointer unused)
if (offset + 4 <= skipped + size) {
head_data = data + offset - skipped;
} else {
head_data = gst_type_find_peek (tf, offset, 4);
head_data = gst_type_find_peek (tf, offset + start_off, 4);
}
if (!head_data)
break;
@ -437,6 +447,7 @@ mp3_type_find (GstTypeFind * tf, gpointer unused)
if (probability < GST_TYPE_FIND_MINIMUM)
probability = GST_TYPE_FIND_MINIMUM;
probability /= (try + 1);
GST_INFO
("audio/mpeg calculated %u = %u * %u / %u * (%u - %u) / %u",
probability, GST_TYPE_FIND_MAXIMUM, found,
@ -467,6 +478,7 @@ mp3_type_find (GstTypeFind * tf, gpointer unused)
skipped++;
size--;
}
}
}
/*** audio/x-ac3 **************************************************************/
@ -1399,6 +1411,7 @@ plugin_init (GstPlugin * plugin)
};
static gchar *mp3_exts[] = { "mp3", "mp2", "mp1", "mpga", NULL };
static gchar *ac3_exts[] = { "ac3", NULL };
static gchar *musepack_exts[] = { "mpc", NULL };
static gchar *mpeg_sys_exts[] = { "mpe", "mpeg", "mpg", NULL };
static gchar *mpeg_video_exts[] = { "mpv", "mpeg", "mpg", NULL };
static gchar *ogg_exts[] = { "ogg", "ogm", NULL };
@ -1439,6 +1452,8 @@ plugin_init (GstPlugin * plugin)
asf_exts,
"\060\046\262\165\216\146\317\021\246\331\000\252\000\142\316\154", 16,
GST_TYPE_FIND_MAXIMUM);
TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-musepack", GST_RANK_PRIMARY,
musepack_exts, "MP+", 3, GST_TYPE_FIND_MAXIMUM);
TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-au", GST_RANK_MARGINAL,
au_exts, ".snd", 4, GST_TYPE_FIND_MAXIMUM);
TYPE_FIND_REGISTER_RIFF (plugin, "video/x-msvideo", GST_RANK_PRIMARY,