From 38946080fd20c3b73154685b10c29aa22fac69c3 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 1 Oct 2003 13:14:52 +0000 Subject: 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 --- ext/dv/gstdvdec.c | 41 +++++++++++++++++++++-------------------- ext/dv/gstdvdec.h | 2 +- 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'ext/dv') diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c index e28f8362..27283f69 100644 --- a/ext/dv/gstdvdec.c +++ b/ext/dv/gstdvdec.c @@ -159,30 +159,34 @@ GST_PAD_TEMPLATE_FACTORY ( audio_src_temp, /* typefind stuff */ static GstCaps* -dv_type_find (GstBuffer *buf, gpointer private) +dv_type_find (GstByteStream *bs, gpointer private) { - guint32 head; + GstBuffer *buf = NULL; GstCaps *new = NULL; - if (GST_BUFFER_SIZE (buf) < 5) - return NULL; + if (gst_bytestream_peek (bs, &buf, 5) == 5) { + guint32 head = GUINT32_FROM_BE (*((guint32 *) GST_BUFFER_DATA (buf))); - head = GUINT32_FROM_BE(*((guint32 *)GST_BUFFER_DATA(buf))); + /* check for DIF and DV flag */ + if ((head & 0xffffff00) == 0x1f070000 && + !(GST_BUFFER_DATA (buf)[4] & 0x01)) { + gchar *format; - /* check for DIF and DV flag */ - if ((head & 0xffffff00) == 0x1f070000 && !(GST_BUFFER_DATA(buf)[4] & 0x01)) { - gchar *format; - - if ((head & 0x000000ff) & 0x80) - format = "PAL"; - else - format = "NTSC"; + if ((head & 0x000000ff) & 0x80) + format = "PAL"; + else + format = "NTSC"; - new = GST_CAPS_NEW ("dv_type_find", - "video/x-dv", - "systemstream", GST_PROPS_BOOLEAN (TRUE) - ); + new = GST_CAPS_NEW ("dv_type_find", + "video/x-dv", + "systemstream", GST_PROPS_BOOLEAN (TRUE)); + } + } + + if (buf != NULL) { + gst_buffer_unref (buf); } + return new; } @@ -1002,9 +1006,6 @@ plugin_init (GModule *module, GstPlugin *plugin) GstElementFactory *factory; GstTypeFactory *type; - if (!gst_library_load ("gstbytestream")) - return FALSE; - /* We need to create an ElementFactory for each element we provide. * This consists of the name of the element, the GType identifier, * and a pointer to the details structure at the top of the file. diff --git a/ext/dv/gstdvdec.h b/ext/dv/gstdvdec.h index 0ac9c49a..cced0803 100644 --- a/ext/dv/gstdvdec.h +++ b/ext/dv/gstdvdec.h @@ -29,7 +29,7 @@ extern "C" { #include -#include +#include /* This is the definition of the element's object structure. */ -- cgit