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/flx/gstflxdec.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/flx/gstflxdec.c')
-rw-r--r-- | gst/flx/gstflxdec.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c index c20327a7..1f55b7d9 100644 --- a/gst/flx/gstflxdec.c +++ b/gst/flx/gstflxdec.c @@ -28,7 +28,7 @@ #define JIFFIE (GST_SECOND/70) -static GstCaps* flxdec_type_find(GstBuffer *buf, gpointer private); +static GstCaps* flxdec_type_find (GstByteStream *bs, gpointer private); /* flx element information */ static GstElementDetails flxdec_details = { @@ -113,27 +113,33 @@ static void flx_decode_delta_flc (GstFlxDec *, guchar *, guchar *); static GstElementClass *parent_class = NULL; static GstCaps* -flxdec_type_find (GstBuffer *buf, gpointer private) +flxdec_type_find (GstByteStream *bs, gpointer private) { - guchar *data = GST_BUFFER_DATA(buf); - GstCaps *new; + GstBuffer *buf = NULL; + GstCaps *new = NULL; - if (GST_BUFFER_SIZE(buf) < 134){ - return NULL; - } + if (gst_bytestream_peek (bs, &buf, 134) == 134) { + guint8 *data = GST_BUFFER_DATA (buf); - /* check magic */ - if ((data[4] == 0x11 || data[4] == 0x12 - || data[4] == 0x30 || data[4] == 0x44) && data[5] == 0xaf) { + /* check magic */ + if ((data[4] == 0x11 || data[4] == 0x12 || + data[4] == 0x30 || data[4] == 0x44) && + data[5] == 0xaf) { /* check the frame type of the first frame */ if ((data[132] == 0x00 || data[132] == 0xfa) && data[133] == 0xf1) { GST_DEBUG ("GstFlxDec: found supported flx format"); - new = gst_caps_new("flxdec_type_find","video/x-fli", NULL); - return new; + new = gst_caps_new ("flxdec_type_find", + "video/x-fli", + NULL); } + } } - - return NULL; + + if (buf != NULL) { + gst_buffer_unref (buf); + } + + return new; } @@ -684,10 +690,6 @@ plugin_init (GModule *module, GstPlugin *plugin) GstElementFactory *factory; GstTypeFactory *type; - /* this filter needs the bytestream package */ - if (!gst_library_load ("gstbytestream")) - return FALSE; - factory = gst_element_factory_new("flxdec", GST_TYPE_FLXDEC, &flxdec_details); g_return_val_if_fail(factory != NULL, FALSE); gst_element_factory_set_rank (factory, GST_ELEMENT_RANK_PRIMARY); |