mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
sys: Use G_DEFINE_TYPE instead of GST_BOILERPLATE
This commit is contained in:
parent
fc4d766e28
commit
8336e2027d
2 changed files with 65 additions and 162 deletions
|
@ -154,7 +154,26 @@ enum
|
||||||
PROP_WINDOW_HEIGHT
|
PROP_WINDOW_HEIGHT
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstVideoSinkClass *parent_class = NULL;
|
/* ============================================================= */
|
||||||
|
/* */
|
||||||
|
/* Public Methods */
|
||||||
|
/* */
|
||||||
|
/* ============================================================= */
|
||||||
|
|
||||||
|
/* =========================================== */
|
||||||
|
/* */
|
||||||
|
/* Object typing & Creation */
|
||||||
|
/* */
|
||||||
|
/* =========================================== */
|
||||||
|
static void gst_ximagesink_interface_init (GstImplementsInterfaceClass * klass);
|
||||||
|
static void gst_ximagesink_navigation_init (GstNavigationInterface * klass);
|
||||||
|
static void gst_ximagesink_xoverlay_init (GstXOverlayClass * klass);
|
||||||
|
#define gst_ximagesink_parent_class parent_class
|
||||||
|
G_DEFINE_TYPE_WITH_CODE (GstXImageSink, gst_ximagesink, GST_TYPE_VIDEO_SINK,
|
||||||
|
G_IMPLEMENT_INTERFACE (GST_TYPE_IMPLEMENTS_INTERFACE,
|
||||||
|
gst_ximagesink_interface_init);
|
||||||
|
G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION, gst_ximagesink_navigation_init);
|
||||||
|
G_IMPLEMENT_INTERFACE (GST_TYPE_X_OVERLAY, gst_ximagesink_xoverlay_init));
|
||||||
|
|
||||||
/* ============================================================= */
|
/* ============================================================= */
|
||||||
/* */
|
/* */
|
||||||
|
@ -1909,19 +1928,6 @@ gst_ximagesink_init (GstXImageSink * ximagesink)
|
||||||
ximagesink->handle_expose = TRUE;
|
ximagesink->handle_expose = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_ximagesink_base_init (gpointer g_class)
|
|
||||||
{
|
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
||||||
|
|
||||||
gst_element_class_set_details_simple (element_class,
|
|
||||||
"Video sink", "Sink/Video",
|
|
||||||
"A standard X based videosink", "Julien Moutte <julien@moutte.net>");
|
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&gst_ximagesink_sink_template_factory));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_ximagesink_class_init (GstXImageSinkClass * klass)
|
gst_ximagesink_class_init (GstXImageSinkClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -1935,8 +1941,6 @@ gst_ximagesink_class_init (GstXImageSinkClass * klass)
|
||||||
gstbasesink_class = (GstBaseSinkClass *) klass;
|
gstbasesink_class = (GstBaseSinkClass *) klass;
|
||||||
videosink_class = (GstVideoSinkClass *) klass;
|
videosink_class = (GstVideoSinkClass *) klass;
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
|
||||||
|
|
||||||
gobject_class->finalize = gst_ximagesink_finalize;
|
gobject_class->finalize = gst_ximagesink_finalize;
|
||||||
gobject_class->set_property = gst_ximagesink_set_property;
|
gobject_class->set_property = gst_ximagesink_set_property;
|
||||||
gobject_class->get_property = gst_ximagesink_get_property;
|
gobject_class->get_property = gst_ximagesink_get_property;
|
||||||
|
@ -1991,6 +1995,13 @@ gst_ximagesink_class_init (GstXImageSinkClass * klass)
|
||||||
"Height of the window", 0, G_MAXUINT64, 0,
|
"Height of the window", 0, G_MAXUINT64, 0,
|
||||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
gst_element_class_set_details_simple (gstelement_class,
|
||||||
|
"Video sink", "Sink/Video",
|
||||||
|
"A standard X based videosink", "Julien Moutte <julien@moutte.net>");
|
||||||
|
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&gst_ximagesink_sink_template_factory));
|
||||||
|
|
||||||
gstelement_class->change_state = gst_ximagesink_change_state;
|
gstelement_class->change_state = gst_ximagesink_change_state;
|
||||||
|
|
||||||
gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_ximagesink_getcaps);
|
gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_ximagesink_getcaps);
|
||||||
|
@ -2002,59 +2013,3 @@ gst_ximagesink_class_init (GstXImageSinkClass * klass)
|
||||||
|
|
||||||
videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_ximagesink_show_frame);
|
videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_ximagesink_show_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ============================================================= */
|
|
||||||
/* */
|
|
||||||
/* Public Methods */
|
|
||||||
/* */
|
|
||||||
/* ============================================================= */
|
|
||||||
|
|
||||||
/* =========================================== */
|
|
||||||
/* */
|
|
||||||
/* Object typing & Creation */
|
|
||||||
/* */
|
|
||||||
/* =========================================== */
|
|
||||||
|
|
||||||
GType
|
|
||||||
gst_ximagesink_get_type (void)
|
|
||||||
{
|
|
||||||
static GType ximagesink_type = 0;
|
|
||||||
|
|
||||||
if (!ximagesink_type) {
|
|
||||||
static const GTypeInfo ximagesink_info = {
|
|
||||||
sizeof (GstXImageSinkClass),
|
|
||||||
gst_ximagesink_base_init,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_ximagesink_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstXImageSink), 0, (GInstanceInitFunc) gst_ximagesink_init,
|
|
||||||
};
|
|
||||||
static const GInterfaceInfo iface_info = {
|
|
||||||
(GInterfaceInitFunc) gst_ximagesink_interface_init, NULL, NULL,
|
|
||||||
};
|
|
||||||
static const GInterfaceInfo navigation_info = {
|
|
||||||
(GInterfaceInitFunc) gst_ximagesink_navigation_init, NULL, NULL,
|
|
||||||
};
|
|
||||||
static const GInterfaceInfo overlay_info = {
|
|
||||||
(GInterfaceInitFunc) gst_ximagesink_xoverlay_init, NULL, NULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
ximagesink_type = g_type_register_static (GST_TYPE_VIDEO_SINK,
|
|
||||||
"GstXImageSink", &ximagesink_info, 0);
|
|
||||||
|
|
||||||
g_type_add_interface_static (ximagesink_type, GST_TYPE_IMPLEMENTS_INTERFACE,
|
|
||||||
&iface_info);
|
|
||||||
g_type_add_interface_static (ximagesink_type, GST_TYPE_NAVIGATION,
|
|
||||||
&navigation_info);
|
|
||||||
g_type_add_interface_static (ximagesink_type, GST_TYPE_X_OVERLAY,
|
|
||||||
&overlay_info);
|
|
||||||
|
|
||||||
/* register type and create class in a more safe place instead of at
|
|
||||||
* runtime since the type registration and class creation is not
|
|
||||||
* threadsafe. */
|
|
||||||
g_type_class_ref (gst_ximage_buffer_pool_get_type ());
|
|
||||||
}
|
|
||||||
|
|
||||||
return ximagesink_type;
|
|
||||||
}
|
|
||||||
|
|
|
@ -186,7 +186,37 @@ enum
|
||||||
PROP_WINDOW_HEIGHT
|
PROP_WINDOW_HEIGHT
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstVideoSinkClass *parent_class = NULL;
|
/* ============================================================= */
|
||||||
|
/* */
|
||||||
|
/* Public Methods */
|
||||||
|
/* */
|
||||||
|
/* ============================================================= */
|
||||||
|
|
||||||
|
/* =========================================== */
|
||||||
|
/* */
|
||||||
|
/* Object typing & Creation */
|
||||||
|
/* */
|
||||||
|
/* =========================================== */
|
||||||
|
static void gst_xvimagesink_interface_init (GstImplementsInterfaceClass *
|
||||||
|
klass);
|
||||||
|
static void gst_xvimagesink_navigation_init (GstNavigationInterface * iface);
|
||||||
|
static void gst_xvimagesink_xoverlay_init (GstXOverlayClass * iface);
|
||||||
|
static void gst_xvimagesink_colorbalance_init (GstColorBalanceClass * iface);
|
||||||
|
static void
|
||||||
|
gst_xvimagesink_property_probe_interface_init (GstPropertyProbeInterface *
|
||||||
|
iface);
|
||||||
|
#define gst_xvimagesink_parent_class parent_class
|
||||||
|
G_DEFINE_TYPE_WITH_CODE (GstXvImageSink, gst_xvimagesink, GST_TYPE_VIDEO_SINK,
|
||||||
|
G_IMPLEMENT_INTERFACE (GST_TYPE_IMPLEMENTS_INTERFACE,
|
||||||
|
gst_xvimagesink_interface_init);
|
||||||
|
G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION,
|
||||||
|
gst_xvimagesink_navigation_init);
|
||||||
|
G_IMPLEMENT_INTERFACE (GST_TYPE_X_OVERLAY, gst_xvimagesink_xoverlay_init);
|
||||||
|
G_IMPLEMENT_INTERFACE (GST_TYPE_COLOR_BALANCE,
|
||||||
|
gst_xvimagesink_colorbalance_init);
|
||||||
|
G_IMPLEMENT_INTERFACE (GST_TYPE_PROPERTY_PROBE,
|
||||||
|
gst_xvimagesink_property_probe_interface_init));
|
||||||
|
|
||||||
|
|
||||||
/* ============================================================= */
|
/* ============================================================= */
|
||||||
/* */
|
/* */
|
||||||
|
@ -2947,19 +2977,6 @@ gst_xvimagesink_init (GstXvImageSink * xvimagesink)
|
||||||
xvimagesink->draw_borders = TRUE;
|
xvimagesink->draw_borders = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
gst_xvimagesink_base_init (gpointer g_class)
|
|
||||||
{
|
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
||||||
|
|
||||||
gst_element_class_set_details_simple (element_class,
|
|
||||||
"Video sink", "Sink/Video",
|
|
||||||
"A Xv based videosink", "Julien Moutte <julien@moutte.net>");
|
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&gst_xvimagesink_sink_template_factory));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_xvimagesink_class_init (GstXvImageSinkClass * klass)
|
gst_xvimagesink_class_init (GstXvImageSinkClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -3107,6 +3124,13 @@ gst_xvimagesink_class_init (GstXvImageSinkClass * klass)
|
||||||
|
|
||||||
gobject_class->finalize = gst_xvimagesink_finalize;
|
gobject_class->finalize = gst_xvimagesink_finalize;
|
||||||
|
|
||||||
|
gst_element_class_set_details_simple (gstelement_class,
|
||||||
|
"Video sink", "Sink/Video",
|
||||||
|
"A Xv based videosink", "Julien Moutte <julien@moutte.net>");
|
||||||
|
|
||||||
|
gst_element_class_add_pad_template (gstelement_class,
|
||||||
|
gst_static_pad_template_get (&gst_xvimagesink_sink_template_factory));
|
||||||
|
|
||||||
gstelement_class->change_state =
|
gstelement_class->change_state =
|
||||||
GST_DEBUG_FUNCPTR (gst_xvimagesink_change_state);
|
GST_DEBUG_FUNCPTR (gst_xvimagesink_change_state);
|
||||||
|
|
||||||
|
@ -3119,79 +3143,3 @@ gst_xvimagesink_class_init (GstXvImageSinkClass * klass)
|
||||||
|
|
||||||
videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_xvimagesink_show_frame);
|
videosink_class->show_frame = GST_DEBUG_FUNCPTR (gst_xvimagesink_show_frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ============================================================= */
|
|
||||||
/* */
|
|
||||||
/* Public Methods */
|
|
||||||
/* */
|
|
||||||
/* ============================================================= */
|
|
||||||
|
|
||||||
/* =========================================== */
|
|
||||||
/* */
|
|
||||||
/* Object typing & Creation */
|
|
||||||
/* */
|
|
||||||
/* =========================================== */
|
|
||||||
|
|
||||||
GType
|
|
||||||
gst_xvimagesink_get_type (void)
|
|
||||||
{
|
|
||||||
static GType xvimagesink_type = 0;
|
|
||||||
|
|
||||||
if (!xvimagesink_type) {
|
|
||||||
static const GTypeInfo xvimagesink_info = {
|
|
||||||
sizeof (GstXvImageSinkClass),
|
|
||||||
gst_xvimagesink_base_init,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_xvimagesink_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstXvImageSink),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_xvimagesink_init,
|
|
||||||
};
|
|
||||||
static const GInterfaceInfo iface_info = {
|
|
||||||
(GInterfaceInitFunc) gst_xvimagesink_interface_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
static const GInterfaceInfo navigation_info = {
|
|
||||||
(GInterfaceInitFunc) gst_xvimagesink_navigation_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
static const GInterfaceInfo overlay_info = {
|
|
||||||
(GInterfaceInitFunc) gst_xvimagesink_xoverlay_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
static const GInterfaceInfo colorbalance_info = {
|
|
||||||
(GInterfaceInitFunc) gst_xvimagesink_colorbalance_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
static const GInterfaceInfo propertyprobe_info = {
|
|
||||||
(GInterfaceInitFunc) gst_xvimagesink_property_probe_interface_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
xvimagesink_type = g_type_register_static (GST_TYPE_VIDEO_SINK,
|
|
||||||
"GstXvImageSink", &xvimagesink_info, 0);
|
|
||||||
|
|
||||||
g_type_add_interface_static (xvimagesink_type,
|
|
||||||
GST_TYPE_IMPLEMENTS_INTERFACE, &iface_info);
|
|
||||||
g_type_add_interface_static (xvimagesink_type, GST_TYPE_NAVIGATION,
|
|
||||||
&navigation_info);
|
|
||||||
g_type_add_interface_static (xvimagesink_type, GST_TYPE_X_OVERLAY,
|
|
||||||
&overlay_info);
|
|
||||||
g_type_add_interface_static (xvimagesink_type, GST_TYPE_COLOR_BALANCE,
|
|
||||||
&colorbalance_info);
|
|
||||||
g_type_add_interface_static (xvimagesink_type, GST_TYPE_PROPERTY_PROBE,
|
|
||||||
&propertyprobe_info);
|
|
||||||
/* register type and create class in a more safe place instead of at
|
|
||||||
* runtime since the type registration and class creation is not
|
|
||||||
* threadsafe. */
|
|
||||||
g_type_class_ref (gst_xvimage_buffer_pool_get_type ());
|
|
||||||
}
|
|
||||||
|
|
||||||
return xvimagesink_type;
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue