summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-07-06 21:25:07 +0200
committerwm4 <wm4@nowhere>2015-07-06 21:25:07 +0200
commitdcd167ca37fcb14719f97ca637ec5f3efc3952d8 (patch)
tree7f92ac6a6bd713c3b3addb27d8102248521f6c9c
parent7c032bde3e6473902bbda2aea65be4bfb9d68802 (diff)
downloadmpv-dcd167ca37fcb14719f97ca637ec5f3efc3952d8.tar.bz2
mpv-dcd167ca37fcb14719f97ca637ec5f3efc3952d8.tar.xz
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.)
-rw-r--r--video/decode/dxva2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/video/decode/dxva2.c b/video/decode/dxva2.c
index 0e99d550ba..c87093812c 100644
--- a/video/decode/dxva2.c
+++ b/video/decode/dxva2.c
@@ -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);