diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2003-10-01 13:14:52 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2003-10-01 13:14:52 +0000 |
commit | 38946080fd20c3b73154685b10c29aa22fac69c3 (patch) | |
tree | e8a6e28a1fe368867ea663058fbd2dbc2b9d5e44 /gst/avi/gstavidemux.c | |
parent | 9905c2c25794875043af52aeff8cffad95faa5de (diff) |
New typefind system: bytestream is now part of the core all plugins have been modified to use this new typefind syste...
Original commit message from CVS:
New typefind system:
* bytestream is now part of the core
* all plugins have been modified to use this new typefind system
* asf typefinding added
* mpeg video stream typefiding removed because it's broken
* duplicate typefind entries removed
* extra id3 typefinding added, because we've seen 4 types of files
(riff/wav, flac, vorbis, mp3) with id3 headers and each of these needs
to work. Instead, I've added an id3 element and let it redo typefiding
after the id3 header. this needs a hack because spider only typefinds
once. We can remove this hack once spider supports multiple typefinds.
* with all this, mp3 typefinding is semi-rewritten
* id3 typefinding in flac/vorbis is removed, it's no longer needed
* fixed spider and gst-typefind to use this, too.
* Other general cleanups
Diffstat (limited to 'gst/avi/gstavidemux.c')
-rw-r--r-- | gst/avi/gstavidemux.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index ed605935..70170309 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -38,7 +38,7 @@ static GstElementDetails gst_avi_demux_details = { "(C) 1999", }; -static GstCaps* avi_type_find (GstBuffer *buf, gpointer private); +static GstCaps* avi_type_find (GstByteStream *bs, gpointer private); /* typefactory for 'avi' */ static GstTypeDefinition avidefinition = { @@ -173,25 +173,29 @@ gst_avi_demux_init (GstAviDemux *avi_demux) } static GstCaps* -avi_type_find (GstBuffer *buf, - gpointer private) +avi_type_find (GstByteStream *bs, + gpointer private) { - gchar *data = GST_BUFFER_DATA (buf); - GstCaps *new; + GstBuffer *buf = NULL; + GstCaps *new = NULL; GST_DEBUG ("avi_demux: typefind"); - if (GST_BUFFER_SIZE (buf) < 12) - return NULL; + if (gst_bytestream_peek (bs, &buf, 12) == 12) { + guint32 head1 = GUINT32_FROM_LE (((guint32 *) GST_BUFFER_DATA (buf))[0]), + head2 = GUINT32_FROM_LE (((guint32 *) GST_BUFFER_DATA (buf))[2]); - if (GUINT32_FROM_LE (((guint32 *)data)[0]) != GST_RIFF_TAG_RIFF) - return NULL; - if (GUINT32_FROM_LE (((guint32 *)data)[2]) != GST_RIFF_RIFF_AVI) - return NULL; + if (head1 == GST_RIFF_TAG_RIFF && head2 == GST_RIFF_RIFF_AVI) { + new = GST_CAPS_NEW ("avi_type_find", + "video/avi", + NULL); + } + } + + if (buf != NULL) { + gst_buffer_unref (buf); + } - new = GST_CAPS_NEW ("avi_type_find", - "video/avi", - NULL); return new; } @@ -1961,10 +1965,6 @@ plugin_init (GModule *module, GstPlugin *plugin) -1 /* end */ }; - /* this filter needs the riff parser */ - if (!gst_library_load ("gstbytestream")) - return FALSE; - if (!gst_library_load ("gstriff")) return FALSE; |