Saving relocations for GTypeInfo and GstElementDetails. Fixes #437457.

Original commit message from CVS:
* 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.
This commit is contained in:
Stefan Kost 2007-06-21 14:29:05 +00:00
parent 9dd0ba7c8f
commit 9eeb1c8e2b
17 changed files with 167 additions and 112 deletions

View file

@ -1,3 +1,26 @@
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:

View file

@ -1137,6 +1137,32 @@ gst_element_class_set_details (GstElementClass * klass,
__gst_element_details_copy (&klass->details, details);
}
/**
* 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.

View file

@ -531,9 +531,9 @@ struct _GstElementClass
/* 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);

View file

@ -3255,3 +3255,33 @@ gst_parse_bin_from_description (const gchar * bin_description,
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);
}

View file

@ -70,6 +70,21 @@ void gst_print_pad_caps (GString *buf, gint indent, GstPad *pad);
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. */
@ -115,19 +130,18 @@ type_as_function ## _get_type (void) \
{ \
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; \

View file

@ -34,12 +34,6 @@
#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,
@ -84,13 +78,17 @@ static GstFlowReturn gst_capsfilter_prepare_buf (GstBaseTransform * trans,
static void
gst_capsfilter_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_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

View file

@ -42,15 +42,6 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
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
{
@ -140,9 +131,15 @@ gst_fake_sink_base_init (gpointer g_class)
{
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

View file

@ -1,6 +1,6 @@
/* 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:
*
@ -65,13 +65,6 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
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
@ -238,10 +231,13 @@ gst_fake_src_base_init (gpointer g_class)
{
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

View file

@ -88,12 +88,6 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
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
@ -148,9 +142,12 @@ gst_fd_sink_base_init (gpointer g_class)
{
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

View file

@ -78,12 +78,6 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
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,
@ -131,9 +125,12 @@ gst_fd_src_base_init (gpointer g_class)
{
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

View file

@ -53,12 +53,6 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
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,
@ -115,9 +109,11 @@ gst_file_sink_base_init (gpointer g_class)
{
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

View file

@ -118,12 +118,6 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
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
{
@ -188,10 +182,13 @@ gst_file_src_base_init (gpointer g_class)
{
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

View file

@ -51,13 +51,6 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
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
{
@ -122,11 +115,14 @@ gst_identity_base_init (gpointer g_class)
{
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

View file

@ -98,12 +98,6 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src%d",
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
@ -171,11 +165,13 @@ gst_multi_queue_base_init (gpointer g_class)
{
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

View file

@ -94,11 +94,6 @@ GST_DEBUG_CATEGORY_STATIC (queue_dataflow);
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
{
@ -243,11 +238,13 @@ gst_queue_base_init (gpointer g_class)
{
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

View file

@ -45,13 +45,6 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
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)
@ -123,9 +116,13 @@ gst_tee_base_init (gpointer g_class)
{
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));
}

View file

@ -63,12 +63,6 @@
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",
@ -167,13 +161,17 @@ gst_type_find_element_base_init (gpointer g_class)
{
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)
{