mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user