From 5c204680fb51af67235b312d43c1153cd175c7c0 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Wed, 25 Feb 2004 17:37:26 +0000 Subject: [PATCH] add debug category and use it properly Original commit message from CVS: add debug category and use it properly --- ChangeLog | 23 ++++++++++++++ gst/videoscale/gstvideoscale.c | 34 +++++++++++++-------- gst/videoscale/gstvideoscale.h | 3 ++ gst/videoscale/videoscale.c | 56 ++++++++++++++++++---------------- 4 files changed, 76 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0230c5a4a9..3cb0593d5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2004-02-25 Thomas Vander Stichele + + * gst/videoscale/gstvideoscale.c: (gst_videoscale_getcaps), + (gst_videoscale_init), (gst_videoscale_chain), + (gst_videoscale_set_property), (plugin_init): + * gst/videoscale/gstvideoscale.h: + * gst/videoscale/videoscale.c: (gst_videoscale_setup), + (gst_videoscale_scale_rgb), (gst_videoscale_planar411), + (gst_videoscale_planar400), (gst_videoscale_packed422), + (gst_videoscale_packed422rev), (gst_videoscale_32bit), + (gst_videoscale_24bit), (gst_videoscale_16bit), + (gst_videoscale_bilinear), (gst_videoscale_bicubic), + (gst_videoscale_scale_plane_slow), + (gst_videoscale_scale_point_sample), + (gst_videoscale_scale_nearest), + (gst_videoscale_scale_nearest_str2), + (gst_videoscale_scale_nearest_str4), + (gst_videoscale_scale_nearest_32bit), + (gst_videoscale_scale_nearest_24bit), + (gst_videoscale_scale_nearest_16bit): + add debugging category and use it properly + fix use of GST_PTR_FORMAT + 2004-02-25 Andy Wingo * gst/interleave/interleave.c (interleave_buffered_loop): Always diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index 88df0c8f54..3710380453 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -26,6 +26,8 @@ #include +/* debug variable definition */ +GST_DEBUG_CATEGORY (videoscale_debug); /* elementfactory information */ static GstElementDetails videoscale_details = GST_ELEMENT_DETAILS ( @@ -176,7 +178,7 @@ gst_videoscale_getcaps (GstPad *pad) videoscale->srcpad; othercaps = gst_pad_get_allowed_caps (otherpad); - GST_DEBUG ("othercaps are: " GST_PTR_FORMAT, othercaps); + GST_DEBUG ("othercaps are: %" GST_PTR_FORMAT, othercaps); caps = gst_caps_copy (othercaps); for(i=0;isinkpad = gst_pad_new_from_template ( gst_videoscale_sink_template_factory(), "sink"); @@ -341,7 +343,6 @@ gst_videoscale_chain (GstPad *pad, GstData *_data) gulong size; GstBuffer *outbuf; - GST_DEBUG ("gst_videoscale_chain"); g_return_if_fail (pad != NULL); g_return_if_fail (GST_IS_PAD (pad)); @@ -354,14 +355,15 @@ gst_videoscale_chain (GstPad *pad, GstData *_data) size = GST_BUFFER_SIZE(buf); if(videoscale->passthru){ - gst_pad_push(videoscale->srcpad, GST_DATA (buf)); + GST_LOG_OBJECT (videoscale, "passing through buffer of %ld bytes in '%s'", + size, GST_OBJECT_NAME (videoscale)); + gst_pad_push (videoscale->srcpad, GST_DATA (buf)); return; } - GST_DEBUG ("gst_videoscale_chain: got buffer of %ld bytes in '%s'",size, - GST_OBJECT_NAME (videoscale)); - - GST_DEBUG ("size=%ld from=%dx%d to=%dx%d fromsize=%ld (should be %d) tosize=%d", + GST_LOG_OBJECT (videoscale, "got buffer of %ld bytes in '%s'",size, + GST_OBJECT_NAME (videoscale)); + GST_LOG_OBJECT (videoscale, "size=%ld from=%dx%d to=%dx%d fromsize=%ld (should be %d) tosize=%d", size, videoscale->from_width, videoscale->from_height, videoscale->to_width, videoscale->to_height, @@ -376,12 +378,12 @@ gst_videoscale_chain (GstPad *pad, GstData *_data) GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(buf); g_return_if_fail(videoscale->format); - GST_DEBUG ("format " GST_FOURCC_FORMAT,GST_FOURCC_ARGS(videoscale->format->fourcc)); + GST_DEBUG_OBJECT (videoscale, "format " GST_FOURCC_FORMAT,GST_FOURCC_ARGS(videoscale->format->fourcc)); g_return_if_fail(videoscale->format->scale); videoscale->format->scale(videoscale, GST_BUFFER_DATA(outbuf), data); - GST_DEBUG ("gst_videoscale_chain: pushing buffer of %d bytes in '%s'",GST_BUFFER_SIZE(outbuf), + GST_DEBUG_OBJECT (videoscale, "pushing buffer of %d bytes in '%s'",GST_BUFFER_SIZE(outbuf), GST_OBJECT_NAME (videoscale)); gst_pad_push(videoscale->srcpad, GST_DATA (outbuf)); @@ -398,7 +400,7 @@ gst_videoscale_set_property (GObject *object, guint prop_id, const GValue *value g_return_if_fail(GST_IS_VIDEOSCALE(object)); src = GST_VIDEOSCALE(object); - GST_DEBUG ("gst_videoscale_set_property"); + GST_DEBUG_OBJECT (src, "gst_videoscale_set_property"); switch (prop_id) { case ARG_METHOD: src->method = g_value_get_enum (value); @@ -431,7 +433,13 @@ gst_videoscale_get_property (GObject *object, guint prop_id, GValue *value, GPar static gboolean plugin_init (GstPlugin *plugin) { - return gst_element_register (plugin, "videoscale", GST_RANK_NONE, GST_TYPE_VIDEOSCALE); + if (!gst_element_register (plugin, "videoscale", GST_RANK_NONE, GST_TYPE_VIDEOSCALE)) + return FALSE; + + g_print ("going to init debug\n"); + GST_DEBUG_CATEGORY_INIT (videoscale_debug, "videoscale", 0, "videoscale element"); + + return TRUE; } GST_PLUGIN_DEFINE ( diff --git a/gst/videoscale/gstvideoscale.h b/gst/videoscale/gstvideoscale.h index fd59b46f93..124ffb0078 100644 --- a/gst/videoscale/gstvideoscale.h +++ b/gst/videoscale/gstvideoscale.h @@ -29,6 +29,9 @@ extern "C" { #endif /* __cplusplus */ +/* debugging */ +GST_DEBUG_CATEGORY_EXTERN (videoscale_debug); +#define GST_CAT_DEFAULT videoscale_debug #define GST_TYPE_VIDEOSCALE \ (gst_videoscale_get_type()) diff --git a/gst/videoscale/videoscale.c b/gst/videoscale/videoscale.c index ba16246e8c..ebd8848914 100644 --- a/gst/videoscale/videoscale.c +++ b/gst/videoscale/videoscale.c @@ -188,10 +188,12 @@ gst_videoscale_setup (GstVideoscale *videoscale) g_return_if_fail (GST_IS_VIDEOSCALE (videoscale)); g_return_if_fail (videoscale->format != NULL); - GST_DEBUG ("format=%p " GST_FOURCC_FORMAT " from %dx%d to %dx%d", - videoscale->format, GST_FOURCC_ARGS(videoscale->format->fourcc), - videoscale->from_width, videoscale->from_height, - videoscale->to_width, videoscale->to_height); + GST_DEBUG_OBJECT (videoscale, "format=%p " GST_FOURCC_FORMAT + " from %dx%d to %dx%d", + videoscale->format, + GST_FOURCC_ARGS(videoscale->format->fourcc), + videoscale->from_width, videoscale->from_height, + videoscale->to_width, videoscale->to_height); if(videoscale->to_width==0 || videoscale->to_height==0 || videoscale->from_width==0 || videoscale->from_height==0){ @@ -203,13 +205,13 @@ gst_videoscale_setup (GstVideoscale *videoscale) if(videoscale->to_width == videoscale->from_width && videoscale->to_height == videoscale->from_height){ - GST_DEBUG ("videoscale: using passthru"); + GST_DEBUG_OBJECT (videoscale, "using passthru"); videoscale->passthru = TRUE; videoscale->inited = TRUE; return; } - GST_DEBUG ("videoscale: scaling method POINT_SAMPLE"); + GST_DEBUG_OBJECT (videoscale, "scaling method POINT_SAMPLE"); videoscale->from_buf_size = (videoscale->from_width * videoscale->from_height * videoscale->format->bpp) / 8; @@ -228,7 +230,7 @@ gst_videoscale_scale_rgb (GstVideoscale *scale, unsigned char *dest, unsigned ch int sh = scale->from_height; int dw = scale->to_width; int dh = scale->to_height; - GST_DEBUG ("videoscale: scaling RGB %dx%d to %dx%d", sw, sh, dw, dh); + GST_DEBUG_OBJECT (scale, "scaling RGB %dx%d to %dx%d", sw, sh, dw, dh); switch (scale->scale_bytes) { case 2: @@ -243,7 +245,7 @@ gst_videoscale_scale_rgb (GstVideoscale *scale, unsigned char *dest, unsigned ch break; } - GST_DEBUG ("videoscale: %p %p", src, dest); + GST_DEBUG_OBJECT (scale, "%p %p", src, dest); //scale->scaler(scale, src, dest, sw, sh, dw, dh); } #endif @@ -256,7 +258,7 @@ gst_videoscale_planar411 (GstVideoscale *scale, unsigned char *dest, unsigned ch int dw = scale->to_width; int dh = scale->to_height; - GST_DEBUG ("videoscale: scaling planar 4:1:1 %dx%d to %dx%d", sw, sh, dw, dh); + GST_DEBUG_OBJECT (scale, "scaling planar 4:1:1 %dx%d to %dx%d", sw, sh, dw, dh); gst_videoscale_scale_nearest(scale, dest, src, sw, sh, dw, dh); @@ -284,7 +286,7 @@ gst_videoscale_planar400 (GstVideoscale *scale, unsigned char *dest, unsigned ch int dw = scale->to_width; int dh = scale->to_height; - GST_DEBUG ("videoscale: scaling Y-only %dx%d to %dx%d", sw, sh, dw, dh); + GST_DEBUG_OBJECT (scale, "scaling Y-only %dx%d to %dx%d", sw, sh, dw, dh); gst_videoscale_scale_nearest(scale, dest, src, sw, sh, dw, dh); } @@ -297,7 +299,7 @@ gst_videoscale_packed422 (GstVideoscale *scale, unsigned char *dest, unsigned ch int dw = scale->to_width; int dh = scale->to_height; - GST_DEBUG ("videoscale: scaling 4:2:2 %dx%d to %dx%d", sw, sh, dw, dh); + GST_DEBUG_OBJECT (scale, "scaling 4:2:2 %dx%d to %dx%d", sw, sh, dw, dh); gst_videoscale_scale_nearest_str2(scale, dest, src, sw, sh, dw, dh); gst_videoscale_scale_nearest_str4(scale, dest+1, src+1, sw/2, sh, dw/2, dh); @@ -313,7 +315,7 @@ gst_videoscale_packed422rev (GstVideoscale *scale, unsigned char *dest, unsigned int dw = scale->to_width; int dh = scale->to_height; - GST_DEBUG ("videoscale: scaling 4:2:2 %dx%d to %dx%d", sw, sh, dw, dh); + GST_DEBUG_OBJECT (scale, "scaling 4:2:2 %dx%d to %dx%d", sw, sh, dw, dh); gst_videoscale_scale_nearest_str2(scale, dest+1, src, sw, sh, dw, dh); gst_videoscale_scale_nearest_str4(scale, dest, src+1, sw/2, sh, dw/2, dh); @@ -329,7 +331,7 @@ gst_videoscale_32bit (GstVideoscale *scale, unsigned char *dest, unsigned char * int dw = scale->to_width; int dh = scale->to_height; - GST_DEBUG ("videoscale: scaling 32bit %dx%d to %dx%d", sw, sh, dw, dh); + GST_DEBUG_OBJECT (scale, "scaling 32bit %dx%d to %dx%d", sw, sh, dw, dh); gst_videoscale_scale_nearest_32bit(scale, dest, src, sw, sh, dw, dh); @@ -343,7 +345,7 @@ gst_videoscale_24bit (GstVideoscale *scale, unsigned char *dest, unsigned char * int dw = scale->to_width; int dh = scale->to_height; - GST_DEBUG ("videoscale: scaling 24bit %dx%d to %dx%d", sw, sh, dw, dh); + GST_DEBUG_OBJECT (scale, "scaling 24bit %dx%d to %dx%d", sw, sh, dw, dh); gst_videoscale_scale_nearest_24bit(scale, dest, src, sw, sh, dw, dh); @@ -357,7 +359,7 @@ gst_videoscale_16bit (GstVideoscale *scale, unsigned char *dest, unsigned char * int dw = scale->to_width; int dh = scale->to_height; - GST_DEBUG ("videoscale: scaling 16bit %dx%d to %dx%d", sw, sh, dw, dh); + GST_DEBUG_OBJECT (scale, "scaling 16bit %dx%d to %dx%d", sw, sh, dw, dh); gst_videoscale_scale_nearest_16bit(scale, dest, src, sw, sh, dw, dh); @@ -376,7 +378,7 @@ gst_videoscale_bilinear (unsigned char *src, double x, double y, int sw, int sh) double dest; int color; - GST_DEBUG ("videoscale: scaling bilinear %f %f %dx%d", x, y, sw, sh); + GST_DEBUG_OBJECT (scale, "scaling bilinear %f %f %dx%d", x, y, sw, sh); dest=(1-a)*(1-b)*RC(j,k)+ a*(1-b)*RC(j+1,k); @@ -405,7 +407,7 @@ gst_videoscale_bicubic (unsigned char *src, double x, double y, int sw, int sh) double t1, t2, t3, t4; double a1, a2, a3, a4; - GST_DEBUG ("videoscale: scaling bicubic %dx%d", sw, sh); + GST_DEBUG_OBJECT (scale, "scaling bicubic %dx%d", sw, sh); a1 = -a*(1-a)*(1-a); a2 = (1-2*a*a+a*a*a); @@ -438,17 +440,17 @@ gst_videoscale_scale_plane_slow (GstVideoscale *scale, unsigned char *src, unsig double xr, yr; int x, y; - GST_DEBUG ("videoscale: scale plane slow %dx%d %dx%d %g %g %p %p", sw, sh, dw, dh, zoomx, zoomy, src, dest); + GST_DEBUG_OBJECT (scale, "scale plane slow %dx%d %dx%d %g %g %p %p", sw, sh, dw, dh, zoomx, zoomy, src, dest); for (y=0; y