From 754ba31af2cb279a8815af316aa1f409cfa8f305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 1 May 2006 19:08:40 +0000 Subject: [PATCH] gst/typefind/gsttypefindfunctions.c: Refine musepack typefinding a bit. Return MAXIMUM probability when we detect str... Original commit message from CVS: * gst/typefind/gsttypefindfunctions.c: (musepack_type_find), (plugin_init): Refine musepack typefinding a bit. Return MAXIMUM probability when we detect stream version 7 to make sure the mpeg audio typefinder doesn't trump us. --- ChangeLog | 8 ++++++++ gst/typefind/gsttypefindfunctions.c | 24 +++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f524de109..ec57f1f037 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-05-01 Tim-Philipp Müller + + * gst/typefind/gsttypefindfunctions.c: (musepack_type_find), + (plugin_init): + Refine musepack typefinding a bit. Return MAXIMUM + probability when we detect stream version 7 to make + sure the mpeg audio typefinder doesn't trump us. + 2006-04-29 Tim-Philipp Müller * gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps): diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index fb88782a1f..addcbdef59 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -782,6 +782,25 @@ suggest: } } +/*** audio/x-musepack ***/ + +static GstStaticCaps musepack_caps = GST_STATIC_CAPS ("audio/x-musepack"); + +#define MUSEPACK_CAPS (gst_static_caps_get(&musepack_caps)) +static void +musepack_type_find (GstTypeFind * tf, gpointer unused) +{ + guint8 *data = gst_type_find_peek (tf, 0, 4); + + if (data && memcmp (data, "MP+", 3) == 0) { + if ((data[3] & 0x7f) == 7) { + gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MUSEPACK_CAPS); + } else { + gst_type_find_suggest (tf, GST_TYPE_FIND_LIKELY + 10, MUSEPACK_CAPS); + } + } +} + /*** audio/x-ac3 ***/ static GstStaticCaps ac3_caps = GST_STATIC_CAPS ("audio/x-ac3"); @@ -2340,9 +2359,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); - /* -1 so id3v1 or apev1/2 are detected with higher preference */ - TYPE_FIND_REGISTER_START_WITH (plugin, "audio/x-musepack", GST_RANK_PRIMARY, - musepack_exts, "MP+", 3, GST_TYPE_FIND_LIKELY + 10); + TYPE_FIND_REGISTER (plugin, "audio/x-musepack", GST_RANK_PRIMARY, + musepack_type_find, musepack_exts, MUSEPACK_CAPS, NULL, NULL); TYPE_FIND_REGISTER (plugin, "audio/x-au", GST_RANK_MARGINAL, au_type_find, au_exts, AU_CAPS, NULL, NULL); TYPE_FIND_REGISTER_RIFF (plugin, "video/x-msvideo", GST_RANK_PRIMARY,