gst: Use G_DEFINE_TYPE instead of GST_BOILERPLATE

This commit is contained in:
Sebastian Dröge 2011-04-19 11:35:53 +02:00
parent 554906918a
commit f10a8f0986
23 changed files with 302 additions and 537 deletions

View file

@ -116,7 +116,8 @@ GST_STATIC_PAD_TEMPLATE ("sink%d",
GST_STATIC_CAPS (CAPS) GST_STATIC_CAPS (CAPS)
); );
GST_BOILERPLATE (GstAdder, gst_adder, GstElement, GST_TYPE_ELEMENT); #define gst_adder_parent_class parent_class
G_DEFINE_TYPE (GstAdder, gst_adder, GST_TYPE_ELEMENT);
static void gst_adder_dispose (GObject * object); static void gst_adder_dispose (GObject * object);
static void gst_adder_set_property (GObject * object, guint prop_id, static void gst_adder_set_property (GObject * object, guint prop_id,
@ -780,21 +781,6 @@ beach:
return ret; return ret;
} }
static void
gst_adder_base_init (gpointer g_class)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_adder_src_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_adder_sink_template));
gst_element_class_set_details_simple (gstelement_class, "Adder",
"Generic/Audio",
"Add N audio channels together",
"Thomas Vander Stichele <thomas at apestaart dot org>");
}
static void static void
gst_adder_class_init (GstAdderClass * klass) gst_adder_class_init (GstAdderClass * klass)
{ {
@ -817,6 +803,15 @@ gst_adder_class_init (GstAdderClass * klass)
"object.", GST_TYPE_CAPS, "object.", GST_TYPE_CAPS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_adder_src_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_adder_sink_template));
gst_element_class_set_details_simple (gstelement_class, "Adder",
"Generic/Audio",
"Add N audio channels together",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gstelement_class->request_new_pad = gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_adder_request_new_pad); GST_DEBUG_FUNCPTR (gst_adder_request_new_pad);
gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_adder_release_pad); gstelement_class->release_pad = GST_DEBUG_FUNCPTR (gst_adder_release_pad);
@ -824,7 +819,7 @@ gst_adder_class_init (GstAdderClass * klass)
} }
static void static void
gst_adder_init (GstAdder * adder, GstAdderClass * klass) gst_adder_init (GstAdder * adder)
{ {
GstPadTemplate *template; GstPadTemplate *template;

View file

@ -108,11 +108,11 @@ enum
ARG_NOISE_SHAPING, ARG_NOISE_SHAPING,
}; };
#define DEBUG_INIT(bla) \ #define DEBUG_INIT \
GST_DEBUG_CATEGORY_INIT (audio_convert_debug, "audioconvert", 0, "audio conversion element"); \ GST_DEBUG_CATEGORY_INIT (audio_convert_debug, "audioconvert", 0, "audio conversion element"); \
GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE"); GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
#define gst_audio_convert_parent_class parent_class
GST_BOILERPLATE_FULL (GstAudioConvert, gst_audio_convert, GstBaseTransform, G_DEFINE_TYPE_WITH_CODE (GstAudioConvert, gst_audio_convert,
GST_TYPE_BASE_TRANSFORM, DEBUG_INIT); GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
/*** GSTREAMER PROTOTYPES *****************************************************/ /*** GSTREAMER PROTOTYPES *****************************************************/
@ -215,25 +215,11 @@ gst_audio_convert_ns_get_type (void)
/*** TYPE FUNCTIONS ***********************************************************/ /*** TYPE FUNCTIONS ***********************************************************/
static void
gst_audio_convert_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_audio_convert_src_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_audio_convert_sink_template));
gst_element_class_set_details_simple (element_class,
"Audio converter", "Filter/Converter/Audio",
"Convert audio to different formats", "Benjamin Otte <otte@gnome.org>");
}
static void static void
gst_audio_convert_class_init (GstAudioConvertClass * klass) gst_audio_convert_class_init (GstAudioConvertClass * klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass); GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass);
gobject_class->dispose = gst_audio_convert_dispose; gobject_class->dispose = gst_audio_convert_dispose;
@ -252,6 +238,14 @@ gst_audio_convert_class_init (GstAudioConvertClass * klass)
GST_TYPE_AUDIO_CONVERT_NOISE_SHAPING, NOISE_SHAPING_NONE, GST_TYPE_AUDIO_CONVERT_NOISE_SHAPING, NOISE_SHAPING_NONE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_audio_convert_src_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_audio_convert_sink_template));
gst_element_class_set_details_simple (element_class,
"Audio converter", "Filter/Converter/Audio",
"Convert audio to different formats", "Benjamin Otte <otte@gnome.org>");
basetransform_class->get_unit_size = basetransform_class->get_unit_size =
GST_DEBUG_FUNCPTR (gst_audio_convert_get_unit_size); GST_DEBUG_FUNCPTR (gst_audio_convert_get_unit_size);
basetransform_class->transform_caps = basetransform_class->transform_caps =
@ -269,7 +263,7 @@ gst_audio_convert_class_init (GstAudioConvertClass * klass)
} }
static void static void
gst_audio_convert_init (GstAudioConvert * this, GstAudioConvertClass * g_class) gst_audio_convert_init (GstAudioConvert * this)
{ {
this->dither = DITHER_TPDF; this->dither = DITHER_TPDF;
this->ns = NOISE_SHAPING_NONE; this->ns = NOISE_SHAPING_NONE;

View file

@ -108,9 +108,6 @@ static GstStaticPadTemplate gst_audio_rate_sink_template =
GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS) GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS)
); );
static void gst_audio_rate_base_init (gpointer g_class);
static void gst_audio_rate_class_init (GstAudioRateClass * klass);
static void gst_audio_rate_init (GstAudioRate * audiorate);
static gboolean gst_audio_rate_sink_event (GstPad * pad, GstEvent * event); static gboolean gst_audio_rate_sink_event (GstPad * pad, GstEvent * event);
static gboolean gst_audio_rate_src_event (GstPad * pad, GstEvent * event); static gboolean gst_audio_rate_src_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_audio_rate_chain (GstPad * pad, GstBuffer * buf); static GstFlowReturn gst_audio_rate_chain (GstPad * pad, GstBuffer * buf);
@ -123,53 +120,13 @@ static void gst_audio_rate_get_property (GObject * object,
static GstStateChangeReturn gst_audio_rate_change_state (GstElement * element, static GstStateChangeReturn gst_audio_rate_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
static GstElementClass *parent_class = NULL;
/*static guint gst_audio_rate_signals[LAST_SIGNAL] = { 0 }; */ /*static guint gst_audio_rate_signals[LAST_SIGNAL] = { 0 }; */
static GParamSpec *pspec_drop = NULL; static GParamSpec *pspec_drop = NULL;
static GParamSpec *pspec_add = NULL; static GParamSpec *pspec_add = NULL;
static GType #define gst_audio_rate_parent_class parent_class
gst_audio_rate_get_type (void) G_DEFINE_TYPE (GstAudioRate, gst_audio_rate, GST_TYPE_ELEMENT);
{
static GType audio_rate_type = 0;
if (!audio_rate_type) {
static const GTypeInfo audio_rate_info = {
sizeof (GstAudioRateClass),
gst_audio_rate_base_init,
NULL,
(GClassInitFunc) gst_audio_rate_class_init,
NULL,
NULL,
sizeof (GstAudioRate),
0,
(GInstanceInitFunc) gst_audio_rate_init,
};
audio_rate_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstAudioRate", &audio_rate_info, 0);
}
return audio_rate_type;
}
static void
gst_audio_rate_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"Audio rate adjuster", "Filter/Effect/Audio",
"Drops/duplicates/adjusts timestamps on audio samples to make a perfect stream",
"Wim Taymans <wim@fluendo.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_audio_rate_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_audio_rate_src_template));
}
static void static void
gst_audio_rate_class_init (GstAudioRateClass * klass) gst_audio_rate_class_init (GstAudioRateClass * klass)
@ -177,8 +134,6 @@ gst_audio_rate_class_init (GstAudioRateClass * klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->set_property = gst_audio_rate_set_property; object_class->set_property = gst_audio_rate_set_property;
object_class->get_property = gst_audio_rate_get_property; object_class->get_property = gst_audio_rate_get_property;
@ -225,6 +180,16 @@ gst_audio_rate_class_init (GstAudioRateClass * klass)
"Don't produce buffers before the first one we receive", "Don't produce buffers before the first one we receive",
DEFAULT_SKIP_TO_FIRST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); DEFAULT_SKIP_TO_FIRST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (element_class,
"Audio rate adjuster", "Filter/Effect/Audio",
"Drops/duplicates/adjusts timestamps on audio samples to make a perfect stream",
"Wim Taymans <wim@fluendo.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_audio_rate_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_audio_rate_src_template));
element_class->change_state = gst_audio_rate_change_state; element_class->change_state = gst_audio_rate_change_state;
} }
@ -860,10 +825,7 @@ gst_audio_rate_change_state (GstElement * element, GstStateChange transition)
break; break;
} }
if (parent_class->change_state) return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return parent_class->change_state (element, transition);
return GST_STATE_CHANGE_SUCCESS;
} }
static gboolean static gboolean

