From c1146641e46bb78b4b5d9ae777822e625a5d6bfd Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Fri, 18 May 2007 09:35:17 +0000 Subject: [PATCH] ext/amrnb/amrnbdec.c (gst_amrnbdec_debug, GST_CAT_DEFAULT, block_size, _do_init, gst_amrnbdec_base_init, gst_amrnbdec... Original commit message from CVS: * ext/amrnb/amrnbdec.c (gst_amrnbdec_debug, GST_CAT_DEFAULT, block_size, _do_init, gst_amrnbdec_base_init, gst_amrnbdec_class_init, gst_amrnbdec_init): * ext/amrnb/amrnbenc.c (gst_amrnbenc_debug, GST_CAT_DEFAULT, _do_init, gst_amrnbenc_base_init, gst_amrnbenc_class_init, gst_amrnbenc_init): * ext/amrnb/amrnbparse.c (gst_amrnbparse_debug, GST_CAT_DEFAULT, block_size, _do_init, gst_amrnbparse_base_init, gst_amrnbparse_class_init, gst_amrnbparse_init): First round of cleanups, that use GST_BOILERPLATE, GST_ELEMENT_DETAILS, GST_DEBUG_FUNCPTR and add log-category. --- ChangeLog | 17 ++++++++++-- ext/amrnb/amrnbdec.c | 56 ++++++++++--------------------------- ext/amrnb/amrnbenc.c | 57 +++++++++++--------------------------- ext/amrnb/amrnbparse.c | 63 ++++++++++-------------------------------- 4 files changed, 61 insertions(+), 132 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7af2be61f7..309cc38d36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-05-18 Stefan Kost + + * ext/amrnb/amrnbdec.c (gst_amrnbdec_debug, GST_CAT_DEFAULT, + block_size, _do_init, gst_amrnbdec_base_init, + gst_amrnbdec_class_init, gst_amrnbdec_init): + * ext/amrnb/amrnbenc.c (gst_amrnbenc_debug, GST_CAT_DEFAULT, _do_init, + gst_amrnbenc_base_init, gst_amrnbenc_class_init, gst_amrnbenc_init): + * ext/amrnb/amrnbparse.c (gst_amrnbparse_debug, GST_CAT_DEFAULT, + block_size, _do_init, gst_amrnbparse_base_init, + gst_amrnbparse_class_init, gst_amrnbparse_init): + First round of cleanups, that use GST_BOILERPLATE, GST_ELEMENT_DETAILS, + GST_DEBUG_FUNCPTR and add log-category. + 2007-05-18 Jan Schmidt * gst/mpegaudioparse/gstmpegaudioparse.c: @@ -2919,7 +2932,7 @@ === release 0.10.0 === -2005-12-05 +2005-12-05 Thomas Vander Stichele * configure.ac: releasing 0.10.0, "Brie" @@ -2947,7 +2960,7 @@ === release 0.9.7 === -2005-12-01 +2005-12-01 Thomas Vander Stichele * configure.ac: releasing 0.9.7, "Canis Meus Naso Non Habet" diff --git a/ext/amrnb/amrnbdec.c b/ext/amrnb/amrnbdec.c index 9588cf7254..2f2cdf01b3 100644 --- a/ext/amrnb/amrnbdec.c +++ b/ext/amrnb/amrnbdec.c @@ -40,64 +40,40 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", "rate = (int) 8000," "channels = (int) 1") ); +GST_DEBUG_CATEGORY_STATIC (gst_amrnbdec_debug); +#define GST_CAT_DEFAULT gst_amrnbdec_debug + static const gint block_size[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 }; -static void gst_amrnbdec_base_init (GstAmrnbDecClass * klass); -static void gst_amrnbdec_class_init (GstAmrnbDecClass * klass); -static void gst_amrnbdec_init (GstAmrnbDec * amrnbdec); - static gboolean gst_amrnbdec_event (GstPad * pad, GstEvent * event); static GstFlowReturn gst_amrnbdec_chain (GstPad * pad, GstBuffer * buffer); static gboolean gst_amrnbdec_setcaps (GstPad * pad, GstCaps * caps); static GstStateChangeReturn gst_amrnbdec_state_change (GstElement * element, GstStateChange transition); -static GstElementClass *parent_class = NULL; +#define _do_init(bla) \ + GST_DEBUG_CATEGORY_INIT (gst_amrnbdec_debug, "amrnbdec", 0, "AMR-NB audio decoder"); -GType -gst_amrnbdec_get_type (void) -{ - static GType amrnbdec_type = 0; - - if (!amrnbdec_type) { - static const GTypeInfo amrnbdec_info = { - sizeof (GstAmrnbDecClass), - (GBaseInitFunc) gst_amrnbdec_base_init, - NULL, - (GClassInitFunc) gst_amrnbdec_class_init, - NULL, - NULL, - sizeof (GstAmrnbDec), - 0, - (GInstanceInitFunc) gst_amrnbdec_init, - }; - - amrnbdec_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstAmrnbDec", &amrnbdec_info, 0); - } - - return amrnbdec_type; -} +GST_BOILERPLATE_FULL (GstAmrnbDec, gst_amrnbdec, GstElement, GST_TYPE_ELEMENT, + _do_init); static void -gst_amrnbdec_base_init (GstAmrnbDecClass * klass) +gst_amrnbdec_base_init (gpointer klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - GstElementDetails gst_amrnbdec_details = { - "AMR-NB decoder", - "Codec/Decoder/Audio", - "Adaptive Multi-Rate Narrow-Band audio decoder", - "Ronald Bultje " - }; + GstElementDetails details = GST_ELEMENT_DETAILS ("AMR-NB audio decoder", + "Codec/Decoder/Audio", + "Adaptive Multi-Rate Narrow-Band audio decoder", + "Ronald Bultje "); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_template)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_template)); - gst_element_class_set_details (element_class, &gst_amrnbdec_details); + gst_element_class_set_details (element_class, &details); } static void @@ -105,13 +81,11 @@ gst_amrnbdec_class_init (GstAmrnbDecClass * klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - - element_class->change_state = gst_amrnbdec_state_change; + element_class->change_state = GST_DEBUG_FUNCPTR (gst_amrnbdec_state_change); } static void -gst_amrnbdec_init (GstAmrnbDec * amrnbdec) +gst_amrnbdec_init (GstAmrnbDec * amrnbdec, GstAmrnbDecClass * klass) { /* create the sink pad */ amrnbdec->sinkpad = diff --git a/ext/amrnb/amrnbenc.c b/ext/amrnb/amrnbenc.c index 3145f79f4c..160cba9cc8 100644 --- a/ext/amrnb/amrnbenc.c +++ b/ext/amrnb/amrnbenc.c @@ -40,9 +40,9 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_STATIC_CAPS ("audio/AMR, " "rate = (int) 8000, " "channels = (int) 1") ); -static void gst_amrnbenc_base_init (GstAmrnbEncClass * klass); -static void gst_amrnbenc_class_init (GstAmrnbEncClass * klass); -static void gst_amrnbenc_init (GstAmrnbEnc * amrnbenc); +GST_DEBUG_CATEGORY_STATIC (gst_amrnbenc_debug); +#define GST_CAT_DEFAULT gst_amrnbenc_debug + static void gst_amrnbenc_finalize (GObject * object); static GstFlowReturn gst_amrnbenc_chain (GstPad * pad, GstBuffer * buffer); @@ -50,51 +50,28 @@ static gboolean gst_amrnbenc_setcaps (GstPad * pad, GstCaps * caps); static GstStateChangeReturn gst_amrnbenc_state_change (GstElement * element, GstStateChange transition); -static GstElementClass *parent_class = NULL; +#define _do_init(bla) \ + GST_DEBUG_CATEGORY_INIT (gst_amrnbenc_debug, "amrnbenc", 0, "AMR-NB audio encoder"); -GType -gst_amrnbenc_get_type (void) -{ - static GType amrnbenc_type = 0; - - if (!amrnbenc_type) { - static const GTypeInfo amrnbenc_info = { - sizeof (GstAmrnbEncClass), - (GBaseInitFunc) gst_amrnbenc_base_init, - NULL, - (GClassInitFunc) gst_amrnbenc_class_init, - NULL, - NULL, - sizeof (GstAmrnbEnc), - 0, - (GInstanceInitFunc) gst_amrnbenc_init, - }; - - amrnbenc_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstAmrnbEnc", &amrnbenc_info, 0); - } - - return amrnbenc_type; -} +GST_BOILERPLATE_FULL (GstAmrnbEnc, gst_amrnbenc, GstElement, GST_TYPE_ELEMENT, + _do_init); static void -gst_amrnbenc_base_init (GstAmrnbEncClass * klass) +gst_amrnbenc_base_init (gpointer klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - GstElementDetails gst_amrnbenc_details = { - "AMR-NB encoder", - "Codec/Encoder/Audio", - "Adaptive Multi-Rate Narrow-Band audio encoder", - "Ronald Bultje , " - "Wim Taymans " - }; + GstElementDetails details = GST_ELEMENT_DETAILS ("AMR-NB audio encoder", + "Codec/Encoder/Audio", + "Adaptive Multi-Rate Narrow-Band audio encoder", + "Ronald Bultje , " + "Wim Taymans "); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_template)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_template)); - gst_element_class_set_details (element_class, &gst_amrnbenc_details); + gst_element_class_set_details (element_class, &details); } static void @@ -103,15 +80,13 @@ gst_amrnbenc_class_init (GstAmrnbEncClass * klass) GObjectClass *object_class = G_OBJECT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - object_class->finalize = gst_amrnbenc_finalize; - element_class->change_state = gst_amrnbenc_state_change; + element_class->change_state = GST_DEBUG_FUNCPTR (gst_amrnbenc_state_change); } static void -gst_amrnbenc_init (GstAmrnbEnc * amrnbenc) +gst_amrnbenc_init (GstAmrnbEnc * amrnbenc, GstAmrnbEncClass * klass) { /* create the sink pad */ amrnbenc->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink"); diff --git a/ext/amrnb/amrnbparse.c b/ext/amrnb/amrnbparse.c index 9ac7c9c4d0..d11023fb84 100644 --- a/ext/amrnb/amrnbparse.c +++ b/ext/amrnb/amrnbparse.c @@ -22,12 +22,8 @@ #endif #include - #include "amrnbparse.h" -GST_DEBUG_CATEGORY_STATIC (amrnbparse_debug); -#define GST_CAT_DEFAULT amrnbparse_debug - static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", GST_PAD_SRC, GST_PAD_ALWAYS, @@ -40,14 +36,13 @@ static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_CAPS ("audio/x-amr-nb-sh") ); +GST_DEBUG_CATEGORY_STATIC (gst_amrnbparse_debug); +#define GST_CAT_DEFAULT gst_amrnbparse_debug + static const gint block_size[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 }; -static void gst_amrnbparse_base_init (GstAmrnbParseClass * klass); -static void gst_amrnbparse_class_init (GstAmrnbParseClass * klass); -static void gst_amrnbparse_init (GstAmrnbParse * amrnbparse); - /*static const GstFormat *gst_amrnbparse_formats (GstPad * pad);*/ static const GstQueryType *gst_amrnbparse_querytypes (GstPad * pad); static gboolean gst_amrnbparse_query (GstPad * pad, GstQuery * query); @@ -61,53 +56,27 @@ static gboolean gst_amrnbparse_sink_activate_pull (GstPad * sinkpad, static GstStateChangeReturn gst_amrnbparse_state_change (GstElement * element, GstStateChange transition); -static GstElementClass *parent_class = NULL; +#define _do_init(bla) \ + GST_DEBUG_CATEGORY_INIT (gst_amrnbparse_debug, "amrnbparse", 0, "AMR-NB audio stream parser"); -GType -gst_amrnbparse_get_type (void) -{ - static GType amrnbparse_type = 0; - - if (!amrnbparse_type) { - static const GTypeInfo amrnbparse_info = { - sizeof (GstAmrnbParseClass), - (GBaseInitFunc) gst_amrnbparse_base_init, - NULL, - (GClassInitFunc) gst_amrnbparse_class_init, - NULL, - NULL, - sizeof (GstAmrnbParse), - 0, - (GInstanceInitFunc) gst_amrnbparse_init, - }; - - amrnbparse_type = g_type_register_static (GST_TYPE_ELEMENT, - "GstAmrnbParse", &amrnbparse_info, 0); - - GST_DEBUG_CATEGORY_INIT (amrnbparse_debug, - "amrnbparse", 0, "AMR-NB stream parsing"); - } - - return amrnbparse_type; -} +GST_BOILERPLATE_FULL (GstAmrnbParse, gst_amrnbparse, GstElement, + GST_TYPE_ELEMENT, _do_init); static void -gst_amrnbparse_base_init (GstAmrnbParseClass * klass) +gst_amrnbparse_base_init (gpointer klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - GstElementDetails gst_amrnbparse_details = { - "AMR-NB parser", - "Codec/Parser/Audio", - "Adaptive Multi-Rate Narrow-Band audio parser", - "Ronald Bultje " - }; + GstElementDetails details = GST_ELEMENT_DETAILS ("AMR-NB audio stream parser", + "Codec/Parser/Audio", + "Adaptive Multi-Rate Narrow-Band audio parser", + "Ronald Bultje "); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&sink_template)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&src_template)); - gst_element_class_set_details (element_class, &gst_amrnbparse_details); + gst_element_class_set_details (element_class, &details); } static void @@ -115,13 +84,11 @@ gst_amrnbparse_class_init (GstAmrnbParseClass * klass) { GstElementClass *element_class = GST_ELEMENT_CLASS (klass); - parent_class = g_type_class_peek_parent (klass); - - element_class->change_state = gst_amrnbparse_state_change; + element_class->change_state = GST_DEBUG_FUNCPTR (gst_amrnbparse_state_change); } static void -gst_amrnbparse_init (GstAmrnbParse * amrnbparse) +gst_amrnbparse_init (GstAmrnbParse * amrnbparse, GstAmrnbParseClass * klass) { /* create the sink pad */ amrnbparse->sinkpad =