From abe33a55261be63f292f7e7113557cda5b330462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 9 Aug 2009 14:55:26 +0200 Subject: [PATCH] autoconvert: Small cleanups --- gst/autoconvert/gstautoconvert.c | 60 +++++++++++--------------------- gst/autoconvert/gstautoconvert.h | 3 ++ 2 files changed, 24 insertions(+), 39 deletions(-) diff --git a/gst/autoconvert/gstautoconvert.c b/gst/autoconvert/gstautoconvert.c index 4311003071..a524155162 100644 --- a/gst/autoconvert/gstautoconvert.c +++ b/gst/autoconvert/gstautoconvert.c @@ -46,13 +46,6 @@ GST_DEBUG_CATEGORY (autoconvert_debug); #define GST_CAT_DEFAULT (autoconvert_debug) /* elementfactory information */ -static const GstElementDetails gst_auto_convert_details = -GST_ELEMENT_DETAILS ("Select convertor based on caps", - "Generic/Bin", - "Selects the right transform element based on the caps", - "Olivier Crete "); - - static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, @@ -63,7 +56,6 @@ static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY); - static GstStaticPadTemplate sink_internal_template = GST_STATIC_PAD_TEMPLATE ("sink_internal", GST_PAD_SINK, @@ -86,10 +78,9 @@ enum enum { PROP_0, - PROP_FACTORIES, + PROP_FACTORIES }; - static void gst_auto_convert_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_auto_convert_get_property (GObject * object, @@ -118,7 +109,6 @@ static gboolean gst_auto_convert_src_event (GstPad * pad, GstEvent * event); static gboolean gst_auto_convert_src_query (GstPad * pad, GstQuery * query); static const GstQueryType *gst_auto_convert_src_query_type (GstPad * pad); - static GstFlowReturn gst_auto_convert_internal_sink_chain (GstPad * pad, GstBuffer * buffer); static gboolean gst_auto_convert_internal_sink_event (GstPad * pad, @@ -140,18 +130,21 @@ static gboolean gst_auto_convert_internal_src_query (GstPad * pad, static const GstQueryType *gst_auto_convert_internal_src_query_type (GstPad * pad); - static void gst_auto_convert_load_factories (GstAutoConvert * autoconvert); -GQuark internal_srcpad_quark = 0; -GQuark internal_sinkpad_quark = 0; -GQuark parent_quark = 0; +static GQuark internal_srcpad_quark = 0; +static GQuark internal_sinkpad_quark = 0; +static GQuark parent_quark = 0; static void gst_auto_convert_do_init (GType type) { GST_DEBUG_CATEGORY_INIT (autoconvert_debug, "autoconvert", 0, "Auto convert based on caps"); + + internal_srcpad_quark = g_quark_from_static_string ("internal_srcpad"); + internal_sinkpad_quark = g_quark_from_static_string ("internal_sinkpad"); + parent_quark = g_quark_from_static_string ("parent"); } GST_BOILERPLATE_FULL (GstAutoConvert, gst_auto_convert, GstBin, @@ -167,53 +160,39 @@ gst_auto_convert_base_init (gpointer klass) gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sinktemplate)); - gst_element_class_set_details (element_class, &gst_auto_convert_details); + gst_element_class_set_details_simple (element_class, + "Select convertor based on caps", "Generic/Bin", + "Selects the right transform element based on the caps", + "Olivier Crete "); } static void gst_auto_convert_class_init (GstAutoConvertClass * klass) { - GObjectClass *gobject_class; - GstElementClass *gstelement_class; - GstBinClass *gstbin_class; + GObjectClass *gobject_class = (GObjectClass *) klass; - gobject_class = (GObjectClass *) klass; - gstelement_class = (GstElementClass *) klass; - gstbin_class = (GstBinClass *) klass; + gobject_class->dispose = gst_auto_convert_dispose; - gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_auto_convert_dispose); - - gobject_class->set_property = - GST_DEBUG_FUNCPTR (gst_auto_convert_set_property); - gobject_class->get_property = - GST_DEBUG_FUNCPTR (gst_auto_convert_get_property); + gobject_class->set_property = gst_auto_convert_set_property; + gobject_class->get_property = gst_auto_convert_get_property; g_object_class_install_property (gobject_class, PROP_FACTORIES, g_param_spec_pointer ("factories", "GList of GstElementFactory", "GList of GstElementFactory objects to pick from (the element takes" " ownership of the list (NULL means it will go through all possible" - " elements), can only be set once", G_PARAM_READWRITE)); - - parent_class = g_type_class_peek_parent (klass); - - internal_srcpad_quark = g_quark_from_static_string ("internal_srcpad"); - internal_sinkpad_quark = g_quark_from_static_string ("internal_sinkpad"); - parent_quark = g_quark_from_static_string ("parent"); + " elements), can only be set once", + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); } static void gst_auto_convert_init (GstAutoConvert * autoconvert, GstAutoConvertClass * klass) { - autoconvert->sinkpad = gst_pad_new_from_static_template (&sinktemplate, "sink"); autoconvert->srcpad = gst_pad_new_from_static_template (&srctemplate, "src"); - gst_element_add_pad (GST_ELEMENT (autoconvert), autoconvert->sinkpad); - gst_element_add_pad (GST_ELEMENT (autoconvert), autoconvert->srcpad); - gst_pad_set_setcaps_function (autoconvert->sinkpad, GST_DEBUG_FUNCPTR (gst_auto_convert_sink_setcaps)); gst_pad_set_getcaps_function (autoconvert->sinkpad, @@ -235,6 +214,9 @@ gst_auto_convert_init (GstAutoConvert * autoconvert, GST_DEBUG_FUNCPTR (gst_auto_convert_src_query)); gst_pad_set_query_type_function (autoconvert->srcpad, GST_DEBUG_FUNCPTR (gst_auto_convert_src_query_type)); + + gst_element_add_pad (GST_ELEMENT (autoconvert), autoconvert->sinkpad); + gst_element_add_pad (GST_ELEMENT (autoconvert), autoconvert->srcpad); } static void diff --git a/gst/autoconvert/gstautoconvert.h b/gst/autoconvert/gstautoconvert.h index 4a3c8df0f8..1210701189 100644 --- a/gst/autoconvert/gstautoconvert.h +++ b/gst/autoconvert/gstautoconvert.h @@ -52,6 +52,9 @@ struct _GstAutoConvert GstElement *current_subelement; GstPad *current_internal_srcpad; GstPad *current_internal_sinkpad; + + GstSegment segment; + GList *cached_events; }; struct _GstAutoConvertClass