From 426ebbae5ff578923a83a4395ff499f0348f7dcc Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 21 Dec 2013 17:43:25 +0100 Subject: video/filter: mp_msg conversions --- video/filter/vf.c | 45 +++++++++++++++++++++--------------------- video/filter/vf.h | 7 +++++-- video/filter/vf_crop.c | 4 ++-- video/filter/vf_delogo.c | 36 +++++++++++++++++---------------- video/filter/vf_divtc.c | 32 ++++++++++++------------------ video/filter/vf_dlopen.c | 23 +++++++++------------ video/filter/vf_eq.c | 4 +++- video/filter/vf_expand.c | 2 +- video/filter/vf_gradfun.c | 2 +- video/filter/vf_lavfi.c | 10 +++++----- video/filter/vf_phase.c | 18 ++++++++--------- video/filter/vf_pullup.c | 2 +- video/filter/vf_scale.c | 17 ++++++---------- video/filter/vf_softpulldown.c | 5 ++--- video/filter/vf_stereo3d.c | 11 ++++------- video/filter/vf_unsharp.c | 5 ----- 16 files changed, 102 insertions(+), 121 deletions(-) (limited to 'video/filter') diff --git a/video/filter/vf.c b/video/filter/vf.c index 77a86501ad..c2d4be6e63 100644 --- a/video/filter/vf.c +++ b/video/filter/vf.c @@ -26,6 +26,7 @@ #include "config.h" +#include "common/global.h" #include "common/msg.h" #include "options/m_option.h" #include "options/m_config.h" @@ -194,29 +195,29 @@ static int vf_default_query_format(struct vf_instance *vf, unsigned int fmt) return vf_next_query_format(vf, fmt); } -static void print_fmt(int msglevel, struct mp_image_params *p) +static void print_fmt(struct mp_log *log, int msglevel, struct mp_image_params *p) { if (p && p->imgfmt) { - mp_msg(MSGT_VFILTER, msglevel, "%dx%d", p->w, p->h); + mp_msg_log(log, msglevel, "%dx%d", p->w, p->h); if (p->w != p->d_w || p->h != p->d_h) - mp_msg(MSGT_VFILTER, msglevel, "->%dx%d", p->d_w, p->d_h); - mp_msg(MSGT_VFILTER, msglevel, " %s", mp_imgfmt_to_name(p->imgfmt)); - mp_msg(MSGT_VFILTER, msglevel, " %s/%s", mp_csp_names[p->colorspace], - mp_csp_levels_names[p->colorlevels]); + mp_msg_log(log, msglevel, "->%dx%d", p->d_w, p->d_h); + mp_msg_log(log, msglevel, " %s", mp_imgfmt_to_name(p->imgfmt)); + mp_msg_log(log, msglevel, " %s/%s", mp_csp_names[p->colorspace], + mp_csp_levels_names[p->colorlevels]); } else { - mp_msg(MSGT_VFILTER, msglevel, "???"); + mp_msg_log(log, msglevel, "???"); } } void vf_print_filter_chain(struct vf_chain *c, int msglevel) { - if (!mp_msg_test(MSGT_VFILTER, msglevel)) + if (!mp_msg_test_log(c->log, msglevel)) return; for (vf_instance_t *f = c->first; f; f = f->next) { - mp_msg(MSGT_VFILTER, msglevel, " [%s] ", f->info->name); - print_fmt(msglevel, &f->fmt_out); - mp_msg(MSGT_VFILTER, msglevel, "\n"); + mp_msg_log(c->log, msglevel, " [%s] ", f->info->name); + print_fmt(c->log, msglevel, &f->fmt_out); + mp_msg_log(c->log, msglevel, "\n"); } } @@ -225,14 +226,13 @@ static struct vf_instance *vf_open(struct vf_chain *c, const char *name, { struct m_obj_desc desc; if (!m_obj_list_find(&desc, &vf_obj_list, bstr0(name))) { - mp_msg(MSGT_VFILTER, MSGL_ERR, - "Couldn't find video filter '%s'.\n", name); + MP_ERR(c, "Couldn't find video filter '%s'.\n", name); return NULL; } vf_instance_t *vf = talloc_zero(NULL, struct vf_instance); *vf = (vf_instance_t) { .info = desc.p, - .opts = c->opts, + .log = mp_log_new(vf, c->log, name), .hwdec = c->hwdec, .query_format = vf_default_query_format, .out_pool = talloc_steal(vf, mp_image_pool_new(16)), @@ -249,7 +249,7 @@ static struct vf_instance *vf_open(struct vf_chain *c, const char *name, return vf; error: - mp_msg(MSGT_VFILTER, MSGL_ERR, "Creating filter '%s' failed.\n", name); + MP_ERR(c, "Creating filter '%s' failed.\n", name); talloc_free(vf); return NULL; } @@ -266,8 +266,7 @@ static vf_instance_t *vf_open_filter(struct vf_chain *c, const char *name, p += sprintf(str, "%s", name); for (i = 0; args && args[2 * i]; i++) p += sprintf(p, " %s=%s", args[2 * i], args[2 * i + 1]); - mp_msg(MSGT_VFILTER, MSGL_INFO, "%s[%s]\n", - "Opening video filter: ", str); + MP_INFO(c, "Opening video filter: [%s]\n", str); return vf_open(c, name, args); } @@ -437,7 +436,7 @@ static void update_formats(struct vf_chain *c, struct vf_instance *vf, // If there are output formats, but no input formats (meaning the // filters after vf work, but vf can't output any format the filters // after it accept), try to insert a conversion filter. - mp_msg(MSGT_VFILTER, MSGL_INFO, "Using conversion filter.\n"); + MP_INFO(c, "Using conversion filter.\n"); struct vf_instance *conv = vf_open(c, "scale", NULL); if (conv) { conv->next = vf->next; @@ -507,8 +506,8 @@ int vf_reconfig(struct vf_chain *c, const struct mp_image_params *params) c->initialized = r < 0 ? -1 : 1; int loglevel = r < 0 ? MSGL_WARN : MSGL_V; if (r == -2) - mp_msg(MSGT_VFILTER, MSGL_ERR, "Image formats incompatible.\n"); - mp_msg(MSGT_VFILTER, loglevel, "Video filter chain:\n"); + MP_ERR(c, "Image formats incompatible.\n"); + mp_msg_log(c->log, loglevel, "Video filter chain:\n"); vf_print_filter_chain(c, loglevel); return r; } @@ -548,11 +547,13 @@ static int output_query_format(struct vf_instance *vf, unsigned int fmt) return 0; } -struct vf_chain *vf_new(struct MPOpts *opts) +struct vf_chain *vf_new(struct mpv_global *global) { struct vf_chain *c = talloc_ptrtype(NULL, c); *c = (struct vf_chain){ - .opts = opts, + .opts = global->opts, + .log = mp_log_new(c, global->log, "!vf"), + .global = global, }; static const struct vf_info in = { .name = "in" }; c->first = talloc(c, struct vf_instance); diff --git a/video/filter/vf.h b/video/filter/vf.h index 96f4aaef7e..4b27160ba3 100644 --- a/video/filter/vf.h +++ b/video/filter/vf.h @@ -27,6 +27,7 @@ #include "video/vfcap.h" struct MPOpts; +struct mpv_global; struct vf_instance; struct vf_priv_s; struct m_obj_settings; @@ -79,7 +80,7 @@ typedef struct vf_instance { struct mp_image_pool *out_pool; struct vf_priv_s *priv; - struct MPOpts *opts; + struct mp_log *log; struct mp_hwdec_info *hwdec; struct mp_image **out_queued; @@ -100,7 +101,9 @@ struct vf_chain { struct mp_image_params output_params; uint8_t allowed_output_formats[IMGFMT_END - IMGFMT_START]; + struct mp_log *log; struct MPOpts *opts; + struct mpv_global *global; struct mp_hwdec_info *hwdec; }; @@ -122,7 +125,7 @@ enum vf_ctrl { VFCTRL_SET_OSD_OBJ, }; -struct vf_chain *vf_new(struct MPOpts *opts); +struct vf_chain *vf_new(struct mpv_global *global); void vf_destroy(struct vf_chain *c); int vf_reconfig(struct vf_chain *c, const struct mp_image_params *params); int vf_control_any(struct vf_chain *c, int cmd, void *arg); diff --git a/video/filter/vf_crop.c b/video/filter/vf_crop.c index cd286910ab..186c710d9f 100644 --- a/video/filter/vf_crop.c +++ b/video/filter/vf_crop.c @@ -59,7 +59,7 @@ static int config(struct vf_instance *vf, // check: if(vf->priv->crop_w+vf->priv->crop_x>width || vf->priv->crop_h+vf->priv->crop_y>height){ - mp_msg(MSGT_VFILTER, MSGL_WARN, "[CROP] Bad position/width/height - cropped area outside of the original!\n"); + MP_WARN(vf, "[CROP] Bad position/width/height - cropped area outside of the original!\n"); return 0; } vf_rescale_dsize(&d_width, &d_height, width, height, @@ -86,7 +86,7 @@ static int vf_open(vf_instance_t *vf){ vf->config=config; vf->filter=filter; vf->query_format=query_format; - mp_msg(MSGT_VFILTER, MSGL_INFO, "Crop: %d x %d, %d ; %d\n", + MP_INFO(vf, "Crop: %d x %d, %d ; %d\n", vf->priv->crop_w, vf->priv->crop_h, vf->priv->crop_x, diff --git a/video/filter/vf_delogo.c b/video/filter/vf_delogo.c index d1e7ea1c4a..e5840800cc 100644 --- a/video/filter/vf_delogo.c +++ b/video/filter/vf_delogo.c @@ -60,8 +60,9 @@ static struct vf_priv_s { * Adjust the coordinates to suit the band width * Also print a notice in verbose mode */ -static void fix_band(struct vf_priv_s *p) +static void fix_band(struct vf_instance *vf) { + struct vf_priv_s *p = vf->priv; if (p->band < 0) { p->band = 4; p->show = 1; @@ -70,12 +71,13 @@ static void fix_band(struct vf_priv_s *p) p->lh += p->band*2; p->xoff -= p->band; p->yoff -= p->band; - mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d x %d, %d x %d, band = %d\n", + MP_VERBOSE(vf, "delogo: %d x %d, %d x %d, band = %d\n", p->xoff, p->yoff, p->lw, p->lh, p->band); } -static void update_sub(struct vf_priv_s *p, double pts) +static void update_sub(struct vf_instance *vf, double pts) { + struct vf_priv_s *p = vf->priv; int ipts = pts * 1000; int tr = p->cur_timed_rect; while (tr < p->n_timed_rect - 1 && ipts >= p->timed_rect[tr + 1].ts) @@ -94,7 +96,7 @@ static void update_sub(struct vf_priv_s *p, double pts) } else { p->xoff = p->yoff = p->lw = p->lh = p->band = 0; } - fix_band(p); + fix_band(vf); } static void do_delogo(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int width, int height, @@ -173,7 +175,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) } if (vf->priv->timed_rect) - update_sub(vf->priv, dmpi->pts); + update_sub(vf, dmpi->pts); do_delogo(dmpi->planes[0], mpi->planes[0], dmpi->stride[0], mpi->stride[0], mpi->w, mpi->h, vf->priv->xoff, vf->priv->yoff, vf->priv->lw, vf->priv->lh, vf->priv->band, vf->priv->show); do_delogo(dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, @@ -197,8 +199,9 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){ return 0; } -static int load_timed_rectangles(struct vf_priv_s *delogo) +static int load_timed_rectangles(struct vf_instance *vf) { + struct vf_priv_s *delogo = vf->priv; FILE *f; char line[2048]; int lineno = 0, p; @@ -208,7 +211,7 @@ static int load_timed_rectangles(struct vf_priv_s *delogo) f = fopen(delogo->file, "r"); if (!f) { - mp_msg(MSGT_VFILTER, MSGL_ERR, "delogo: unable to load %s: %s\n", + MP_ERR(vf, "delogo: unable to load %s: %s\n", delogo->file, strerror(errno)); return -1; } @@ -218,14 +221,13 @@ static int load_timed_rectangles(struct vf_priv_s *delogo) continue; if (n_rect == alloc_rect) { if (alloc_rect > INT_MAX / 2 / (int)sizeof(*rect)) { - mp_msg(MSGT_VFILTER, MSGL_WARN, - "delogo: too many rectangles\n"); + MP_WARN(vf, "delogo: too many rectangles\n"); goto load_error; } alloc_rect = alloc_rect ? 2 * alloc_rect : 256; nr = realloc(rect, alloc_rect * sizeof(*rect)); if (!nr) { - mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: out of memory\n"); + MP_WARN(vf, "delogo: out of memory\n"); goto load_error; } rect = nr; @@ -236,18 +238,18 @@ static int load_timed_rectangles(struct vf_priv_s *delogo) &ts, &nr->x, &nr->y, &nr->w, &nr->h, &nr->b); if ((p == 2 && !nr->x) || p == 5 || p == 6) { if (ts <= last_ts) - mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: %s:%d: wrong time\n", + MP_WARN(vf, "delogo: %s:%d: wrong time\n", delogo->file, lineno); nr->ts = 1000 * ts + 0.5; n_rect++; } else { - mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: %s:%d: syntax error\n", + MP_WARN(vf, "delogo: %s:%d: syntax error\n", delogo->file, lineno); } } fclose(f); if (!n_rect) { - mp_msg(MSGT_VFILTER, MSGL_ERR, "delogo: %s: no rectangles found\n", + MP_ERR(vf, "delogo: %s: no rectangles found\n", delogo->file); free(rect); return -1; @@ -280,18 +282,18 @@ static int vf_open(vf_instance_t *vf){ p->xoff, p->yoff, p->lw, p->lh, band, show) >= 0) { if (p->file && p->file[0]) - mp_msg(MSGT_VFILTER, MSGL_WARN, "delogo: file argument ignored\n"); + MP_WARN(vf, "delogo: file argument ignored\n"); return 1; } if (vf->priv->file) { - if (load_timed_rectangles(vf->priv)) + if (load_timed_rectangles(vf)) return 0; - mp_msg(MSGT_VFILTER, MSGL_V, "delogo: %d from %s\n", + MP_VERBOSE(vf, "delogo: %d from %s\n", vf->priv->n_timed_rect, vf->priv->file); vf->priv->cur_timed_rect = -1; } - fix_band(vf->priv); + fix_band(vf); return 1; } diff --git a/video/filter/vf_divtc.c b/video/filter/vf_divtc.c index bf0b7426b4..a27f73b3ee 100644 --- a/video/filter/vf_divtc.c +++ b/video/filter/vf_divtc.c @@ -286,8 +286,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) case 2: if(p->frameno/5>p->bcount) { - mp_msg(MSGT_VFILTER, MSGL_ERR, - "\n%s: Log file ends prematurely! " + MP_ERR(vf, "\n%s: Log file ends prematurely! " "Switching to one pass mode.\n", vf->info->name); p->pass=0; break; @@ -308,8 +307,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) if(f<100) { - mp_msg(MSGT_VFILTER, MSGL_INFO, - "\n%s: Mismatch with pass-1: %+d frame(s).\n", + MP_INFO(vf, "\n%s: Mismatch with pass-1: %+d frame(s).\n", vf->info->name, f); p->frameno+=f; @@ -317,8 +315,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) } else if(p->misscount++>=30) { - mp_msg(MSGT_VFILTER, MSGL_ERR, - "\n%s: Sync with pass-1 lost! " + MP_ERR(vf, "\n%s: Sync with pass-1 lost! " "Switching to one pass mode.\n", vf->info->name); p->pass=0; break; @@ -352,8 +349,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) if(newphase!=p->phase && ((p->phase+4)%5phase=newphase; - mp_msg(MSGT_VFILTER, MSGL_STATUS, - "\n%s: Telecine phase %d.\n", vf->info->name, p->phase); + MP_INFO(vf, "\n%s: Telecine phase %d.\n", vf->info->name, p->phase); } switch((p->frameno++-p->phase+10)%5) @@ -381,8 +377,9 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) return mpi; } -static int analyze(struct vf_priv_s *p) +static int analyze(struct vf_instance *vf) { + struct vf_priv_s *p = vf->priv; int *buf=0, *bp, bufsize=0, n, b, f, i, j, m, s; unsigned int *cbuf=0, *cp; int8_t *pbuf; @@ -403,7 +400,7 @@ static int analyze(struct vf_priv_s *p) if(!bp || !cp) { - mp_msg(MSGT_VFILTER, MSGL_FATAL, "%s: Not enough memory.\n", + MP_FATAL(vf, "%s: Not enough memory.\n", vf_info_divtc.name); free(buf); free(cbuf); @@ -416,7 +413,7 @@ static int analyze(struct vf_priv_s *p) if(n <= 15) { - mp_msg(MSGT_VFILTER, MSGL_FATAL, "%s: Empty 2-pass log file.\n", + MP_FATAL(vf, "%s: Empty 2-pass log file.\n", vf_info_divtc.name); free(buf); free(cbuf); @@ -460,8 +457,7 @@ static int analyze(struct vf_priv_s *p) p->deghost=s1>s0?deghost:0; - mp_msg(MSGT_VFILTER, MSGL_INFO, - "%s: Deghosting %-3s (relative pattern strength %+.2fdB).\n", + MP_INFO(vf, "%s: Deghosting %-3s (relative pattern strength %+.2fdB).\n", vf_info_divtc.name, p->deghost?"ON":"OFF", 10.0*log10(s1/s0)); @@ -493,7 +489,7 @@ static int analyze(struct vf_priv_s *p) if(f==b) { free(buf-15); - mp_msg(MSGT_VFILTER, MSGL_FATAL, "%s: No telecine pattern found!\n", + MP_FATAL(vf, "%s: No telecine pattern found!\n", vf_info_divtc.name); return 0; } @@ -623,8 +619,7 @@ static int vf_open(vf_instance_t *vf) case 1: if(!(p->file=fopen(p->filename, "w"))) { - mp_msg(MSGT_VFILTER, MSGL_FATAL, - "%s: Can't create file %s.\n", vf->info->name, p->filename); + MP_FATAL(vf, "%s: Can't create file %s.\n", vf->info->name, p->filename); goto fail; } @@ -633,12 +628,11 @@ static int vf_open(vf_instance_t *vf) case 2: if(!(p->file=fopen(p->filename, "r"))) { - mp_msg(MSGT_VFILTER, MSGL_FATAL, - "%s: Can't open file %s.\n", vf->info->name, p->filename); + MP_FATAL(vf, "%s: Can't open file %s.\n", vf->info->name, p->filename); goto fail; } - if(!analyze(p)) + if(!analyze(vf)) goto fail; fclose(p->file); diff --git a/video/filter/vf_dlopen.c b/video/filter/vf_dlopen.c index dedafda85c..4eefec150c 100644 --- a/video/filter/vf_dlopen.c +++ b/video/filter/vf_dlopen.c @@ -135,11 +135,11 @@ static int config(struct vf_instance *vf, vf->priv->filter.out_cnt = 1; if (!vf->priv->filter.in_fmt) { - mp_msg(MSGT_VFILTER, MSGL_ERR, "invalid input/output format\n"); + MP_ERR(vf, "invalid input/output format\n"); return 0; } if (vf->priv->filter.config && vf->priv->filter.config(&vf->priv->filter) < 0) { - mp_msg(MSGT_VFILTER, MSGL_ERR, "filter config failed\n"); + MP_ERR(vf, "filter config failed\n"); return 0; } @@ -167,13 +167,11 @@ static int config(struct vf_instance *vf, } if (!vf->priv->outfmt) { - mp_msg(MSGT_VFILTER, MSGL_ERR, - "filter config wants an unsupported output format\n"); + MP_ERR(vf, "filter config wants an unsupported output format\n"); return 0; } if (!vf->priv->out_cnt || vf->priv->out_cnt > FILTER_MAX_OUTCNT) { - mp_msg(MSGT_VFILTER, MSGL_ERR, - "filter config wants to yield zero or too many output frames\n"); + MP_ERR(vf, "filter config wants to yield zero or too many output frames\n"); return 0; } @@ -308,14 +306,13 @@ static int vf_open(vf_instance_t *vf) { int i; if (!vf->priv->cfg_dllname) { - mp_msg(MSGT_VFILTER, MSGL_ERR, - "usage: -vf dlopen=filename.so:function:args\n"); + MP_ERR(vf, "usage: -vf dlopen=filename.so:function:args\n"); return 0; } vf->priv->dll = DLLOpen(vf->priv->cfg_dllname); if (!vf->priv->dll) { - mp_msg(MSGT_VFILTER, MSGL_ERR, "library not found: %s\n", + MP_ERR(vf, "library not found: %s\n", vf->priv->cfg_dllname); return 0; } @@ -323,7 +320,7 @@ static int vf_open(vf_instance_t *vf) vf_dlopen_getcontext_func *func = (vf_dlopen_getcontext_func *) DLLSymbol(vf->priv->dll, "vf_dlopen_getcontext"); if (!func) { - mp_msg(MSGT_VFILTER, MSGL_ERR, "library is not a filter: %s\n", + MP_ERR(vf, "library is not a filter: %s\n", vf->priv->cfg_dllname); return 0; } @@ -346,15 +343,13 @@ static int vf_open(vf_instance_t *vf) if (func(&vf->priv->filter, vf->priv->cfg_argc, (const char **)vf->priv->cfg_argv) < 0) { - mp_msg(MSGT_VFILTER, MSGL_ERR, - "function did not create a filter: %s\n", + MP_ERR(vf, "function did not create a filter: %s\n", vf->priv->cfg_dllname); return 0; } if (!vf->priv->filter.put_image) { - mp_msg(MSGT_VFILTER, MSGL_ERR, - "function did not create a filter that can put images: %s\n", + MP_ERR(vf, "function did not create a filter that can put images: %s\n", vf->priv->cfg_dllname); return 0; } diff --git a/video/filter/vf_eq.c b/video/filter/vf_eq.c index b5a898a58f..d362390d88 100644 --- a/video/filter/vf_eq.c +++ b/video/filter/vf_eq.c @@ -58,6 +58,7 @@ typedef struct eq2_param_t { } eq2_param_t; typedef struct vf_priv_s { + struct mp_log *log; eq2_param_t param[3]; double contrast; @@ -313,7 +314,7 @@ void check_values (eq2_param_t *par) static void print_values (vf_eq2_t *eq2) { - mp_msg (MSGT_VFILTER, MSGL_V, "vf_eq2: c=%.2f b=%.2f g=%.4f s=%.2f \n", + MP_VERBOSE(eq2, "vf_eq2: c=%.2f b=%.2f g=%.4f s=%.2f \n", eq2->contrast, eq2->brightness, eq2->gamma, eq2->saturation ); } @@ -470,6 +471,7 @@ int vf_open(vf_instance_t *vf) vf->priv = malloc (sizeof (vf_eq2_t)); eq2 = vf->priv; + eq2->log = vf->log; for (i = 0; i < 3; i++) { eq2->buf[i] = NULL; diff --git a/video/filter/vf_expand.c b/video/filter/vf_expand.c index e4d9f2dd33..2e03441757 100644 --- a/video/filter/vf_expand.c +++ b/video/filter/vf_expand.c @@ -148,7 +148,7 @@ static int vf_open(vf_instance_t *vf){ vf->config=config; vf->query_format=query_format; vf->filter=filter; - mp_msg(MSGT_VFILTER, MSGL_INFO, "Expand: %d x %d, %d ; %d, aspect: %f, round: %d\n", + MP_INFO(vf, "Expand: %d x %d, %d ; %d, aspect: %f, round: %d\n", vf->priv->cfg_exp_w, vf->priv->cfg_exp_h, vf->priv->cfg_exp_x, diff --git a/video/filter/vf_gradfun.c b/video/filter/vf_gradfun.c index 87464d5bb6..2ca211fb74 100644 --- a/video/filter/vf_gradfun.c +++ b/video/filter/vf_gradfun.c @@ -379,7 +379,7 @@ static int vf_open(vf_instance_t *vf) bool have_size = vf->priv->cfg_size > -1; if (have_radius && have_size) { - mp_msg(MSGT_VFILTER, MSGL_ERR, "scale: gradfun: only one of " + MP_ERR(vf, "scale: gradfun: only one of " "radius/size parameters allowed at the same time!\n"); return 0; } diff --git a/video/filter/vf_lavfi.c b/video/filter/vf_lavfi.c index 03602aa702..c5d237c01d 100644 --- a/video/filter/vf_lavfi.c +++ b/video/filter/vf_lavfi.c @@ -130,19 +130,19 @@ static bool recreate_graph(struct vf_instance *vf, int width, int height, vf->priv->lw_recreate_cb(vf); if (bstr0(p->cfg_graph).len == 0) { - mp_msg(MSGT_VFILTER, MSGL_FATAL, "lavfi: no filter graph set\n"); + MP_FATAL(vf, "lavfi: no filter graph set\n"); return false; } destroy_graph(vf); - mp_msg(MSGT_VFILTER, MSGL_V, "lavfi: create graph: '%s'\n", p->cfg_graph); + MP_VERBOSE(vf, "lavfi: create graph: '%s'\n", p->cfg_graph); AVFilterGraph *graph = avfilter_graph_alloc(); if (!graph) goto error; if (parse_avopts(graph, p->cfg_avopts) < 0) { - mp_msg(MSGT_VFILTER, MSGL_FATAL, "lavfi: could not set opts: '%s'\n", + MP_FATAL(vf, "lavfi: could not set opts: '%s'\n", p->cfg_avopts); goto error; } @@ -214,7 +214,7 @@ static bool recreate_graph(struct vf_instance *vf, int width, int height, return true; error: - mp_msg(MSGT_VFILTER, MSGL_FATAL, "Can't configure libavfilter graph.\n"); + MP_FATAL(vf, "Can't configure libavfilter graph.\n"); avfilter_graph_free(&graph); talloc_free(tmp); return false; @@ -444,7 +444,7 @@ int vf_lw_set_graph(struct vf_instance *vf, struct vf_lw_opts *lavfi_opts, lavfi_opts = (struct vf_lw_opts *)vf_lw_conf.defaults; if (!lavfi_opts->enable || !have_filter(filter)) return -1; - mp_msg(MSGT_VFILTER, MSGL_V, "Using libavfilter for '%s'\n", vf->info->name); + MP_VERBOSE(vf, "Using libavfilter for '%s'\n", vf->info->name); void *old_priv = vf->priv; struct vf_priv_s *p = talloc(vf, struct vf_priv_s); vf->priv = p; diff --git a/video/filter/vf_phase.c b/video/filter/vf_phase.c index 38668f6d8e..b016e66820 100644 --- a/video/filter/vf_phase.c +++ b/video/filter/vf_phase.c @@ -88,7 +88,8 @@ static void do_plane(unsigned char *to, unsigned char *from, * between the fields. */ -static enum mode analyze_plane(unsigned char *old, unsigned char *new, +static enum mode analyze_plane(struct vf_instance *vf, + unsigned char *old, unsigned char *new, int w, int h, int os, int ns, enum mode mode, int unused, int fields) { @@ -188,14 +189,11 @@ static enum mode analyze_plane(unsigned char *old, unsigned char *new, mode=PROGRESSIVE; } - if( mp_msg_test(MSGT_VFILTER,MSGL_V) ) - { - mp_msg(MSGT_VFILTER, MSGL_INFO, "%c", mode==BOTTOM_FIRST?'b':mode==TOP_FIRST?'t':'p'); - if(tdiff==65536.0) mp_msg(MSGT_VFILTER, MSGL_INFO," N/A "); else mp_msg(MSGT_VFILTER, MSGL_INFO," %8.2f", tdiff); - if(bdiff==65536.0) mp_msg(MSGT_VFILTER, MSGL_INFO," N/A "); else mp_msg(MSGT_VFILTER, MSGL_INFO," %8.2f", bdiff); - if(pdiff==65536.0) mp_msg(MSGT_VFILTER, MSGL_INFO," N/A "); else mp_msg(MSGT_VFILTER, MSGL_INFO," %8.2f", pdiff); - mp_msg(MSGT_VFILTER, MSGL_INFO," \n"); - } + MP_INFO(vf, "%c", mode==BOTTOM_FIRST?'b':mode==TOP_FIRST?'t':'p'); + if(tdiff==65536.0) MP_INFO(vf, " N/A "); else MP_INFO(vf, " %8.2f", tdiff); + if(bdiff==65536.0) MP_INFO(vf, " N/A "); else MP_INFO(vf, " %8.2f", bdiff); + if(pdiff==65536.0) MP_INFO(vf, " N/A "); else MP_INFO(vf, " %8.2f", pdiff); + MP_INFO(vf, " \n"); return mode; } @@ -216,7 +214,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) if(!vf->priv->buf[0]) mode=PROGRESSIVE; else - mode=analyze_plane(vf->priv->buf[0], mpi->planes[0], + mode=analyze_plane(vf, vf->priv->buf[0], mpi->planes[0], pw[0], dmpi->h, pw[0], mpi->stride[0], mode, vf->priv->verbose, mpi->fields); diff --git a/video/filter/vf_pullup.c b/video/filter/vf_pullup.c index 4fb51fe9d0..b3bac3e301 100644 --- a/video/filter/vf_pullup.c +++ b/video/filter/vf_pullup.c @@ -112,7 +112,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) if (1) { b = pullup_get_buffer(c, 2); if (!b) { - mp_msg(MSGT_VFILTER,MSGL_ERR,"Could not get buffer from pullup!\n"); + MP_ERR(vf, "Could not get buffer from pullup!\n"); f = pullup_get_frame(c); pullup_release_frame(f); goto skip; diff --git a/video/filter/vf_scale.c b/video/filter/vf_scale.c index 7d935462a0..2096292e68 100644 --- a/video/filter/vf_scale.c +++ b/video/filter/vf_scale.c @@ -191,9 +191,7 @@ static unsigned int find_best_out(vf_instance_t *vf, int in_format) ret = check_outfmt(vf, format); - mp_msg(MSGT_VFILTER, MSGL_DBG2, "scale: query(%s) -> %d\n", - vo_format_name( - format), ret & 3); + MP_DBG(vf, "scale: query(%s) -> %d\n", vo_format_name(format), ret & 3); if (ret & VFCAP_CSP_SUPPORTED_BY_HW) { best = format; // no conversion -> bingo! break; @@ -226,8 +224,7 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in, int round_w = 0, round_h = 0; if (!best) { - mp_msg(MSGT_VFILTER, MSGL_WARN, - "SwScale: no supported outfmt found :(\n"); + MP_WARN(vf, "SwScale: no supported outfmt found :(\n"); return -1; } @@ -251,8 +248,7 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in, // TODO: establish a direct connection to the user's brain // and find out what the heck he thinks MPlayer should do // with this nonsense. - mp_msg(MSGT_VFILTER, MSGL_ERR, - "SwScale: EUSERBROKEN Check your parameters, they make no sense!\n"); + MP_ERR(vf, "SwScale: EUSERBROKEN Check your parameters, they make no sense!\n"); return -1; } @@ -289,7 +285,7 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in, } } - mp_msg(MSGT_VFILTER, MSGL_DBG2, "SwScale: scaling %dx%d %s to %dx%d %s \n", + MP_DBG(vf, "SwScale: scaling %dx%d %s to %dx%d %s \n", width, height, vo_format_name(outfmt), vf->priv->w, vf->priv->h, vo_format_name(best)); @@ -329,8 +325,7 @@ static int reconfig(struct vf_instance *vf, struct mp_image_params *in, if (mp_sws_reinit(vf->priv->sws) < 0) { // error... - mp_msg(MSGT_VFILTER, MSGL_WARN, - "Couldn't init libswscale for this setup\n"); + MP_WARN(vf, "Couldn't init libswscale for this setup\n"); return -1; } return 0; @@ -401,7 +396,7 @@ static int vf_open(vf_instance_t *vf) vf->priv->sws->params[0] = vf->priv->param[0]; vf->priv->sws->params[1] = vf->priv->param[1]; - mp_msg(MSGT_VFILTER, MSGL_V, "SwScale params: %d x %d (-1=no scaling)\n", + MP_VERBOSE(vf, "SwScale params: %d x %d (-1=no scaling)\n", vf->priv->cfg_w, vf->priv->cfg_h); return 1; diff --git a/video/filter/vf_softpulldown.c b/video/filter/vf_softpulldown.c index f2dbba29bf..f1b8bdd0be 100644 --- a/video/filter/vf_softpulldown.c +++ b/video/filter/vf_softpulldown.c @@ -71,8 +71,7 @@ static int filter(struct vf_instance *vf, struct mp_image *mpi) !(flags & MP_IMGFIELD_TOP_FIRST)) || (state == 1 && flags & MP_IMGFIELD_TOP_FIRST)) { - mp_msg(MSGT_VFILTER, MSGL_WARN, - "softpulldown: Unexpected field flags: state=%d top_field_first=%d repeat_first_field=%d\n", + MP_WARN(vf, "softpulldown: Unexpected field flags: state=%d top_field_first=%d repeat_first_field=%d\n", state, (flags & MP_IMGFIELD_TOP_FIRST) != 0, (flags & MP_IMGFIELD_REPEAT_FIRST) != 0); @@ -128,7 +127,7 @@ static int control(vf_instance_t *vf, int request, void *data) static void uninit(struct vf_instance *vf) { - mp_msg(MSGT_VFILTER, MSGL_INFO, "softpulldown: %lld frames in, %lld frames out\n", vf->priv->in, vf->priv->out); + MP_INFO(vf, "softpulldown: %lld frames in, %lld frames out\n", vf->priv->in, vf->priv->out); free(vf->priv); } diff --git a/video/filter/vf_stereo3d.c b/video/filter/vf_stereo3d.c index c896b4a73b..e809c54818 100644 --- a/video/filter/vf_stereo3d.c +++ b/video/filter/vf_stereo3d.c @@ -156,7 +156,7 @@ static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) { if ((width & 1) || (height & 1)) { - mp_msg(MSGT_VFILTER, MSGL_WARN, "[stereo3d] invalid height or width\n"); + MP_WARN(vf, "[stereo3d] invalid height or width\n"); return 0; } //default input values @@ -197,8 +197,7 @@ static int config(struct vf_instance *vf, int width, int height, int d_width, vf->priv->in.row_left = vf->priv->height; break; default: - mp_msg(MSGT_VFILTER, MSGL_WARN, - "[stereo3d] stereo format of input is not supported\n"); + MP_WARN(vf, "[stereo3d] stereo format of input is not supported\n"); return 0; break; } @@ -272,8 +271,7 @@ static int config(struct vf_instance *vf, int width, int height, int d_width, //use default settings break; default: - mp_msg(MSGT_VFILTER, MSGL_WARN, - "[stereo3d] stereo format of output is not supported\n"); + MP_WARN(vf, "[stereo3d] stereo format of output is not supported\n"); return 0; break; } @@ -377,8 +375,7 @@ static struct mp_image *filter(struct vf_instance *vf, struct mp_image *mpi) break; } default: - mp_msg(MSGT_VFILTER, MSGL_WARN, - "[stereo3d] stereo format of output is not supported\n"); + MP_WARN(vf, "[stereo3d] stereo format of output is not supported\n"); return NULL; break; } diff --git a/video/filter/vf_unsharp.c b/video/filter/vf_unsharp.c index 179e9b78ae..04eac5ff16 100644 --- a/video/filter/vf_unsharp.c +++ b/video/filter/vf_unsharp.c @@ -131,13 +131,10 @@ static int config( struct vf_instance *vf, int z, stepsX, stepsY; FilterParam *fp; - char *effect; // allocate buffers fp = &vf->priv->lumaParam; - effect = fp->amount == 0 ? "don't touch" : fp->amount < 0 ? "blur" : "sharpen"; - mp_msg( MSGT_VFILTER, MSGL_INFO, "unsharp: %dx%d:%0.2f (%s luma) \n", fp->msizeX, fp->msizeY, fp->amount, effect ); memset( fp->SC, 0, sizeof( fp->SC ) ); stepsX = fp->msizeX/2; stepsY = fp->msizeY/2; @@ -145,8 +142,6 @@ static int config( struct vf_instance *vf, fp->SC[z] = av_malloc(sizeof(*(fp->SC[z])) * (width+2*stepsX)); fp = &vf->priv->chromaParam; - effect = fp->amount == 0 ? "don't touch" : fp->amount < 0 ? "blur" : "sharpen"; - mp_msg( MSGT_VFILTER, MSGL_INFO, "unsharp: %dx%d:%0.2f (%s chroma)\n", fp->msizeX, fp->msizeY, fp->amount, effect ); memset( fp->SC, 0, sizeof( fp->SC ) ); stepsX = fp->msizeX/2; stepsY = fp->msizeY/2; -- cgit v1.2.3