ass_mp: reallocate cached subtitle image data on format changes

When the format of the subtitle bitmaps changes, such as with taking
screenshots with vo_vaapi (RGBA for the VO vs. Y8 for screenshots), the
cache image obviously needs to be recreated.

Fixes #4325.
This commit is contained in:
wm4 2017-04-17 19:34:27 +02:00
parent f7637db377
commit ce4ab483b5
1 changed files with 2 additions and 1 deletions

View File

@ -220,7 +220,8 @@ static bool pack(struct mp_ass_packer *p, struct sub_bitmaps *res, int imgfmt)
res->packed_h = bb[1].y;
if (!p->cached_img || p->cached_img->w < res->packed_w ||
p->cached_img->h < res->packed_h)
p->cached_img->h < res->packed_h ||
p->cached_img->imgfmt != imgfmt)
{
talloc_free(p->cached_img);
p->cached_img = mp_image_alloc(imgfmt, p->packer->w, p->packer->h);