-#if FF_API_STRUCT_VAAPI_CONTEXT
- if (avctx->hwaccel_context) {
- av_log(avctx, AV_LOG_WARNING, "Using deprecated struct "
- "vaapi_context in decode.\n");
-
- ctx->have_old_context = 1;
- ctx->old_context = avctx->hwaccel_context;
-
- // Really we only want the VAAPI device context, but this
- // allocates a whole generic device context because we don't
- // have any other way to determine how big it should be.
- ctx->device_ref =
- av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_VAAPI);
- if (!ctx->device_ref) {
- err = AVERROR(ENOMEM);
- goto fail;
- }
- ctx->device = (AVHWDeviceContext*)ctx->device_ref->data;
- ctx->hwctx = ctx->device->hwctx;
-
- ctx->hwctx->display = ctx->old_context->display;
-
- // The old VAAPI decode setup assumed this quirk was always
- // present, so set it here to avoid the behaviour changing.
- ctx->hwctx->driver_quirks =
- AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS;
-
- }
-#endif
-
-#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;
-
- av_log(avctx, AV_LOG_DEBUG, "Using user-supplied decoder "
- "context: %#x/%#x.\n", ctx->va_config, ctx->va_context);
- } else {
-#endif
-