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
This commit is contained in:
Benjamin Otte 2003-10-31 20:03:29 +00:00
parent e206183335
commit 92ba809c91
16 changed files with 326 additions and 207 deletions

View File

@ -1149,6 +1149,36 @@ if test "x$HAVE_FFMPEG" = xyes; then
AC_CONFIG_SUBDIRS(gst-libs/ext/ffmpeg/ffmpeg) AC_CONFIG_SUBDIRS(gst-libs/ext/ffmpeg/ffmpeg)
fi 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 #########################
dnl # Make the output files # dnl # Make the output files #
dnl ######################### dnl #########################

View File

@ -1,12 +1,10 @@
plugin_LTLIBRARIES = libgstgnomevfssrc.la libgstgnomevfssink.la plugin_LTLIBRARIES = libgstgnomevfs.la
libgstgnomevfssrc_la_SOURCES = gstgnomevfssrc.c libgstgnomevfs_la_SOURCES = gstgnomevfs.c gstgnomevfssrc.c gstgnomevfssink.c
libgstgnomevfssrc_la_CFLAGS = $(GST_CFLAGS) $(GNOME_VFS_CFLAGS) libgstgnomevfs_la_CFLAGS = $(GST_CFLAGS) $(GNOME_VFS_CFLAGS)
libgstgnomevfssrc_la_LIBADD = $(GNOME_VFS_LIBS) libgstgnomevfs_la_LIBADD = $(GNOME_VFS_LIBS)
libgstgnomevfssrc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) 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)

View File

@ -0,0 +1,54 @@
/* 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
)

View File

@ -0,0 +1,35 @@
/* 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__ */

View File

