+2007-06-21 Stefan Kost <ensonic@users.sf.net>
+
+ * gst/gstelement.c: (gst_element_class_set_details_simple):
+ * gst/gstelement.h:
+ * gst/gstutils.c: (gst_type_register_static_full):
+ * gst/gstutils.h:
+ * plugins/elements/gstcapsfilter.c: (gst_capsfilter_base_init):
+ * plugins/elements/gstfakesink.c: (gst_fake_sink_base_init):
+ * plugins/elements/gstfakesrc.c: (gst_fake_src_base_init):
+ * plugins/elements/gstfdsink.c: (gst_fd_sink_base_init):
+ * plugins/elements/gstfdsrc.c: (gst_fd_src_base_init):
+ * plugins/elements/gstfilesink.c: (gst_file_sink_base_init):
+ * plugins/elements/gstfilesrc.c: (gst_file_src_base_init):
+ * plugins/elements/gstidentity.c: (gst_identity_base_init):
+ * plugins/elements/gstmultiqueue.c: (gst_multi_queue_base_init):
+ * plugins/elements/gstqueue.c: (gst_queue_base_init),
+ (apply_buffer), (gst_queue_chain):
+ * plugins/elements/gsttee.c: (gst_tee_base_init):
+ * plugins/elements/gsttypefindelement.c:
+ (gst_type_find_element_base_init),
+ (gst_type_find_element_class_init):
+ Saving relocations for GTypeInfo and GstElementDetails. Fixes #437457.
+
2007-06-21 Tim-Philipp Müller <tim at centricular dot net>
* docs/pwg/advanced-types.xml:
}
/**
+ * gst_element_class_set_details_simple:
+ * @klass: class to set details for
+ * @longname: details
+ * @classification: details
+ * @description: details
+ * @author: details
+ *
+ * Sets the detailed information for a #GstElementClass. Simpler version of
+ * gst_element_class_set_details() that generates less liker overhead.
+ * <note>This function is for use in _base_init functions only.</note>
+ *
+ * The detail-strings are copied.
+ */
+void
+gst_element_class_set_details_simple (GstElementClass * klass, gchar * longname,
+ gchar * classification, gchar * description, gchar * author)
+{
+ const GstElementDetails details =
+ GST_ELEMENT_DETAILS (longname, classification, description, author);
+
+ g_return_if_fail (GST_IS_ELEMENT_CLASS (klass));
+
+ __gst_element_details_copy (&klass->details, &details);
+}
+
+/**
* gst_element_class_get_pad_template_list:
* @element_class: a #GstElementClass to get pad templates of.
*
/* element class pad templates */
void gst_element_class_add_pad_template (GstElementClass *klass, GstPadTemplate *templ);
GstPadTemplate* gst_element_class_get_pad_template (GstElementClass *element_class, const gchar *name);
-GList* gst_element_class_get_pad_template_list (GstElementClass *element_class);
-void gst_element_class_set_details (GstElementClass *klass,
- const GstElementDetails *details);
+GList* gst_element_class_get_pad_template_list (GstElementClass *element_class);
+void gst_element_class_set_details (GstElementClass *klass, const GstElementDetails *details);
+void gst_element_class_set_details_simple (GstElementClass *klass, gchar *longname, gchar *classification, gchar *description, gchar *author);
/* element instance */
GType gst_element_get_type (void);
return NULL;
#endif
}
+
+GType
+gst_type_register_static_full (GType parent_type,
+ const gchar * type_name,
+ guint class_size,
+ GBaseInitFunc base_init,
+ GBaseFinalizeFunc base_finalize,
+ GClassInitFunc class_init,
+ GClassFinalizeFunc class_finalize,
+ gconstpointer class_data,
+ guint instance_size,
+ guint16 n_preallocs,
+ GInstanceInitFunc instance_init,
+ const GTypeValueTable * value_table, GTypeFlags flags)
+{
+ GTypeInfo info;
+
+ info.class_size = class_size;
+ info.base_init = base_init;
+ info.base_finalize = base_finalize;
+ info.class_init = class_init;
+ info.class_finalize = class_finalize;
+ info.class_data = class_data;
+ info.instance_size = instance_size;
+ info.n_preallocs = n_preallocs;
+ info.instance_init = instance_init;
+ info.value_table = value_table;
+
+ return g_type_register_static (parent_type, type_name, &info, flags);
+}
void gst_print_element_args (GString *buf, gint indent, GstElement *element);
+GType gst_type_register_static_full (GType parent_type,
+ const gchar *type_name,
+ guint class_size,
+ GBaseInitFunc base_init,
+ GBaseFinalizeFunc base_finalize,
+ GClassInitFunc class_init,
+ GClassFinalizeFunc class_finalize,
+ gconstpointer class_data,
+ guint instance_size,
+ guint16 n_preallocs,
+ GInstanceInitFunc instance_init,
+ const GTypeValueTable *value_table,
+ GTypeFlags flags);
+
+
/* Macros for defining classes. Ideas taken from Bonobo, which took theirs
from Nautilus and GOB. */
{ \
static GType object_type = 0; \
if (G_UNLIKELY (object_type == 0)) { \
- static const GTypeInfo object_info = { \
- sizeof (type ## Class), \
- type_as_function ## _base_init, \
- NULL, /* base_finalize */ \
- type_as_function ## _class_init_trampoline, \
- NULL, /* class_finalize */ \
- NULL, /* class_data */ \
- sizeof (type), \
- 0, /* n_preallocs */ \
- (GInstanceInitFunc) type_as_function ## _init \
- }; \
- object_type = g_type_register_static (parent_type_macro, #type, \
- &object_info, (GTypeFlags) 0); \
+ object_type = gst_type_register_static_full (parent_type_macro, #type, \
+ sizeof (type ## Class), \
+ type_as_function ## _base_init, \
+ NULL, /* base_finalize */ \
+ type_as_function ## _class_init_trampoline, \
+ NULL, /* class_finalize */ \
+ NULL, /* class_data */ \
+ sizeof (type), \
+ 0, /* n_preallocs */ \
+ (GInstanceInitFunc) type_as_function ## _init, \
+ NULL, \
+ (GTypeFlags) 0); \
additional_initializations (object_type); \
} \
return object_type; \
#include "../../gst/gst-i18n-lib.h"
#include "gstcapsfilter.h"
-static const GstElementDetails gst_capsfilter_details =
-GST_ELEMENT_DETAILS ("CapsFilter",
- "Generic",
- "Pass data without modification, limiting formats",
- "David Schleef <ds@schleef.org>");
-
enum
{
PROP_0,
static void
gst_capsfilter_base_init (gpointer g_class)
{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_add_pad_template (element_class,
+ GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+
+ gst_element_class_set_details_simple (gstelement_class,
+ "CapsFilter",
+ "Generic",
+ "Pass data without modification, limiting formats",
+ "David Schleef <ds@schleef.org>");
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
- gst_element_class_add_pad_template (element_class,
+ gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
- gst_element_class_set_details (element_class, &gst_capsfilter_details);
}
static void
GST_DEBUG_CATEGORY_STATIC (gst_fake_sink_debug);
#define GST_CAT_DEFAULT gst_fake_sink_debug
-static const GstElementDetails gst_fake_sink_details =
-GST_ELEMENT_DETAILS ("Fake Sink",
- "Sink",
- "Black hole for data",
- "Erik Walthinsen <omega@cse.ogi.edu>, "
- "Wim Taymans <wim@fluendo.com>, "
- "Mr. 'frag-me-more' Vanderwingo <wingo@fluendo.com>");
-
-
/* FakeSink signals and args */
enum
{
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "Fake Sink",
+ "Sink",
+ "Black hole for data",
+ "Erik Walthinsen <omega@cse.ogi.edu>, "
+ "Wim Taymans <wim@fluendo.com>, "
+ "Mr. 'frag-me-more' Vanderwingo <wingo@fluendo.com>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
- gst_element_class_set_details (gstelement_class, &gst_fake_sink_details);
}
static void
/* GStreamer
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- * 2000 Wim Taymans <wtay@chello.be>
+ * 2000 Wim Taymans <wim@fluendo.com>
*
* gstfakesrc.c:
*
GST_DEBUG_CATEGORY_STATIC (gst_fake_src_debug);
#define GST_CAT_DEFAULT gst_fake_src_debug
-static const GstElementDetails gst_fake_src_details =
-GST_ELEMENT_DETAILS ("Fake Source",
- "Source",
- "Push empty (no data) buffers around",
- "Erik Walthinsen <omega@cse.ogi.edu>, "
- "Wim Taymans <wim.taymans@chello.be>");
-
/* FakeSrc signals and args */
enum
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "Fake Source",
+ "Source",
+ "Push empty (no data) buffers around",
+ "Erik Walthinsen <omega@cse.ogi.edu>, " "Wim Taymans <wim@fluendo.com>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
-
- gst_element_class_set_details (gstelement_class, &gst_fake_src_details);
}
static void
GST_DEBUG_CATEGORY_STATIC (gst_fd_sink__debug);
#define GST_CAT_DEFAULT gst_fd_sink__debug
-static const GstElementDetails gst_fd_sink__details =
-GST_ELEMENT_DETAILS ("Filedescriptor Sink",
- "Sink/File",
- "Write data to a file descriptor",
- "Erik Walthinsen <omega@cse.ogi.edu>");
-
/* FdSink signals and args */
enum
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "Filedescriptor Sink",
+ "Sink/File",
+ "Write data to a file descriptor", "Erik Walthinsen <omega@cse.ogi.edu>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
- gst_element_class_set_details (gstelement_class, &gst_fd_sink__details);
}
static void
GST_DEBUG_CATEGORY_STATIC (gst_fd_src_debug);
#define GST_CAT_DEFAULT gst_fd_src_debug
-static const GstElementDetails gst_fd_src_details =
-GST_ELEMENT_DETAILS ("Disk Source",
- "Source/File",
- "Synchronous read from a file",
- "Erik Walthinsen <omega@cse.ogi.edu>");
-
enum
{
PROP_0,
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "Filedescriptor Source",
+ "Source/File",
+ "Read from a file descriptor", "Erik Walthinsen <omega@cse.ogi.edu>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
- gst_element_class_set_details (gstelement_class, &gst_fd_src_details);
}
static void
GST_DEBUG_CATEGORY_STATIC (gst_file_sink_debug);
#define GST_CAT_DEFAULT gst_file_sink_debug
-static const GstElementDetails gst_file_sink_details =
-GST_ELEMENT_DETAILS ("File Sink",
- "Sink/File",
- "Write stream to a file",
- "Thomas <thomas@apestaart.org>");
-
enum
{
ARG_0,
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "File Sink",
+ "Sink/File", "Write stream to a file", "Thomas <thomas@apestaart.org>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
- gst_element_class_set_details (gstelement_class, &gst_file_sink_details);
}
static void
GST_DEBUG_CATEGORY_STATIC (gst_file_src_debug);
#define GST_CAT_DEFAULT gst_file_src_debug
-static const GstElementDetails gst_file_src_details =
-GST_ELEMENT_DETAILS ("File Source",
- "Source/File",
- "Read from arbitrary point in a file",
- "Erik Walthinsen <omega@cse.ogi.edu>");
-
/* FileSrc signals and args */
enum
{
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "File Source",
+ "Source/File",
+ "Read from arbitrary point in a file",
+ "Erik Walthinsen <omega@cse.ogi.edu>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
-
- gst_element_class_set_details (gstelement_class, &gst_file_src_details);
}
static void
GST_DEBUG_CATEGORY_STATIC (gst_identity_debug);
#define GST_CAT_DEFAULT gst_identity_debug
-static const GstElementDetails gst_identity_details =
-GST_ELEMENT_DETAILS ("Identity",
- "Generic",
- "Pass data without modification",
- "Erik Walthinsen <omega@cse.ogi.edu>");
-
-
/* Identity signals and args */
enum
{
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "Identity",
+ "Generic",
+ "Pass data without modification", "Erik Walthinsen <omega@cse.ogi.edu>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
- gst_element_class_set_details (gstelement_class, &gst_identity_details);
}
static void
GST_DEBUG_CATEGORY_STATIC (multi_queue_debug);
#define GST_CAT_DEFAULT (multi_queue_debug)
-static const GstElementDetails gst_multi_queue_details =
-GST_ELEMENT_DETAILS ("MultiQueue",
- "Generic",
- "Multiple data queue",
- "Edward Hervey <edward@fluendo.com>");
-
/* default limits, we try to keep up to 2 seconds of data and if there is not
* time, up to 10 MB. The number of buffers is dynamically scaled to make sure
* there is data in the queues. Normally, the byte and time limits are not hit
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "MultiQueue",
+ "Generic", "Multiple data queue", "Edward Hervey <edward@fluendo.com>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
- gst_element_class_set_details (gstelement_class, &gst_multi_queue_details);
}
static void
queue->max_size.time, \
queue->queue->length)
-static const GstElementDetails gst_queue_details = GST_ELEMENT_DETAILS ("Queue",
- "Generic",
- "Simple data queue",
- "Erik Walthinsen <omega@cse.ogi.edu>");
-
/* Queue signals and args */
enum
{
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "Queue",
+ "Generic", "Simple data queue", "Erik Walthinsen <omega@cse.ogi.edu>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
- gst_element_class_set_details (gstelement_class, &gst_queue_details);
}
static void
GST_DEBUG_CATEGORY_STATIC (gst_tee_debug);
#define GST_CAT_DEFAULT gst_tee_debug
-static const GstElementDetails gst_tee_details =
-GST_ELEMENT_DETAILS ("Tee pipe fitting",
- "Generic",
- "1-to-N pipe fitting",
- "Erik Walthinsen <omega@cse.ogi.edu>, "
- "Wim \"Tim\" Taymans <wim@fluendo.com>");
-
#define GST_TYPE_TEE_PULL_MODE (gst_tee_pull_mode_get_type())
static GType
gst_tee_pull_mode_get_type (void)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "Tee pipe fitting",
+ "Generic",
+ "1-to-N pipe fitting",
+ "Erik Walthinsen <omega@cse.ogi.edu>, " "Wim Taymans <wim@fluendo.com>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
- gst_element_class_set_details (gstelement_class, &gst_tee_details);
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&tee_src_template));
}
GST_DEBUG_CATEGORY_STATIC (gst_type_find_element_debug);
#define GST_CAT_DEFAULT gst_type_find_element_debug
-static const GstElementDetails gst_type_find_element_details =
-GST_ELEMENT_DETAILS ("TypeFind",
- "Generic",
- "Finds the media type of a stream",
- "Benjamin Otte <in7y118@public.uni-hamburg.de>");
-
/* generic templates */
GstStaticPadTemplate type_find_element_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
+ gst_element_class_set_details_simple (gstelement_class,
+ "TypeFind",
+ "Generic",
+ "Finds the media type of a stream",
+ "Benjamin Otte <in7y118@public.uni-hamburg.de>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&type_find_element_src_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&type_find_element_sink_template));
- gst_element_class_set_details (gstelement_class,
- &gst_type_find_element_details);
}
+
static void
gst_type_find_element_class_init (GstTypeFindElementClass * typefind_class)
{