Browse code

lavfi: change name of tracing functions and of the macro which enables them

The enabling symbol is renamed FF_AVFILTER_TRACE. Avoid conflicts with
the DEBUG macro, which may be defined for different purposes.

Stefano Sabatini authored on 2012/06/05 18:24:07
Showing 4 changed files
... ...
@@ -182,7 +182,7 @@ void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
182 182
     AVFilterPad *dst = link->dstpad;
183 183
     int64_t pts;
184 184
 
185
-    FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1);
185
+    FF_TPRINTF_START(NULL, filter_samples); ff_tlog_link(NULL, link, 1);
186 186
 
187 187
     if (!(filter_samples = dst->filter_samples))
188 188
         filter_samples = ff_default_filter_samples;
... ...
@@ -19,8 +19,6 @@
19 19
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 20
  */
21 21
 
22
-/* #define DEBUG */
23
-
24 22
 #include "libavutil/pixdesc.h"
25 23
 #include "libavutil/rational.h"
26 24
 #include "libavutil/audioconvert.h"
... ...
@@ -43,17 +41,17 @@ char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
43 43
     return buf;
44 44
 }
45 45
 
46
-void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
46
+void ff_tlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
47 47
 {
48 48
     av_unused char buf[16];
49
-    av_dlog(ctx,
49
+    ff_tlog(ctx,
50 50
             "ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64,
51 51
             ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0],
52 52
             ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3],
53 53
             ref->pts, ref->pos);
54 54
 
55 55
     if (ref->video) {
56
-        av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
56
+        ff_tlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
57 57
                 ref->video->sample_aspect_ratio.num, ref->video->sample_aspect_ratio.den,
58 58
                 ref->video->w, ref->video->h,
59 59
                 !ref->video->interlaced     ? 'P' :         /* Progressive  */
... ...
@@ -62,13 +60,13 @@ void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
62 62
                 av_get_picture_type_char(ref->video->pict_type));
63 63
     }
64 64
     if (ref->audio) {
65
-        av_dlog(ctx, " cl:%"PRId64"d n:%d r:%d",
65
+        ff_tlog(ctx, " cl:%"PRId64"d n:%d r:%d",
66 66
                 ref->audio->channel_layout,
67 67
                 ref->audio->nb_samples,
68 68
                 ref->audio->sample_rate);
69 69
     }
70 70
 
71
-    av_dlog(ctx, "]%s", end ? "\n" : "");
71
+    ff_tlog(ctx, "]%s", end ? "\n" : "");
72 72
 }
73 73
 
74 74
 unsigned avfilter_version(void) {
... ...
@@ -295,10 +293,10 @@ int avfilter_config_links(AVFilterContext *filter)
295 295
     return 0;
296 296
 }
297 297
 
298
-void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
298
+void ff_tlog_link(void *ctx, AVFilterLink *link, int end)
299 299
 {
300 300
     if (link->type == AVMEDIA_TYPE_VIDEO) {
301
-        av_dlog(ctx,
301
+        ff_tlog(ctx,
302 302
                 "link[%p s:%dx%d fmt:%s %s->%s]%s",
303 303
                 link, link->w, link->h,
304 304
                 av_pix_fmt_descriptors[link->format].name,
... ...
@@ -309,7 +307,7 @@ void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
309 309
         char buf[128];
310 310
         av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
311 311
 
312
-        av_dlog(ctx,
312
+        ff_tlog(ctx,
313 313
                 "link[%p r:%d cl:%s fmt:%s %s->%s]%s",
314 314
                 link, (int)link->sample_rate, buf,
315 315
                 av_get_sample_fmt_name(link->format),
... ...
@@ -321,7 +319,7 @@ void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
321 321
 
322 322
 int ff_request_frame(AVFilterLink *link)
323 323
 {
324
-    FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1);
324
+    FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, link, 1);
325 325
 
326 326
     if (link->srcpad->request_frame)
327 327
         return link->srcpad->request_frame(link);
... ...
@@ -126,15 +126,23 @@ void ff_free_pool(AVFilterPool *pool);
126 126
 
127 127
 void ff_command_queue_pop(AVFilterContext *filter);
128 128
 
129
-/* misc debug functions */
129
+/* misc trace functions */
130 130
 
131
-#define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func)
131
+/* #define FF_AVFILTER_TRACE */
132
+
133
+#ifdef FF_AVFILTER_TRACE
134
+#    define ff_tlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
135
+#else
136
+#    define ff_tlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
137
+#endif
138
+
139
+#define FF_TPRINTF_START(ctx, func) ff_tlog(NULL, "%-16s: ", #func)
132 140
 
133 141
 char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms);
134 142
 
135
-void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end);
143
+void ff_tlog_ref(void *ctx, AVFilterBufferRef *ref, int end);
136 144
 
137
-void ff_dlog_link(void *ctx, AVFilterLink *link, int end);
145
+void ff_tlog_link(void *ctx, AVFilterLink *link, int end);
138 146
 
139 147
 /**
140 148
  * Insert a new pad.
... ...
@@ -132,8 +132,8 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int
132 132
     AVFilterBufferRef *ret = NULL;
133 133
 
134 134
     av_unused char buf[16];
135
-    FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0);
136
-    av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
135
+    FF_TPRINTF_START(NULL, get_video_buffer); ff_tlog_link(NULL, link, 0);
136
+    ff_tlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
137 137
 
138 138
     if (link->dstpad->get_video_buffer)
139 139
         ret = link->dstpad->get_video_buffer(link, perms, w, h);
... ...
@@ -144,7 +144,7 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int
144 144
     if (ret)
145 145
         ret->type = AVMEDIA_TYPE_VIDEO;
146 146
 
147
-    FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1);
147
+    FF_TPRINTF_START(NULL, get_video_buffer); ff_tlog_link(NULL, link, 0); ff_tlog(NULL, " returning "); ff_tlog_ref(NULL, ret, 1);
148 148
 
149 149
     return ret;
150 150
 }
... ...
@@ -177,7 +177,7 @@ void ff_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
177 177
     int perms = picref->perms;
178 178
     AVFilterCommand *cmd= link->dst->command_queue;
179 179
 
180
-    FF_DPRINTF_START(NULL, start_frame); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " "); ff_dlog_ref(NULL, picref, 1);
180
+    FF_TPRINTF_START(NULL, start_frame); ff_tlog_link(NULL, link, 0); ff_tlog(NULL, " "); ff_tlog_ref(NULL, picref, 1);
181 181
 
182 182
     if (!(start_frame = dst->start_frame))
183 183
         start_frame = default_start_frame;
... ...
@@ -284,7 +284,7 @@ void ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
284 284
     int i, j, vsub;
285 285
     void (*draw_slice)(AVFilterLink *, int, int, int);
286 286
 
287
-    FF_DPRINTF_START(NULL, draw_slice); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir);
287
+    FF_TPRINTF_START(NULL, draw_slice); ff_tlog_link(NULL, link, 0); ff_tlog(NULL, " y:%d h:%d dir:%d\n", y, h, slice_dir);
288 288
 
289 289
     /* copy the slice if needed for permission reasons */
290 290
     if (link->src_buf) {