app: Use G_DEFINE_TYPE instead of GST_BOILERPLATE

This commit is contained in:
Sebastian Dröge 2011-04-19 10:47:15 +02:00
parent a7e8c8debe
commit 0f1741da23
2 changed files with 29 additions and 60 deletions

View file

@ -185,20 +185,10 @@ static GstMiniObject *gst_app_sink_pull_object (GstAppSink * appsink);
static guint gst_app_sink_signals[LAST_SIGNAL] = { 0 }; static guint gst_app_sink_signals[LAST_SIGNAL] = { 0 };
static void #define gst_app_sink_parent_class parent_class
_do_init (GType filesrc_type) G_DEFINE_TYPE_WITH_CODE (GstAppSink, gst_app_sink, GST_TYPE_BASE_SINK,
{ G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER,
static const GInterfaceInfo urihandler_info = { gst_app_sink_uri_handler_init));
gst_app_sink_uri_handler_init,
NULL,
NULL
};
g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER,
&urihandler_info);
}
GST_BOILERPLATE_FULL (GstAppSink, gst_app_sink, GstBaseSink, GST_TYPE_BASE_SINK,
_do_init);
/* Can't use glib-genmarshal for this, as it doesn't know how to handle /* Can't use glib-genmarshal for this, as it doesn't know how to handle
* GstMiniObject-based types, which are a new fundamental type */ * GstMiniObject-based types, which are a new fundamental type */
@ -234,27 +224,15 @@ gst_app_marshal_BUFFER__VOID (GClosure * closure,
gst_value_take_buffer (return_value, v_return); gst_value_take_buffer (return_value, v_return);
} }
static void
gst_app_sink_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GST_DEBUG_CATEGORY_INIT (app_sink_debug, "appsink", 0, "appsink element");
gst_element_class_set_details_simple (element_class, "AppSink",
"Generic/Sink", "Allow the application to get access to raw buffer",
"David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_app_sink_template));
}
static void static void
gst_app_sink_class_init (GstAppSinkClass * klass) gst_app_sink_class_init (GstAppSinkClass * klass)
{ {
GObjectClass *gobject_class = (GObjectClass *) klass; GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *element_class = (GstElementClass *) klass;
GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass; GstBaseSinkClass *basesink_class = (GstBaseSinkClass *) klass;
GST_DEBUG_CATEGORY_INIT (app_sink_debug, "appsink", 0, "appsink element");
gobject_class->dispose = gst_app_sink_dispose; gobject_class->dispose = gst_app_sink_dispose;
gobject_class->finalize = gst_app_sink_finalize; gobject_class->finalize = gst_app_sink_finalize;
@ -441,6 +419,13 @@ gst_app_sink_class_init (GstAppSinkClass * klass)
pull_buffer_list), NULL, NULL, gst_app_marshal_BUFFER__VOID, pull_buffer_list), NULL, NULL, gst_app_marshal_BUFFER__VOID,
GST_TYPE_BUFFER_LIST, 0, G_TYPE_NONE); GST_TYPE_BUFFER_LIST, 0, G_TYPE_NONE);
gst_element_class_set_details_simple (element_class, "AppSink",
"Generic/Sink", "Allow the application to get access to raw buffer",
"David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_app_sink_template));
basesink_class->unlock = gst_app_sink_unlock_start; basesink_class->unlock = gst_app_sink_unlock_start;
basesink_class->unlock_stop = gst_app_sink_unlock_stop; basesink_class->unlock_stop = gst_app_sink_unlock_stop;
basesink_class->start = gst_app_sink_start; basesink_class->start = gst_app_sink_start;
@ -459,7 +444,7 @@ gst_app_sink_class_init (GstAppSinkClass * klass)
} }
static void static void
gst_app_sink_init (GstAppSink * appsink, GstAppSinkClass * klass) gst_app_sink_init (GstAppSink * appsink)
{ {
GstAppSinkPrivate *priv; GstAppSinkPrivate *priv;

View file

@ -249,42 +249,19 @@ static GstFlowReturn gst_app_src_push_buffer_action (GstAppSrc * appsrc,
static guint gst_app_src_signals[LAST_SIGNAL] = { 0 }; static guint gst_app_src_signals[LAST_SIGNAL] = { 0 };
static void #define gst_app_src_parent_class parent_class
_do_init (GType filesrc_type) G_DEFINE_TYPE_WITH_CODE (GstAppSrc, gst_app_src, GST_TYPE_BASE_SRC,
{ G_IMPLEMENT_INTERFACE (GST_TYPE_URI_HANDLER, gst_app_src_uri_handler_init));
static const GInterfaceInfo urihandler_info = {
gst_app_src_uri_handler_init,
NULL,
NULL
};
g_type_add_interface_static (filesrc_type, GST_TYPE_URI_HANDLER,
&urihandler_info);
}
GST_BOILERPLATE_FULL (GstAppSrc, gst_app_src, GstBaseSrc, GST_TYPE_BASE_SRC,
_do_init);
static void
gst_app_src_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
GST_DEBUG_CATEGORY_INIT (app_src_debug, "appsrc", 0, "appsrc element");
gst_element_class_set_details_simple (element_class, "AppSrc",
"Generic/Source", "Allow the application to feed buffers to a pipeline",
"David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_app_src_template));
}
static void static void
gst_app_src_class_init (GstAppSrcClass * klass) gst_app_src_class_init (GstAppSrcClass * klass)
{ {
GObjectClass *gobject_class = (GObjectClass *) klass; GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *element_class = (GstElementClass *) klass;
GstBaseSrcClass *basesrc_class = (GstBaseSrcClass *) klass; GstBaseSrcClass *basesrc_class = (GstBaseSrcClass *) klass;
GST_DEBUG_CATEGORY_INIT (app_src_debug, "appsrc", 0, "appsrc element");
gobject_class->dispose = gst_app_src_dispose; gobject_class->dispose = gst_app_src_dispose;
gobject_class->finalize = gst_app_src_finalize; gobject_class->finalize = gst_app_src_finalize;
@ -498,6 +475,13 @@ gst_app_src_class_init (GstAppSrcClass * klass)
end_of_stream), NULL, NULL, __gst_app_marshal_ENUM__VOID, end_of_stream), NULL, NULL, __gst_app_marshal_ENUM__VOID,
GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE); GST_TYPE_FLOW_RETURN, 0, G_TYPE_NONE);
gst_element_class_set_details_simple (element_class, "AppSrc",
"Generic/Source", "Allow the application to feed buffers to a pipeline",
"David Schleef <ds@schleef.org>, Wim Taymans <wim.taymans@gmail.com>");
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&gst_app_src_template));
basesrc_class->create = gst_app_src_create; basesrc_class->create = gst_app_src_create;
basesrc_class->start = gst_app_src_start; basesrc_class->start = gst_app_src_start;
basesrc_class->stop = gst_app_src_stop; basesrc_class->stop = gst_app_src_stop;
@ -517,7 +501,7 @@ gst_app_src_class_init (GstAppSrcClass * klass)
} }
static void static void
gst_app_src_init (GstAppSrc * appsrc, GstAppSrcClass * klass) gst_app_src_init (GstAppSrc * appsrc)
{ {
GstAppSrcPrivate *priv; GstAppSrcPrivate *priv;