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.
This commit is contained in:
Stefan Kost 2007-05-18 09:35:17 +00:00
parent c145813ad3
commit c1146641e4
4 changed files with 61 additions and 132 deletions

View file

@ -1,3 +1,16 @@
2007-05-18 Stefan Kost <ensonic@users.sf.net>
* 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 <thaytan@mad.scientist.com> 2007-05-18 Jan Schmidt <thaytan@mad.scientist.com>
* gst/mpegaudioparse/gstmpegaudioparse.c: * gst/mpegaudioparse/gstmpegaudioparse.c:
@ -2919,7 +2932,7 @@
=== release 0.10.0 === === release 0.10.0 ===
2005-12-05 <thomas (at) apestaart (dot) org> 2005-12-05 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* configure.ac: * configure.ac:
releasing 0.10.0, "Brie" releasing 0.10.0, "Brie"
@ -2947,7 +2960,7 @@
=== release 0.9.7 === === release 0.9.7 ===
2005-12-01 <thomas (at) apestaart (dot) org> 2005-12-01 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
* configure.ac: * configure.ac:
releasing 0.9.7, "Canis Meus Naso Non Habet" releasing 0.9.7, "Canis Meus Naso Non Habet"

View file

@ -40,64 +40,40 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
"rate = (int) 8000," "channels = (int) 1") "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, static const gint block_size[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5,
0, 0, 0, 0, 0, 0, 0 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 gboolean gst_amrnbdec_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_amrnbdec_chain (GstPad * pad, GstBuffer * buffer); static GstFlowReturn gst_amrnbdec_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_amrnbdec_setcaps (GstPad * pad, GstCaps * caps); static gboolean gst_amrnbdec_setcaps (GstPad * pad, GstCaps * caps);
static GstStateChangeReturn gst_amrnbdec_state_change (GstElement * element, static GstStateChangeReturn gst_amrnbdec_state_change (GstElement * element,
GstStateChange transition); 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_BOILERPLATE_FULL (GstAmrnbDec, gst_amrnbdec, GstElement, GST_TYPE_ELEMENT,
gst_amrnbdec_get_type (void) _do_init);
{
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;
}
static void static void
gst_amrnbdec_base_init (GstAmrnbDecClass * klass) gst_amrnbdec_base_init (gpointer klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstElementDetails gst_amrnbdec_details = { GstElementDetails details = GST_ELEMENT_DETAILS ("AMR-NB audio decoder",
"AMR-NB decoder",
"Codec/Decoder/Audio", "Codec/Decoder/Audio",
"Adaptive Multi-Rate Narrow-Band audio decoder", "Adaptive Multi-Rate Narrow-Band audio decoder",
"Ronald Bultje <rbultje@ronald.bitfreak.net>" "Ronald Bultje <rbultje@ronald.bitfreak.net>");
};
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template)); gst_static_pad_template_get (&sink_template));
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_template)); 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 static void
@ -105,13 +81,11 @@ gst_amrnbdec_class_init (GstAmrnbDecClass * klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); element_class->change_state = GST_DEBUG_FUNCPTR (gst_amrnbdec_state_change);
element_class->change_state = gst_amrnbdec_state_change;
} }
static void static void
gst_amrnbdec_init (GstAmrnbDec * amrnbdec) gst_amrnbdec_init (GstAmrnbDec * amrnbdec, GstAmrnbDecClass * klass)
{ {
/* create the sink pad */ /* create the sink pad */
amrnbdec->sinkpad = amrnbdec->sinkpad =

View file

@ -40,9 +40,9 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS ("audio/AMR, " "rate = (int) 8000, " "channels = (int) 1") GST_STATIC_CAPS ("audio/AMR, " "rate = (int) 8000, " "channels = (int) 1")
); );
static void gst_amrnbenc_base_init (GstAmrnbEncClass * klass); GST_DEBUG_CATEGORY_STATIC (gst_amrnbenc_debug);
static void gst_amrnbenc_class_init (GstAmrnbEncClass * klass); #define GST_CAT_DEFAULT gst_amrnbenc_debug
static void gst_amrnbenc_init (GstAmrnbEnc * amrnbenc);
static void gst_amrnbenc_finalize (GObject * object); static void gst_amrnbenc_finalize (GObject * object);
static GstFlowReturn gst_amrnbenc_chain (GstPad * pad, GstBuffer * buffer); 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, static GstStateChangeReturn gst_amrnbenc_state_change (GstElement * element,
GstStateChange transition); 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_BOILERPLATE_FULL (GstAmrnbEnc, gst_amrnbenc, GstElement, GST_TYPE_ELEMENT,
gst_amrnbenc_get_type (void) _do_init);
{
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;
}
static void static void
gst_amrnbenc_base_init (GstAmrnbEncClass * klass) gst_amrnbenc_base_init (gpointer klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstElementDetails gst_amrnbenc_details = { GstElementDetails details = GST_ELEMENT_DETAILS ("AMR-NB audio encoder",
"AMR-NB encoder",
"Codec/Encoder/Audio", "Codec/Encoder/Audio",
"Adaptive Multi-Rate Narrow-Band audio encoder", "Adaptive Multi-Rate Narrow-Band audio encoder",
"Ronald Bultje <rbultje@ronald.bitfreak.net>, " "Ronald Bultje <rbultje@ronald.bitfreak.net>, "
"Wim Taymans <wim@fluendo.com>" "Wim Taymans <wim@fluendo.com>");
};
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template)); gst_static_pad_template_get (&sink_template));
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_template)); 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 static void
@ -103,15 +80,13 @@ gst_amrnbenc_class_init (GstAmrnbEncClass * 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->finalize = gst_amrnbenc_finalize; 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 static void
gst_amrnbenc_init (GstAmrnbEnc * amrnbenc) gst_amrnbenc_init (GstAmrnbEnc * amrnbenc, GstAmrnbEncClass * klass)
{ {
/* create the sink pad */ /* create the sink pad */
amrnbenc->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink"); amrnbenc->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");

View file

@ -22,12 +22,8 @@
#endif #endif
#include <string.h> #include <string.h>
#include "amrnbparse.h" #include "amrnbparse.h"
GST_DEBUG_CATEGORY_STATIC (amrnbparse_debug);
#define GST_CAT_DEFAULT amrnbparse_debug
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src", static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC, GST_PAD_SRC,
GST_PAD_ALWAYS, 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_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, static const gint block_size[16] = { 12, 13, 15, 17, 19, 20, 26, 31, 5,
0, 0, 0, 0, 0, 0, 0 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 GstFormat *gst_amrnbparse_formats (GstPad * pad);*/
static const GstQueryType *gst_amrnbparse_querytypes (GstPad * pad); static const GstQueryType *gst_amrnbparse_querytypes (GstPad * pad);
static gboolean gst_amrnbparse_query (GstPad * pad, GstQuery * query); 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, static GstStateChangeReturn gst_amrnbparse_state_change (GstElement * element,
GstStateChange transition); 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_BOILERPLATE_FULL (GstAmrnbParse, gst_amrnbparse, GstElement,
gst_amrnbparse_get_type (void) GST_TYPE_ELEMENT, _do_init);
{
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;
}
static void static void
gst_amrnbparse_base_init (GstAmrnbParseClass * klass) gst_amrnbparse_base_init (gpointer klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstElementDetails gst_amrnbparse_details = { GstElementDetails details = GST_ELEMENT_DETAILS ("AMR-NB audio stream parser",
"AMR-NB parser",
"Codec/Parser/Audio", "Codec/Parser/Audio",
"Adaptive Multi-Rate Narrow-Band audio parser", "Adaptive Multi-Rate Narrow-Band audio parser",
"Ronald Bultje <rbultje@ronald.bitfreak.net>" "Ronald Bultje <rbultje@ronald.bitfreak.net>");
};
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_template)); gst_static_pad_template_get (&sink_template));
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_template)); 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 static void
@ -115,13 +84,11 @@ gst_amrnbparse_class_init (GstAmrnbParseClass * klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
parent_class = g_type_class_peek_parent (klass); element_class->change_state = GST_DEBUG_FUNCPTR (gst_amrnbparse_state_change);
element_class->change_state = gst_amrnbparse_state_change;
} }
static void static void
gst_amrnbparse_init (GstAmrnbParse * amrnbparse) gst_amrnbparse_init (GstAmrnbParse * amrnbparse, GstAmrnbParseClass * klass)
{ {
/* create the sink pad */ /* create the sink pad */
amrnbparse->sinkpad = amrnbparse->sinkpad =