@ -25,13 +25,14 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
#include "gstgnomevfs.h"
#include <gst/gst.h> #include <gst/gst.h>
#include <libgnomevfs/gnome-vfs.h> #include <libgnomevfs/gnome-vfs.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
GstElementDetails gst_gnomevfssink_details;
#define GST_TYPE_GNOMEVFSSINK \ #define GST_TYPE_GNOMEVFSSINK \
(gst_gnomevfssink_get_type()) (gst_gnomevfssink_get_type())
@ -74,18 +75,13 @@ struct _GstGnomeVFSSinkClass {
void (*erase_ask) (GstElement *element,GstPad *pad); void (*erase_ask) (GstElement *element,GstPad *pad);
}; };
GType gst_gnomevfssink_get_type(void);
/* elementfactory information */ /* elementfactory information */
GstElementDetails gst_gnomevfssink_details = { static GstElementDetails gst_gnomevfssink_details = GST_ELEMENT_DETAILS (
"GnomeVFS Sink", "GnomeVFS Sink",
"Sink/File", "Sink/File",
"LGPL",
"Write stream to a GnomeVFS URI", "Write stream to a GnomeVFS URI",
VERSION, "Bastien Nocera <hadess@hadess.net>"
"Bastien Nocera <hadess@hadess.net>", );
"(C) 2001"
};
/* GnomeVFSSink signals and args */ /* 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_class_init (GstGnomeVFSSinkClass *klass);
static void gst_gnomevfssink_init (GstGnomeVFSSink *gnomevfssink); static void gst_gnomevfssink_init (GstGnomeVFSSink *gnomevfssink);
@ -126,7 +123,8 @@ gst_gnomevfssink_get_type (void)
if (!gnomevfssink_type) { if (!gnomevfssink_type) {
static const GTypeInfo gnomevfssink_info = { static const GTypeInfo gnomevfssink_info = {
sizeof(GstGnomeVFSSinkClass), NULL, sizeof(GstGnomeVFSSinkClass),
gst_gnomevfssink_base_init,
NULL, NULL,
(GClassInitFunc)gst_gnomevfssink_class_init, (GClassInitFunc)gst_gnomevfssink_class_init,
NULL, NULL,
@ -140,6 +138,14 @@ gst_gnomevfssink_get_type (void)
return gnomevfssink_type; 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 static void
gst_gnomevfssink_class_init (GstGnomeVFSSinkClass *klass) gst_gnomevfssink_class_init (GstGnomeVFSSinkClass *klass)
{ {
@ -356,24 +362,3 @@ gst_gnomevfssink_change_state (GstElement *element)
return GST_STATE_SUCCESS; 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
};

View File

@ -30,6 +30,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include "gstgnomevfs.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/time.h> #include <sys/time.h>
@ -48,7 +50,6 @@
/* gnome-vfs.h doesn't include the following header, which we need: */ /* gnome-vfs.h doesn't include the following header, which we need: */
#include <libgnomevfs/gnome-vfs-standard-callbacks.h> #include <libgnomevfs/gnome-vfs-standard-callbacks.h>
GstElementDetails gst_gnomevfssrc_details;
#define GST_TYPE_GNOMEVFSSRC \ #define GST_TYPE_GNOMEVFSSRC \
(gst_gnomevfssrc_get_type()) (gst_gnomevfssrc_get_type())
@ -123,16 +124,12 @@ struct _GstGnomeVFSSrcClass {
GstElementClass parent_class; GstElementClass parent_class;
}; };
/* elementfactory information */ static GstElementDetails gst_gnomevfssrc_details = GST_ELEMENT_DETAILS (
GstElementDetails gst_gnomevfssrc_details = {
"GnomeVFS Source", "GnomeVFS Source",
"Source/File", "Source/File",
"LGPL",
"Read from any GnomeVFS file", "Read from any GnomeVFS file",
VERSION, "Bastien Nocera <hadess@hadess.net>"
"Bastien Nocera <hadess@hadess.net>", );
"(C) 2001",
};
GST_PAD_FORMATS_FUNCTION (gst_gnomevfssrc_get_formats, GST_PAD_FORMATS_FUNCTION (gst_gnomevfssrc_get_formats,
GST_FORMAT_BYTES GST_FORMAT_BYTES
@ -169,8 +166,7 @@ enum {
ARG_SEEKABLE, 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_class_init (GstGnomeVFSSrcClass *klass);
static void gst_gnomevfssrc_init (GstGnomeVFSSrc *gnomevfssrc); static void gst_gnomevfssrc_init (GstGnomeVFSSrc *gnomevfssrc);
static void gst_gnomevfssrc_dispose (GObject *object); static void gst_gnomevfssrc_dispose (GObject *object);
@ -205,7 +201,8 @@ GType gst_gnomevfssrc_get_type(void)
if (!gnomevfssrc_type) { if (!gnomevfssrc_type) {
static const GTypeInfo gnomevfssrc_info = { static const GTypeInfo gnomevfssrc_info = {
sizeof(GstGnomeVFSSrcClass), NULL, sizeof(GstGnomeVFSSrcClass),
gst_gnomevfssrc_base_init,
NULL, NULL,
(GClassInitFunc) gst_gnomevfssrc_class_init, (GClassInitFunc) gst_gnomevfssrc_class_init,
NULL, NULL,
@ -223,6 +220,14 @@ GType gst_gnomevfssrc_get_type(void)
return gnomevfssrc_type; 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) static void gst_gnomevfssrc_class_init(GstGnomeVFSSrcClass *klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
@ -1150,22 +1155,6 @@ static GstElementStateReturn gst_gnomevfssrc_change_state(GstElement *element)
return GST_STATE_SUCCESS; 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 static gboolean
gst_gnomevfssrc_srcpad_query (GstPad *pad, GstQueryType type, gst_gnomevfssrc_srcpad_query (GstPad *pad, GstQueryType type,
GstFormat *format, gint64 *value) GstFormat *format, gint64 *value)
@ -1258,16 +1247,3 @@ gst_gnomevfssrc_srcpad_event (GstPad *pad, GstEvent *event)
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = {
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
"gnomevfssrc",
plugin_init
};
/*
Local Variables:
c-file-style: "linux"
End:
*/

View File

@ -17,6 +17,10 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "audio.h" #include "audio.h"
int int
@ -175,15 +179,20 @@ gst_audio_is_buffer_framed (GstPad* pad, GstBuffer* buf)
} }
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
gst_plugin_set_longname (plugin, "Support services for audio plugins");
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"gstaudio", "gstaudio",
plugin_init "Support services for audio plugins",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
);

View File

@ -315,17 +315,3 @@ gst_gconf_get_default_visualization_element (void)
return ret; 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
};

View File

@ -17,8 +17,9 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H
#include <config.h> # include "config.h"
#endif
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/idct/idct.h> #include <gst/idct/idct.h>
@ -127,15 +128,20 @@ void gst_idct_destroy(GstIDCT *idct)
} }
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
gst_plugin_set_longname (plugin, "Accelerated IDCT routines");
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"gstidct", "gstidct",
plugin_init "Accelerated IDCT routines",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View File

@ -182,9 +182,8 @@ gmi_seek_to_track (GstMediaInfo *info, long track)
res = gst_pad_send_event (info->priv->decoder_pad, event); res = gst_pad_send_event (info->priv->decoder_pad, event);
if (!res) if (!res)
{ {
g_warning ("seek to logical track on pad %s:%s failed of element %s", g_warning ("seek to logical track on pad %s:%s failed",
GST_DEBUG_PAD_NAME(info->priv->decoder_pad), GST_DEBUG_PAD_NAME(info->priv->decoder_pad));
gst_element_get_factory((gst_pad_get_parent(info->priv->decoder_pad)))->details->longname);
return FALSE; return FALSE;
} }
/* clear structs because of the seek */ /* clear structs because of the seek */

View File

@ -870,16 +870,21 @@ void resample_sinc_ft_float(resample_t * r)
} }
static gboolean 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; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"gstresample", "gstresample",
plugin_init "Resampling routines for use in audio plugins",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
);