View file

@ -78,6 +78,8 @@ struct _GstAudioRateClass
GstElementClass parent_class; GstElementClass parent_class;
}; };
GType gst_audio_rate_get_type (void);
G_END_DECLS G_END_DECLS
#endif /* __GST_AUDIO_RATE_H__ */ #endif /* __GST_AUDIO_RATE_H__ */

View file

@ -146,28 +146,14 @@ static gboolean gst_audio_resample_stop (GstBaseTransform * base);
static gboolean gst_audio_resample_query (GstPad * pad, GstQuery * query); static gboolean gst_audio_resample_query (GstPad * pad, GstQuery * query);
static const GstQueryType *gst_audio_resample_query_type (GstPad * pad); static const GstQueryType *gst_audio_resample_query_type (GstPad * pad);
GST_BOILERPLATE (GstAudioResample, gst_audio_resample, GstBaseTransform, #define gst_audio_resample_parent_class parent_class
GST_TYPE_BASE_TRANSFORM); G_DEFINE_TYPE (GstAudioResample, gst_audio_resample, GST_TYPE_BASE_TRANSFORM);
static void
gst_audio_resample_base_init (gpointer g_class)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_audio_resample_src_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_audio_resample_sink_template));
gst_element_class_set_details_simple (gstelement_class, "Audio resampler",
"Filter/Converter/Audio", "Resamples audio",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void static void
gst_audio_resample_class_init (GstAudioResampleClass * klass) gst_audio_resample_class_init (GstAudioResampleClass * klass)
{ {
GObjectClass *gobject_class = (GObjectClass *) klass; GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
gobject_class->set_property = gst_audio_resample_set_property; gobject_class->set_property = gst_audio_resample_set_property;
gobject_class->get_property = gst_audio_resample_get_property; gobject_class->get_property = gst_audio_resample_get_property;
@ -194,6 +180,15 @@ gst_audio_resample_class_init (GstAudioResampleClass * klass)
"Length of the resample filter", 0, G_MAXINT, 64, "Length of the resample filter", 0, G_MAXINT, 64,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_audio_resample_src_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_audio_resample_sink_template));
gst_element_class_set_details_simple (gstelement_class, "Audio resampler",
"Filter/Converter/Audio", "Resamples audio",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
GST_BASE_TRANSFORM_CLASS (klass)->start = GST_BASE_TRANSFORM_CLASS (klass)->start =
GST_DEBUG_FUNCPTR (gst_audio_resample_start); GST_DEBUG_FUNCPTR (gst_audio_resample_start);
GST_BASE_TRANSFORM_CLASS (klass)->stop = GST_BASE_TRANSFORM_CLASS (klass)->stop =
@ -217,8 +212,7 @@ gst_audio_resample_class_init (GstAudioResampleClass * klass)
} }
static void static void
gst_audio_resample_init (GstAudioResample * resample, gst_audio_resample_init (GstAudioResample * resample)
GstAudioResampleClass * klass)
{ {
GstBaseTransform *trans = GST_BASE_TRANSFORM (resample); GstBaseTransform *trans = GST_BASE_TRANSFORM (resample);
@ -984,7 +978,7 @@ gst_audio_resample_event (GstBaseTransform * base, GstEvent * event)
break; break;
} }
return parent_class->event (base, event); return GST_BASE_TRANSFORM_CLASS (parent_class)->event (base, event);
} }
static gboolean static gboolean

View file

