diff options
author | wm4 <wm4@nowhere> | 2013-12-21 17:43:25 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-12-21 20:50:10 +0100 |
commit | 426ebbae5ff578923a83a4395ff499f0348f7dcc (patch) | |
tree | e0155cf4a0813ca15a0cd6364bcae25c81cf164b /video/filter/vf_delogo.c | |
parent | 877303aaa9111fc56a8e5edbeb439699acfe44c0 (diff) | |
download | mpv-426ebbae5ff578923a83a4395ff499f0348f7dcc.tar.bz2 mpv-426ebbae5ff578923a83a4395ff499f0348f7dcc.tar.xz |
video/filter: mp_msg conversions
Diffstat (limited to 'video/filter/vf_delogo.c')
-rw-r--r-- | video/filter/vf_delogo.c | 36 |
1 files changed, 19 insertions, 17 deletions
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; } |