add debug category and use it properly

Original commit message from CVS:
add debug category and use it properly
This commit is contained in:
Thomas Vander Stichele 2004-02-25 17:37:26 +00:00
parent cd8976a9eb
commit 5c204680fb
4 changed files with 76 additions and 40 deletions

View file

@ -1,3 +1,26 @@
2004-02-25 Thomas Vander Stichele <thomas at apestaart dot org>
* 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 <wingo@pobox.com>
* gst/interleave/interleave.c (interleave_buffered_loop): Always

View file

@ -26,6 +26,8 @@
#include <videoscale.h>
/* 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;i<gst_caps_get_size(caps);i++) {
@ -188,7 +190,7 @@ gst_videoscale_getcaps (GstPad *pad)
NULL);
}
GST_DEBUG ("returning caps: " GST_PTR_FORMAT, caps);
GST_DEBUG ("returning caps: %" GST_PTR_FORMAT, caps);
return caps;
}
@ -274,7 +276,7 @@ gst_videoscale_link (GstPad *pad, const GstCaps *caps)
static void
gst_videoscale_init (GstVideoscale *videoscale)
{
GST_DEBUG ("gst_videoscale_init");
GST_DEBUG_OBJECT (videoscale, "_init");
videoscale->sinkpad = 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 (

View file

@ -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())

View file

@ -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<dh; y++) {
yr = ((double)y)/zoomy;
for (x=0; x<dw; x++) {
xr = ((double)x)/zoomx;
GST_DEBUG ("videoscale: scale plane slow %g %g %p", xr, yr, (src+(int)(x)+(int)((y)*sw)));
GST_DEBUG_OBJECT (scale, "scale plane slow %g %g %p", xr, yr, (src+(int)(x)+(int)((y)*sw)));
if (floor(xr) == xr && floor(yr) == yr){
GST_DEBUG ("videoscale: scale plane %g %g %p %p", xr, yr, (src+(int)(x)+(int)((y)*sw)), dest);
GST_DEBUG_OBJECT (scale, "scale plane %g %g %p %p", xr, yr, (src+(int)(x)+(int)((y)*sw)), dest);
*dest++ = RC(xr, yr);
}
else {
@ -470,7 +472,7 @@ gst_videoscale_scale_point_sample (GstVideoscale *scale, unsigned char *src, uns
int sum, xcount, ycount, loop;
unsigned char *srcp, *srcp2;
GST_DEBUG ("videoscale: scaling nearest point sample %p %p %d", src, dest, dw);
GST_DEBUG_OBJECT (scale, "scaling nearest point sample %p %p %d", src, dest, dw);
ypos = 0x10000;
yinc = (sh<<16)/dh;
@ -521,7 +523,7 @@ gst_videoscale_scale_nearest (GstVideoscale *scale,
guchar *destp = dest;
guchar *srcp = src;
GST_DEBUG ("videoscale: scaling nearest %p %p %d", src, dest, dw);
GST_DEBUG_OBJECT (scale, "scaling nearest %p %p %d", src, dest, dw);
ypos = 0x10000;
@ -565,7 +567,7 @@ gst_videoscale_scale_nearest_str2 (GstVideoscale *scale,
guchar *destp = dest;
guchar *srcp = src;
GST_DEBUG ("videoscale: scaling nearest %p %p %d", src, dest, dw);
GST_DEBUG_OBJECT (scale, "scaling nearest %p %p %d", src, dest, dw);
ypos = 0x10000;
@ -610,7 +612,7 @@ gst_videoscale_scale_nearest_str4 (GstVideoscale *scale,
guchar *destp = dest;
guchar *srcp = src;
GST_DEBUG ("videoscale: scaling nearest %p %p %d", src, dest, dw);
GST_DEBUG_OBJECT (scale, "scaling nearest %p %p %d", src, dest, dw);
ypos = 0x10000;
@ -655,7 +657,7 @@ gst_videoscale_scale_nearest_32bit (GstVideoscale *scale,
guchar *destp = dest;
guchar *srcp = src;
GST_DEBUG ("videoscale: scaling nearest %p %p %d", src, dest, dw);
GST_DEBUG_OBJECT (scale, "scaling nearest %p %p %d", src, dest, dw);
ypos = 0x10000;
@ -700,7 +702,7 @@ gst_videoscale_scale_nearest_24bit (GstVideoscale *scale,
guchar *destp = dest;
guchar *srcp = src;
GST_DEBUG ("videoscale: scaling nearest %p %p %d", src, dest, dw);
GST_DEBUG_OBJECT (scale, "scaling nearest %p %p %d", src, dest, dw);
ypos = 0x10000;
@ -747,7 +749,7 @@ gst_videoscale_scale_nearest_16bit (GstVideoscale *scale,
guchar *destp = dest;
guchar *srcp = src;
GST_DEBUG ("videoscale: scaling nearest %p %p %d", src, dest, dw);
GST_DEBUG_OBJECT (scale, "scaling nearest %p %p %d", src, dest, dw);
ypos = 0x10000;