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
This commit is contained in:
Ronald S. Bultje 2003-10-01 13:14:45 +00:00
parent afc9757308
commit 595cbc2d05
7 changed files with 22 additions and 44 deletions

View file

@ -262,7 +262,7 @@ GST_PLUGINS_ALL="\
ac3parse adder audioscale auparse avi \
asfdemux audioconvert cdxaparse chart \
cutter debug deinterlace effectv festival \
filter flx goom intfloat law level median mixmatrix \
filter flx goom id3 intfloat law level median mixmatrix \
mpeg1sys mpeg1videoparse mpeg2enc mpeg2sub \
mpegaudio mpegaudioparse mpegstream mpegtypes \
monoscope oneton overlay passthrough playondemand qtdemux \
@ -1180,6 +1180,7 @@ gst/festival/Makefile
gst/filter/Makefile
gst/flx/Makefile
gst/goom/Makefile
gst/id3/Makefile
gst/intfloat/Makefile
gst/law/Makefile
gst/level/Makefile

View file

@ -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) \

View file

@ -2351,9 +2351,6 @@ plugin_init (GModule * module, GstPlugin * plugin)
{
GstElementFactory *factory;
if (!gst_library_load ("gstbytestream"))
return FALSE;
factory = gst_element_factory_new ("alsasrc", GST_TYPE_ALSA_SRC, &gst_alsa_src_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory, gst_alsa_src_pad_factory ());

View file

@ -25,7 +25,7 @@ extern GType vorbisfile_get_type(void);
extern GstElementDetails vorbisfile_details;
extern GstElementDetails vorbisenc_details;
static GstCaps* vorbis_type_find (GstBuffer *buf, gpointer private);
static GstCaps* vorbis_type_find (GstByteStream *bs, gpointer private);
GstPadTemplate *gst_vorbisdec_src_template, *gst_vorbisdec_sink_template;
GstPadTemplate *gst_vorbisenc_src_template, *gst_vorbisenc_sink_template;
@ -81,40 +81,26 @@ static GstTypeDefinition vorbisdefinition = {
};
static GstCaps*
vorbis_type_find (GstBuffer *buf, gpointer private)
vorbis_type_find (GstByteStream *bs, gpointer private)
{
guint32 head;
gint offset;
guint8 *data;
gint size;
GstBuffer *buf = NULL;
GstCaps *new = NULL;
data = GST_BUFFER_DATA (buf);
size = GST_BUFFER_SIZE (buf);
if (gst_bytestream_peek (bs, &buf, 4) == 4) {
guint32 head = GUINT32_FROM_BE (*((guint32 *) GST_BUFFER_DATA (buf)));
if (size < sizeof(guint32))
return NULL;
head = GUINT32_FROM_BE (*((guint32 *)data));
if (head == 0x4F676753) {
return gst_caps_new ("vorbis_type_find", "application/ogg", NULL);
} else {
/* checks for existance of vorbis identification header in case
* there's an ID3 tag */
for (offset = 0; offset < size-7; offset++) {
if (data[offset] == 0x01 &&
data[offset+1] == 'v' &&
data[offset+2] == 'o' &&
data[offset+3] == 'r' &&
data[offset+4] == 'b' &&
data[offset+5] == 'i' &&
data[offset+6] == 's' ) {
return gst_caps_new ("vorbis_type_find", "application/ogg", NULL);
}
if (head == 0x4F676753) {
new = GST_CAPS_NEW ("vorbis_type_find",
"application/ogg",
NULL);
}
}
return NULL;
if (buf != NULL) {
gst_buffer_unref (buf);
}
return new;
}
@ -172,10 +158,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (file));
/* this filter needs the bytestream package */
if (!gst_library_load ("gstbytestream"))
return FALSE;
type = gst_type_factory_new (&vorbisdefinition);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type));

View file

@ -24,7 +24,7 @@
#include <gst/gst.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
#include <gst/bytestream/bytestream.h>
#include <gst/gstbytestream.h>
#define GST_TYPE_VORBISFILE \
(vorbisfile_get_type())

View file

@ -606,9 +606,6 @@ plugin_init (GModule *module, GstPlugin *plugin)
factory = gst_element_factory_new ("adder", GST_TYPE_ADDER, &adder_details);
g_return_val_if_fail (factory != NULL, FALSE);
if (! gst_library_load ("gstbytestream"))
return FALSE;
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (gst_adder_src_template_factory));
gst_element_factory_add_pad_template (factory,

View file

@ -24,7 +24,7 @@
#define __GST_ADDER_H__
#include <gst/gst.h>
#include <gst/bytestream/bytestream.h>
#include <gst/gstbytestream.h>
#ifdef __cplusplus
extern "C" {