0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-19 19:42:24 +02:00

screenshot: minor simplification

This also will set image=NULL, if the video frame is marked as hwaccel,
and could not be copied to normal RAM. This will probably change the
error message (due to screenshot_get() returning NULL, instead of making
image conversion fail at a later point), but the behavior is the same
anyway.
This commit is contained in:
wm4 2017-03-18 12:53:28 +01:00
parent 8a28f94a7e
commit d26788fbd7

View File

@ -347,19 +347,16 @@ static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode)
}
}
bool hwimage = image && (image->fmt.flags & MP_IMGFLAG_HWACCEL);
if (hwimage) {
if (image && (image->fmt.flags & MP_IMGFLAG_HWACCEL)) {
struct mp_image *nimage = mp_image_hw_download(image, NULL);
if (!nimage && mpctx->vo_chain && mpctx->vo_chain->hwdec_devs) {
struct mp_hwdec_ctx *ctx =
hwdec_devices_get_first(mpctx->vo_chain->hwdec_devs);
if (ctx && ctx->download_image && hwimage)
if (ctx && ctx->download_image)
nimage = ctx->download_image(ctx, image, NULL);
}
if (nimage) {
talloc_free(image);
image = nimage;
}
talloc_free(image);
image = nimage;
}
if (image && mode == MODE_SUBTITLES)