mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
bb005a385a
commit
1cf229f462
|
@ -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],
|
memcpy_pic(dst->planes[n], src->planes[n], line_bytes, dst->plane_h[n],
|
||||||
dst->stride[n], src->stride[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);
|
memcpy(dst->planes[1], src->planes[1], MP_PALETTE_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue