diff options
author | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2003-10-01 13:14:50 +0000 |
---|---|---|
committer | Ronald S. Bultje <rbultje@ronald.bitfreak.net> | 2003-10-01 13:14:50 +0000 |
commit | d9e4457faa360b470a5ae418e3444fccd6c0a5de (patch) | |
tree | 2a981bbe80d369449ad5d79e65ae7e766f1635ba /gst/cdxaparse/gstcdxaparse.c | |
parent | b569848e286b7435997a67e17fa0b21db892131d (diff) | |
download | gst-plugins-bad-d9e4457faa360b470a5ae418e3444fccd6c0a5de.tar.gz gst-plugins-bad-d9e4457faa360b470a5ae418e3444fccd6c0a5de.tar.bz2 gst-plugins-bad-d9e4457faa360b470a5ae418e3444fccd6c0a5de.zip |
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/cdxaparse/gstcdxaparse.c')
-rw-r--r-- | gst/cdxaparse/gstcdxaparse.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/gst/cdxaparse/gstcdxaparse.c b/gst/cdxaparse/gstcdxaparse.c index 5af9bd81..bfe3c8ac 100644 --- a/gst/cdxaparse/gstcdxaparse.c +++ b/gst/cdxaparse/gstcdxaparse.c @@ -50,7 +50,7 @@ static GstElementDetails gst_cdxa_parse_details = { "(C) 2002", }; -static GstCaps* cdxa_type_find (GstBuffer *buf, gpointer private); +static GstCaps* cdxa_type_find (GstByteStream *bs, gpointer private); /* typefactory for 'cdxa' */ static GstTypeDefinition cdxadefinition = { @@ -159,25 +159,28 @@ gst_cdxa_parse_init (GstCDXAParse *cdxa_parse) } static GstCaps* -cdxa_type_find (GstBuffer *buf, - gpointer private) +cdxa_type_find (GstByteStream *bs, + gpointer private) { - gchar *data = GST_BUFFER_DATA (buf); - GstCaps *new; + GstBuffer *buf = NULL; + GstCaps *new = NULL; GST_DEBUG ("cdxa_parse: 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_CDXA) - return NULL; + if (head1 == GST_RIFF_TAG_RIFF && head2 == GST_RIFF_RIFF_CDXA) { + new = GST_CAPS_NEW ("cdxa_type_find", + "video/x-cdxa", + NULL); + } + } - new = GST_CAPS_NEW ("cdxa_type_find", - "video/x-cdxa", - NULL); + if (buf != NULL) { + gst_buffer_unref (buf); + } return new; } @@ -342,10 +345,6 @@ plugin_init (GModule *module, GstPlugin *plugin) GstElementFactory *factory; GstTypeFactory *type; - /* this filter needs the riff parser */ - if (!gst_library_load ("gstbytestream")) - return FALSE; - /* create an elementfactory for the cdxa_parse element */ factory = gst_element_factory_new ("cdxaparse", GST_TYPE_CDXA_PARSE, &gst_cdxa_parse_details); |