@ -109,9 +109,8 @@ static GstStaticPadTemplate gst_audio_test_src_src_template =
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]") "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 2 ]")
); );
#define gst_audio_test_src_parent_class parent_class
GST_BOILERPLATE (GstAudioTestSrc, gst_audio_test_src, GstBaseSrc, G_DEFINE_TYPE (GstAudioTestSrc, gst_audio_test_src, GST_TYPE_BASE_SRC);
GST_TYPE_BASE_SRC);
#define GST_TYPE_AUDIO_TEST_SRC_WAVE (gst_audiostestsrc_wave_get_type()) #define GST_TYPE_AUDIO_TEST_SRC_WAVE (gst_audiostestsrc_wave_get_type())
static GType static GType
@ -167,27 +166,15 @@ static gboolean gst_audio_test_src_stop (GstBaseSrc * basesrc);
static GstFlowReturn gst_audio_test_src_create (GstBaseSrc * basesrc, static GstFlowReturn gst_audio_test_src_create (GstBaseSrc * basesrc,
guint64 offset, guint length, GstBuffer ** buffer); guint64 offset, guint length, GstBuffer ** buffer);
static void
gst_audio_test_src_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_audio_test_src_src_template));
gst_element_class_set_details_simple (element_class,
"Audio test source", "Source/Audio",
"Creates audio test signals of given frequency and volume",
"Stefan Kost <ensonic@users.sf.net>");
}
static void static void
gst_audio_test_src_class_init (GstAudioTestSrcClass * klass) gst_audio_test_src_class_init (GstAudioTestSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstBaseSrcClass *gstbasesrc_class; GstBaseSrcClass *gstbasesrc_class;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass; gstbasesrc_class = (GstBaseSrcClass *) klass;
gobject_class->set_property = gst_audio_test_src_set_property; gobject_class->set_property = gst_audio_test_src_set_property;
@ -230,6 +217,13 @@ gst_audio_test_src_class_init (GstAudioTestSrcClass * klass)
"Can activate in pull mode", DEFAULT_CAN_ACTIVATE_PULL, "Can activate in pull mode", DEFAULT_CAN_ACTIVATE_PULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_audio_test_src_src_template));
gst_element_class_set_details_simple (gstelement_class,
"Audio test source", "Source/Audio",
"Creates audio test signals of given frequency and volume",
"Stefan Kost <ensonic@users.sf.net>");
gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_audio_test_src_setcaps); gstbasesrc_class->set_caps = GST_DEBUG_FUNCPTR (gst_audio_test_src_setcaps);
gstbasesrc_class->is_seekable = gstbasesrc_class->is_seekable =
GST_DEBUG_FUNCPTR (gst_audio_test_src_is_seekable); GST_DEBUG_FUNCPTR (gst_audio_test_src_is_seekable);
@ -245,7 +239,7 @@ gst_audio_test_src_class_init (GstAudioTestSrcClass * klass)
} }
static void static void
gst_audio_test_src_init (GstAudioTestSrc * src, GstAudioTestSrcClass * g_class) gst_audio_test_src_init (GstAudioTestSrc * src)
{ {
GstPad *pad = GST_BASE_SRC_PAD (src); GstPad *pad = GST_BASE_SRC_PAD (src);

View file

@ -333,28 +333,8 @@ invalid_out_caps:
} }
} }
GST_BOILERPLATE (GstFFMpegCsp, gst_ffmpegcsp, GstVideoFilter, #define gst_ffmpegcsp_parent_class parent_class
GST_TYPE_VIDEO_FILTER); G_DEFINE_TYPE (GstFFMpegCsp, gst_ffmpegcsp, GST_TYPE_VIDEO_FILTER);
static void
gst_ffmpegcsp_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_ffmpegcsp_src_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_ffmpegcsp_sink_template));
gst_element_class_set_details_simple (element_class,
"FFMPEG Colorspace converter", "Filter/Converter/Video",
"Converts video from one colorspace to another",
"GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
_QRAWRGB = g_quark_from_string ("video/x-raw-rgb");
_QRAWYUV = g_quark_from_string ("video/x-raw-yuv");
_QALPHAMASK = g_quark_from_string ("alpha_mask");
}
static void static void
gst_ffmpegcsp_finalize (GObject * obj) gst_ffmpegcsp_finalize (GObject * obj)
@ -371,11 +351,26 @@ static void
gst_ffmpegcsp_class_init (GstFFMpegCspClass * klass) gst_ffmpegcsp_class_init (GstFFMpegCspClass * klass)
{ {
GObjectClass *gobject_class = (GObjectClass *) klass; GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseTransformClass *gstbasetransform_class = GstBaseTransformClass *gstbasetransform_class =
(GstBaseTransformClass *) klass; (GstBaseTransformClass *) klass;
_QRAWRGB = g_quark_from_string ("video/x-raw-rgb");
_QRAWYUV = g_quark_from_string ("video/x-raw-yuv");
_QALPHAMASK = g_quark_from_string ("alpha_mask");
gobject_class->finalize = gst_ffmpegcsp_finalize; gobject_class->finalize = gst_ffmpegcsp_finalize;
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_ffmpegcsp_src_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_ffmpegcsp_sink_template));
gst_element_class_set_details_simple (gstelement_class,
"FFMPEG Colorspace converter", "Filter/Converter/Video",
"Converts video from one colorspace to another",
"GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
gstbasetransform_class->transform_caps = gstbasetransform_class->transform_caps =
GST_DEBUG_FUNCPTR (gst_ffmpegcsp_transform_caps); GST_DEBUG_FUNCPTR (gst_ffmpegcsp_transform_caps);
gstbasetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_ffmpegcsp_set_caps); gstbasetransform_class->set_caps = GST_DEBUG_FUNCPTR (gst_ffmpegcsp_set_caps);
@ -388,7 +383,7 @@ gst_ffmpegcsp_class_init (GstFFMpegCspClass * klass)
} }
static void static void
gst_ffmpegcsp_init (GstFFMpegCsp * space, GstFFMpegCspClass * klass) gst_ffmpegcsp_init (GstFFMpegCsp * space)
{ {
space->from_pixfmt = space->to_pixfmt = PIX_FMT_NB; space->from_pixfmt = space->to_pixfmt = PIX_FMT_NB;
space->palette = NULL; space->palette = NULL;

View file

@ -62,11 +62,11 @@ GST_STATIC_PAD_TEMPLATE ("src",
GST_DEBUG_CATEGORY_STATIC (gst_gdp_depay_debug); GST_DEBUG_CATEGORY_STATIC (gst_gdp_depay_debug);
#define GST_CAT_DEFAULT gst_gdp_depay_debug #define GST_CAT_DEFAULT gst_gdp_depay_debug
#define _do_init(x) \ #define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_gdp_depay_debug, "gdpdepay", 0, \ GST_DEBUG_CATEGORY_INIT (gst_gdp_depay_debug, "gdpdepay", 0, \
"GDP depayloader"); "GDP depayloader");
#define gst_gdp_depay_parent_class parent_class
GST_BOILERPLATE_FULL (GstGDPDepay, gst_gdp_depay, GstElement, G_DEFINE_TYPE_WITH_CODE (GstGDPDepay, gst_gdp_depay,
GST_TYPE_ELEMENT, _do_init); GST_TYPE_ELEMENT, _do_init);
static gboolean gst_gdp_depay_sink_event (GstPad * pad, GstEvent * event); static gboolean gst_gdp_depay_sink_event (GstPad * pad, GstEvent * event);
@ -79,22 +79,6 @@ static GstStateChangeReturn gst_gdp_depay_change_state (GstElement *
static void gst_gdp_depay_finalize (GObject * object); static void gst_gdp_depay_finalize (GObject * object);
static void
gst_gdp_depay_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"GDP Depayloader", "GDP/Depayloader",
"Depayloads GStreamer Data Protocol buffers",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gdp_depay_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gdp_depay_src_template));
}
static void static void
gst_gdp_depay_class_init (GstGDPDepayClass * klass) gst_gdp_depay_class_init (GstGDPDepayClass * klass)
{ {
@ -104,13 +88,23 @@ gst_gdp_depay_class_init (GstGDPDepayClass * klass)
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass; gstelement_class = (GstElementClass *) klass;
gst_element_class_set_details_simple (gstelement_class,
"GDP Depayloader", "GDP/Depayloader",
"Depayloads GStreamer Data Protocol buffers",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gdp_depay_sink_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gdp_depay_src_template));
gstelement_class->change_state = gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_gdp_depay_change_state); GST_DEBUG_FUNCPTR (gst_gdp_depay_change_state);
gobject_class->finalize = gst_gdp_depay_finalize; gobject_class->finalize = gst_gdp_depay_finalize;
} }
static void static void
gst_gdp_depay_init (GstGDPDepay * gdpdepay, GstGDPDepayClass * g_class) gst_gdp_depay_init (GstGDPDepay * gdpdepay)
{ {
gdpdepay->sinkpad = gdpdepay->sinkpad =
gst_pad_new_from_static_template (&gdp_depay_sink_template, "sink"); gst_pad_new_from_static_template (&gdp_depay_sink_template, "sink");

View file

@ -67,12 +67,11 @@ enum
PROP_VERSION, PROP_VERSION,
}; };
#define _do_init(x) \ #define _do_init \
GST_DEBUG_CATEGORY_INIT (gst_gdp_pay_debug, "gdppay", 0, \ GST_DEBUG_CATEGORY_INIT (gst_gdp_pay_debug, "gdppay", 0, \
"GDP payloader"); "GDP payloader");
#define gst_gdp_pay_parent_class parent_class
GST_BOILERPLATE_FULL (GstGDPPay, gst_gdp_pay, GstElement, G_DEFINE_TYPE_WITH_CODE (GstGDPPay, gst_gdp_pay, GST_TYPE_ELEMENT, _do_init);
GST_TYPE_ELEMENT, _do_init);
static void gst_gdp_pay_reset (GstGDPPay * this); static void gst_gdp_pay_reset (GstGDPPay * this);
@ -90,22 +89,6 @@ static void gst_gdp_pay_get_property (GObject * object, guint prop_id,
static void gst_gdp_pay_finalize (GObject * gobject); static void gst_gdp_pay_finalize (GObject * gobject);
static void
gst_gdp_pay_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"GDP Payloader", "GDP/Payloader",
"Payloads GStreamer Data Protocol buffers",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gdp_pay_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gdp_pay_src_template));
}
static void static void
gst_gdp_pay_class_init (GstGDPPayClass * klass) gst_gdp_pay_class_init (GstGDPPayClass * klass)
{ {
@ -133,11 +116,21 @@ gst_gdp_pay_class_init (GstGDPPayClass * klass)
GST_TYPE_DP_VERSION, DEFAULT_VERSION, GST_TYPE_DP_VERSION, DEFAULT_VERSION,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class,
"GDP Payloader", "GDP/Payloader",
"Payloads GStreamer Data Protocol buffers",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gdp_pay_sink_template));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gdp_pay_src_template));
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_gdp_pay_change_state); gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_gdp_pay_change_state);
} }
static void static void
gst_gdp_pay_init (GstGDPPay * gdppay, GstGDPPayClass * g_class) gst_gdp_pay_init (GstGDPPay * gdppay)
{ {
gdppay->sinkpad = gdppay->sinkpad =
gst_pad_new_from_static_template (&gdp_pay_sink_template, "sink"); gst_pad_new_from_static_template (&gdp_pay_sink_template, "sink");

View file

@ -54,8 +54,9 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink_%d",
static const gboolean passthrough = TRUE; static const gboolean passthrough = TRUE;
GST_BOILERPLATE (GstStreamSynchronizer, gst_stream_synchronizer, #define gst_stream_synchronizer_parent_class parent_class
GstElement, GST_TYPE_ELEMENT); G_DEFINE_TYPE (GstStreamSynchronizer, gst_stream_synchronizer,
GST_TYPE_ELEMENT);
typedef struct typedef struct
{ {
@ -943,29 +944,12 @@ gst_stream_synchronizer_finalize (GObject * object)
/* GObject type initialization */ /* GObject type initialization */
static void static void
gst_stream_synchronizer_init (GstStreamSynchronizer * self, gst_stream_synchronizer_init (GstStreamSynchronizer * self)
GstStreamSynchronizerClass * klass)
{ {
self->lock = g_mutex_new (); self->lock = g_mutex_new ();
self->stream_finish_cond = g_cond_new (); self->stream_finish_cond = g_cond_new ();
} }
static void
gst_stream_synchronizer_base_init (gpointer g_class)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
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_simple (gstelement_class,
"Stream Synchronizer", "Generic",
"Synchronizes a group of streams to have equal durations and starting points",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void static void
gst_stream_synchronizer_class_init (GstStreamSynchronizerClass * klass) gst_stream_synchronizer_class_init (GstStreamSynchronizerClass * klass)
{ {
@ -977,6 +961,16 @@ gst_stream_synchronizer_class_init (GstStreamSynchronizerClass * klass)
gobject_class->finalize = gst_stream_synchronizer_finalize; gobject_class->finalize = gst_stream_synchronizer_finalize;
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sinktemplate));
gst_element_class_set_details_simple (element_class,
"Stream Synchronizer", "Generic",
"Synchronizes a group of streams to have equal durations and starting points",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
element_class->change_state = element_class->change_state =
GST_DEBUG_FUNCPTR (gst_stream_synchronizer_change_state); GST_DEBUG_FUNCPTR (gst_stream_synchronizer_change_state);
element_class->request_new_pad = element_class->request_new_pad =

View file

@ -79,8 +79,8 @@ enum
PROP_SUBTITLE_ENCODING PROP_SUBTITLE_ENCODING
}; };
GST_BOILERPLATE (GstSubtitleOverlay, gst_subtitle_overlay, GstBin, #define gst_subtitle_overlay_parent_class parent_class
GST_TYPE_BIN); G_DEFINE_TYPE (GstSubtitleOverlay, gst_subtitle_overlay, GST_TYPE_BIN);
static void _pad_blocked_cb (GstPad * pad, gboolean blocked, static void _pad_blocked_cb (GstPad * pad, gboolean blocked,
gpointer user_data); gpointer user_data);
@ -95,7 +95,7 @@ do_async_start (GstSubtitleOverlay * self)
gst_message_new_async_start (GST_OBJECT_CAST (self), FALSE); gst_message_new_async_start (GST_OBJECT_CAST (self), FALSE);
GST_DEBUG_OBJECT (self, "Posting async-start"); GST_DEBUG_OBJECT (self, "Posting async-start");
parent_class->handle_message (GST_BIN_CAST (self), msg); GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (self), msg);
self->do_async = TRUE; self->do_async = TRUE;
} }
} }
@ -107,7 +107,7 @@ do_async_done (GstSubtitleOverlay * self)
GstMessage *msg = gst_message_new_async_done (GST_OBJECT_CAST (self)); GstMessage *msg = gst_message_new_async_done (GST_OBJECT_CAST (self));
GST_DEBUG_OBJECT (self, "Posting async-done"); GST_DEBUG_OBJECT (self, "Posting async-done");
parent_class->handle_message (GST_BIN_CAST (self), msg); GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (self), msg);
self->do_async = FALSE; self->do_async = FALSE;
} }
} }
@ -1512,25 +1512,6 @@ gst_subtitle_overlay_set_property (GObject * object, guint prop_id,
} }
} }
static void
gst_subtitle_overlay_base_init (gpointer g_class)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
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 (&video_sinktemplate));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&subtitle_sinktemplate));
gst_element_class_set_details_simple (gstelement_class, "Subtitle Overlay",
"Video/Overlay/Subtitle",
"Overlays a video stream with subtitles",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
}
static void static void
gst_subtitle_overlay_class_init (GstSubtitleOverlayClass * klass) gst_subtitle_overlay_class_init (GstSubtitleOverlayClass * klass)
{ {
@ -1563,6 +1544,19 @@ gst_subtitle_overlay_class_init (GstSubtitleOverlayClass * klass)
"ISO-8859-15 will be assumed.", NULL, "ISO-8859-15 will be assumed.", NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&video_sinktemplate));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&subtitle_sinktemplate));
gst_element_class_set_details_simple (element_class, "Subtitle Overlay",
"Video/Overlay/Subtitle",
"Overlays a video stream with subtitles",
"Sebastian Dröge <sebastian.droege@collabora.co.uk>");
element_class->change_state = element_class->change_state =
GST_DEBUG_FUNCPTR (gst_subtitle_overlay_change_state); GST_DEBUG_FUNCPTR (gst_subtitle_overlay_change_state);
@ -2027,8 +2021,7 @@ out:
} }
static void static void
gst_subtitle_overlay_init (GstSubtitleOverlay * self, gst_subtitle_overlay_init (GstSubtitleOverlay * self)
GstSubtitleOverlayClass * klass)
{ {
GstPadTemplate *templ; GstPadTemplate *templ;
GstIterator *it; GstIterator *it;

View file

@ -186,7 +186,8 @@ enum
static guint gst_uri_decode_bin_signals[LAST_SIGNAL] = { 0 }; static guint gst_uri_decode_bin_signals[LAST_SIGNAL] = { 0 };
GType gst_uri_decode_bin_get_type (void); GType gst_uri_decode_bin_get_type (void);
GST_BOILERPLATE (GstURIDecodeBin, gst_uri_decode_bin, GstBin, GST_TYPE_BIN); #define gst_uri_decode_bin_parent_class parent_class
G_DEFINE_TYPE (GstURIDecodeBin, gst_uri_decode_bin, GST_TYPE_BIN);
static void remove_decoders (GstURIDecodeBin * bin, gboolean force); static void remove_decoders (GstURIDecodeBin * bin, gboolean force);
static void gst_uri_decode_bin_set_property (GObject * object, guint prop_id, static void gst_uri_decode_bin_set_property (GObject * object, guint prop_id,
@ -202,19 +203,6 @@ static gboolean gst_uri_decode_bin_query (GstElement * element,
static GstStateChangeReturn gst_uri_decode_bin_change_state (GstElement * static GstStateChangeReturn gst_uri_decode_bin_change_state (GstElement *
element, GstStateChange transition); element, GstStateChange transition);
static void
gst_uri_decode_bin_base_init (gpointer g_class)
{
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_set_details_simple (gstelement_class,
"URI Decoder", "Generic/Bin/Decoder",
"Autoplug and decode an URI to raw media",
"Wim Taymans <wim.taymans@gmail.com>");
}
static gboolean static gboolean
_gst_boolean_accumulator (GSignalInvocationHint * ihint, _gst_boolean_accumulator (GSignalInvocationHint * ihint,
GValue * return_accu, const GValue * handler_return, gpointer dummy) GValue * return_accu, const GValue * handler_return, gpointer dummy)
@ -637,6 +625,13 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass)
G_SIGNAL_RUN_LAST, 0, NULL, NULL, G_SIGNAL_RUN_LAST, 0, NULL, NULL,
gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_ELEMENT); gst_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GST_TYPE_ELEMENT);
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_set_details_simple (gstelement_class,
"URI Decoder", "Generic/Bin/Decoder",
"Autoplug and decode an URI to raw media",
"Wim Taymans <wim.taymans@gmail.com>");
gstelement_class->query = GST_DEBUG_FUNCPTR (gst_uri_decode_bin_query); gstelement_class->query = GST_DEBUG_FUNCPTR (gst_uri_decode_bin_query);
gstelement_class->change_state = gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_uri_decode_bin_change_state); GST_DEBUG_FUNCPTR (gst_uri_decode_bin_change_state);
@ -653,7 +648,7 @@ gst_uri_decode_bin_class_init (GstURIDecodeBinClass * klass)
} }
static void static void
gst_uri_decode_bin_init (GstURIDecodeBin * dec, GstURIDecodeBinClass * klass) gst_uri_decode_bin_init (GstURIDecodeBin * dec)
{ {
/* first filter out the interesting element factories */ /* first filter out the interesting element factories */
dec->factories_lock = g_mutex_new (); dec->factories_lock = g_mutex_new ();
@ -835,7 +830,7 @@ do_async_start (GstURIDecodeBin * dbin)
dbin->async_pending = TRUE; dbin->async_pending = TRUE;
message = gst_message_new_async_start (GST_OBJECT_CAST (dbin), FALSE); message = gst_message_new_async_start (GST_OBJECT_CAST (dbin), FALSE);
parent_class->handle_message (GST_BIN_CAST (dbin), message); GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (dbin), message);
} }
static void static void
@ -846,7 +841,7 @@ do_async_done (GstURIDecodeBin * dbin)
if (dbin->async_pending) { if (dbin->async_pending) {
GST_DEBUG_OBJECT (dbin, "posting ASYNC_DONE"); GST_DEBUG_OBJECT (dbin, "posting ASYNC_DONE");
message = gst_message_new_async_done (GST_OBJECT_CAST (dbin)); message = gst_message_new_async_done (GST_OBJECT_CAST (dbin));
parent_class->handle_message (GST_BIN_CAST (dbin), message); GST_BIN_CLASS (parent_class)->handle_message (GST_BIN_CAST (dbin), message);
dbin->async_pending = FALSE; dbin->async_pending = FALSE;
} }

