From 92ba809c91decda93d00fbfd39a28d51b1efda94 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 31 Oct 2003 20:03:29 +0000 Subject: [PATCH] first bunch of conversions to new plugin_init. Includes libs/gst, gst/id3, sys/oss, ext/gnomevfs, gst/typefind and ex... Original commit message from CVS: first bunch of conversions to new plugin_init. Includes libs/gst, gst/id3, sys/oss, ext/gnomevfs, gst/typefind and ext/mad. You guessed it, everything Rhythmbox needs ;) fixed BMP typefind and made gnomevfs one plugin instead of two while doing this --- configure.ac | 30 +++++++ ext/gnomevfs/Makefile.am | 16 ++-- ext/gnomevfs/gstgnomevfs.c | 54 +++++++++++ ext/gnomevfs/gstgnomevfs.h | 35 ++++++++ ext/gnomevfs/gstgnomevfssink.c | 49 ++++------ ext/gnomevfs/gstgnomevfssrc.c | 56 ++++-------- gst-libs/gst/audio/audio.c | 19 ++-- gst-libs/gst/gconf/gconf.c | 14 --- gst-libs/gst/idct/idct.c | 20 +++-- gst-libs/gst/media-info/media-info-priv.c | 5 +- gst-libs/gst/resample/resample.c | 15 ++-- gst-libs/gst/riff/riff.c | 18 ++-- gst-libs/gst/video/video.c | 19 ++-- gst-libs/gst/xwindowlistener/xwindowlistener.c | 17 ++-- gst/typefind/gsttypefindfunctions.c | 118 ++++++++++++++----------- gst/volume/gstvolume.c | 48 +++++----- 16 files changed, 326 insertions(+), 207 deletions(-) create mode 100644 ext/gnomevfs/gstgnomevfs.c create mode 100644 ext/gnomevfs/gstgnomevfs.h diff --git a/configure.ac b/configure.ac index 9c653b3..be345ac 100644 --- a/configure.ac +++ b/configure.ac @@ -1149,6 +1149,36 @@ if test "x$HAVE_FFMPEG" = xyes; then AC_CONFIG_SUBDIRS(gst-libs/ext/ffmpeg/ffmpeg) fi +dnl ############################ +dnl # Set up some more defines # +dnl ############################ + +dnl set license and copyright notice +AC_DEFINE(GST_LICENSE, "LGPL", [GStreamer license]) +AC_DEFINE(GST_COPYRIGHT, "(c) 1999-2003 The GStreamer Team", [copyright message in plugins]) +dnl package name in plugins +AC_ARG_WITH(package-name, +AC_HELP_STRING([--with-package-name],[specify package name to use in plugins]), +[case "${withval}" in + yes) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;; + no) AC_MSG_ERROR(bad value ${withval} for --with-package-name) ;; + *) GST_PACKAGE="${withval}" ;; +esac], +[GST_PACKAGE="Gstreamer"]) dnl Default value +AC_MSG_NOTICE(Using $GST_PACKAGE as package name) +AC_DEFINE_UNQUOTED(GST_PACKAGE, "$GST_PACKAGE", [package name in plugins]) +dnl package origin URL +AC_ARG_WITH(package-origin, +AC_HELP_STRING([--with-package-origin],[specify package origin URL to use in plugins]), +[case "${withval}" in + yes) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;; + no) AC_MSG_ERROR(bad value ${withval} for --with-package-origin) ;; + *) GST_ORIGIN="${withval}" ;; +esac], +[GST_ORIGIN="http://gstreamer.net"]) dnl Default value +AC_MSG_NOTICE(Using $GST_ORIGIN as package origin) +AC_DEFINE_UNQUOTED(GST_ORIGIN, "$GST_ORIGIN", [package origin]) + dnl ######################### dnl # Make the output files # dnl ######################### diff --git a/ext/gnomevfs/Makefile.am b/ext/gnomevfs/Makefile.am index 263f70e..6d4bf7d 100644 --- a/ext/gnomevfs/Makefile.am +++ b/ext/gnomevfs/Makefile.am @@ -1,12 +1,10 @@ -plugin_LTLIBRARIES = libgstgnomevfssrc.la libgstgnomevfssink.la +plugin_LTLIBRARIES = libgstgnomevfs.la -libgstgnomevfssrc_la_SOURCES = gstgnomevfssrc.c -libgstgnomevfssrc_la_CFLAGS = $(GST_CFLAGS) $(GNOME_VFS_CFLAGS) -libgstgnomevfssrc_la_LIBADD = $(GNOME_VFS_LIBS) -libgstgnomevfssrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgstgnomevfs_la_SOURCES = gstgnomevfs.c gstgnomevfssrc.c gstgnomevfssink.c +libgstgnomevfs_la_CFLAGS = $(GST_CFLAGS) $(GNOME_VFS_CFLAGS) +libgstgnomevfs_la_LIBADD = $(GNOME_VFS_LIBS) +libgstgnomevfs_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) + +noinst_HEADERS = gstgnomevfs.h -libgstgnomevfssink_la_SOURCES = gstgnomevfssink.c -libgstgnomevfssink_la_CFLAGS = $(GST_CFLAGS) $(GNOME_VFS_CFLAGS) -libgstgnomevfssink_la_LIBADD = $(GNOME_VFS_LIBS) -libgstgnomevfssink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) diff --git a/ext/gnomevfs/gstgnomevfs.c b/ext/gnomevfs/gstgnomevfs.c new file mode 100644 index 0000000..0351e70 --- /dev/null +++ b/ext/gnomevfs/gstgnomevfs.c @@ -0,0 +1,54 @@ +/* GStreamer + * Copyright (C) 2003 Benjamin Otte + * + * gnomevfs.c: register gnomevfs elements + * + * 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. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "gstgnomevfs.h" +#include + +static gboolean +plugin_init(GstPlugin *plugin) +{ + if (!gst_element_register (plugin, "gnomevfssrc", + GST_RANK_SECONDARY, gst_gnomevfssrc_get_type()) || + !gst_element_register (plugin, "gnomevfssink", + GST_RANK_SECONDARY, gst_gnomevfssink_get_type())) { + return FALSE; + } + + return TRUE; +} + +GST_PLUGIN_DEFINE ( + GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "gnomevfs", + "elements to access the Gnome vfs", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +) + diff --git a/ext/gnomevfs/gstgnomevfs.h b/ext/gnomevfs/gstgnomevfs.h new file mode 100644 index 0000000..350a911 --- /dev/null +++ b/ext/gnomevfs/gstgnomevfs.h @@ -0,0 +1,35 @@ +/* GStreamer + * Copyright (C) 2003 Benjamin Otte + * + * 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 __GST_GNOME_VFS_H__ +#define __GST_GNOME_VFS_H__ + +#include + +G_BEGIN_DECLS + + +GType gst_gnomevfssink_get_type (void); +GType gst_gnomevfssrc_get_type (void); + + +G_END_DECLS + +#endif /* __GST_GNOME_VFS_H__ */ diff --git a/ext/gnomevfs/gstgnomevfssink.c b/ext/gnomevfs/gstgnomevfssink.c index 936a969..8335793 100644 --- a/ext/gnomevfs/gstgnomevfssink.c +++ b/ext/gnomevfs/gstgnomevfssink.c @@ -25,13 +25,14 @@ #ifdef HAVE_CONFIG_H #include "config.h" #endif + +#include "gstgnomevfs.h" + #include #include #include #include -GstElementDetails gst_gnomevfssink_details; - #define GST_TYPE_GNOMEVFSSINK \ (gst_gnomevfssink_get_type()) @@ -74,18 +75,13 @@ struct _GstGnomeVFSSinkClass { void (*erase_ask) (GstElement *element,GstPad *pad); }; -GType gst_gnomevfssink_get_type(void); - /* elementfactory information */ -GstElementDetails gst_gnomevfssink_details = { +static GstElementDetails gst_gnomevfssink_details = GST_ELEMENT_DETAILS ( "GnomeVFS Sink", "Sink/File", - "LGPL", "Write stream to a GnomeVFS URI", - VERSION, - "Bastien Nocera ", - "(C) 2001" -}; + "Bastien Nocera " +); /* GnomeVFSSink signals and args */ @@ -103,6 +99,7 @@ enum { }; +static void gst_gnomevfssink_base_init (gpointer g_class); static void gst_gnomevfssink_class_init (GstGnomeVFSSinkClass *klass); static void gst_gnomevfssink_init (GstGnomeVFSSink *gnomevfssink); @@ -126,7 +123,8 @@ gst_gnomevfssink_get_type (void) if (!gnomevfssink_type) { static const GTypeInfo gnomevfssink_info = { - sizeof(GstGnomeVFSSinkClass), NULL, + sizeof(GstGnomeVFSSinkClass), + gst_gnomevfssink_base_init, NULL, (GClassInitFunc)gst_gnomevfssink_class_init, NULL, @@ -141,6 +139,14 @@ gst_gnomevfssink_get_type (void) } static void +gst_gnomevfssink_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details (element_class, &gst_gnomevfssink_details); +} + +static void gst_gnomevfssink_class_init (GstGnomeVFSSinkClass *klass) { GObjectClass *gobject_class; @@ -356,24 +362,3 @@ gst_gnomevfssink_change_state (GstElement *element) return GST_STATE_SUCCESS; } -static gboolean -plugin_init (GModule *module, GstPlugin *plugin) -{ - GstElementFactory *factory; - - /* create an elementfactory for the aasink element */ - factory = gst_element_factory_new("gnomevfssink", GST_TYPE_GNOMEVFSSINK, - &gst_gnomevfssink_details); - g_return_val_if_fail(factory != NULL, FALSE); - - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - - return TRUE; -} - -GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gnomevfssink", - plugin_init -}; diff --git a/ext/gnomevfs/gstgnomevfssrc.c b/ext/gnomevfs/gstgnomevfssrc.c index 699159a..a18f030 100644 --- a/ext/gnomevfs/gstgnomevfssrc.c +++ b/ext/gnomevfs/gstgnomevfssrc.c @@ -30,6 +30,8 @@ #include "config.h" #endif +#include "gstgnomevfs.h" + #include #include #include @@ -48,7 +50,6 @@ /* gnome-vfs.h doesn't include the following header, which we need: */ #include -GstElementDetails gst_gnomevfssrc_details; #define GST_TYPE_GNOMEVFSSRC \ (gst_gnomevfssrc_get_type()) @@ -123,16 +124,12 @@ struct _GstGnomeVFSSrcClass { GstElementClass parent_class; }; -/* elementfactory information */ -GstElementDetails gst_gnomevfssrc_details = { +static GstElementDetails gst_gnomevfssrc_details = GST_ELEMENT_DETAILS ( "GnomeVFS Source", "Source/File", - "LGPL", "Read from any GnomeVFS file", - VERSION, - "Bastien Nocera ", - "(C) 2001", -}; + "Bastien Nocera " +); GST_PAD_FORMATS_FUNCTION (gst_gnomevfssrc_get_formats, GST_FORMAT_BYTES @@ -169,8 +166,7 @@ enum { ARG_SEEKABLE, }; -GType gst_gnomevfssrc_get_type(void); - +static void gst_gnomevfssrc_base_init (gpointer g_class); static void gst_gnomevfssrc_class_init (GstGnomeVFSSrcClass *klass); static void gst_gnomevfssrc_init (GstGnomeVFSSrc *gnomevfssrc); static void gst_gnomevfssrc_dispose (GObject *object); @@ -205,7 +201,8 @@ GType gst_gnomevfssrc_get_type(void) if (!gnomevfssrc_type) { static const GTypeInfo gnomevfssrc_info = { - sizeof(GstGnomeVFSSrcClass), NULL, + sizeof(GstGnomeVFSSrcClass), + gst_gnomevfssrc_base_init, NULL, (GClassInitFunc) gst_gnomevfssrc_class_init, NULL, @@ -223,6 +220,14 @@ GType gst_gnomevfssrc_get_type(void) return gnomevfssrc_type; } +static void +gst_gnomevfssrc_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_set_details (element_class, &gst_gnomevfssrc_details); +} + static void gst_gnomevfssrc_class_init(GstGnomeVFSSrcClass *klass) { GObjectClass *gobject_class; @@ -1150,22 +1155,6 @@ static GstElementStateReturn gst_gnomevfssrc_change_state(GstElement *element) return GST_STATE_SUCCESS; } -static gboolean plugin_init(GModule *module, GstPlugin *plugin) -{ - GstElementFactory *factory; - - /* create an elementfactory for the aasink element */ - factory = - gst_element_factory_new("gnomevfssrc", GST_TYPE_GNOMEVFSSRC, - &gst_gnomevfssrc_details); - g_return_val_if_fail(factory != NULL, FALSE); - - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - - return TRUE; -} - - static gboolean gst_gnomevfssrc_srcpad_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64 *value) @@ -1258,16 +1247,3 @@ gst_gnomevfssrc_srcpad_event (GstPad *pad, GstEvent *event) return TRUE; } - -GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gnomevfssrc", - plugin_init -}; - -/* - Local Variables: - c-file-style: "linux" - End: -*/ diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c index 3190edc..3a723b8 100644 --- a/gst-libs/gst/audio/audio.c +++ b/gst-libs/gst/audio/audio.c @@ -17,6 +17,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "audio.h" int @@ -175,15 +179,20 @@ gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf) } static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - gst_plugin_set_longname (plugin, "Support services for audio plugins"); return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "gstaudio", - plugin_init -}; + "Support services for audio plugins", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +); diff --git a/gst-libs/gst/gconf/gconf.c b/gst-libs/gst/gconf/gconf.c index 2452aa7..8a1c582 100644 --- a/gst-libs/gst/gconf/gconf.c +++ b/gst-libs/gst/gconf/gconf.c @@ -315,17 +315,3 @@ gst_gconf_get_default_visualization_element (void) return ret; } -static gboolean -plugin_init (GModule *module, GstPlugin *plugin) -{ - gst_plugin_set_longname (plugin, - "Convenience routines for GConf interaction"); - return TRUE; -} - -GstPluginDesc plugin_desc = { - GST_VERSION_MAJOR, - GST_VERSION_MINOR, - "gstgconf", - plugin_init -}; diff --git a/gst-libs/gst/idct/idct.c b/gst-libs/gst/idct/idct.c index f5955c1..4e62a47 100644 --- a/gst-libs/gst/idct/idct.c +++ b/gst-libs/gst/idct/idct.c @@ -17,8 +17,9 @@ * Boston, MA 02111-1307, USA. */ - -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include #include @@ -127,15 +128,20 @@ void gst_idct_destroy(GstIDCT *idct) } static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - gst_plugin_set_longname (plugin, "Accelerated IDCT routines"); return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "gstidct", - plugin_init -}; + "Accelerated IDCT routines", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +) diff --git a/gst-libs/gst/media-info/media-info-priv.c b/gst-libs/gst/media-info/media-info-priv.c index eae5853..b923713 100644 --- a/gst-libs/gst/media-info/media-info-priv.c +++ b/gst-libs/gst/media-info/media-info-priv.c @@ -182,9 +182,8 @@ gmi_seek_to_track (GstMediaInfo *info, long track) res = gst_pad_send_event (info->priv->decoder_pad, event); if (!res) { - g_warning ("seek to logical track on pad %s:%s failed of element %s", - GST_DEBUG_PAD_NAME(info->priv->decoder_pad), - gst_element_get_factory((gst_pad_get_parent(info->priv->decoder_pad)))->details->longname); + g_warning ("seek to logical track on pad %s:%s failed", + GST_DEBUG_PAD_NAME(info->priv->decoder_pad)); return FALSE; } /* clear structs because of the seek */ diff --git a/gst-libs/gst/resample/resample.c b/gst-libs/gst/resample/resample.c index 7ced0f5..b298e86 100644 --- a/gst-libs/gst/resample/resample.c +++ b/gst-libs/gst/resample/resample.c @@ -870,16 +870,21 @@ void resample_sinc_ft_float(resample_t * r) } static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - gst_plugin_set_longname (plugin, "Resampling routines for use in audio plugins"); return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "gstresample", - plugin_init -}; + "Resampling routines for use in audio plugins", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +); diff --git a/gst-libs/gst/riff/riff.c b/gst-libs/gst/riff/riff.c index 2e77c01..bb29150 100644 --- a/gst-libs/gst/riff/riff.c +++ b/gst-libs/gst/riff/riff.c @@ -17,19 +17,27 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - gst_plugin_set_longname (plugin, "RIFF convenience routines"); return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "gstriff", - plugin_init -}; + "RIFF convenience routines", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +) diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index 11e26c9..0d4a2ea 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -18,6 +18,10 @@ * Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include "video.h" /* This is simply a convenience function, nothing more or less */ @@ -97,15 +101,20 @@ gst_video_get_size (GstPad *pad, } static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - gst_plugin_set_longname (plugin, "Convenience routines for video plugins"); return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "gstvideo", - plugin_init -}; + "Convenience routines for video plugins", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +) diff --git a/gst-libs/gst/xwindowlistener/xwindowlistener.c b/gst-libs/gst/xwindowlistener/xwindowlistener.c index 513e029..dda220c 100644 --- a/gst-libs/gst/xwindowlistener/xwindowlistener.c +++ b/gst-libs/gst/xwindowlistener/xwindowlistener.c @@ -637,17 +637,20 @@ gst_xwin_stop (GstXWindowListener *xwin) */ static gboolean -plugin_init (GModule *module, - GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - gst_plugin_set_longname (plugin, - "X11-based XWindow event/motion listener"); return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "xwindowlistener", - plugin_init -}; + "X11-based XWindow event/motion listener", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +) diff --git a/gst/typefind/gsttypefindfunctions.c b/gst/typefind/gsttypefindfunctions.c index 4236ec8..b21beea 100644 --- a/gst/typefind/gsttypefindfunctions.c +++ b/gst/typefind/gsttypefindfunctions.c @@ -559,7 +559,7 @@ mpeg1_parse_header (GstTypeFind *tf, guint64 offset) * 1-(1-1/2^(65*GST_MPEG_TYPEFIND_TRY_HEADERS))^GST_MPEG_TYPEFIND_TRY_SYNC * for current values: * 1-(1-1/2^(65*2)^50000 - * and that value is way smaller than 0,1% + * = 3.6734..*10^-35 */ #define GST_MPEG_TYPEFIND_TRY_HEADERS 2 #define GST_MPEG_TYPEFIND_TRY_SYNC (GST_TYPE_FIND_MAXIMUM * 500) /* 50kB */ @@ -937,12 +937,15 @@ jng_type_find (GstTypeFind *tf, gpointer unused) static void bmp_type_find (GstTypeFind *tf, gpointer unused) { - guint8 *data = gst_type_find_peek (tf, 0, 14); + guint8 *data = gst_type_find_peek (tf, 0, 18); if (data && memcmp (data, "BM", 2) == 0) { - if (data[14] == GUINT16_TO_LE (12) || - data[14] == GUINT16_TO_LE (64) || - data[14] == GUINT16_TO_LE (40)) { + if ((data[14] == 0x0C || + data[14] == 0x28 || + data[14] == 0xF0) && + data[15] == 0 && + data[16] == 0 && + data[17] == 0) { gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, BMP_CAPS); } } @@ -951,7 +954,8 @@ bmp_type_find (GstTypeFind *tf, gpointer unused) /*** image/tiff ********************/ #define TIFF_CAPS(endian) (endian == 0 ? \ GST_CAPS_NEW ("tiff_type_find", "image/tiff", \ - "endianness", GST_PROPS_INT_RANGE (G_LITTLE_ENDIAN, G_BIG_ENDIAN)) : \ + "endianness", GST_PROPS_LIST (GST_PROPS_INT ( \ + G_LITTLE_ENDIAN), GST_PROPS_INT (G_BIG_ENDIAN))) : \ GST_CAPS_NEW ("tiff_type_find", "image/tiff", \ "endianness", GST_PROPS_INT (endian))) static void @@ -1066,8 +1070,12 @@ sid_type_find (GstTypeFind *tf, gpointer private) /*** plugin initialization ****************************************************/ +#define TYPE_FIND_REGISTER(plugin,name,rank,func,ext,caps,priv) G_BEGIN_DECLS{\ + if (!gst_type_find_register (plugin, name, rank, func, ext, caps, priv))\ + return FALSE; \ +}G_END_DECLS static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { /* can't initialize this via a struct as caps can't be statically initialized */ @@ -1109,79 +1117,85 @@ plugin_init (GModule *module, GstPlugin *plugin) GST_DEBUG_CATEGORY_INIT (type_find_debug, "typefindfunctions", GST_DEBUG_FG_GREEN | GST_DEBUG_BG_RED, "generic type find functions"); - gst_type_find_factory_register (plugin, "video/x-ms-asf", GST_ELEMENT_RANK_SECONDARY, + TYPE_FIND_REGISTER (plugin, "video/x-ms-asf", GST_RANK_SECONDARY, asf_type_find, asf_exts, ASF_CAPS, NULL); - gst_type_find_factory_register (plugin, "audio/x-au", GST_ELEMENT_RANK_MARGINAL, + TYPE_FIND_REGISTER (plugin, "audio/x-au", GST_RANK_MARGINAL, au_type_find, au_exts, AU_CAPS, NULL); - gst_type_find_factory_register (plugin, "video/avi", GST_ELEMENT_RANK_PRIMARY, + TYPE_FIND_REGISTER (plugin, "video/avi", GST_RANK_PRIMARY, avi_type_find, avi_exts, AVI_CAPS, NULL); - gst_type_find_factory_register (plugin, "video/x-cdxa", GST_ELEMENT_RANK_SECONDARY, + TYPE_FIND_REGISTER (plugin, "video/x-cdxa", GST_RANK_SECONDARY, cdxa_type_find, cdxa_exts, CDXA_CAPS, NULL); - gst_type_find_factory_register (plugin, "audio/x-flac", GST_ELEMENT_RANK_PRIMARY, + TYPE_FIND_REGISTER (plugin, "audio/x-flac", GST_RANK_PRIMARY, flac_type_find, flac_exts, FLAC_CAPS, NULL); - gst_type_find_factory_register (plugin, "video/x-fli", GST_ELEMENT_RANK_MARGINAL, + TYPE_FIND_REGISTER (plugin, "video/x-fli", GST_RANK_MARGINAL, flx_type_find, flx_exts, FLX_CAPS, NULL); - gst_type_find_factory_register (plugin, "application/x-id3", GST_ELEMENT_RANK_PRIMARY, + TYPE_FIND_REGISTER (plugin, "application/x-id3", GST_RANK_PRIMARY, id3_type_find, id3_exts, ID3_CAPS, NULL); - gst_type_find_factory_register (plugin, "audio/x-mod", GST_ELEMENT_RANK_SECONDARY, + TYPE_FIND_REGISTER (plugin, "audio/x-mod", GST_RANK_SECONDARY, mod_type_find, mod_exts, MOD_CAPS, NULL); - gst_type_find_factory_register (plugin, "audio/mpeg", GST_ELEMENT_RANK_PRIMARY, + TYPE_FIND_REGISTER (plugin, "audio/mpeg", GST_RANK_PRIMARY, mp3_type_find, mp3_exts, MP3_CAPS (0), NULL); - gst_type_find_factory_register (plugin, "video/mpeg1", GST_ELEMENT_RANK_PRIMARY, + TYPE_FIND_REGISTER (plugin, "video/mpeg1", GST_RANK_PRIMARY, mpeg1_sys_type_find, mpeg_sys_exts, MPEG_SYS_CAPS (1), NULL); - gst_type_find_factory_register (plugin, "video/mpeg2", GST_ELEMENT_RANK_SECONDARY, + TYPE_FIND_REGISTER (plugin, "video/mpeg2", GST_RANK_SECONDARY, mpeg2_sys_type_find, mpeg_sys_exts, MPEG_SYS_CAPS (2), NULL); - gst_type_find_factory_register (plugin, "application/ogg", GST_ELEMENT_RANK_PRIMARY, + TYPE_FIND_REGISTER (plugin, "application/ogg", GST_RANK_PRIMARY, ogg_type_find, ogg_exts, OGG_CAPS, NULL); - gst_type_find_factory_register (plugin, "video/quicktime", GST_ELEMENT_RANK_SECONDARY, + TYPE_FIND_REGISTER (plugin, "video/quicktime", GST_RANK_SECONDARY, qt_type_find, qt_exts, QT_CAPS, NULL); - gst_type_find_factory_register (plugin, "application/vnd.rn-realmedia", GST_ELEMENT_RANK_SECONDARY, + TYPE_FIND_REGISTER (plugin, "application/vnd.rn-realmedia", GST_RANK_SECONDARY, rm_type_find, rm_exts, RM_CAPS, NULL); - gst_type_find_factory_register (plugin, "application/x-shockwave-flash", GST_ELEMENT_RANK_SECONDARY, + TYPE_FIND_REGISTER (plugin, "application/x-shockwave-flash", GST_RANK_SECONDARY, swf_type_find, swf_exts, SWF_CAPS, NULL); - gst_type_find_factory_register (plugin, "text/plain", GST_ELEMENT_RANK_MARGINAL, + TYPE_FIND_REGISTER (plugin, "text/plain", GST_RANK_MARGINAL, utf8_type_find, utf8_exts, UTF8_CAPS, NULL); - gst_type_find_factory_register (plugin, "text/uri-list", GST_ELEMENT_RANK_MARGINAL, + TYPE_FIND_REGISTER (plugin, "text/uri-list", GST_RANK_MARGINAL, uri_type_find, uri_exts, URI_CAPS, NULL); - gst_type_find_factory_register (plugin, "audio/x-wav", GST_ELEMENT_RANK_PRIMARY, + TYPE_FIND_REGISTER (plugin, "audio/x-wav", GST_RANK_PRIMARY, wav_type_find, wav_exts, WAV_CAPS, NULL); - gst_type_find_factory_register (plugin, "audio/x-aiff", GST_ELEMENT_RANK_PRIMARY, + TYPE_FIND_REGISTER (plugin, "audio/x-aiff", GST_RANK_SECONDARY, aiff_type_find, aiff_exts, AIFF_CAPS, NULL); - gst_type_find_factory_register (plugin, "audio/x-shorten", GST_ELEMENT_RANK_PRIMARY, + TYPE_FIND_REGISTER (plugin, "audio/x-shorten", GST_RANK_SECONDARY, shn_type_find, shn_exts, SHN_CAPS, NULL); - gst_type_find_factory_register (plugin, "image/jpeg", GST_ELEMENT_RANK_PRIMARY, + TYPE_FIND_REGISTER (plugin, "image/jpeg", GST_RANK_PRIMARY, jpeg_type_find, jpeg_exts, JPEG_CAPS, NULL); - gst_type_find_factory_register (plugin, "image/gif", GST_ELEMENT_RANK_PRIMARY, - gif_type_find, gif_exts, GIF_CAPS, NULL); - gst_type_find_factory_register (plugin, "image/png", GST_ELEMENT_RANK_PRIMARY, - png_type_find, png_exts, PNG_CAPS, NULL); - gst_type_find_factory_register (plugin, "image/bmp", GST_ELEMENT_RANK_PRIMARY, - bmp_type_find, bmp_exts, BMP_CAPS, NULL); - gst_type_find_factory_register (plugin, "image/tiff", GST_ELEMENT_RANK_PRIMARY, - tiff_type_find, tiff_exts, TIFF_CAPS(0), NULL); - gst_type_find_factory_register (plugin, "video/x-matroska", GST_ELEMENT_RANK_SECONDARY, + TYPE_FIND_REGISTER (plugin, "image/gif", GST_RANK_PRIMARY, + gif_type_find, gif_exts, GIF_CAPS, NULL); + TYPE_FIND_REGISTER (plugin, "image/png", GST_RANK_PRIMARY, + png_type_find, png_exts, PNG_CAPS, NULL); + TYPE_FIND_REGISTER (plugin, "image/bmp", GST_RANK_PRIMARY, + bmp_type_find, bmp_exts, BMP_CAPS, NULL); + TYPE_FIND_REGISTER (plugin, "image/tiff", GST_RANK_PRIMARY, + tiff_type_find, tiff_exts, TIFF_CAPS(0), NULL); + TYPE_FIND_REGISTER (plugin, "video/x-matroska", GST_RANK_SECONDARY, matroska_type_find, matroska_exts, MATROSKA_CAPS, NULL); - gst_type_find_factory_register (plugin, "video/x-dv", GST_ELEMENT_RANK_SECONDARY, + TYPE_FIND_REGISTER (plugin, "video/x-dv", GST_RANK_SECONDARY, dv_type_find, dv_exts, DV_CAPS, NULL); - gst_type_find_factory_register (plugin, "video/x-sid", GST_ELEMENT_RANK_MARGINAL, + TYPE_FIND_REGISTER (plugin, "video/x-sid", GST_RANK_MARGINAL, sid_type_find, sid_exts, SID_CAPS, NULL); - gst_type_find_factory_register (plugin, "image/x-xcf", GST_ELEMENT_RANK_SECONDARY, - xcf_type_find, xcf_exts, XCF_CAPS, NULL); - gst_type_find_factory_register (plugin, "video/x-mng", GST_ELEMENT_RANK_SECONDARY, - mng_type_find, mng_exts, MNG_CAPS, NULL); - gst_type_find_factory_register (plugin, "image/x-jng", GST_ELEMENT_RANK_SECONDARY, - jng_type_find, jng_exts, JNG_CAPS, NULL); - gst_type_find_factory_register (plugin, "image/x-xpixmap", GST_ELEMENT_RANK_SECONDARY, - xpm_type_find, xpm_exts, XPM_CAPS, NULL); - gst_type_find_factory_register (plugin, "image/x-sun-raster", GST_ELEMENT_RANK_SECONDARY, - ras_type_find, ras_exts, RAS_CAPS, NULL); + TYPE_FIND_REGISTER (plugin, "image/x-xcf", GST_RANK_SECONDARY, + xcf_type_find, xcf_exts, XCF_CAPS, NULL); + TYPE_FIND_REGISTER (plugin, "video/x-mng", GST_RANK_SECONDARY, + mng_type_find, mng_exts, MNG_CAPS, NULL); + TYPE_FIND_REGISTER (plugin, "image/x-jng", GST_RANK_SECONDARY, + jng_type_find, jng_exts, JNG_CAPS, NULL); + TYPE_FIND_REGISTER (plugin, "image/x-xpixmap", GST_RANK_SECONDARY, + xpm_type_find, xpm_exts, XPM_CAPS, NULL); + TYPE_FIND_REGISTER (plugin, "image/x-sun-raster", GST_RANK_SECONDARY, + ras_type_find, ras_exts, RAS_CAPS, NULL); return TRUE; } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "typefindfunctions", - plugin_init -}; + "default typefind functions", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +) diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index 3e8a276..c3fd9fc 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -32,11 +32,8 @@ static GstElementDetails volume_details = { "Volume", "Filter/Audio/Effect", - "LGPL", "Set volume on audio/raw streams", - VERSION, "Andy Wingo ", - "(C) 2001" }; @@ -95,7 +92,8 @@ GST_PAD_TEMPLATE_FACTORY (volume_src_factory, ) ); -static void volume_class_init (GstVolumeClass *klass); +static void volume_base_init (gpointer g_class); +static void volume_class_init (GstVolumeClass *klass); static void volume_init (GstVolume *filter); static void volume_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); @@ -178,7 +176,8 @@ gst_volume_get_type(void) { if (!volume_type) { static const GTypeInfo volume_info = { - sizeof(GstVolumeClass), NULL, + sizeof(GstVolumeClass), + volume_base_init, NULL, (GClassInitFunc)volume_class_init, NULL, @@ -191,7 +190,15 @@ gst_volume_get_type(void) { } return volume_type; } - +static void +volume_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_add_pad_template (element_class, volume_src_factory ()); + gst_element_class_add_pad_template (element_class, volume_sink_factory ()); + gst_element_class_set_details (element_class, &volume_details); +} static void volume_class_init (GstVolumeClass *klass) { @@ -415,27 +422,22 @@ volume_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec * } static gboolean -plugin_init (GModule *module, GstPlugin *plugin) +plugin_init (GstPlugin *plugin) { - GstElementFactory *factory; - - factory = gst_element_factory_new("volume",GST_TYPE_VOLUME, - &volume_details); - g_return_val_if_fail(factory != NULL, FALSE); - - gst_element_factory_add_pad_template (factory, volume_src_factory ()); - gst_element_factory_add_pad_template (factory, volume_sink_factory ()); - - gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory)); - - /* initialize dparam support library */ gst_control_init(NULL,NULL); - return TRUE; + + return gst_element_register (plugin, "volume", GST_RANK_PRIMARY, GST_TYPE_VOLUME); } -GstPluginDesc plugin_desc = { +GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, "volume", - plugin_init -}; + "element for controlling audio volume", + plugin_init, + VERSION, + GST_LICENSE, + GST_COPYRIGHT, + GST_PACKAGE, + GST_ORIGIN +) -- 2.7.4