summaryrefslogtreecommitdiffstats
path: root/video/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-04-23 15:56:45 +0200
committerwm4 <wm4@nowhere>2017-04-23 16:07:03 +0200
commitf59371de2170141fc28540d03c4e7ecc62844ebf (patch)
treef741cb2f05e218bd361f6a3b142cab152cf2902f /video/out
parent1d0a858447cee977c9b4faa65d163100f20d4047 (diff)
downloadmpv-f59371de2170141fc28540d03c4e7ecc62844ebf.tar.bz2
mpv-f59371de2170141fc28540d03c4e7ecc62844ebf.tar.xz
video: drop vaapi/vdpau hw decoding support with FFmpeg 3.2
This drops support for the old libavcodec APIs. Now FFmpeg 3.3 or FFmpeg git is required. Libav has no release with the new APIs yet, so for Libav git as of a few weeks or months ago or so is required if you want to use Libav. Not much actually changes in hwdec_vaegl.c - some code is removed, but the reindentation inflates the diff.
Diffstat (limited to 'video/out')
-rw-r--r--video/out/opengl/hwdec_vaegl.c81
1 files changed, 34 insertions, 47 deletions
diff --git a/video/out/opengl/hwdec_vaegl.c b/video/out/opengl/hwdec_vaegl.c
index 899d3ad388..dc2645bf05 100644
--- a/video/out/opengl/hwdec_vaegl.c
+++ b/video/out/opengl/hwdec_vaegl.c
@@ -414,55 +414,42 @@ static void determine_working_formats(struct gl_hwdec *hw)
p->probing_formats = true;
- if (HAVE_VAAPI_HWACCEL_OLD) {
- struct mp_image_pool *alloc = mp_image_pool_new(1);
- va_pool_set_allocator(alloc, p->ctx, VA_RT_FORMAT_YUV420);
- struct mp_image *s = mp_image_pool_get(alloc, IMGFMT_VAAPI, 64, 64);
- if (s) {
- va_surface_init_subformat(s);
- if (try_format(hw, s))
- MP_TARRAY_APPEND(p, formats, num_formats, IMGFMT_NV12);
- }
- talloc_free(s);
- talloc_free(alloc);
- } else {
- AVHWFramesConstraints *fc =
+ AVHWFramesConstraints *fc =
av_hwdevice_get_hwframe_constraints(p->ctx->av_device_ref, NULL);
- if (!fc) {
- MP_WARN(hw, "failed to retrieve libavutil frame constaints\n");
- goto done;
- }
- for (int n = 0; fc->valid_sw_formats[n] != AV_PIX_FMT_NONE; n++) {
- AVBufferRef *fref = NULL;
- struct mp_image *s = NULL;
- AVFrame *frame = NULL;
- fref = av_hwframe_ctx_alloc(p->ctx->av_device_ref);
- if (!fref)
- goto err;
- AVHWFramesContext *fctx = (void *)fref->data;
- fctx->format = AV_PIX_FMT_VAAPI;
- fctx->sw_format = fc->valid_sw_formats[n];
- fctx->width = 128;
- fctx->height = 128;
- if (av_hwframe_ctx_init(fref) < 0)
- goto err;
- frame = av_frame_alloc();
- if (!frame)
- goto err;
- if (av_hwframe_get_buffer(fref, frame, 0) < 0)
- goto err;
- s = mp_image_from_av_frame(frame);
- if (!s || !mp_image_params_valid(&s->params))
- goto err;
- if (try_format(hw, s))
- MP_TARRAY_APPEND(p, formats, num_formats, s->params.hw_subfmt);
- err:
- talloc_free(s);
- av_frame_free(&frame);
- av_buffer_unref(&fref);
- }
- av_hwframe_constraints_free(&fc);
+ if (!fc) {
+ MP_WARN(hw, "failed to retrieve libavutil frame constaints\n");
+ goto done;
+ }
+ for (int n = 0; fc->valid_sw_formats[n] != AV_PIX_FMT_NONE; n++) {
+ AVBufferRef *fref = NULL;
+ struct mp_image *s = NULL;
+ AVFrame *frame = NULL;
+ fref = av_hwframe_ctx_alloc(p->ctx->av_device_ref);
+ if (!fref)
+ goto err;
+ AVHWFramesContext *fctx = (void *)fref->data;
+ fctx->format = AV_PIX_FMT_VAAPI;
+ fctx->sw_format = fc->valid_sw_formats[n];
+ fctx->width = 128;
+ fctx->height = 128;
+ if (av_hwframe_ctx_init(fref) < 0)
+ goto err;
+ frame = av_frame_alloc();
+ if (!frame)
+ goto err;
+ if (av_hwframe_get_buffer(fref, frame, 0) < 0)
+ goto err;
+ s = mp_image_from_av_frame(frame);
+ if (!s || !mp_image_params_valid(&s->params))
+ goto err;
+ if (try_format(hw, s))
+ MP_TARRAY_APPEND(p, formats, num_formats, s->params.hw_subfmt);
+ err:
+ talloc_free(s);
+ av_frame_free(&frame);
+ av_buffer_unref(&fref);
}
+ av_hwframe_constraints_free(&fc);
done:
MP_TARRAY_APPEND(p, formats, num_formats, 0); // terminate it