summaryrefslogtreecommitdiffstats
path: root/player/screenshot.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-22 17:47:14 +0100
committerwm4 <wm4@nowhere>2015-01-22 18:18:23 +0100
commit74581a61064f56b170e555fa72d9cdca161d2307 (patch)
tree532223eaa3644b01501d443ebca9011ee12af963 /player/screenshot.c
parente9ac3fc3a1505c4db1773a2a24d35ac41ab69887 (diff)
downloadmpv-74581a61064f56b170e555fa72d9cdca161d2307.tar.bz2
mpv-74581a61064f56b170e555fa72d9cdca161d2307.tar.xz
video: handle hwdec screenshots differently
Instead of converting the hw surface to an image in the VO, provide a generic way to convet hw surfaces, and use this in the screenshot code. It's all relatively straightforward, except vdpau is being terrible. It needs a huge chunk of new code, because copying back is not simple.
Diffstat (limited to 'player/screenshot.c')
-rw-r--r--player/screenshot.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/player/screenshot.c b/player/screenshot.c
index 4e22afc69d..7d1c743e40 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -343,6 +343,16 @@ static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode)
image = args.out_image;
if (image) {
+ if (mpctx->d_video && mpctx->d_video->hwdec_info) {
+ struct mp_hwdec_ctx *ctx = mpctx->d_video->hwdec_info->hwctx;
+ struct mp_image *nimage = NULL;
+ if (ctx && ctx->download_image)
+ nimage = ctx->download_image(ctx, image, NULL);
+ if (nimage) {
+ talloc_free(image);
+ image = nimage;
+ }
+ }
if (mode == MODE_SUBTITLES && !args.has_osd)
add_subs(mpctx, image);
}