avcodec/nvdec_hevc: fail to initialize on unsupported profiles

This commit is contained in:
Timo Rothenpieler 2023-10-10 17:34:47 +02:00
parent 2e33f5ced0
commit 68f9dfa5cc
1 changed files with 9 additions and 0 deletions

View File

@ -306,6 +306,15 @@ static int nvdec_hevc_frame_params(AVCodecContext *avctx,
static int nvdec_hevc_decode_init(AVCodecContext *avctx) {
NVDECContext *ctx = avctx->internal->hwaccel_priv_data;
ctx->supports_444 = 1;
if (avctx->profile != AV_PROFILE_HEVC_MAIN &&
avctx->profile != AV_PROFILE_HEVC_MAIN_10 &&
avctx->profile != AV_PROFILE_HEVC_MAIN_STILL_PICTURE &&
avctx->profile != AV_PROFILE_HEVC_REXT) {
av_log(avctx, AV_LOG_ERROR, "Unsupported HEVC profile: %d\n", avctx->profile);
return AVERROR(ENOTSUP);
}
return ff_nvdec_decode_init(avctx);
}