Commit 134815a0 authored by Stefano Sabatini's avatar Stefano Sabatini

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.
parent c1d62489
......@@ -182,7 +182,7 @@ void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
AVFilterPad *dst = link->dstpad;
int64_t pts;
FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1);
FF_TPRINTF_START(NULL, filter_samples); ff_tlog_link(NULL, link, 1);
if (!(filter_samples = dst->filter_samples))
filter_samples = ff_default_filter_samples;
......
......@@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* #define DEBUG */
#include "libavutil/pixdesc.h"
#include "libavutil/rational.h"
#include "libavutil/audioconvert.h"
......@@ -43,17 +41,17 @@ char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
return buf;
}
void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
void ff_tlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
{
av_unused char buf[16];
av_dlog(ctx,
ff_tlog(ctx,
"ref[%p buf:%p refcount:%d perms:%s data:%p linesize[%d, %d, %d, %d] pts:%"PRId64" pos:%"PRId64,
ref, ref->buf, ref->buf->refcount, ff_get_ref_perms_string(buf, sizeof(buf), ref->perms), ref->data[0],
ref->linesize[0], ref->linesize[1], ref->linesize[2], ref->linesize[3],
ref->pts, ref->pos);
if (ref->video) {
av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
ff_tlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c",
ref->video->sample_aspect_ratio.num, ref->video->sample_aspect_ratio.den,
ref->video->w, ref->video->h,
!ref->video->interlaced ? 'P' : /* Progressive */
......@@ -62,13 +60,13 @@ void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end)
av_get_picture_type_char(ref->video->pict_type));
}
if (ref->audio) {
av_dlog(ctx, " cl:%"PRId64"d n:%d r:%d",
ff_tlog(ctx, " cl:%"PRId64"d n:%d r:%d",
ref->audio->channel_layout,
ref->audio->nb_samples,
ref->audio->sample_rate);
}
av_dlog(ctx, "]%s", end ? "\n" : "");
ff_tlog(ctx, "]%s", end ? "\n" : "");
}
unsigned avfilter_version(void) {
......@@ -295,10 +293,10 @@ int avfilter_config_links(AVFilterContext *filter)
return 0;
}
void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
void ff_tlog_link(void *ctx, AVFilterLink *link, int end)
{
if (link->type == AVMEDIA_TYPE_VIDEO) {
av_dlog(ctx,
ff_tlog(ctx,
"link[%p s:%dx%d fmt:%s %s->%s]%s",
link, link->w, link->h,
av_pix_fmt_descriptors[link->format].name,
......@@ -309,7 +307,7 @@ void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
char buf[128];
av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
av_dlog(ctx,
ff_tlog(ctx,
"link[%p r:%d cl:%s fmt:%s %s->%s]%s",
link, (int)link->sample_rate, buf,
av_get_sample_fmt_name(link->format),
......@@ -321,7 +319,7 @@ void ff_dlog_link(void *ctx, AVFilterLink *link, int end)
int ff_request_frame(AVFilterLink *link)
{
FF_DPRINTF_START(NULL, request_frame); ff_dlog_link(NULL, link, 1);
FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, link, 1);
if (link->srcpad->request_frame)
return link->srcpad->request_frame(link);
......
......@@ -126,15 +126,23 @@ void ff_free_pool(AVFilterPool *pool);
void ff_command_queue_pop(AVFilterContext *filter);
/* misc debug functions */
/* misc trace functions */
#define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func)
/* #define FF_AVFILTER_TRACE */
#ifdef FF_AVFILTER_TRACE
# define ff_tlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__)
#else
# define ff_tlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
#endif
#define FF_TPRINTF_START(ctx, func) ff_tlog(NULL, "%-16s: ", #func)
char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms);
void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end);
void ff_tlog_ref(void *ctx, AVFilterBufferRef *ref, int end);
void ff_dlog_link(void *ctx, AVFilterLink *link, int end);
void ff_tlog_link(void *ctx, AVFilterLink *link, int end);
/**
* Insert a new pad.
......
......@@ -132,8 +132,8 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int
AVFilterBufferRef *ret = NULL;
av_unused char buf[16];
FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0);
av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
FF_TPRINTF_START(NULL, get_video_buffer); ff_tlog_link(NULL, link, 0);
ff_tlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h);
if (link->dstpad->get_video_buffer)
ret = link->dstpad->get_video_buffer(link, perms, w, h);
......@@ -144,7 +144,7 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int
if (ret)
ret->type = AVMEDIA_TYPE_VIDEO;
FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1);
FF_TPRINTF_START(NULL, get_video_buffer); ff_tlog_link(NULL, link, 0); ff_tlog(NULL, " returning "); ff_tlog_ref(NULL, ret, 1);
return ret;
}
......@@ -177,7 +177,7 @@ void ff_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
int perms = picref->perms;
AVFilterCommand *cmd= link->dst->command_queue;
FF_DPRINTF_START(NULL, start_frame); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " "); ff_dlog_ref(NULL, picref, 1);
FF_TPRINTF_START(NULL, start_frame); ff_tlog_link(NULL, link, 0); ff_tlog(NULL, " "); ff_tlog_ref(NULL, picref, 1);
if (!(start_frame = dst->start_frame))
start_frame = default_start_frame;
......@@ -284,7 +284,7 @@ void ff_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
int i, j, vsub;
void (*draw_slice)(AVFilterLink *, int, int, int);
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);
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);
/* copy the slice if needed for permission reasons */
if (link->src_buf) {
......
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