summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-03-18 12:53:28 +0100
committerwm4 <wm4@nowhere>2017-03-18 14:15:34 +0100
commitd26788fbd7e804aa44fcb01331893fc20b4a381f (patch)
tree1fb48b8978d7be646573557fadee0107bf2a67af /player
parent8a28f94a7e17885662c7cdfbb6d07b84b86212d2 (diff)
downloadmpv-d26788fbd7e804aa44fcb01331893fc20b4a381f.tar.bz2
mpv-d26788fbd7e804aa44fcb01331893fc20b4a381f.tar.xz
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.
Diffstat (limited to 'player')
-rw-r--r--player/screenshot.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/player/screenshot.c b/player/screenshot.c
index 4c043ab986..dc3cca3d33 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -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)