Commit 96da1c51 authored by Stefano Sabatini's avatar Stefano Sabatini

Implement trace messages logging in the filterchain processing.

It is only enabled when the DEBUG symbol is defined.

Originally committed as revision 20187 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 2ad4c241
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
/* #define DEBUG */
#include "libavcodec/imgconvert.h" #include "libavcodec/imgconvert.h"
#include "avfilter.h" #include "avfilter.h"
...@@ -160,21 +162,50 @@ int avfilter_config_links(AVFilterContext *filter) ...@@ -160,21 +162,50 @@ int avfilter_config_links(AVFilterContext *filter)
return 0; 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 *avfilter_get_video_buffer(AVFilterLink *link, int perms)
{ {
AVFilterPicRef *ret = NULL; 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) if(link_dpad(link).get_video_buffer)
ret = link_dpad(link).get_video_buffer(link, perms); ret = link_dpad(link).get_video_buffer(link, perms);
if(!ret) if(!ret)
ret = avfilter_default_get_video_buffer(link, perms); 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; return ret;
} }
int avfilter_request_frame(AVFilterLink *link) int avfilter_request_frame(AVFilterLink *link)
{ {
DPRINTF_START(NULL, request_frame); dprintf_link(NULL, link, 1);
if(link_spad(link).request_frame) if(link_spad(link).request_frame)
return link_spad(link).request_frame(link); return link_spad(link).request_frame(link);
else if(link->src->inputs[0]) else if(link->src->inputs[0])
...@@ -205,6 +236,8 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref) ...@@ -205,6 +236,8 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
void (*start_frame)(AVFilterLink *, AVFilterPicRef *); void (*start_frame)(AVFilterLink *, AVFilterPicRef *);
AVFilterPad *dst = &link_dpad(link); 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)) if(!(start_frame = dst->start_frame))
start_frame = avfilter_default_start_frame; start_frame = avfilter_default_start_frame;
...@@ -253,6 +286,8 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h) ...@@ -253,6 +286,8 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h)
int i, j, hsub, vsub; int i, j, hsub, vsub;
void (*draw_slice)(AVFilterLink *, int, int); 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 */ /* copy the slice if needed for permission reasons */
if(link->srcpic) { if(link->srcpic) {
avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub); avcodec_get_chroma_sub_sample(link->format, &hsub, &vsub);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment