From a3824d508e22f18dced18370e98cf75c863a5123 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 14 Jan 2013 19:19:23 +0100 Subject: video: print filter chain in verbose mode Somewhat useful to see where filters are auto-inserted and which formats they take. --- video/filter/vf.c | 34 ++++++++++++++++++++++++++++++++-- video/filter/vf.h | 3 ++- 2 files changed, 34 insertions(+), 3 deletions(-) (limited to 'video/filter') diff --git a/video/filter/vf.c b/video/filter/vf.c index b7a2044ad1..93088953dc 100644 --- a/video/filter/vf.c +++ b/video/filter/vf.c @@ -151,6 +151,35 @@ static struct mp_image *vf_default_filter(struct vf_instance *vf, return mpi; } +static void print_fmt(int msglevel, struct vf_format *fmt) +{ + if (fmt && fmt->configured) { + mp_msg(MSGT_VFILTER, msglevel, "%dx%d", fmt->w, fmt->h); + if (fmt->w != fmt->dw || fmt->h != fmt->dh) + mp_msg(MSGT_VFILTER, msglevel, "->%dx%d", fmt->dw, fmt->dh); + mp_msg(MSGT_VFILTER, msglevel, " %s %#x", mp_imgfmt_to_name(fmt->fmt), + fmt->flags); + } else { + mp_msg(MSGT_VFILTER, msglevel, "???"); + } +} + +void vf_print_filter_chain(int msglevel, struct vf_instance *vf) +{ + if (!mp_msg_test(MSGT_VFILTER, msglevel)) + return; + + for (vf_instance_t *f = vf; f; f = f->next) { + mp_msg(MSGT_VFILTER, msglevel, " [%s] ", f->info->name); + print_fmt(msglevel, &f->fmt_in); + if (f->next) { + mp_msg(MSGT_VFILTER, msglevel, " -> "); + print_fmt(msglevel, &f->fmt_out); + } + mp_msg(MSGT_VFILTER, msglevel, "\n"); + } +} + struct vf_instance *vf_open_plugin_noerr(struct MPOpts *opts, const vf_info_t *const *filter_list, vf_instance_t *next, const char *name, @@ -385,8 +414,9 @@ int vf_config_wrapper(struct vf_instance *vf, if (r) { vf->fmt_in = (struct vf_format) { .configured = 1, - .w = width, - .h = height, + .w = width, .h = height, + .dw = d_width, .dh = d_height, + .flags = flags, .fmt = outfmt, }; vf->fmt_out = vf->next ? vf->next->fmt_in : (struct vf_format){0}; diff --git a/video/filter/vf.h b/video/filter/vf.h index bca9ebfff5..2a6fc5a41e 100644 --- a/video/filter/vf.h +++ b/video/filter/vf.h @@ -43,7 +43,7 @@ typedef struct vf_info { struct vf_format { int configured; - int w, h, fmt; + int w, h, dw, dh, flags, fmt; }; typedef struct vf_instance { @@ -140,6 +140,7 @@ void vf_uninit_filter_chain(vf_instance_t *vf); int vf_config_wrapper(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt); +void vf_print_filter_chain(int msglevel, struct vf_instance *vf); void vf_rescale_dsize(struct vf_instance *vf, int *d_width, int *d_height, int old_w, int old_h, int new_w, int new_h); -- cgit v1.2.3