View file

@ -44,7 +44,8 @@ static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS ("text/x-pango-markup") GST_STATIC_CAPS ("text/x-pango-markup")
); );
GST_BOILERPLATE (GstSsaParse, gst_ssa_parse, GstElement, GST_TYPE_ELEMENT); #define gst_ssa_parse_parent_class parent_class
G_DEFINE_TYPE (GstSsaParse, gst_ssa_parse, GST_TYPE_ELEMENT);
static GstStateChangeReturn gst_ssa_parse_change_state (GstElement * static GstStateChangeReturn gst_ssa_parse_change_state (GstElement *
element, GstStateChange transition); element, GstStateChange transition);
@ -53,24 +54,6 @@ static gboolean gst_ssa_parse_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_ssa_parse_sink_event (GstPad * pad, GstEvent * event); static gboolean gst_ssa_parse_sink_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf); static GstFlowReturn gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf);
static void
gst_ssa_parse_base_init (gpointer klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_templ));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"SSA Subtitle Parser", "Codec/Parser/Subtitle",
"Parses SSA subtitle streams",
"Tim-Philipp Müller <tim centricular net>");
GST_DEBUG_CATEGORY_INIT (ssa_parse_debug, "ssaparse", 0,
"SSA subtitle parser");
}
static void static void
gst_ssa_parse_dispose (GObject * object) gst_ssa_parse_dispose (GObject * object)
{ {
@ -83,7 +66,7 @@ gst_ssa_parse_dispose (GObject * object)
} }
static void static void
gst_ssa_parse_init (GstSsaParse * parse, GstSsaParseClass * klass) gst_ssa_parse_init (GstSsaParse * parse)
{ {
parse->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink"); parse->sinkpad = gst_pad_new_from_static_template (&sink_templ, "sink");
gst_pad_set_setcaps_function (parse->sinkpad, gst_pad_set_setcaps_function (parse->sinkpad,
@ -115,6 +98,18 @@ gst_ssa_parse_class_init (GstSsaParseClass * klass)
object_class->dispose = gst_ssa_parse_dispose; object_class->dispose = gst_ssa_parse_dispose;
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_templ));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"SSA Subtitle Parser", "Codec/Parser/Subtitle",
"Parses SSA subtitle streams",
"Tim-Philipp Müller <tim centricular net>");
GST_DEBUG_CATEGORY_INIT (ssa_parse_debug, "ssaparse", 0,
"SSA subtitle parser");
element_class->change_state = GST_DEBUG_FUNCPTR (gst_ssa_parse_change_state); element_class->change_state = GST_DEBUG_FUNCPTR (gst_ssa_parse_change_state);
} }
@ -372,7 +367,7 @@ gst_ssa_parse_change_state (GstElement * element, GstStateChange transition)
break; break;
} }
ret = parent_class->change_state (element, transition); ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
if (ret == GST_STATE_CHANGE_FAILURE) if (ret == GST_STATE_CHANGE_FAILURE)
return ret; return ret;