View File

@ -17,19 +17,27 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <riff.h> #include <riff.h>
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
gst_plugin_set_longname (plugin, "RIFF convenience routines");
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"gstriff", "gstriff",
plugin_init "RIFF convenience routines",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View File

@ -18,6 +18,10 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "video.h" #include "video.h"
/* This is simply a convenience function, nothing more or less */ /* This is simply a convenience function, nothing more or less */
@ -97,15 +101,20 @@ gst_video_get_size (GstPad *pad,
} }
static gboolean static gboolean
plugin_init (GModule *module, GstPlugin *plugin) plugin_init (GstPlugin *plugin)
{ {
gst_plugin_set_longname (plugin, "Convenience routines for video plugins");
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"gstvideo", "gstvideo",
plugin_init "Convenience routines for video plugins",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View File

@ -637,17 +637,20 @@ gst_xwin_stop (GstXWindowListener *xwin)
*/ */
static gboolean static gboolean
plugin_init (GModule *module, plugin_init (GstPlugin *plugin)
GstPlugin *plugin)
{ {
gst_plugin_set_longname (plugin,
"X11-based XWindow event/motion listener");
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"xwindowlistener", "xwindowlistener",
plugin_init "X11-based XWindow event/motion listener",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View File

@ -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 * 1-(1-1/2^(65*GST_MPEG_TYPEFIND_TRY_HEADERS))^GST_MPEG_TYPEFIND_TRY_SYNC
* for current values: * for current values:
* 1-(1-1/2^(65*2)^50000 * 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_HEADERS 2
#define GST_MPEG_TYPEFIND_TRY_SYNC (GST_TYPE_FIND_MAXIMUM * 500) /* 50kB */ #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 static void
bmp_type_find (GstTypeFind *tf, gpointer unused) 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 && memcmp (data, "BM", 2) == 0) {
if (data[14] == GUINT16_TO_LE (12) || if ((data[14] == 0x0C ||
data[14] == GUINT16_TO_LE (64) || data[14] == 0x28 ||
data[14] == GUINT16_TO_LE (40)) { data[14] == 0xF0) &&
data[15] == 0 &&
data[16] == 0 &&
data[17] == 0) {
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, BMP_CAPS); gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, BMP_CAPS);
} }
} }
@ -951,7 +954,8 @@ bmp_type_find (GstTypeFind *tf, gpointer unused)
/*** image/tiff ********************/ /*** image/tiff ********************/
#define TIFF_CAPS(endian) (endian == 0 ? \ #define TIFF_CAPS(endian) (endian == 0 ? \
GST_CAPS_NEW ("tiff_type_find", "image/tiff", \ 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", \ GST_CAPS_NEW ("tiff_type_find", "image/tiff", \
"endianness", GST_PROPS_INT (endian))) "endianness", GST_PROPS_INT (endian)))
static void static void
@ -1066,8 +1070,12 @@ sid_type_find (GstTypeFind *tf, gpointer private)
/*** plugin initialization ****************************************************/ /*** 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 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 */ /* 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_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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); 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); jpeg_type_find, jpeg_exts, JPEG_CAPS, NULL);
gst_type_find_factory_register (plugin, "image/gif", GST_ELEMENT_RANK_PRIMARY, TYPE_FIND_REGISTER (plugin, "image/gif", GST_RANK_PRIMARY,
gif_type_find, gif_exts, GIF_CAPS, NULL); gif_type_find, gif_exts, GIF_CAPS, NULL);
gst_type_find_factory_register (plugin, "image/png", GST_ELEMENT_RANK_PRIMARY, TYPE_FIND_REGISTER (plugin, "image/png", GST_RANK_PRIMARY,
png_type_find, png_exts, PNG_CAPS, NULL); png_type_find, png_exts, PNG_CAPS, NULL);
gst_type_find_factory_register (plugin, "image/bmp", GST_ELEMENT_RANK_PRIMARY, TYPE_FIND_REGISTER (plugin, "image/bmp", GST_RANK_PRIMARY,
bmp_type_find, bmp_exts, BMP_CAPS, NULL); bmp_type_find, bmp_exts, BMP_CAPS, NULL);
gst_type_find_factory_register (plugin, "image/tiff", GST_ELEMENT_RANK_PRIMARY, TYPE_FIND_REGISTER (plugin, "image/tiff", GST_RANK_PRIMARY,
tiff_type_find, tiff_exts, TIFF_CAPS(0), NULL); 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, "video/x-matroska", GST_RANK_SECONDARY,
matroska_type_find, matroska_exts, MATROSKA_CAPS, NULL); 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); 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); sid_type_find, sid_exts, SID_CAPS, NULL);
gst_type_find_factory_register (plugin, "image/x-xcf", GST_ELEMENT_RANK_SECONDARY, TYPE_FIND_REGISTER (plugin, "image/x-xcf", GST_RANK_SECONDARY,
xcf_type_find, xcf_exts, XCF_CAPS, NULL); xcf_type_find, xcf_exts, XCF_CAPS, NULL);
gst_type_find_factory_register (plugin, "video/x-mng", GST_ELEMENT_RANK_SECONDARY, TYPE_FIND_REGISTER (plugin, "video/x-mng", GST_RANK_SECONDARY,
mng_type_find, mng_exts, MNG_CAPS, NULL); mng_type_find, mng_exts, MNG_CAPS, NULL);
gst_type_find_factory_register (plugin, "image/x-jng", GST_ELEMENT_RANK_SECONDARY, TYPE_FIND_REGISTER (plugin, "image/x-jng", GST_RANK_SECONDARY,
jng_type_find, jng_exts, JNG_CAPS, NULL); jng_type_find, jng_exts, JNG_CAPS, NULL);
gst_type_find_factory_register (plugin, "image/x-xpixmap", GST_ELEMENT_RANK_SECONDARY, TYPE_FIND_REGISTER (plugin, "image/x-xpixmap", GST_RANK_SECONDARY,
xpm_type_find, xpm_exts, XPM_CAPS, NULL); xpm_type_find, xpm_exts, XPM_CAPS, NULL);
gst_type_find_factory_register (plugin, "image/x-sun-raster", GST_ELEMENT_RANK_SECONDARY, TYPE_FIND_REGISTER (plugin, "image/x-sun-raster", GST_RANK_SECONDARY,
ras_type_find, ras_exts, RAS_CAPS, NULL); ras_type_find, ras_exts, RAS_CAPS, NULL);
return TRUE; return TRUE;
} }
GstPluginDesc plugin_desc = { GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR, GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"typefindfunctions", "typefindfunctions",
plugin_init "default typefind functions",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)

View File

@ -32,11 +32,8 @@
static GstElementDetails volume_details = { static GstElementDetails volume_details = {
"Volume", "Volume",
"Filter/Audio/Effect", "Filter/Audio/Effect",
"LGPL",
"Set volume on audio/raw streams", "Set volume on audio/raw streams",
VERSION,
"Andy Wingo <apwingo@eos.ncsu.edu>", "Andy Wingo <apwingo@eos.ncsu.edu>",
"(C) 2001"
}; };
@ -95,6 +92,7 @@ GST_PAD_TEMPLATE_FACTORY (volume_src_factory,
) )
); );
static void volume_base_init (gpointer g_class);
static void volume_class_init (GstVolumeClass *klass); static void volume_class_init (GstVolumeClass *klass);
static void volume_init (GstVolume *filter); static void volume_init (GstVolume *filter);
@ -178,7 +176,8 @@ gst_volume_get_type(void) {
if (!volume_type) { if (!volume_type) {
static const GTypeInfo volume_info = { static const GTypeInfo volume_info = {
sizeof(GstVolumeClass), NULL, sizeof(GstVolumeClass),
volume_base_init,
NULL, NULL,
(GClassInitFunc)volume_class_init, (GClassInitFunc)volume_class_init,
NULL, NULL,
@ -191,7 +190,15 @@ gst_volume_get_type(void) {
} }
return volume_type; 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 static void
volume_class_init (GstVolumeClass *klass) volume_class_init (GstVolumeClass *klass)
{ {
@ -415,27 +422,22 @@ volume_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *
} }
static gboolean 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); 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_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"volume", "volume",
plugin_init "element for controlling audio volume",
}; plugin_init,
VERSION,
GST_LICENSE,
GST_COPYRIGHT,
GST_PACKAGE,
GST_ORIGIN
)