From 5bb80c9f5359a446d52ad7824095ae4c67bf3cdf Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Tue, 28 Oct 2003 20:52:41 +0000 Subject: merge TYPEFIND branch. Major changes: Original commit message from CVS: merge TYPEFIND branch. Major changes: - totally reworked type(find) system - all typefind functions are in gst/typefind now - more typefind functions then before - some plugins might fail to compile now because I don't have them installed and they a) require bytestream or b) haven't had their typefind fixed. Please fix those plugins and put the typefind functions into gst/typefind if they don't have dependencies --- gst/cdxaparse/gstcdxaparse.c | 44 +------ gst/cdxaparse/gstcdxaparse.h | 2 +- gst/festival/gstfestival.c | 50 -------- gst/flx/gstflxdec.c | 47 +------ gst/flx/gstflxdec.h | 2 +- gst/mixmatrix/mixmatrix.c | 5 +- gst/modplug/Makefile.am | 4 +- gst/modplug/gstmodplug.cc | 59 +-------- gst/modplug/gstmodplug.h | 4 +- gst/modplug/modplug_types.cc | 221 --------------------------------- gst/modplug/modplug_types.h | 44 ------- gst/mpegaudioparse/Makefile.am | 1 - gst/mpegaudioparse/README | 12 -- gst/mpegaudioparse/gstmpegaudioparse.c | 86 ------------- gst/qtdemux/qtdemux.c | 42 +------ gst/qtdemux/qtdemux.h | 2 +- gst/rtjpeg/gstrtjpeg.c | 7 -- 17 files changed, 23 insertions(+), 609 deletions(-) delete mode 100644 gst/modplug/modplug_types.cc delete mode 100644 gst/modplug/modplug_types.h delete mode 100644 gst/mpegaudioparse/README (limited to 'gst') diff --git a/gst/cdxaparse/gstcdxaparse.c b/gst/cdxaparse/gstcdxaparse.c index a601b727..2ee3071d 100644 --- a/gst/cdxaparse/gstcdxaparse.c +++ b/gst/cdxaparse/gstcdxaparse.c @@ -50,16 +50,6 @@ static GstElementDetails gst_cdxa_parse_details = { "(C) 2002", }; -static GstCaps* cdxa_type_find (GstByteStream *bs, gpointer private); - -/* typefactory for 'cdxa' */ -static GstTypeDefinition cdxadefinition = { - "cdxaparse_video", - "video/x-cdxa", - ".dat", - cdxa_type_find, -}; - /* CDXAParse signals and args */ enum { /* FILL ME */ @@ -158,33 +148,6 @@ gst_cdxa_parse_init (GstCDXAParse *cdxa_parse) } -static GstCaps* -cdxa_type_find (GstByteStream *bs, - gpointer private) -{ - GstBuffer *buf = NULL; - GstCaps *new = NULL; - - GST_DEBUG ("cdxa_parse: typefind"); - - if (gst_bytestream_peek (bs, &buf, 12) == 12) { - guint32 head1 = GUINT32_FROM_LE (((guint32 *) GST_BUFFER_DATA (buf))[0]), - head2 = GUINT32_FROM_LE (((guint32 *) GST_BUFFER_DATA (buf))[2]); - - if (head1 == GST_RIFF_TAG_RIFF && head2 == GST_RIFF_RIFF_CDXA) { - new = GST_CAPS_NEW ("cdxa_type_find", - "video/x-cdxa", - NULL); - } - } - - if (buf != NULL) { - gst_buffer_unref (buf); - } - - return new; -} - static gboolean gst_cdxa_parse_handle_event (GstCDXAParse *cdxa_parse) { @@ -343,7 +306,9 @@ static gboolean plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; - GstTypeFactory *type; + + if (!gst_library_load ("gstbytestream")) + return FALSE; /* create an elementfactory for the cdxa_parse element */ factory = gst_element_factory_new ("cdxaparse", GST_TYPE_CDXA_PARSE, @@ -353,9 +318,6 @@ plugin_init (GModule *module, GstPlugin *plugin) gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_templ)); gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_templ)); - type = gst_type_factory_new (&cdxadefinition); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type)); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); return TRUE; diff --git a/gst/cdxaparse/gstcdxaparse.h b/gst/cdxaparse/gstcdxaparse.h index c46df149..ff466014 100644 --- a/gst/cdxaparse/gstcdxaparse.h +++ b/gst/cdxaparse/gstcdxaparse.h @@ -24,7 +24,7 @@ #include #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/gst/festival/gstfestival.c b/gst/festival/gstfestival.c index a0f3b8f6..636f1e12 100644 --- a/gst/festival/gstfestival.c +++ b/gst/festival/gstfestival.c @@ -80,8 +80,6 @@ static void gst_festival_class_init (GstFestivalClass *klass); static void gst_festival_init (GstFestival *festival); -static GstCaps* text_type_find (GstByteStream *bs, gpointer private); - static void gst_festival_chain (GstPad *pad, GstData *_data); static GstElementStateReturn gst_festival_change_state (GstElement *element); @@ -123,17 +121,6 @@ GST_PAD_TEMPLATE_FACTORY (src_template_factory, ) ) -/* typefactory for 'wav' */ -static GstTypeDefinition -textdefinition = -{ - "festival_text/plain", - "text/plain", - ".txt", - text_type_find, -}; - - /* Festival signals and args */ enum { /* FILL ME */ @@ -197,40 +184,6 @@ gst_festival_init (GstFestival *festival) festival->info = festival_default_info(); } -static GstCaps* -text_type_find (GstByteStream *bs, gpointer private) -{ - GstBuffer *buf = NULL; - GstCaps *new = NULL; - -#define TEXT_SIZE 32 - - /* read arbitrary number and see if it's textual */ - if (gst_bytestream_peek (bs, &buf, TEXT_SIZE) == TEXT_SIZE) { - gchar *data = GST_BUFFER_DATA (buf); - gint i; - - for (i = 0; i < TEXT_SIZE; i++) { - if (!isprint (data[i]) && data[i] != '\n') { - goto out; - } - } - - /* well, we found something that looks like text... */ - new = gst_caps_new ("text_type_find", - "text/plain", - NULL); - } -out: - - if (buf != NULL) { - gst_buffer_unref (buf); - } - - return new; -} - - static void gst_festival_chain (GstPad *pad, GstData *_data) { @@ -484,7 +437,6 @@ static gboolean plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; - GstTypeFactory *type; /* create an elementfactory for the festival element */ factory = gst_element_factory_new ("festival", GST_TYPE_FESTIVAL, @@ -495,9 +447,7 @@ plugin_init (GModule *module, GstPlugin *plugin) gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (sink_template_factory)); gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (src_template_factory)); - type = gst_type_factory_new (&textdefinition); gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type)); return TRUE; } diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c index 7ed55f1b..f4e085c3 100644 --- a/gst/flx/gstflxdec.c +++ b/gst/flx/gstflxdec.c @@ -28,8 +28,6 @@ #define JIFFIE (GST_SECOND/70) -static GstCaps* flxdec_type_find (GstByteStream *bs, gpointer private); - /* flx element information */ static GstElementDetails flxdec_details = { "FLX Decoder", @@ -41,13 +39,6 @@ static GstElementDetails flxdec_details = { "(C) 2001", }; -static GstTypeDefinition flxdec_definition = { - "flxdec_video/fli", - "video/fli", - ".flc .fli", - flxdec_type_find, -}; - /* Flx signals and args */ enum { /* FILL ME */ @@ -112,37 +103,6 @@ static void flx_decode_delta_flc (GstFlxDec *, guchar *, guchar *); static GstElementClass *parent_class = NULL; -static GstCaps* -flxdec_type_find (GstByteStream *bs, gpointer private) -{ - GstBuffer *buf = NULL; - GstCaps *new = 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 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); - } - } - } - - if (buf != NULL) { - gst_buffer_unref (buf); - } - - return new; -} - - GType gst_flxdec_get_type(void) { @@ -688,7 +648,9 @@ static gboolean plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; - GstTypeFactory *type; + + 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); @@ -699,9 +661,6 @@ plugin_init (GModule *module, GstPlugin *plugin) gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - type = gst_type_factory_new (&flxdec_definition); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type)); - return TRUE; } diff --git a/gst/flx/gstflxdec.h b/gst/flx/gstflxdec.h index 0ee4b1c5..be4fa4ba 100644 --- a/gst/flx/gstflxdec.h +++ b/gst/flx/gstflxdec.h @@ -23,7 +23,7 @@ #include #include "flx_color.h" -#include +#include #ifdef __cplusplus diff --git a/gst/mixmatrix/mixmatrix.c b/gst/mixmatrix/mixmatrix.c index a795a6f5..7b03c83f 100644 --- a/gst/mixmatrix/mixmatrix.c +++ b/gst/mixmatrix/mixmatrix.c @@ -22,7 +22,7 @@ #endif #include #include -#include +#include #include #include @@ -500,6 +500,9 @@ plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; + if (!gst_library_load ("gstbytestream")) + return FALSE; + factory = gst_element_factory_new ("mixmatrix", GST_TYPE_MIXMATRIX, &mixmatrix_details); g_return_val_if_fail (factory != NULL, FALSE); diff --git a/gst/modplug/Makefile.am b/gst/modplug/Makefile.am index 52d9d408..ffbc56b0 100644 --- a/gst/modplug/Makefile.am +++ b/gst/modplug/Makefile.am @@ -2,9 +2,9 @@ SUBDIRS=libmodplug . plugin_LTLIBRARIES = libgstmodplug.la -libgstmodplug_la_SOURCES = modplug_types.cc gstmodplug.cc +libgstmodplug_la_SOURCES = gstmodplug.cc libgstmodplug_la_CXXFLAGS = $(GST_CFLAGS) libgstmodplug_la_LIBADD = $(top_builddir)/gst/modplug/libmodplug/libmodplug.la libgstmodplug_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -noinst_HEADERS = gstmodplug.h modplug_types.h +noinst_HEADERS = gstmodplug.h diff --git a/gst/modplug/gstmodplug.cc b/gst/modplug/gstmodplug.cc index 0401a6c6..c8d2555b 100644 --- a/gst/modplug/gstmodplug.cc +++ b/gst/modplug/gstmodplug.cc @@ -129,50 +129,6 @@ static GstElementStateReturn static GstElementClass *parent_class = NULL; -static GstCaps* -modplug_type_find (GstByteStream *bs, gpointer priv) -{ - GstBuffer *buf = NULL; - GstCaps *newc = NULL; - - if (gst_bytestream_peek (bs, &buf, 75) == 75) { - if (MOD_CheckType (buf) || - Mod_669_CheckType (buf) || - Amf_CheckType (buf) || - Dsm_CheckType (buf) || - Fam_CheckType (buf) || - Gdm_CheckType (buf) || - Imf_CheckType (buf) || - It_CheckType (buf) || - M15_CheckType (buf) || -#if 0 - Med_CheckType (buf) || /* FIXME */ -#endif - Mtm_CheckType (buf) || - Okt_CheckType (buf) || - S3m_CheckType (buf) || - Xm_CheckType (buf)) { - newc = GST_CAPS_NEW ("modplug_type_find", - "audio/x-mod", - NULL); - } - } - - if (buf != NULL) { - gst_buffer_unref (buf); - } - - return newc; -} - -static GstTypeDefinition modplug_definitions[] = { - { "modplug_audio/mod", "audio/x-mod", - ".mod .sam .med .stm .mtm .669 .ult .far .amf " - ".dsm .imf .gdm .stx .okt .xm .it .s3m", - modplug_type_find }, - { NULL, NULL, NULL, NULL } -}; - GType gst_modplug_get_type(void) { static GType modplug_type = 0; @@ -858,12 +814,12 @@ gst_modplug_get_property (GObject *object, guint id, GValue *value, GParamSpec * static gboolean plugin_init (GModule *module, GstPlugin *plugin) { - GstElementFactory *factory; - guint i; + GstElementFactory *factory; + guint i; /* this filter needs the bytestream package */ -/* if (!gst_library_load ("gstbytestream")) - return FALSE;*/ + if (!gst_library_load ("gstbytestream")) + return FALSE; factory = gst_element_factory_new ("modplug", GST_TYPE_MODPLUG, &modplug_details); g_return_val_if_fail (factory != NULL, FALSE); @@ -874,13 +830,6 @@ plugin_init (GModule *module, GstPlugin *plugin) gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (modplug_src_template_factory)); i = 0; - while (modplug_definitions[i].name) { - GstTypeFactory *type; - - type = gst_type_factory_new (&modplug_definitions[i]); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type)); - i++; - } gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); diff --git a/gst/modplug/gstmodplug.h b/gst/modplug/gstmodplug.h index dcdbf062..86f815e3 100644 --- a/gst/modplug/gstmodplug.h +++ b/gst/modplug/gstmodplug.h @@ -28,10 +28,8 @@ extern "C" { #endif /* __cplusplus */ #include -#include +#include -#include "modplug_types.h" - #define GST_TYPE_MODPLUG \ (gst_modplug_get_type()) diff --git a/gst/modplug/modplug_types.cc b/gst/modplug/modplug_types.cc deleted file mode 100644 index a6ca7874..00000000 --- a/gst/modplug/modplug_types.cc +++ /dev/null @@ -1,221 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#include -#include /* memcmp */ -#include /* isdigit */ - -#include "modplug_types.h" - -#define MODULEHEADERSIZE 0x438 - - -gboolean MOD_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ) + MODULEHEADERSIZE; - - /* Protracker and variants */ - if (( ! memcmp( data, "M.K.", 4 )) || ( ! memcmp( data, "M!K!", 4 ))) - return TRUE; - - /* Star Tracker */ - if ((( ! memcmp( data, "FLT", 3 )) || ( ! memcmp( data, "EXO", 3 ))) && ( isdigit( data[3] ))) - return TRUE; - - /* Oktalyzer (Amiga) */ - if (! memcmp( data, "OKTA", 4 )) - return TRUE; - - /* Oktalyser (Atari) */ - if ( ! memcmp( data, "CD81", 4 )) - return TRUE; - - /* Fasttracker */ - if (( ! memcmp( data + 1, "CHN", 3 )) && ( isdigit( data[0] ))) - return TRUE; - - /* Fasttracker or Taketracker */ - if ((( ! memcmp( data + 2, "CH", 2 )) || ( ! memcmp( data + 2, "CN", 2 ))) && ( isdigit( data[0] )) && ( isdigit( data[1] ))) - return TRUE; - - return FALSE; -} - -gboolean Mod_669_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( ! memcmp( data, "if", 2 ) || ! memcmp( data, "JN", 2 )) - return TRUE; - - return FALSE; -} - -gboolean Amf_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( memcmp( data, "AMF", 3) ) - return FALSE; - - data = GST_BUFFER_DATA( buf ) + 3; - - if (( (gint)*data >= 10 ) && ( (gint)*data <= 14 )) - return TRUE; - - return FALSE; -} - -gboolean Dsm_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( ! memcmp( data, "RIFF", 4 ) && ! memcmp( data + 8, "DSMF", 4 )) - return TRUE; - - return FALSE; -} - -gboolean Fam_CheckType( GstBuffer *buf ) -{ -guint8 *data; -static unsigned char FARSIG[4+3]={'F','A','R',0xfe,13,10,26}; - - data = GST_BUFFER_DATA( buf ); - - if(( memcmp( data, FARSIG, 4 )) || ( memcmp( data + 44, FARSIG + 4, 3 ))) - return FALSE; - - return 1; -} - -gboolean Gdm_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if ( ! memcmp( data, "GDM\xfe", 4 ) && ! memcmp( data + 71, "GMFS", 4 )) - return TRUE; - - return FALSE; -} - -gboolean Imf_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ) + 0x3c; - - if( ! memcmp( data, "IM10", 4)) - return TRUE; - - return FALSE; -} - -gboolean It_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( ! memcmp( data, "IMPM", 4 )) - return TRUE; - - return FALSE; -} - -gboolean M15_CheckType( GstBuffer *buf ) -{ - /* FIXME: M15 CheckType to do */ - return FALSE; -} - -gboolean Med_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if(( ! memcmp(data, "MMD0", 4 )) || ( memcmp( data, "MMD1", 4 ))) - return TRUE; - - return FALSE; -} - -gboolean Mtm_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( ! memcmp( data, "MTM", 3 )) - return TRUE; - - return FALSE; -} - -gboolean Okt_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( ! memcmp( data, "OKTSONG", 8 )) - return TRUE; - - return FALSE; -} - -gboolean S3m_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ) + 0x2c; - - if( ! memcmp( data, "SCRM", 4 )) - return TRUE; - - return FALSE; -} - -gboolean Xm_CheckType( GstBuffer *buf ) -{ -guint8 *data; - - data = GST_BUFFER_DATA( buf ); - - if( memcmp( data, "Extended Module: ", 17 )) - return FALSE; - - if( data[ 37 ] == 0x1a ) - return TRUE; - - return FALSE; -} - - diff --git a/gst/modplug/modplug_types.h b/gst/modplug/modplug_types.h deleted file mode 100644 index 63b5a08c..00000000 --- a/gst/modplug/modplug_types.h +++ /dev/null @@ -1,44 +0,0 @@ -/* GStreamer - * Copyright (C) <1999> Erik Walthinsen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ -#ifndef __MODPLUG_TYPES_H__ -#define __MODPLUG_TYPES_H__ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -gboolean MOD_CheckType (GstBuffer *buf); -gboolean Mod_669_CheckType (GstBuffer *buf); -gboolean Amf_CheckType (GstBuffer *buf); -gboolean Dsm_CheckType (GstBuffer *buf); -gboolean Fam_CheckType (GstBuffer *buf); -gboolean Gdm_CheckType (GstBuffer *buf); -gboolean Imf_CheckType (GstBuffer *buf); -gboolean It_CheckType (GstBuffer *buf); -gboolean M15_CheckType (GstBuffer *buf); -gboolean Mtm_CheckType (GstBuffer *buf); -gboolean Okt_CheckType (GstBuffer *buf); -gboolean S3m_CheckType (GstBuffer *buf); -gboolean Xm_CheckType (GstBuffer *buf); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __MODPLUG_TYPES_H__ */ diff --git a/gst/mpegaudioparse/Makefile.am b/gst/mpegaudioparse/Makefile.am index cb06727f..02f8a2ee 100644 --- a/gst/mpegaudioparse/Makefile.am +++ b/gst/mpegaudioparse/Makefile.am @@ -6,4 +6,3 @@ libgstmpegaudioparse_la_LIBADD = libgstmpegaudioparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) noinst_HEADERS = gstmpegaudioparse.h -EXTRA_DIST = README diff --git a/gst/mpegaudioparse/README b/gst/mpegaudioparse/README deleted file mode 100644 index 8a803d3e..00000000 --- a/gst/mpegaudioparse/README +++ /dev/null @@ -1,12 +0,0 @@ -MP3 Audio Parser -================ - -This element acts as a parser for mpeg audio data. It's called 'mp3' but -in reality will work for any MPEG-1, MPEG-2, or MPEG-2.5 elemental audio -stream of any of Layers I, II, and III. It will not (currently, ever?) -handle MPEG-2 BC or NBC streams, as those have rather specialized needs -best served be a different filter. - -It will take an mpeg audio stream in any form on its 'src' input, with any -buffer size, and split it into buffers containing a single frame each. -NOTE: ancillary data is not dealt with right now. diff --git a/gst/mpegaudioparse/gstmpegaudioparse.c b/gst/mpegaudioparse/gstmpegaudioparse.c index b0a30806..a4d7a849 100644 --- a/gst/mpegaudioparse/gstmpegaudioparse.c +++ b/gst/mpegaudioparse/gstmpegaudioparse.c @@ -35,15 +35,6 @@ static GstElementDetails mp3parse_details = { "(C) 1999", }; -static GstCaps * mp3_type_find (GstByteStream *bs, gpointer data); - -static GstTypeDefinition mp3type_definition = { - "mp3_audio/mpeg", - "audio/mpeg", - ".mp3 .mp2 .mp1 .mpga", - mp3_type_find, -}; - static GstPadTemplate* mp3_src_factory (void) { @@ -267,78 +258,6 @@ mp3_caps_create (guint layer, guint channels, return new; } -static GstCaps * -mp3_type_find (GstByteStream *bs, gpointer private) -{ - GstBuffer *buf = NULL; - GstCaps *new = NULL; - guint8 *data; - guint size; - guint32 head; - guint layer = 0, bitrate = 0, samplerate = 0, channels = 0; - - /* note that even if we don't get the requested size, - * it might still be a (very small) mp3 */ - gst_bytestream_peek (bs, &buf, GST_MP3_TYPEFIND_MIN_DATA); - if (!buf) { - goto done; - } - - data = GST_BUFFER_DATA (buf); - size = GST_BUFFER_SIZE (buf); - - while (size >= 4) { - head = GUINT32_FROM_BE(*((guint32 *)data)); - if ((head & 0xffe00000) == 0xffe00000) { - guint length; - guint prev_layer = 0, prev_bitrate = 0, - prev_channels = 0, prev_samplerate = 0; - guint found = 0; /* number of valid headers found */ - guint pos = 0; - - do { - if (!(length = mp3_type_frame_length_from_header (head, &layer, - &channels, &bitrate, - &samplerate))) { - break; - } - if ((prev_layer && prev_layer != layer) || !layer || - (prev_bitrate && prev_bitrate != bitrate) || !bitrate || - (prev_samplerate && prev_samplerate != samplerate) || !samplerate || - (prev_channels && prev_channels != channels) || !channels) { - /* this means an invalid property, or a change, which likely - * indicates that this is not a mp3 but just a random bytestream */ - break; - } - prev_layer = layer; - prev_bitrate = bitrate; - prev_channels = channels; - prev_samplerate = samplerate; - pos += length; - if (++found >= GST_MP3_TYPEFIND_MIN_HEADERS) { - /* we're pretty sure that this is mp3 now */ - new = mp3_caps_create (layer, channels, bitrate, samplerate); - goto done; - } - - /* and now, find a new head */ - head = GUINT32_FROM_BE(*((guint32 *) &(data[pos]))); - if ((head & 0xffe00000) != 0xffe00000) - break; - } while (TRUE); - } - data++; - size--; - } - -done: - if (buf != NULL) { - gst_buffer_unref (buf); - } - - return new; -} - static void gst_mp3parse_class_init (GstMPEGAudioParseClass *klass) { @@ -658,7 +577,6 @@ static gboolean plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; - GstTypeFactory *type; /* create an elementfactory for the mp3parse element */ factory = gst_element_factory_new ("mp3parse", @@ -674,10 +592,6 @@ plugin_init (GModule *module, GstPlugin *plugin) gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - /* type finding */ - type = gst_type_factory_new (&mp3type_definition); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type)); - return TRUE; } diff --git a/gst/qtdemux/qtdemux.c b/gst/qtdemux/qtdemux.c index dfd4b2c5..06352f1d 100644 --- a/gst/qtdemux/qtdemux.c +++ b/gst/qtdemux/qtdemux.c @@ -104,15 +104,6 @@ gst_qtdemux_details = "(C) 2003", }; -static GstCaps* quicktime_type_find (GstByteStream *bs, gpointer private); - -static GstTypeDefinition quicktimedefinition = { - "qtdemux_video/quicktime", - "video/quicktime", - ".mov", - quicktime_type_find, -}; - enum { LAST_SIGNAL }; @@ -186,37 +177,10 @@ gst_qtdemux_init (GstQTDemux *qtdemux) gst_element_add_pad (GST_ELEMENT (qtdemux), qtdemux->sinkpad); } -static GstCaps* -quicktime_type_find (GstByteStream *bs, gpointer private) -{ - 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 (buf != NULL) { - gst_buffer_unref (buf); - } - - return new; -} - static gboolean plugin_init (GModule *module, GstPlugin *plugin) { GstElementFactory *factory; - GstTypeFactory *type; GstCaps *audiocaps = NULL, *videocaps = NULL, *temp; const guint32 audio_fcc[] = { /* FILLME */ @@ -227,6 +191,9 @@ 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); @@ -254,9 +221,6 @@ plugin_init (GModule *module, GstPlugin *plugin) gst_element_factory_add_pad_template (factory, videosrctempl); gst_element_factory_add_pad_template (factory, audiosrctempl); - type = gst_type_factory_new (&quicktimedefinition); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (type)); - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); return TRUE; diff --git a/gst/qtdemux/qtdemux.h b/gst/qtdemux/qtdemux.h index 46684be8..c005a96e 100644 --- a/gst/qtdemux/qtdemux.h +++ b/gst/qtdemux/qtdemux.h @@ -22,7 +22,7 @@ #define __GST_QTDEMUX_H__ #include -#include +#include #ifdef __cplusplus extern "C" { diff --git a/gst/rtjpeg/gstrtjpeg.c b/gst/rtjpeg/gstrtjpeg.c index c8842882..4284b8dd 100644 --- a/gst/rtjpeg/gstrtjpeg.c +++ b/gst/rtjpeg/gstrtjpeg.c @@ -25,13 +25,6 @@ extern GstElementDetails gst_rtjpegenc_details; extern GstElementDetails gst_rtjpegdec_details; -GstTypeDefinition rtjpegdefinition = { - "rtjpeg_video/rtjpeg", - "video/x-rtjpeg", - ".rtj", - NULL, -}; - static gboolean plugin_init (GModule *module, GstPlugin *plugin) { -- cgit v1.2.1