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 /ext | |
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 'ext')
-rw-r--r-- | ext/Makefile.am | 5 | ||||
-rw-r--r-- | ext/dv/gstdvdec.c | 41 | ||||
-rw-r--r-- | ext/dv/gstdvdec.h | 2 | ||||
-rw-r--r-- | ext/flac/gstflac.c | 47 | ||||
-rw-r--r-- | ext/flac/gstflacdec.h | 2 | ||||
-rw-r--r-- | ext/ladspa/gstladspa.c | 3 | ||||
-rw-r--r-- | ext/ladspa/gstladspa.h | 2 |
7 files changed, 43 insertions, 59 deletions
diff --git a/ext/Makefile.am b/ext/Makefile.am index 2b1ab6ec..66346eac 100644 --- a/ext/Makefile.am +++ b/ext/Makefile.am @@ -278,8 +278,9 @@ SUBDIRS=$(A52DEC_DIR) $(AALIB_DIR) $(ALSA_DIR) \ $(ARTS_DIR) $(ARTSC_DIR) $(AUDIOFILE_DIR) \ $(CDPARANOIA_DIR) $(DIVX_DIR) \ $(DVDREAD_DIR) $(DVDNAV_DIR) $(ESD_DIR) $(MAS_DIR) \ - $(FFMPEG_DIR) $(FLAC_DIR) $(GDK_PIXBUF_DIR) $(GNOMEVFS_DIR) $(GSM_DIR) \ - $(HERMES_DIR) $(JACK_DIR) $(JPEG_DIR) \ + $(FFMPEG_DIR) $(FLAC_DIR) $(GDK_PIXBUF_DIR) \ + $(GNOMEVFS_DIR) $(GSM_DIR) $(HERMES_DIR) \ + $(JACK_DIR) $(JPEG_DIR) \ $(LADSPA_DIR) $(LAME_DIR) $(LCS_DIR) \ $(LIBDV_DIR) $(LIBFAME_DIR) $(LIBPNG_DIR) \ $(MAD_DIR) $(MATROSKA_DIR) $(MIKMOD_DIR) \ 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 <libdv/dv.h> -#include <gst/bytestream/bytestream.h> +#include <gst/gstbytestream.h> /* This is the definition of the element's object structure. */ diff --git a/ext/flac/gstflac.c b/ext/flac/gstflac.c index 2c30df32..2fe8f419 100644 --- a/ext/flac/gstflac.c +++ b/ext/flac/gstflac.c @@ -26,7 +26,7 @@ extern GstElementDetails flacenc_details; extern GstElementDetails flacdec_details; -static GstCaps* flac_type_find (GstBuffer *buf, gpointer private); +static GstCaps* flac_type_find (GstByteStream *bs, gpointer private); GstPadTemplate *gst_flacdec_src_template, *gst_flacdec_sink_template; GstPadTemplate *gst_flacenc_src_template, *gst_flacenc_sink_template; @@ -70,37 +70,26 @@ static GstTypeDefinition flacdefinition = { static GstCaps* -flac_type_find (GstBuffer *buf, gpointer private) +flac_type_find (GstByteStream *bs, gpointer private) { - gint offset; - guint8 *data; - gint size; - guint32 head; - - if (GST_BUFFER_SIZE (buf) < 4) - return NULL; + GstBuffer *buf = NULL; + GstCaps *new = NULL; - data = GST_BUFFER_DATA (buf); - size = GST_BUFFER_SIZE (buf); - - head = GUINT32_FROM_BE (*((guint32 *)GST_BUFFER_DATA (buf))); - - if (head == 0x664C6143) - return gst_caps_new ("flac_type_find", "application/x-flac", NULL); - else { - /* checks for existance of flac identification header in case - * there's an ID3 tag */ - for (offset = 0; offset < size-4; offset++) { - if (data[offset] == 'f' && - data[offset+1] == 'L' && - data[offset+2] == 'a' && - data[offset+3] == 'C' ) { - return gst_caps_new ("flac_type_find", "application/x-flac", NULL); - } + if (gst_bytestream_peek (bs, &buf, 4) == 4) { + guint32 head = GUINT32_FROM_BE (*((guint32 *) GST_BUFFER_DATA (buf))); + + if (head == 0x664C6143) { + new = GST_CAPS_NEW ("flac_type_find", + "application/x-flac", + NULL); } } - return NULL; + if (buf != NULL) { + gst_buffer_unref (buf); + } + + return new; } @@ -111,10 +100,6 @@ plugin_init (GModule *module, GstPlugin *plugin) GstTypeFactory *type; GstCaps *raw_caps, *flac_caps; - /* this filter needs the bytestream package */ - if (!gst_library_load ("gstbytestream")) - return FALSE; - gst_plugin_set_longname (plugin, "The FLAC Lossless compressor Codec"); /* create an elementfactory for the flacenc element */ diff --git a/ext/flac/gstflacdec.h b/ext/flac/gstflacdec.h index 67742ac6..0b374440 100644 --- a/ext/flac/gstflacdec.h +++ b/ext/flac/gstflacdec.h @@ -24,7 +24,7 @@ #include <config.h> #include <gst/gst.h> -#include <gst/bytestream/bytestream.h> +#include <gst/gstbytestream.h> #include <FLAC/all.h> diff --git a/ext/ladspa/gstladspa.c b/ext/ladspa/gstladspa.c index 460bdf12..5f16dbf5 100644 --- a/ext/ladspa/gstladspa.c +++ b/ext/ladspa/gstladspa.c @@ -993,9 +993,6 @@ plugin_init (GModule *module, GstPlugin *plugin) LADSPAPluginSearch(ladspa_describe_plugin); - if (! gst_library_load ("gstbytestream")) - return FALSE; - /* initialize dparam support library */ gst_control_init(NULL,NULL); diff --git a/ext/ladspa/gstladspa.h b/ext/ladspa/gstladspa.h index 89a039e9..85348a95 100644 --- a/ext/ladspa/gstladspa.h +++ b/ext/ladspa/gstladspa.h @@ -26,7 +26,7 @@ #include <config.h> #include <gst/gst.h> -#include <gst/bytestream/bytestream.h> +#include <gst/gstbytestream.h> #include "ladspa.h" |