1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-09 15:47:44 +00:00

dxva2: fix handling of cropped video

Basically, we need to make sure to allocate enough data for the pretty
dumb copy_nv12 function. (It could be avoided by making the function
less dumb, but this fix is simpler.)
This commit is contained in:
wm4 2015-07-06 21:25:07 +02:00
parent 7c032bde3e
commit dcd167ca37

View File

@ -311,8 +311,11 @@ static struct mp_image *dxva2_retrieve_image(struct lavc_ctx *s,
IDirect3DSurface9_GetDesc(surface, &surfaceDesc);
if (surfaceDesc.Width < img->w || surfaceDesc.Height < img->h)
return img;
struct mp_image *sw_img =
mp_image_pool_get(ctx->sw_pool, IMGFMT_NV12, img->w, img->h);
mp_image_pool_get(ctx->sw_pool, IMGFMT_NV12, surfaceDesc.Width, surfaceDesc.Height);
if (!sw_img)
return img;
@ -325,6 +328,7 @@ static struct mp_image *dxva2_retrieve_image(struct lavc_ctx *s,
}
ctx->copy_nv12(sw_img, LockedRect.pBits, LockedRect.Pitch, surfaceDesc.Height);
mp_image_set_size(sw_img, img->w, img->h);
mp_image_copy_attributes(sw_img, img);
IDirect3DSurface9_UnlockRect(surface);