Commit 92ba809c authored by Benjamin Otte's avatar Benjamin Otte

first bunch of conversions to new plugin_init. Includes libs/gst, gst/id3,...

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
parent e2061833
......@@ -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 #########################
......
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)
/* GStreamer
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* 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 <gst/gst.h>
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
)
/* GStreamer
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
*
* 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 <glib-object.h>
G_BEGIN_DECLS
GType gst_gnomevfssink_get_type (void);
GType gst_gnomevfssrc_get_type (void);
G_END_DECLS
#endif /* __GST_GNOME_VFS_H__ */
......@@ -25,13 +25,14 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstgnomevfs.h"
#include <gst/gst.h>
#include <libgnomevfs/gnome-vfs.h>
#include <string.h>
#include <errno.h>
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 <hadess@hadess.net>",
"(C) 2001"
};
"Bastien Nocera <hadess@hadess.net>"
);
/* 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,
......@@ -140,6 +138,14 @@ gst_gnomevfssink_get_type (void)
return gnomevfssink_type;
}
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)
{
......@@ -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
};
......@@ -30,6 +30,8 @@
#include "config.h"
#endif
#include "gstgnomevfs.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
......@@ -48,7 +50,6 @@
/* gnome-vfs.h doesn't include the following header, which we need: */
#include <libgnomevfs/gnome-vfs-standard-callbacks.h>
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 <hadess@hadess.net>",
"(C) 2001",
};
"Bastien Nocera <hadess@hadess.net>"
);
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:
*/
......@@ -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
);
......@@ -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
};
......@@ -17,8 +17,9 @@
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gst/gst.h>
#include <gst/idct/idct.h>
......@@ -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
)
......@@ -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 */
......
......@@ -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
);
......@@ -17,19 +17,27 @@
* Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <riff.h>
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
)
......@@ -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
)
......@@ -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
)
......@@ -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);