diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2008-02-25 06:29:09 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-02-25 06:29:09 +0000 |
commit | 49e1c708bb58f1f5d45b0b6b884b2152d8b386e3 (patch) | |
tree | 833e7ffc4071ff377314e332dd6f7ce75576efcd | |
parent | 6ab3a0e0c06f21d0101f2c4bccac6fdb1f2a3adf (diff) | |
download | gstreamer-plugins-base-49e1c708bb58f1f5d45b0b6b884b2152d8b386e3.tar.gz |
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.
-rw-r--r-- | ChangeLog | 6 | ||||
m--------- | common | 0 | ||||
-rw-r--r-- | gst/typefind/gsttypefindfunctions.c | 19 |
3 files changed, 25 insertions, 0 deletions
@@ -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> diff --git a/common b/common -Subproject bd6ec57040fe3fa93e21ca440dfe494e3ee1855 +Subproject a574e6214b06fcbdfc00e952e2f3edc06997ee9 diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index de2b35a76..48ec1b15e 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -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, |