summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-01-12 13:02:19 +0100
committerwm4 <wm4@nowhere>2017-01-12 13:59:35 +0100
commitfb4ae3c06ca6598ecf31d9e39276f87091e5037d (patch)
treeedf3d0f14a3933f2b73d00a4dc16985986bb9f7b /player
parent06b30cc81f86ce31ad35399ccfc432a316a09e0d (diff)
downloadmpv-fb4ae3c06ca6598ecf31d9e39276f87091e5037d.tar.bz2
mpv-fb4ae3c06ca6598ecf31d9e39276f87091e5037d.tar.xz
cuda: use libavutil functions for copying hw surfaces to memory
mp_image_hw_download() is a libavutil wrapper added in the previous commit. We drop our own code completely, as everything is provided by libavutil and our helper wrapper. This breaks the screenshot code, so that has to be adjusted as well.
Diffstat (limited to 'player')
-rw-r--r--player/screenshot.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/player/screenshot.c b/player/screenshot.c
index 13532ec1a3..4c043ab986 100644
--- a/player/screenshot.c
+++ b/player/screenshot.c
@@ -31,6 +31,7 @@
#include "common/msg.h"
#include "options/path.h"
#include "video/mp_image.h"
+#include "video/mp_image_pool.h"
#include "video/decode/dec_video.h"
#include "video/out/vo.h"
#include "video/image_writer.h"
@@ -346,12 +347,15 @@ static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode)
}
}
- if (image && mpctx->vo_chain && mpctx->vo_chain->hwdec_devs) {
- struct mp_hwdec_ctx *ctx =
- hwdec_devices_get_first(mpctx->vo_chain->hwdec_devs);
- struct mp_image *nimage = NULL;
- if (ctx && ctx->download_image && (image->fmt.flags & MP_IMGFLAG_HWACCEL))
- nimage = ctx->download_image(ctx, image, NULL);
+ bool hwimage = image && (image->fmt.flags & MP_IMGFLAG_HWACCEL);
+ if (hwimage) {
+ 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)
+ nimage = ctx->download_image(ctx, image, NULL);
+ }
if (nimage) {
talloc_free(image);
image = nimage;