aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2023-10-10 17:34:47 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2023-10-12 20:57:35 +0200
commit68f9dfa5cc2e876207ca38affbbdaa0d6714d654 (patch)
tree6319c6564d13ff14fe7b8859f37e395357a60d3e
parent2e33f5ced0c9ae2c2d9d6aa1a5535ae637d48ce7 (diff)
downloadffmpeg-68f9dfa5cc2e876207ca38affbbdaa0d6714d654.tar.gz
avcodec/nvdec_hevc: fail to initialize on unsupported profiles
-rw-r--r--libavcodec/nvdec_hevc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/nvdec_hevc.c b/libavcodec/nvdec_hevc.c
index 91fb9f5384..b83d5edcf9 100644
--- a/libavcodec/nvdec_hevc.c
+++ b/libavcodec/nvdec_hevc.c
@@ -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);
}