Commit 4ac17766 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 64eb55d8
......@@ -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 #########################
......
......@@ -26,26 +26,48 @@
#include "gstosssrc.h"
#include "gstossgst.h"
extern gchar *__gst_oss_plugin_dir;
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
plugin_init (GstPlugin *plugin)
{
guint i = 0;
gchar **path;
if (!gst_library_load ("gstaudio"))
return FALSE;
if (!gst_osselement_factory_init (plugin) ||
!gst_osssrc_factory_init (plugin) ||
!gst_osssink_factory_init (plugin) ||
!gst_ossgst_factory_init (plugin)) {
g_warning ("Failed to register OSS elements!");
/* get the path of this plugin, we assume the helper progam lives in the */
/* same directory. */
path = g_strsplit (plugin->filename, G_DIR_SEPARATOR_S, 0);
while (path[i]) {
i++;
if (path[i] == NULL) {
g_free (path[i-1]);
path[i-1] = NULL;
}
}
__gst_oss_plugin_dir = g_strjoinv (G_DIR_SEPARATOR_S, path);
g_strfreev (path);
if (!gst_element_register (plugin, "osssrc", GST_RANK_PRIMARY, GST_TYPE_OSSSRC) ||
!gst_element_register (plugin, "osssink", GST_RANK_PRIMARY, GST_TYPE_OSSSINK) ||
!gst_element_register (plugin, "ossgst", GST_RANK_MARGINAL, GST_TYPE_OSSGST)) {
return FALSE;
}
return TRUE;
}
GstPluginDesc plugin_desc = {
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"ossaudio",
plugin_init
};
"OSS (Open Sound System) support for GStreamer",
plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)
......@@ -43,17 +43,6 @@ enum {
ARG_DEVICE_NAME,
};
/* elementfactory information */
static GstElementDetails gst_osselement_details = {
"Audio Element (OSS)",
"Generic/Audio",
"LGPL",
"Generic OSS element",
VERSION,
"Erik Walthinsen <omega@cse.ogi.edu>",
"(C) 1999",
};
static void gst_osselement_class_init (GstOssElementClass *klass);
static void gst_osselement_init (GstOssElement *oss);
static void gst_osselement_dispose (GObject *object);
......@@ -677,17 +666,3 @@ gst_osselement_change_state (GstElement *element)
return GST_STATE_SUCCESS;
}
gboolean
gst_osselement_factory_init (GstPlugin *plugin)
{
GstElementFactory *factory;
factory = gst_element_factory_new ("ossmixer",
GST_TYPE_OSSELEMENT,
&gst_osselement_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
}
......@@ -91,9 +91,6 @@ struct _GstOssElementClass {
GType gst_osselement_get_type (void);
/* factory register function */
gboolean gst_osselement_factory_init (GstPlugin *plugin);
/* some useful functions */
gboolean gst_osselement_parse_caps (GstOssElement *oss,
GstCaps *caps);
......
......@@ -37,16 +37,14 @@
#include "gstosshelper.h"
static GstElementDetails gst_ossgst_details = {
static GstElementDetails gst_ossgst_details = GST_ELEMENT_DETAILS (
"Audio Wrapper (OSS)",
"Source/Audio",
"LGPL",
"Hijacks /dev/dsp to get the output of OSS apps into GStreamer",
VERSION,
"Wim Taymans <wim.taymans@chello.be>",
"(C) 2001",
};
"Wim Taymans <wim.taymans@chello.be>"
);
static void gst_ossgst_base_init (gpointer g_class);
static void gst_ossgst_class_init (GstOssGstClass *klass);
static void gst_ossgst_init (GstOssGst *ossgst);
......@@ -118,7 +116,7 @@ ossgst_src_factory (void)
static GstElementClass *parent_class = NULL;
static GstPadTemplate *gst_ossgst_src_template;
static gchar *plugin_dir = NULL;
gchar *__gst_oss_plugin_dir = NULL;
GType
gst_ossgst_get_type (void)
......@@ -128,7 +126,7 @@ gst_ossgst_get_type (void)
if (!ossgst_type) {
static const GTypeInfo ossgst_info = {
sizeof(GstOssGstClass),
NULL,
gst_ossgst_base_init,
NULL,
(GClassInitFunc)gst_ossgst_class_init,
NULL,
......@@ -143,6 +141,14 @@ gst_ossgst_get_type (void)
return ossgst_type;
}
static void
gst_ossgst_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &gst_ossgst_details);
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (ossgst_src_factory));
}
static void
gst_ossgst_class_init (GstOssGstClass *klass)
{
......@@ -399,7 +405,7 @@ gst_ossgst_spawn_process (GstOssGst *ossgst)
ld_preload = "";
}
ld_preload = g_strconcat (ld_preload, " ", plugin_dir, G_DIR_SEPARATOR_S,
ld_preload = g_strconcat (ld_preload, " ", __gst_oss_plugin_dir, G_DIR_SEPARATOR_S,
"libgstosshelper.so", NULL);
setenv ("LD_PRELOAD", ld_preload, TRUE);
......@@ -451,34 +457,3 @@ gst_ossgst_change_state (GstElement *element)
return GST_STATE_SUCCESS;
}
gboolean
gst_ossgst_factory_init (GstPlugin *plugin)
{
GstElementFactory *factory;
gchar **path;
gint i =0;
/* get the path of this plugin, we assume the helper progam lives in the */
/* same directory. */
path = g_strsplit (plugin->filename, G_DIR_SEPARATOR_S, 0);
while (path[i]) {
i++;
if (path[i] == NULL) {
g_free (path[i-1]);
path[i-1] = NULL;
}
}
plugin_dir = g_strjoinv (G_DIR_SEPARATOR_S, path);
g_strfreev (path);
factory = gst_element_factory_new ("ossgst", GST_TYPE_OSSGST, &gst_ossgst_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_ossgst_src_template = ossgst_src_factory ();
gst_element_factory_add_pad_template (factory, gst_ossgst_src_template);
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
}
......@@ -77,8 +77,6 @@ struct _GstOssGstClass {
GType gst_ossgst_get_type(void);
gboolean gst_ossgst_factory_init(GstPlugin *plugin);
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
......@@ -31,17 +31,15 @@
#include "gstosssink.h"
/* elementfactory information */
static GstElementDetails gst_osssink_details = {
static GstElementDetails gst_osssink_details = GST_ELEMENT_DETAILS (
"Audio Sink (OSS)",
"Sink/Audio",
"LGPL",
"Output to a sound card via OSS",
VERSION,
"Erik Walthinsen <omega@cse.ogi.edu>, "
"Wim Taymans <wim.taymans@chello.be>",
"(C) 1999",
};
"Wim Taymans <wim.taymans@chello.be>"
);
static void gst_osssink_base_init (gpointer g_class);
static void gst_osssink_class_init (GstOssSinkClass *klass);
static void gst_osssink_init (GstOssSink *osssink);
static void gst_osssink_dispose (GObject *object);
......@@ -121,7 +119,7 @@ gst_osssink_get_type (void)
if (!osssink_type) {
static const GTypeInfo osssink_info = {
sizeof(GstOssSinkClass),
NULL,
gst_osssink_base_init,
NULL,
(GClassInitFunc)gst_osssink_class_init,
NULL,
......@@ -160,6 +158,14 @@ gst_osssink_dispose (GObject *object)
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_osssink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &gst_osssink_details);
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (osssink_sink_factory));
}
static void
gst_osssink_class_init (GstOssSinkClass *klass)
{
......@@ -600,18 +606,3 @@ gst_osssink_change_state (GstElement *element)
return GST_STATE_SUCCESS;
}
gboolean
gst_osssink_factory_init (GstPlugin *plugin)
{
GstElementFactory *factory;
factory = gst_element_factory_new ("osssink", GST_TYPE_OSSSINK, &gst_osssink_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory, GST_PAD_TEMPLATE_GET (osssink_sink_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
}
......@@ -78,8 +78,6 @@ struct _GstOssSinkClass {
GType gst_osssink_get_type(void);
gboolean gst_osssink_factory_init(GstPlugin *plugin);
G_END_DECLS
#endif /* __GST_OSSSINK_H__ */
......@@ -37,15 +37,12 @@
#include <gst/audio/audioclock.h>
/* elementfactory information */
static GstElementDetails gst_osssrc_details = {
static GstElementDetails gst_osssrc_details = GST_ELEMENT_DETAILS (
"Audio Source (OSS)",
"Source/Audio",
"LGPL",
"Read from the sound card",
VERSION,
"Erik Walthinsen <omega@cse.ogi.edu>",
"(C) 1999",
};
"Erik Walthinsen <omega@cse.ogi.edu>"
);
/* OssSrc signals and args */
......@@ -85,6 +82,7 @@ GST_PAD_TEMPLATE_FACTORY (osssrc_src_factory,
)
)
static void gst_osssrc_base_init (gpointer g_class);
static void gst_osssrc_class_init (GstOssSrcClass *klass);
static void gst_osssrc_init (GstOssSrc *osssrc);
static void gst_osssrc_dispose (GObject *object);
......@@ -125,7 +123,7 @@ gst_osssrc_get_type (void)
if (!osssrc_type) {
static const GTypeInfo osssrc_info = {
sizeof(GstOssSrcClass),
NULL,
gst_osssrc_base_init,
NULL,
(GClassInitFunc)gst_osssrc_class_init,
NULL,
......@@ -139,6 +137,14 @@ gst_osssrc_get_type (void)
return osssrc_type;
}
static void
gst_osssrc_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details (element_class, &gst_osssrc_details);
gst_element_class_add_pad_template (element_class, GST_PAD_TEMPLATE_GET (osssrc_src_factory));
}
static void
gst_osssrc_class_init (GstOssSrcClass *klass)
{
......@@ -538,21 +544,3 @@ gst_osssrc_src_query (GstPad *pad, GstQueryType type, GstFormat *format, gint64
}
return res;
}
gboolean
gst_osssrc_factory_init (GstPlugin *plugin)
{
GstElementFactory *factory;
factory = gst_element_factory_new ("osssrc",
GST_TYPE_OSSSRC,
&gst_osssrc_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_element_factory_add_pad_template (factory,
GST_PAD_TEMPLATE_GET (osssrc_src_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
}
......@@ -72,8 +72,6 @@ struct _GstOssSrcClass {
GType gst_osssrc_get_type(void);
gboolean gst_osssrc_factory_init (GstPlugin *plugin);
G_END_DECLS
#endif /* __GST_OSSSRC_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment