avcodec/decode: Improve validity check a bit

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2024-02-27 22:05:39 +01:00
parent 22dda5615e
commit 80736531da
1 changed files with 2 additions and 2 deletions

View File

@ -977,8 +977,8 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
} }
if (!avctx->codec) if (!avctx->codec)
return AVERROR(EINVAL); return AVERROR(EINVAL);
if (avctx->codec->type != AVMEDIA_TYPE_SUBTITLE) { if (ffcodec(avctx->codec)->cb_type != FF_CODEC_CB_TYPE_DECODE_SUB) {
av_log(avctx, AV_LOG_ERROR, "Invalid media type for subtitles\n"); av_log(avctx, AV_LOG_ERROR, "Codec not subtitle decoder\n");
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }