MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / ff_vaapi_decode_init

Function ff_vaapi_decode_init

libavcodec/vaapi_decode.c:692–736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

690}
691
692int ff_vaapi_decode_init(AVCodecContext *avctx)
693{
694 VAAPIDecodeContext *ctx = avctx->internal->hwaccel_priv_data;
695 VAStatus vas;
696 int err;
697
698 ctx->va_config = VA_INVALID_ID;
699 ctx->va_context = VA_INVALID_ID;
700
701 err = ff_decode_get_hw_frames_ctx(avctx, AV_HWDEVICE_TYPE_VAAPI);
702 if (err < 0)
703 goto fail;
704
705 ctx->frames = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
706 ctx->hwfc = ctx->frames->hwctx;
707 ctx->device = ctx->frames->device_ctx;
708 ctx->hwctx = ctx->device->hwctx;
709
710 err = vaapi_decode_make_config(avctx, ctx->frames->device_ref,
711 &ctx->va_config, NULL);
712 if (err)
713 goto fail;
714
715 vas = vaCreateContext(ctx->hwctx->display, ctx->va_config,
716 avctx->coded_width, avctx->coded_height,
717 VA_PROGRESSIVE,
718 ctx->hwfc->surface_ids,
719 ctx->hwfc->nb_surfaces,
720 &ctx->va_context);
721 if (vas != VA_STATUS_SUCCESS) {
722 av_log(avctx, AV_LOG_ERROR, "Failed to create decode "
723 "context: %d (%s).\n", vas, vaErrorStr(vas));
724 err = AVERROR(EIO);
725 goto fail;
726 }
727
728 av_log(avctx, AV_LOG_DEBUG, "Decode context initialised: "
729 "%#x/%#x.\n", ctx->va_config, ctx->va_context);
730
731 return 0;
732
733fail:
734 ff_vaapi_decode_uninit(avctx);
735 return err;
736}
737
738int ff_vaapi_decode_uninit(AVCodecContext *avctx)
739{

Callers 1

vaapi_av1_decode_initFunction · 0.85

Calls 4

vaapi_decode_make_configFunction · 0.85
av_logFunction · 0.85
ff_vaapi_decode_uninitFunction · 0.85

Tested by

no test coverage detected