Add typefinder for Mobile XMF. Fixes bug #568707.
authorBenjamin Gaignard <benjamin@gaignard.net>
Fri, 23 Jan 2009 09:19:27 +0000 (10:19 +0100)
committerSebastian Dröge <slomo@circular-chaos.org>
Fri, 23 Jan 2009 09:19:27 +0000 (10:19 +0100)
gst/typefind/gsttypefindfunctions.c

index 8e81fe6..33e924e 100644 (file)
@@ -412,6 +412,33 @@ mid_type_find (GstTypeFind * tf, gpointer unused)
       && data[3] == 'd')
     gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MID_CAPS);
 }
+/*** audio/mobile-xmf ***/
+
+static GstStaticCaps mxmf_caps = GST_STATIC_CAPS ("audio/mobile-xmf");
+
+#define MXMF_CAPS gst_static_caps_get(&mxmf_caps)
+static void
+mxmf_type_find (GstTypeFind * tf, gpointer unused)
+{
+  guint8 *data = NULL;
+
+ /* Search FileId "XMF_" 4 bytes */
+  data = gst_type_find_peek (tf, 0, 4);
+  if (data && data[0] == 'X' && data[1] == 'M' && data[2] == 'F'
+      && data[3] == '_') {      
+ /* Search Format version "2.00" 4 bytes */      
+               data = gst_type_find_peek (tf, 4, 4);
+               if (data && data[0] == '2' && data[1] == '.' && data[2] == '0'
+                     && data[3] == '0') {
+ /* Search TypeId 2    1 byte */      
+                       data = gst_type_find_peek (tf, 11, 1);
+                       if (data && data[0] == 2 ) {    
+                               gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MXMF_CAPS);
+                       }
+               }
+       }
+}
+
 
 /*** video/x-fli ***/
 
@@ -3136,6 +3163,7 @@ plugin_init (GstPlugin * plugin)
   static gchar *vivo_exts[] = { "viv", NULL };
   static gchar *nsf_exts[] = { "nsf", NULL };
   static gchar *mid_exts[] = { "mid", "midi", NULL };
+  static gchar *mxmf_exts[] = { "mxmf", NULL };
   static gchar *imelody_exts[] = { "imy", "ime", "imelody", NULL };
   static gchar *pdf_exts[] = { "pdf", NULL };
   static gchar *mxf_exts[] = { "mxf", NULL };
@@ -3171,6 +3199,8 @@ plugin_init (GstPlugin * plugin)
 #endif
   TYPE_FIND_REGISTER (plugin, "audio/midi", GST_RANK_PRIMARY, mid_type_find,
       mid_exts, MID_CAPS, NULL, NULL);
+  TYPE_FIND_REGISTER (plugin, "audio/mobile-xmf", GST_RANK_PRIMARY, mxmf_type_find,
+      mxmf_exts, MXMF_CAPS, NULL, NULL);
   TYPE_FIND_REGISTER (plugin, "video/x-fli", GST_RANK_MARGINAL, flx_type_find,
       flx_exts, FLX_CAPS, NULL, NULL);
   TYPE_FIND_REGISTER (plugin, "application/x-id3v2", GST_RANK_PRIMARY + 103,