View file

@ -79,9 +79,6 @@ static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS ("text/plain; text/x-pango-markup") GST_STATIC_CAPS ("text/plain; text/x-pango-markup")
); );
static void gst_sub_parse_base_init (GstSubParseClass * klass);
static void gst_sub_parse_class_init (GstSubParseClass * klass);
static void gst_sub_parse_init (GstSubParse * subparse);
static gboolean gst_sub_parse_src_event (GstPad * pad, GstEvent * event); static gboolean gst_sub_parse_src_event (GstPad * pad, GstEvent * event);
static gboolean gst_sub_parse_src_query (GstPad * pad, GstQuery * query); static gboolean gst_sub_parse_src_query (GstPad * pad, GstQuery * query);
@ -92,48 +89,8 @@ static GstStateChangeReturn gst_sub_parse_change_state (GstElement * element,
static GstFlowReturn gst_sub_parse_chain (GstPad * sinkpad, GstBuffer * buf); static GstFlowReturn gst_sub_parse_chain (GstPad * sinkpad, GstBuffer * buf);
static GstElementClass *parent_class = NULL; #define gst_sub_parse_parent_class parent_class
G_DEFINE_TYPE (GstSubParse, gst_sub_parse, GST_TYPE_ELEMENT);
GType
gst_sub_parse_get_type (void)
{
static GType sub_parse_type = 0;
if (!sub_parse_type) {
static const GTypeInfo sub_parse_info = {
sizeof (GstSubParseClass),
(GBaseInitFunc) gst_sub_parse_base_init,
NULL,
(GClassInitFunc) gst_sub_parse_class_init,
NULL,
NULL,
sizeof (GstSubParse),
0,
(GInstanceInitFunc) gst_sub_parse_init,
};
sub_parse_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstSubParse", &sub_parse_info, 0);
}
return sub_parse_type;
}
static void
gst_sub_parse_base_init (GstSubParseClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_templ));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"Subtitle parser", "Codec/Parser/Subtitle",
"Parses subtitle (.sub) files into text streams",
"Gustavo J. A. M. Carneiro <gjc@inescporto.pt>, "
"GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
}
static void static void
gst_sub_parse_dispose (GObject * object) gst_sub_parse_dispose (GObject * object)
@ -184,12 +141,20 @@ gst_sub_parse_class_init (GstSubParseClass * klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->dispose = gst_sub_parse_dispose; object_class->dispose = gst_sub_parse_dispose;
object_class->set_property = gst_sub_parse_set_property; object_class->set_property = gst_sub_parse_set_property;
object_class->get_property = gst_sub_parse_get_property; object_class->get_property = gst_sub_parse_get_property;
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_templ));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_templ));
gst_element_class_set_details_simple (element_class,
"Subtitle parser", "Codec/Parser/Subtitle",
"Parses subtitle (.sub) files into text streams",
"Gustavo J. A. M. Carneiro <gjc@inescporto.pt>, "
"GStreamer maintainers <gstreamer-devel@lists.sourceforge.net>");
element_class->change_state = gst_sub_parse_change_state; element_class->change_state = gst_sub_parse_change_state;
g_object_class_install_property (object_class, PROP_ENCODING, g_object_class_install_property (object_class, PROP_ENCODING,
@ -1698,7 +1663,7 @@ gst_sub_parse_change_state (GstElement * element, GstStateChange transition)
break; break;
} }
ret = parent_class->change_state (element, transition); ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
if (ret == GST_STATE_CHANGE_FAILURE) if (ret == GST_STATE_CHANGE_FAILURE)
return ret; return ret;

View file

@ -343,26 +343,11 @@ static void gst_multi_fd_sink_set_property (GObject * object, guint prop_id,
static void gst_multi_fd_sink_get_property (GObject * object, guint prop_id, static void gst_multi_fd_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
GST_BOILERPLATE (GstMultiFdSink, gst_multi_fd_sink, GstBaseSink, #define gst_multi_fd_sink_parent_class parent_class
GST_TYPE_BASE_SINK); G_DEFINE_TYPE (GstMultiFdSink, gst_multi_fd_sink, GST_TYPE_BASE_SINK);
static guint gst_multi_fd_sink_signals[LAST_SIGNAL] = { 0 }; static guint gst_multi_fd_sink_signals[LAST_SIGNAL] = { 0 };
static void
gst_multi_fd_sink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sinktemplate));
gst_element_class_set_details_simple (element_class,
"Multi filedescriptor sink", "Sink/Network",
"Send data to multiple filedescriptors",
"Thomas Vander Stichele <thomas at apestaart dot org>, "
"Wim Taymans <wim@fluendo.com>");
}
static void static void
gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass) gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
{ {
@ -663,6 +648,15 @@ gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
client_fd_removed), NULL, NULL, gst_tcp_marshal_VOID__INT, client_fd_removed), NULL, NULL, gst_tcp_marshal_VOID__INT,
G_TYPE_NONE, 1, G_TYPE_INT); G_TYPE_NONE, 1, G_TYPE_INT);
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
gst_element_class_set_details_simple (gstelement_class,
"Multi filedescriptor sink", "Sink/Network",
"Send data to multiple filedescriptors",
"Thomas Vander Stichele <thomas at apestaart dot org>, "
"Wim Taymans <wim@fluendo.com>");
gstelement_class->change_state = gstelement_class->change_state =
GST_DEBUG_FUNCPTR (gst_multi_fd_sink_change_state); GST_DEBUG_FUNCPTR (gst_multi_fd_sink_change_state);
@ -679,7 +673,7 @@ gst_multi_fd_sink_class_init (GstMultiFdSinkClass * klass)
} }
static void static void
gst_multi_fd_sink_init (GstMultiFdSink * this, GstMultiFdSinkClass * klass) gst_multi_fd_sink_init (GstMultiFdSink * this)
{ {
GST_OBJECT_FLAG_UNSET (this, GST_MULTI_FD_SINK_OPEN); GST_OBJECT_FLAG_UNSET (this, GST_MULTI_FD_SINK_OPEN);

View file

@ -65,9 +65,6 @@ static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_ALWAYS, GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY); GST_STATIC_CAPS_ANY);
static void gst_tcp_client_sink_base_init (gpointer g_class);
static void gst_tcp_client_sink_class_init (GstTCPClientSink * klass);
static void gst_tcp_client_sink_init (GstTCPClientSink * tcpclientsink);
static void gst_tcp_client_sink_finalize (GObject * gobject); static void gst_tcp_client_sink_finalize (GObject * gobject);
static gboolean gst_tcp_client_sink_setcaps (GstBaseSink * bsink, static gboolean gst_tcp_client_sink_setcaps (GstBaseSink * bsink,
@ -83,53 +80,13 @@ static void gst_tcp_client_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static GstElementClass *parent_class = NULL;
/*static guint gst_tcp_client_sink_signals[LAST_SIGNAL] = { 0 }; */ /*static guint gst_tcp_client_sink_signals[LAST_SIGNAL] = { 0 }; */
GType #define gst_tcp_client_sink_parent_class parent_class
gst_tcp_client_sink_get_type (void) G_DEFINE_TYPE (GstTCPClientSink, gst_tcp_client_sink, GST_TYPE_BASE_SINK);
{
static GType tcpclientsink_type = 0;
if (!tcpclientsink_type) {
static const GTypeInfo tcpclientsink_info = {
sizeof (GstTCPClientSinkClass),
gst_tcp_client_sink_base_init,
NULL,
(GClassInitFunc) gst_tcp_client_sink_class_init,
NULL,
NULL,
sizeof (GstTCPClientSink),
0,
(GInstanceInitFunc) gst_tcp_client_sink_init,
NULL
};
tcpclientsink_type =
g_type_register_static (GST_TYPE_BASE_SINK, "GstTCPClientSink",
&tcpclientsink_info, 0);
}
return tcpclientsink_type;
}
static void static void
gst_tcp_client_sink_base_init (gpointer g_class) gst_tcp_client_sink_class_init (GstTCPClientSinkClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sinktemplate));
gst_element_class_set_details_simple (element_class,
"TCP client sink", "Sink/Network",
"Send data as a client over the network via TCP",
"Thomas Vander Stichele <thomas at apestaart dot org>");
}
static void
gst_tcp_client_sink_class_init (GstTCPClientSink * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class; GstElementClass *gstelement_class;
@ -153,6 +110,14 @@ gst_tcp_client_sink_class_init (GstTCPClientSink * klass)
0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT, 0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sinktemplate));
gst_element_class_set_details_simple (gstelement_class,
"TCP client sink", "Sink/Network",
"Send data as a client over the network via TCP",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gstelement_class->change_state = gst_tcp_client_sink_change_state; gstelement_class->change_state = gst_tcp_client_sink_change_state;
gstbasesink_class->set_caps = gst_tcp_client_sink_setcaps; gstbasesink_class->set_caps = gst_tcp_client_sink_setcaps;

View file

@ -65,9 +65,8 @@ enum
PROP_PORT PROP_PORT
}; };
#define gst_tcp_client_src_parent_class parent_class
GST_BOILERPLATE (GstTCPClientSrc, gst_tcp_client_src, GstPushSrc, G_DEFINE_TYPE (GstTCPClientSrc, gst_tcp_client_src, GST_TYPE_PUSH_SRC);
GST_TYPE_PUSH_SRC);
static void gst_tcp_client_src_finalize (GObject * gobject); static void gst_tcp_client_src_finalize (GObject * gobject);
@ -86,29 +85,16 @@ static void gst_tcp_client_src_set_property (GObject * object, guint prop_id,
static void gst_tcp_client_src_get_property (GObject * object, guint prop_id, static void gst_tcp_client_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static void
gst_tcp_client_src_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_set_details_simple (element_class,
"TCP client source", "Source/Network",
"Receive data as a client over the network via TCP",
"Thomas Vander Stichele <thomas at apestaart dot org>");
}
static void static void
gst_tcp_client_src_class_init (GstTCPClientSrcClass * klass) gst_tcp_client_src_class_init (GstTCPClientSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstBaseSrcClass *gstbasesrc_class; GstBaseSrcClass *gstbasesrc_class;
GstPushSrcClass *gstpush_src_class; GstPushSrcClass *gstpush_src_class;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass; gstbasesrc_class = (GstBaseSrcClass *) klass;
gstpush_src_class = (GstPushSrcClass *) klass; gstpush_src_class = (GstPushSrcClass *) klass;
@ -125,6 +111,14 @@ gst_tcp_client_src_class_init (GstTCPClientSrcClass * klass)
TCP_HIGHEST_PORT, TCP_DEFAULT_PORT, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_set_details_simple (gstelement_class,
"TCP client source", "Source/Network",
"Receive data as a client over the network via TCP",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gstbasesrc_class->get_caps = gst_tcp_client_src_getcaps; gstbasesrc_class->get_caps = gst_tcp_client_src_getcaps;
gstbasesrc_class->start = gst_tcp_client_src_start; gstbasesrc_class->start = gst_tcp_client_src_start;
gstbasesrc_class->stop = gst_tcp_client_src_stop; gstbasesrc_class->stop = gst_tcp_client_src_stop;
@ -138,7 +132,7 @@ gst_tcp_client_src_class_init (GstTCPClientSrcClass * klass)
} }
static void static void
gst_tcp_client_src_init (GstTCPClientSrc * this, GstTCPClientSrcClass * g_class) gst_tcp_client_src_init (GstTCPClientSrc * this)
{ {
this->port = TCP_DEFAULT_PORT; this->port = TCP_DEFAULT_PORT;
this->host = g_strdup (TCP_DEFAULT_HOST); this->host = g_strdup (TCP_DEFAULT_HOST);

View file

@ -74,29 +74,18 @@ static void gst_tcp_server_sink_set_property (GObject * object, guint prop_id,
static void gst_tcp_server_sink_get_property (GObject * object, guint prop_id, static void gst_tcp_server_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
#define gst_tcp_server_sink_parent_class parent_class
GST_BOILERPLATE (GstTCPServerSink, gst_tcp_server_sink, GstMultiFdSink, G_DEFINE_TYPE (GstTCPServerSink, gst_tcp_server_sink, GST_TYPE_MULTI_FD_SINK);
GST_TYPE_MULTI_FD_SINK);
static void
gst_tcp_server_sink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"TCP server sink", "Sink/Network",
"Send data as a server over the network via TCP",
"Thomas Vander Stichele <thomas at apestaart dot org>");
}
static void static void
gst_tcp_server_sink_class_init (GstTCPServerSinkClass * klass) gst_tcp_server_sink_class_init (GstTCPServerSinkClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstMultiFdSinkClass *gstmultifdsink_class; GstMultiFdSinkClass *gstmultifdsink_class;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstmultifdsink_class = (GstMultiFdSinkClass *) klass; gstmultifdsink_class = (GstMultiFdSinkClass *) klass;
gobject_class->set_property = gst_tcp_server_sink_set_property; gobject_class->set_property = gst_tcp_server_sink_set_property;
@ -111,6 +100,11 @@ gst_tcp_server_sink_class_init (GstTCPServerSinkClass * klass)
0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT, 0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class,
"TCP server sink", "Sink/Network",
"Send data as a server over the network via TCP",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gstmultifdsink_class->init = gst_tcp_server_sink_init_send; gstmultifdsink_class->init = gst_tcp_server_sink_init_send;
gstmultifdsink_class->wait = gst_tcp_server_sink_handle_wait; gstmultifdsink_class->wait = gst_tcp_server_sink_handle_wait;
gstmultifdsink_class->close = gst_tcp_server_sink_close; gstmultifdsink_class->close = gst_tcp_server_sink_close;
@ -120,8 +114,7 @@ gst_tcp_server_sink_class_init (GstTCPServerSinkClass * klass)
} }
static void static void
gst_tcp_server_sink_init (GstTCPServerSink * this, gst_tcp_server_sink_init (GstTCPServerSink * this)
GstTCPServerSinkClass * klass)
{ {
this->server_port = TCP_DEFAULT_PORT; this->server_port = TCP_DEFAULT_PORT;
/* should support as minimum 576 for IPV4 and 1500 for IPV6 */ /* should support as minimum 576 for IPV4 and 1500 for IPV6 */

View file

@ -66,9 +66,8 @@ enum
PROP_PORT PROP_PORT
}; };
#define gst_tcp_server_src_parent_class parent_class
GST_BOILERPLATE (GstTCPServerSrc, gst_tcp_server_src, GstPushSrc, G_DEFINE_TYPE (GstTCPServerSrc, gst_tcp_server_src, GST_TYPE_PUSH_SRC);
GST_TYPE_PUSH_SRC);
static void gst_tcp_server_src_finalize (GObject * gobject); static void gst_tcp_server_src_finalize (GObject * gobject);
@ -84,29 +83,16 @@ static void gst_tcp_server_src_set_property (GObject * object, guint prop_id,
static void gst_tcp_server_src_get_property (GObject * object, guint prop_id, static void gst_tcp_server_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
static void
gst_tcp_server_src_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_set_details_simple (element_class,
"TCP server source", "Source/Network",
"Receive data as a server over the network via TCP",
"Thomas Vander Stichele <thomas at apestaart dot org>");
}
static void static void
gst_tcp_server_src_class_init (GstTCPServerSrcClass * klass) gst_tcp_server_src_class_init (GstTCPServerSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstBaseSrcClass *gstbasesrc_class; GstBaseSrcClass *gstbasesrc_class;
GstPushSrcClass *gstpush_src_class; GstPushSrcClass *gstpush_src_class;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass; gstbasesrc_class = (GstBaseSrcClass *) klass;
gstpush_src_class = (GstPushSrcClass *) klass; gstpush_src_class = (GstPushSrcClass *) klass;
@ -122,6 +108,14 @@ gst_tcp_server_src_class_init (GstTCPServerSrcClass * klass)
0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT, 0, TCP_HIGHEST_PORT, TCP_DEFAULT_PORT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&srctemplate));
gst_element_class_set_details_simple (gstelement_class,
"TCP server source", "Source/Network",
"Receive data as a server over the network via TCP",
"Thomas Vander Stichele <thomas at apestaart dot org>");
gstbasesrc_class->start = gst_tcp_server_src_start; gstbasesrc_class->start = gst_tcp_server_src_start;
gstbasesrc_class->stop = gst_tcp_server_src_stop; gstbasesrc_class->stop = gst_tcp_server_src_stop;
gstbasesrc_class->unlock = gst_tcp_server_src_unlock; gstbasesrc_class->unlock = gst_tcp_server_src_unlock;
@ -133,7 +127,7 @@ gst_tcp_server_src_class_init (GstTCPServerSrcClass * klass)
} }
static void static void
gst_tcp_server_src_init (GstTCPServerSrc * src, GstTCPServerSrcClass * g_class) gst_tcp_server_src_init (GstTCPServerSrc * src)
{ {
src->server_port = TCP_DEFAULT_PORT; src->server_port = TCP_DEFAULT_PORT;
src->host = g_strdup (TCP_DEFAULT_HOST); src->host = g_strdup (TCP_DEFAULT_HOST);

View file

@ -135,23 +135,8 @@ static GstStateChangeReturn gst_video_rate_change_state (GstElement * element,
static GParamSpec *pspec_drop = NULL; static GParamSpec *pspec_drop = NULL;
static GParamSpec *pspec_duplicate = NULL; static GParamSpec *pspec_duplicate = NULL;
GST_BOILERPLATE (GstVideoRate, gst_video_rate, GstElement, GST_TYPE_ELEMENT); #define gst_video_rate_parent_class parent_class
G_DEFINE_TYPE (GstVideoRate, gst_video_rate, GST_TYPE_ELEMENT);
static void
gst_video_rate_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"Video rate adjuster", "Filter/Effect/Video",
"Drops/duplicates/adjusts timestamps on video frames to make a perfect stream",
"Wim Taymans <wim@fluendo.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_video_rate_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_video_rate_src_template));
}
static void static void
gst_video_rate_class_init (GstVideoRateClass * klass) gst_video_rate_class_init (GstVideoRateClass * klass)
@ -199,6 +184,16 @@ gst_video_rate_class_init (GstVideoRateClass * klass)
"Don't produce buffers before the first one we receive", "Don't produce buffers before the first one we receive",
DEFAULT_SKIP_TO_FIRST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); DEFAULT_SKIP_TO_FIRST, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (element_class,
"Video rate adjuster", "Filter/Effect/Video",
"Drops/duplicates/adjusts timestamps on video frames to make a perfect stream",
"Wim Taymans <wim@fluendo.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_video_rate_sink_template));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_video_rate_src_template));
element_class->change_state = GST_DEBUG_FUNCPTR (gst_video_rate_change_state); element_class->change_state = GST_DEBUG_FUNCPTR (gst_video_rate_change_state);
} }
@ -423,7 +418,7 @@ gst_video_rate_reset (GstVideoRate * videorate)
} }
static void static void
gst_video_rate_init (GstVideoRate * videorate, GstVideoRateClass * klass) gst_video_rate_init (GstVideoRate * videorate)
{ {
videorate->sinkpad = videorate->sinkpad =
gst_pad_new_from_static_template (&gst_video_rate_sink_template, "sink"); gst_pad_new_from_static_template (&gst_video_rate_sink_template, "sink");
@ -993,7 +988,7 @@ gst_video_rate_change_state (GstElement * element, GstStateChange transition)
break; break;
} }
ret = parent_class->change_state (element, transition); ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY: case GST_STATE_CHANGE_PAUSED_TO_READY:

