summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-21 09:33:51 +0200
committerwm4 <wm4@nowhere>2014-09-21 09:33:51 +0200
commit1cf229f4623ec302afb71ab93f44f273ffb1a515 (patch)
treec6bf7d642ec44f31ab85912d56734195de5237f3
parentbb005a385a937bc2a50233bb4f3f99188674c890 (diff)
downloadmpv-1cf229f4623ec302afb71ab93f44f273ffb1a515.tar.bz2
mpv-1cf229f4623ec302afb71ab93f44f273ffb1a515.tar.xz
video: fix some vo_direct3d crashes due to FFmpeg nonsense
For incomprehensible reasons, AV_PIX_FMT_GRAY8 (and some others) have a palette. This literally makes no sense and this issue has bitten us before, but it is how it is. This also caused a crash with vo_direct3d: this mapped a texture as IMGFMT_Y8 (i.e. AV_PIX_FMT_GRAY8), and when copying this, it tried to copy the non-existent palette. Fixes #1113.
-rw-r--r--video/mp_image.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/video/mp_image.c b/video/mp_image.c
index 7b430dfaf6..ea84bb4dbd 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -354,7 +354,8 @@ void mp_image_copy(struct mp_image *dst, struct mp_image *src)
memcpy_pic(dst->planes[n], src->planes[n], line_bytes, dst->plane_h[n],
dst->stride[n], src->stride[n]);
}
- if (dst->fmt.flags & MP_IMGFLAG_PAL)
+ // Watch out for AV_PIX_FMT_FLAG_PSEUDOPAL retardation
+ if ((dst->fmt.flags & MP_IMGFLAG_PAL) && dst->planes[1] && src->planes[1])
memcpy(dst->planes[1], src->planes[1], MP_PALETTE_SIZE);
}