From 336e1346e4d6bf66d297e5ac5abaeaff5e422ae7 Mon Sep 17 00:00:00 2001 From: Benjamin Gaignard Date: Fri, 23 Jan 2009 10:19:27 +0100 Subject: [PATCH] Add typefinder for Mobile XMF. Fixes bug #568707. --- gst/typefind/gsttypefindfunctions.c | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index 8e81fe6dc5..33e924ef1b 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -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,