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/qtdemux | |
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/qtdemux')
-rw-r--r-- | gst/qtdemux/qtdemux.c | 40 | ||||
-rw-r--r-- | gst/qtdemux/qtdemux.h | 2 |
2 files changed, 22 insertions, 20 deletions
diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index 3358db33..f5a95c03 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -104,7 +104,7 @@ gst_qtdemux_details = "(C) 2003", }; -static GstCaps* quicktime_type_find (GstBuffer *buf, gpointer private); +static GstCaps* quicktime_type_find (GstByteStream *bs, gpointer private); static GstTypeDefinition quicktimedefinition = { "qtdemux_video/quicktime", @@ -187,24 +187,29 @@ gst_qtdemux_init (GstQTDemux *qtdemux) } static GstCaps* -quicktime_type_find (GstBuffer *buf, gpointer private) +quicktime_type_find (GstByteStream *bs, gpointer private) { - gchar *data = GST_BUFFER_DATA (buf); - - g_return_val_if_fail (data != NULL, NULL); - - if(GST_BUFFER_SIZE(buf) < 8){ - return NULL; + GstBuffer *buf = NULL; + GstCaps *new = NULL; + + if (gst_bytestream_peek (bs, &buf, 8) == 8) { + gchar *data = GST_BUFFER_DATA (buf); + + if (!strncmp (&data[4], "wide", 4) || + !strncmp (&data[4], "moov", 4) || + !strncmp (&data[4], "mdat", 4) || + !strncmp (&data[4], "free", 4)) { + new = GST_CAPS_NEW ("quicktime_type_find", + "video/quicktime", + NULL); + } } - if (strncmp (&data[4], "wide", 4)==0 || - strncmp (&data[4], "moov", 4)==0 || - strncmp (&data[4], "mdat", 4)==0 || - strncmp (&data[4], "free", 4)==0) { - return gst_caps_new ("quicktime_type_find", - "video/quicktime", - NULL); + + if (buf != NULL) { + gst_buffer_unref (buf); } - return NULL; + + return new; } static gboolean @@ -222,9 +227,6 @@ plugin_init (GModule *module, GstPlugin *plugin) }; gint i; - if (!gst_library_load ("gstbytestream")) - return FALSE; - factory = gst_element_factory_new ("qtdemux", GST_TYPE_QTDEMUX, &gst_qtdemux_details); g_return_val_if_fail(factory != NULL, FALSE); diff --git a/gst/qtdemux/qtdemux.h b/gst/qtdemux/qtdemux.h index 108faab1..46684be8 100644 --- a/gst/qtdemux/qtdemux.h +++ b/gst/qtdemux/qtdemux.h @@ -22,7 +22,7 @@ #define __GST_QTDEMUX_H__ #include <gst/gst.h> -#include <gst/bytestream/bytestream.h> +#include <gst/gstbytestream.h> #ifdef __cplusplus extern "C" { |