View file

@ -212,28 +212,14 @@ static void gst_video_scale_set_property (GObject * object, guint prop_id,
static void gst_video_scale_get_property (GObject * object, guint prop_id, static void gst_video_scale_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec); GValue * value, GParamSpec * pspec);
GST_BOILERPLATE (GstVideoScale, gst_video_scale, GstVideoFilter, #define gst_video_scale_parent_class parent_class
GST_TYPE_VIDEO_FILTER); G_DEFINE_TYPE (GstVideoScale, gst_video_scale, GST_TYPE_VIDEO_FILTER);
static void
gst_video_scale_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"Video scaler", "Filter/Converter/Video/Scaler",
"Resizes video", "Wim Taymans <wim.taymans@chello.be>");
gst_element_class_add_pad_template (element_class,
gst_video_scale_sink_template_factory ());
gst_element_class_add_pad_template (element_class,
gst_video_scale_src_template_factory ());
}
static void static void
gst_video_scale_class_init (GstVideoScaleClass * klass) gst_video_scale_class_init (GstVideoScaleClass * klass)
{ {
GObjectClass *gobject_class = (GObjectClass *) klass; GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *element_class = (GstElementClass *) klass;
GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass; GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
gobject_class->finalize = (GObjectFinalizeFunc) gst_video_scale_finalize; gobject_class->finalize = (GObjectFinalizeFunc) gst_video_scale_finalize;
@ -251,6 +237,15 @@ gst_video_scale_class_init (GstVideoScaleClass * klass)
DEFAULT_PROP_ADD_BORDERS, DEFAULT_PROP_ADD_BORDERS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (element_class,
"Video scaler", "Filter/Converter/Video/Scaler",
"Resizes video", "Wim Taymans <wim.taymans@chello.be>");
gst_element_class_add_pad_template (element_class,
gst_video_scale_sink_template_factory ());
gst_element_class_add_pad_template (element_class,
gst_video_scale_src_template_factory ());
trans_class->transform_caps = trans_class->transform_caps =
GST_DEBUG_FUNCPTR (gst_video_scale_transform_caps); GST_DEBUG_FUNCPTR (gst_video_scale_transform_caps);
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_scale_set_caps); trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_scale_set_caps);
@ -262,7 +257,7 @@ gst_video_scale_class_init (GstVideoScaleClass * klass)
} }
static void static void
gst_video_scale_init (GstVideoScale * videoscale, GstVideoScaleClass * klass) gst_video_scale_init (GstVideoScale * videoscale)
{ {
videoscale->tmp_buf = NULL; videoscale->tmp_buf = NULL;
videoscale->method = DEFAULT_PROP_METHOD; videoscale->method = DEFAULT_PROP_METHOD;

View file

@ -82,9 +82,8 @@ enum
}; };
GST_BOILERPLATE (GstVideoTestSrc, gst_video_test_src, GstPushSrc, #define gst_video_test_src_parent_class parent_class
GST_TYPE_PUSH_SRC); G_DEFINE_TYPE (GstVideoTestSrc, gst_video_test_src, GST_TYPE_PUSH_SRC);
static void gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc, static void gst_video_test_src_set_pattern (GstVideoTestSrc * videotestsrc,
int pattern_type); int pattern_type);
@ -164,28 +163,16 @@ gst_video_test_src_color_spec_get_type (void)
return video_test_src_color_spec_type; return video_test_src_color_spec_type;
} }
static void
gst_video_test_src_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_set_details_simple (element_class,
"Video test source", "Source/Video",
"Creates a test video stream", "David A. Schleef <ds@schleef.org>");
gst_element_class_add_pad_template (element_class,
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
gst_video_test_src_getcaps (NULL)));
}
static void static void
gst_video_test_src_class_init (GstVideoTestSrcClass * klass) gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstBaseSrcClass *gstbasesrc_class; GstBaseSrcClass *gstbasesrc_class;
GstPushSrcClass *gstpushsrc_class; GstPushSrcClass *gstpushsrc_class;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass; gstbasesrc_class = (GstBaseSrcClass *) klass;
gstpushsrc_class = (GstPushSrcClass *) klass; gstpushsrc_class = (GstPushSrcClass *) klass;
@ -303,6 +290,14 @@ gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
G_MININT32, G_MAXINT32, DEFAULT_HORIZONTAL_SPEED, G_MININT32, G_MAXINT32, DEFAULT_HORIZONTAL_SPEED,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (gstelement_class,
"Video test source", "Source/Video",
"Creates a test video stream", "David A. Schleef <ds@schleef.org>");
gst_element_class_add_pad_template (gstelement_class,
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
gst_video_test_src_getcaps (NULL)));
gstbasesrc_class->get_caps = gst_video_test_src_getcaps; gstbasesrc_class->get_caps = gst_video_test_src_getcaps;
gstbasesrc_class->set_caps = gst_video_test_src_setcaps; gstbasesrc_class->set_caps = gst_video_test_src_setcaps;
gstbasesrc_class->is_seekable = gst_video_test_src_is_seekable; gstbasesrc_class->is_seekable = gst_video_test_src_is_seekable;
@ -315,7 +310,7 @@ gst_video_test_src_class_init (GstVideoTestSrcClass * klass)
} }
static void static void
gst_video_test_src_init (GstVideoTestSrc * src, GstVideoTestSrcClass * g_class) gst_video_test_src_init (GstVideoTestSrc * src)
{ {
GstPad *pad = GST_BASE_SRC_PAD (src); GstPad *pad = GST_BASE_SRC_PAD (src);

View file

@ -142,32 +142,12 @@ enum
static void gst_volume_interface_init (GstImplementsInterfaceClass * klass); static void gst_volume_interface_init (GstImplementsInterfaceClass * klass);
static void gst_volume_mixer_init (GstMixerClass * iface); static void gst_volume_mixer_init (GstMixerClass * iface);
#define _init_interfaces(type) \ #define gst_volume_parent_class parent_class
{ \ G_DEFINE_TYPE_WITH_CODE (GstVolume, gst_volume,
static const GInterfaceInfo voliface_info = { \ GST_TYPE_AUDIO_FILTER, G_IMPLEMENT_INTERFACE (GST_TYPE_IMPLEMENTS_INTERFACE,
(GInterfaceInitFunc) gst_volume_interface_init, \ gst_volume_interface_init);
NULL, \ G_IMPLEMENT_INTERFACE (GST_TYPE_MIXER, gst_volume_mixer_init);
NULL \ G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL));
}; \
static const GInterfaceInfo volmixer_info = { \
(GInterfaceInitFunc) gst_volume_mixer_init, \
NULL, \
NULL \
}; \
static const GInterfaceInfo svol_info = { \
NULL, \
NULL, \
NULL \
}; \
\
g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, \
&voliface_info); \
g_type_add_interface_static (type, GST_TYPE_MIXER, &volmixer_info); \
g_type_add_interface_static (type, GST_TYPE_STREAM_VOLUME, &svol_info); \
}
GST_BOILERPLATE_FULL (GstVolume, gst_volume, GstAudioFilter,
GST_TYPE_AUDIO_FILTER, _init_interfaces);
static void volume_set_property (GObject * object, guint prop_id, static void volume_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec); const GValue * value, GParamSpec * pspec);
@ -431,30 +411,17 @@ gst_volume_dispose (GObject * object)
G_OBJECT_CLASS (parent_class)->dispose (object); G_OBJECT_CLASS (parent_class)->dispose (object);
} }
static void
gst_volume_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GstAudioFilterClass *filter_class = GST_AUDIO_FILTER_CLASS (g_class);
GstCaps *caps;
gst_element_class_set_details_simple (element_class, "Volume",
"Filter/Effect/Audio",
"Set volume on audio/raw streams", "Andy Wingo <wingo@pobox.com>");
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (filter_class, caps);
gst_caps_unref (caps);
}
static void static void
gst_volume_class_init (GstVolumeClass * klass) gst_volume_class_init (GstVolumeClass * klass)
{ {
GObjectClass *gobject_class; GObjectClass *gobject_class;
GstElementClass *element_class;
GstBaseTransformClass *trans_class; GstBaseTransformClass *trans_class;
GstAudioFilterClass *filter_class; GstAudioFilterClass *filter_class;
GstCaps *caps;
gobject_class = (GObjectClass *) klass; gobject_class = (GObjectClass *) klass;
element_class = (GstElementClass *) klass;
trans_class = (GstBaseTransformClass *) klass; trans_class = (GstBaseTransformClass *) klass;
filter_class = (GstAudioFilterClass *) (klass); filter_class = (GstAudioFilterClass *) (klass);
@ -472,6 +439,14 @@ gst_volume_class_init (GstVolumeClass * klass)
0.0, VOLUME_MAX_DOUBLE, DEFAULT_PROP_VOLUME, 0.0, VOLUME_MAX_DOUBLE, DEFAULT_PROP_VOLUME,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
gst_element_class_set_details_simple (element_class, "Volume",
"Filter/Effect/Audio",
"Set volume on audio/raw streams", "Andy Wingo <wingo@pobox.com>");
caps = gst_caps_from_string (ALLOWED_CAPS);
gst_audio_filter_class_add_pad_templates (filter_class, caps);
gst_caps_unref (caps);
trans_class->before_transform = GST_DEBUG_FUNCPTR (volume_before_transform); trans_class->before_transform = GST_DEBUG_FUNCPTR (volume_before_transform);
trans_class->transform_ip = GST_DEBUG_FUNCPTR (volume_transform_ip); trans_class->transform_ip = GST_DEBUG_FUNCPTR (volume_transform_ip);
trans_class->stop = GST_DEBUG_FUNCPTR (volume_stop); trans_class->stop = GST_DEBUG_FUNCPTR (volume_stop);
@ -479,7 +454,7 @@ gst_volume_class_init (GstVolumeClass * klass)
} }
static void static void
gst_volume_init (GstVolume * self, GstVolumeClass * g_class) gst_volume_init (GstVolume * self)
{ {
GstMixerTrack *track = NULL; GstMixerTrack *track = NULL;