gst/typefind/gsttypefindfunctions.c: Add midi typefinder, copied from the timidity plugin.

Original commit message from CVS:
* gst/typefind/gsttypefindfunctions.c: (mid_type_find),
(plugin_init):
Add midi typefinder, copied from the timidity plugin.
This commit is contained in:
Sebastian Dröge 2008-02-25 06:29:09 +00:00
parent 6ab3a0e0c0
commit 49e1c708bb
3 changed files with 26 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2008-02-25 Sebastian Dröge <slomo@circular-chaos.org>
* gst/typefind/gsttypefindfunctions.c: (mid_type_find),
(plugin_init):
Add midi typefinder, copied from the timidity plugin.
2008-02-23 Tim-Philipp Müller <tim at centricular dot net>
Based on patch by: Tomasz Sałaciński <tsalacinski gmail com>

2
common

@ -1 +1 @@
Subproject commit bd6ec57040fe3fa93e21ca440dfe494e3ee18555
Subproject commit a574e6214b06fcbdfc00e952e2f3edc06997ee93

View file

@ -336,6 +336,22 @@ html_type_find (GstTypeFind * tf, gpointer unused)
}
}
/*** audio/midi ***/
static GstStaticCaps mid_caps = GST_STATIC_CAPS ("audio/midi");
#define MID_CAPS gst_static_caps_get(&mid_caps)
static void
mid_type_find (GstTypeFind * tf, gpointer unused)
{
guint8 *data = gst_type_find_peek (tf, 0, 4);
/* http://jedi.ks.uiuc.edu/~johns/links/music/midifile.html */
if (data && data[0] == 'M' && data[1] == 'T' && data[2] == 'h'
&& data[3] == 'd')
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, MID_CAPS);
}
/*** video/x-fli ***/
static GstStaticCaps flx_caps = GST_STATIC_CAPS ("video/x-fli");
@ -2944,6 +2960,7 @@ plugin_init (GstPlugin * plugin)
static gchar *nuv_exts[] = { "nuv", NULL };
static gchar *vivo_exts[] = { "viv", NULL };
static gchar *nsf_exts[] = { "nsf", NULL };
static gchar *mid_exts[] = { "mid", "midi", NULL };
GST_DEBUG_CATEGORY_INIT (type_find_debug, "typefindfunctions",
GST_DEBUG_FG_GREEN | GST_DEBUG_BG_RED, "generic type find functions");
@ -2966,6 +2983,8 @@ plugin_init (GstPlugin * plugin)
TYPE_FIND_REGISTER_START_WITH (plugin, "video/x-vcd", GST_RANK_PRIMARY,
cdxa_exts, "\000\377\377\377\377\377\377\377\377\377\377\000", 12,
GST_TYPE_FIND_MAXIMUM);
TYPE_FIND_REGISTER (plugin, "audio/midi", GST_RANK_PRIMARY, mid_type_find,
mid_exts, MID_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,