gst/typefind/gsttypefindfunctions.c: Refine musepack typefinding a bit. Return MAXIMU...
authorTim-Philipp Müller <tim@centricular.net>
Mon, 1 May 2006 19:08:40 +0000 (19:08 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Mon, 1 May 2006 19:08:40 +0000 (19:08 +0000)
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
gst/typefind/gsttypefindfunctions.c

index 8f524de..ec57f1f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-05-01  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * 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  <tim at centricular dot net>
 
        * gst-libs/gst/riff/riff-media.c: (gst_riff_create_audio_caps):
index fb88782..addcbde 100644 (file)
@@ -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,