[FFmpeg-cvslog] r20187 - trunk/libavfilter/avfilter.c

stefano subversion
Wed Oct 7 00:07:33 CEST 2009


Author: stefano
Date: Wed Oct  7 00:07:32 2009
New Revision: 20187

Log:
Implement trace messages logging in the filterchain processing.

It is only enabled when the DEBUG symbol is defined.

Modified:
   trunk/libavfilter/avfilter.c

Modified: trunk/libavfilter/avfilter.c
==============================================================================
--- trunk/libavfilter/avfilter.c	Tue Oct  6 23:55:41 2009	(r20186)
+++ trunk/libavfilter/avfilter.c	Wed Oct  7 00:07:32 2009	(r20187)
@@ -19,6 +19,8 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+/* #define DEBUG */
+
 #include "libavcodec/imgconvert.h"
 #include "avfilter.h"
 
@@ -160,21 +162,50 @@ int avfilter_config_links(AVFilterContex
     return 0;
 }
 
+static void dprintf_picref(void *ctx, AVFilterPicRef *picref, int end)
+{
+    dprintf(ctx,
+            "picref[%p data[%p, %p, %p, %p] linesize[%d, %d, %d, %d] pts:%"PRId64" s:%dx%d]%s",
+            picref,
+            picref->data    [0], picref->data    [1], picref->data    [2], picref->data    [3],
+            picref->linesize[0], picref->linesize[1], picref->linesize[2], picref->linesize[3],
+            picref->pts, picref->w, picref->h,
+            end ? "\n" : "");
+}
+
+static void dprintf_link(void *ctx, AVFilterLink *link, int end)
+{
+    dprintf(ctx,
+            "link[%p s:%dx%d %-16s->%-16s]%s",
+            link, link->w, link->h,
+            link->src ? link->src->filter->name : "",
+            link->dst ? link->dst->filter->name : "",
+            end ? "\n" : "");
+}
+
+#define DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func)
+
 AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms)
 {
     AVFilterPicRef *ret = NULL;
 
+    DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d\n", perms);
+
     if(link_dpad(link).get_video_buffer)
         ret = link_dpad(link).get_video_buffer(link, perms);
 
     if(!ret)
         ret = avfilter_default_get_video_buffer(link, perms);
 
+    DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); dprintf_picref(NULL, ret, 1);
+
     return ret;
 }
 
 int avfilter_request_frame(AVFilterLink *link)
 {
+    DPRINTF_START(NULL, request_frame); dprintf_link(NULL, link, 1);
+
     if(link_spad(link).request_frame)
         return link_spad(link).request_frame(link);
     else if(link->src->inputs[0])
@@ -205,6 +236,8 @@ void avfilter_start_frame(AVFilterLink *
     void (*start_frame)(AVFilterLink *, AVFilterPicRef *);
     AVFilterPad *dst = &link_dpad(link);
 
+    DPRINTF_START(NULL, start_frame); dprintf_link(NULL, link, 0); dprintf(NULL, " "); dprintf_picref(NULL, picref, 1);
+
     if(!(start_frame = dst->start_frame))
         start_frame = avfilter_default_start_frame;
 
@@ -253,6 +286,8 @@ void avfilter_draw_slice(AVFilterLink *l
     int i, j, hsub, vsub;
     void (*draw_slice)(AVFilterLink *, int, int);
 
+    DPRINTF_START(NULL, draw_slice); dprintf_link(NULL, link, 0); dprintf(NULL, " y:%d h:%d\n", y, h);
+
     /* copy the slice if needed for permission reasons */
     if(link->srcpic) {
         avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub);



More information about the ffmpeg-cvslog mailing list