diff options
author | Mark Thompson <sw@jkqxz.net> | 2016-08-24 23:30:29 +0100 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2017-01-17 23:06:46 +0000 |
commit | 2a4a8653b6ca77ed1c9cec1336c55d291ef545b6 (patch) | |
tree | 3841d6d6be3756b943b6ec8802aa2ba2c2b75bcb /libavcodec/vaapi_decode.c | |
parent | 542a65d0b33abf81e5087ec9142bb11a54f23cde (diff) | |
download | ffmpeg-2a4a8653b6ca77ed1c9cec1336c55d291ef545b6.tar.gz |
lavc: Remove old vaapi decode infrastructure
Deprecates struct vaapi_context and the installed header vaapi.h,
to be removed at the next version bump.
(cherry picked from commit 851960f6f8cf1f946fe42fa36cf6598fac68072c)
Diffstat (limited to 'libavcodec/vaapi_decode.c')
-rw-r--r-- | libavcodec/vaapi_decode.c | 78 |
1 files changed, 46 insertions, 32 deletions
diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 878e8ed3d1..da9e4aedde 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -427,6 +427,7 @@ int ff_vaapi_decode_init(AVCodecContext *avctx) ctx->va_config = VA_INVALID_ID; ctx->va_context = VA_INVALID_ID; +#if FF_API_STRUCT_VAAPI_CONTEXT if (avctx->hwaccel_context) { av_log(avctx, AV_LOG_WARNING, "Using deprecated struct " "vaapi_context in decode.\n"); @@ -453,7 +454,9 @@ int ff_vaapi_decode_init(AVCodecContext *avctx) ctx->hwctx->driver_quirks = AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS; - } else if (avctx->hw_frames_ctx) { + } else +#endif + if (avctx->hw_frames_ctx) { // This structure has a shorter lifetime than the enclosing // AVCodecContext, so we inherit the references from there // and do not need to make separate ones. @@ -471,6 +474,7 @@ int ff_vaapi_decode_init(AVCodecContext *avctx) goto fail; } +#if FF_API_STRUCT_VAAPI_CONTEXT if (ctx->have_old_context) { ctx->va_config = ctx->old_context->config_id; ctx->va_context = ctx->old_context->context_id; @@ -478,27 +482,31 @@ int ff_vaapi_decode_init(AVCodecContext *avctx) av_log(avctx, AV_LOG_DEBUG, "Using user-supplied decoder " "context: %#x/%#x.\n", ctx->va_config, ctx->va_context); } else { - err = vaapi_decode_make_config(avctx); - if (err) - goto fail; +#endif - vas = vaCreateContext(ctx->hwctx->display, ctx->va_config, - avctx->coded_width, avctx->coded_height, - VA_PROGRESSIVE, - ctx->hwfc->surface_ids, - ctx->hwfc->nb_surfaces, - &ctx->va_context); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to create decode " - "context: %d (%s).\n", vas, vaErrorStr(vas)); - err = AVERROR(EIO); - goto fail; - } + err = vaapi_decode_make_config(avctx); + if (err) + goto fail; - av_log(avctx, AV_LOG_DEBUG, "Decode context initialised: " - "%#x/%#x.\n", ctx->va_config, ctx->va_context); + vas = vaCreateContext(ctx->hwctx->display, ctx->va_config, + avctx->coded_width, avctx->coded_height, + VA_PROGRESSIVE, + ctx->hwfc->surface_ids, + ctx->hwfc->nb_surfaces, + &ctx->va_context); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to create decode " + "context: %d (%s).\n", vas, vaErrorStr(vas)); + err = AVERROR(EIO); + goto fail; } + av_log(avctx, AV_LOG_DEBUG, "Decode context initialised: " + "%#x/%#x.\n", ctx->va_config, ctx->va_context); +#if FF_API_STRUCT_VAAPI_CONTEXT + } +#endif + return 0; fail: @@ -511,26 +519,32 @@ int ff_vaapi_decode_uninit(AVCodecContext *avctx) VAAPIDecodeContext *ctx = avctx->internal->hwaccel_priv_data; VAStatus vas; +#if FF_API_STRUCT_VAAPI_CONTEXT if (ctx->have_old_context) { av_buffer_unref(&ctx->device_ref); } else { - if (ctx->va_context != VA_INVALID_ID) { - vas = vaDestroyContext(ctx->hwctx->display, ctx->va_context); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to destroy decode " - "context %#x: %d (%s).\n", - ctx->va_context, vas, vaErrorStr(vas)); - } +#endif + + if (ctx->va_context != VA_INVALID_ID) { + vas = vaDestroyContext(ctx->hwctx->display, ctx->va_context); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to destroy decode " + "context %#x: %d (%s).\n", + ctx->va_context, vas, vaErrorStr(vas)); } - if (ctx->va_config != VA_INVALID_ID) { - vas = vaDestroyConfig(ctx->hwctx->display, ctx->va_config); - if (vas != VA_STATUS_SUCCESS) { - av_log(avctx, AV_LOG_ERROR, "Failed to destroy decode " - "configuration %#x: %d (%s).\n", - ctx->va_config, vas, vaErrorStr(vas)); - } + } + if (ctx->va_config != VA_INVALID_ID) { + vas = vaDestroyConfig(ctx->hwctx->display, ctx->va_config); + if (vas != VA_STATUS_SUCCESS) { + av_log(avctx, AV_LOG_ERROR, "Failed to destroy decode " + "configuration %#x: %d (%s).\n", + ctx->va_config, vas, vaErrorStr(vas)); } } +#if FF_API_STRUCT_VAAPI_CONTEXT + } +#endif + return 0; } |