diff options
author | wm4 <wm4@nowhere> | 2017-01-12 12:51:55 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-01-12 13:58:28 +0100 |
commit | 06b30cc81f86ce31ad35399ccfc432a316a09e0d (patch) | |
tree | cb008b92b49e1eed3e52ae9d26e7bd159ce0c9f1 /video/vaapi.c | |
parent | 162c2e2d00c46c989fdf116181a21f8701ad99be (diff) | |
download | mpv-06b30cc81f86ce31ad35399ccfc432a316a09e0d.tar.bz2 mpv-06b30cc81f86ce31ad35399ccfc432a316a09e0d.tar.xz |
vaapi: use libavutil functions for copying hw surfaces to memory
Makes va_surface_download() call mp_image_hw_download() for
libavutil-allocated surfaces, which in turn calls
av_hwframe_transfer_data().
mp_image_hw_download() is actually not specific to vaapi, and can be
used for any hw surface allocated by libavutil.
Diffstat (limited to 'video/vaapi.c')
-rw-r--r-- | video/vaapi.c | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/video/vaapi.c b/video/vaapi.c index b239925c37..e71232db21 100644 --- a/video/vaapi.c +++ b/video/vaapi.c @@ -514,25 +514,10 @@ struct mp_image *va_surface_download(struct mp_image *src, if (!src || src->imgfmt != IMGFMT_VAAPI) return NULL; struct va_surface *p = va_surface_in_mp_image(src); - struct va_surface tmp_p; if (!p) { // We might still be able to get to the cheese if this is a surface // produced by libavutil's vaapi glue code. - if (!src->hwctx) - return NULL; - AVHWFramesContext *fctx = (void *)src->hwctx->data; - // as set by video/decode/vaapi.c - struct mp_vaapi_ctx *ctx = fctx->user_opaque; - tmp_p = (struct va_surface){ - .ctx = ctx, - .id = va_surface_id(src), - .rt_format = VA_RT_FORMAT_YUV420, - .w = fctx->width, - .h = fctx->height, - .display = ctx->display, - .image = { .image_id = VA_INVALID_ID, .buf = VA_INVALID_ID }, - }; - p = &tmp_p; + return mp_image_hw_download(src, pool); } struct mp_image *mpi = NULL; struct mp_vaapi_ctx *ctx = p->ctx; @@ -563,11 +548,6 @@ struct mp_image *va_surface_download(struct mp_image *src, done: - if (p == &tmp_p) { - if (p->image.image_id != VA_INVALID_ID) - vaDestroyImage(p->display, p->image.image_id); - } - if (!mpi) MP_ERR(ctx, "failed to get surface data.\n"); return mpi; |