summaryrefslogtreecommitdiffstats
path: root/sub/sd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-16 07:26:45 +0200
committerwm4 <wm4@nowhere>2012-10-16 07:26:45 +0200
commitf45eab6faea05834c1337175dbe51437707b8d7e (patch)
treee8c4b6fa8621c5456ad5cfd9400366ac32c9484d /sub/sd_lavc.c
parent84c34806864d0e44855d87e9fb47c70297f260ef (diff)
downloadmpv-f45eab6faea05834c1337175dbe51437707b8d7e.tar.bz2
mpv-f45eab6faea05834c1337175dbe51437707b8d7e.tar.xz
sub: fix and simplify some change detection details
Fix spudec change detection. The internal changed-flag was not reset when retrieving indexed bitmaps, and subtitles were rescaled every frame, even if they were not changing. Simplify subtitle decoders by not requiring them to check whether the passed-in screen size has changed. sd_lavc did this, and spudec would have needed to do the same. Instead, leave this to the osd_object force_redraw flag. Subtitle decoders (such as libass) can still signal that only the positions of subtitles have changed, but making _all_ subtitle decoders do this just to deal with screen size changes is worthless.
Diffstat (limited to 'sub/sd_lavc.c')
-rw-r--r--sub/sd_lavc.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index a5fe23721a..4311db7dc5 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -187,7 +187,6 @@ static void get_bitmaps(struct sh_sub *sh, struct osd_state *osd,
if (priv->bitmaps_changed && priv->count > 0)
priv->outbitmaps = talloc_memdup(priv, priv->inbitmaps,
talloc_get_size(priv->inbitmaps));
- bool pos_changed = false;
int inw = priv->avctx->width;
int inh = priv->avctx->height;
guess_resolution(sh->type, &inw, &inh);
@@ -197,18 +196,15 @@ static void get_bitmaps(struct sh_sub *sh, struct osd_state *osd,
for (int i = 0; i < priv->count; i++) {
struct sub_bitmap *bi = &priv->inbitmaps[i];
struct sub_bitmap *bo = &priv->outbitmaps[i];
-#define SET(var, val) pos_changed |= var != (int)(val); var = (val)
- SET(bo->x, bi->x * xscale + d->ml);
- SET(bo->y, bi->y * yscale + d->mt);
- SET(bo->dw, bi->w * xscale);
- SET(bo->dh, bi->h * yscale);
+ bo->x = bi->x * xscale + d->ml;
+ bo->y = bi->y * yscale + d->mt;
+ bo->dw = bi->w * xscale;
+ bo->dh = bi->h * yscale;
}
res->parts = priv->outbitmaps;
res->num_parts = priv->count;
if (priv->bitmaps_changed)
res->bitmap_id = ++res->bitmap_pos_id;
- else if (pos_changed)
- res->bitmap_pos_id++;
priv->bitmaps_changed = false;
res->format = SUBBITMAP_INDEXED;
res->scaled = xscale != 1 || yscale != 1;