diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2012-06-01 23:05:13 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2012-06-05 11:52:47 +0200 |
commit | 1488c4dc0bbd64a4452ec408ad1c01a121daad76 (patch) | |
tree | 5ee870b80ff86b8af5f3ee59628762c8e53bdf3b | |
parent | 1faf0d6a7a70cb0bcfbbff0421fb00bb6da658f9 (diff) | |
download | ffmpeg-1488c4dc0bbd64a4452ec408ad1c01a121daad76.tar.gz |
lavfi: move tracing utilities definition from video.c to avfilter.c
These utilities are meant to be defined in avfilter.c, since they are
generic and thus contain both audio and video code.
-rw-r--r-- | libavfilter/avfilter.c | 40 | ||||
-rw-r--r-- | libavfilter/internal.h | 6 | ||||
-rw-r--r-- | libavfilter/video.c | 40 |
3 files changed, 46 insertions, 40 deletions
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index b56106a857..041ba1b9c0 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -31,6 +31,46 @@ #include "formats.h" #include "internal.h" +char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) +{ + snprintf(buf, buf_size, "%s%s%s%s%s%s", + perms & AV_PERM_READ ? "r" : "", + perms & AV_PERM_WRITE ? "w" : "", + perms & AV_PERM_PRESERVE ? "p" : "", + perms & AV_PERM_REUSE ? "u" : "", + perms & AV_PERM_REUSE2 ? "U" : "", + perms & AV_PERM_NEG_LINESIZES ? "n" : ""); + return buf; +} + +void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) +{ + av_unused char buf[16]; + av_dlog(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", + ref->video->sample_aspect_ratio.num, ref->video->sample_aspect_ratio.den, + ref->video->w, ref->video->h, + !ref->video->interlaced ? 'P' : /* Progressive */ + ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */ + ref->video->key_frame, + av_get_picture_type_char(ref->video->pict_type)); + } + if (ref->audio) { + av_dlog(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" : ""); +} + unsigned avfilter_version(void) { av_assert0(LIBAVFILTER_VERSION_MICRO >= 100); return LIBAVFILTER_VERSION_INT; diff --git a/libavfilter/internal.h b/libavfilter/internal.h index 595fdaeb12..0b294d83aa 100644 --- a/libavfilter/internal.h +++ b/libavfilter/internal.h @@ -134,8 +134,14 @@ void ff_free_pool(AVFilterPool *pool); void ff_command_queue_pop(AVFilterContext *filter); +/* misc debug functions */ + #define FF_DPRINTF_START(ctx, func) av_dlog(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_dlog_link(void *ctx, AVFilterLink *link, int end); #endif /* AVFILTER_INTERNAL_H */ diff --git a/libavfilter/video.c b/libavfilter/video.c index 888c537e54..c26c7b7327 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -26,46 +26,6 @@ #include "internal.h" #include "video.h" -static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) -{ - snprintf(buf, buf_size, "%s%s%s%s%s%s", - perms & AV_PERM_READ ? "r" : "", - perms & AV_PERM_WRITE ? "w" : "", - perms & AV_PERM_PRESERVE ? "p" : "", - perms & AV_PERM_REUSE ? "u" : "", - perms & AV_PERM_REUSE2 ? "U" : "", - perms & AV_PERM_NEG_LINESIZES ? "n" : ""); - return buf; -} - -static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) -{ - av_unused char buf[16]; - av_dlog(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", - ref->video->sample_aspect_ratio.num, ref->video->sample_aspect_ratio.den, - ref->video->w, ref->video->h, - !ref->video->interlaced ? 'P' : /* Progressive */ - ref->video->top_field_first ? 'T' : 'B', /* Top / Bottom */ - ref->video->key_frame, - av_get_picture_type_char(ref->video->pict_type)); - } - if (ref->audio) { - av_dlog(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" : ""); -} - AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); |