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/decode/vd.c | 15 ++++++++------- video/filter/vf.c | 34 ++++++++++++++++++++++++++++++++-- video/filter/vf.h | 3 ++- 3 files changed, 42 insertions(+), 10 deletions(-) (limited to 'video') diff --git a/video/decode/vd.c b/video/decode/vd.c index e3cb70ad1b..7cdd25f55a 100644 --- a/video/decode/vd.c +++ b/video/decode/vd.c @@ -83,12 +83,8 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int out_fmt) // check if libvo and codec has common outfmt (no conversion): for (;;) { - if (mp_msg_test(MSGT_DECVIDEO, MSGL_V)) { - mp_msg(MSGT_DECVIDEO, MSGL_V, "Trying filter chain:"); - for (vf_instance_t *f = vf; f; f = f->next) - mp_msg(MSGT_DECVIDEO, MSGL_V, " %s", f->info->name); - mp_msg(MSGT_DECVIDEO, MSGL_V, "\n"); - } + mp_msg(MSGT_VFILTER, MSGL_V, "Trying filter chain:\n"); + vf_print_filter_chain(MSGL_V, vf); int flags = vf->query_format(vf, out_fmt); mp_msg(MSGT_CPLAYER, MSGL_DBG2, "vo_debug: query(%s) returned 0x%X \n", @@ -108,7 +104,9 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int out_fmt) mp_tmsg(MSGT_CPLAYER, MSGL_WARN, "The selected video_out device is incompatible with this codec.\n"\ "Try appending the scale filter to your filter list,\n"\ - "e.g. -vf spp,scale instead of -vf spp.\n"); + "e.g. -vf filter,scale instead of -vf filter.\n"); + mp_tmsg(MSGT_VFILTER, MSGL_WARN, "Attempted filter chain:\n"); + vf_print_filter_chain(MSGL_WARN, vf); sh->vf_initialized = -1; return 0; // failed } @@ -198,6 +196,9 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int out_fmt) return 0; } + mp_tmsg(MSGT_VFILTER, MSGL_V, "Video filter chain:\n"); + vf_print_filter_chain(MSGL_V, vf); + sh->vf_initialized = 1; set_video_colorspace(sh); 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