summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-02-27 22:05:39 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-01 01:35:42 +0100
commit80736531da54213a515ff24ca3e929afe214ed0f (patch)
tree4c6a6d3fa0607e0b4a96f393248b19eaed9b60ed
parent22dda5615e8a3adfe183c0304f56929eb8d40f71 (diff)
avcodec/decode: Improve validity check a bit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/decode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index da6446d879..7c67b18bc4 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -977,8 +977,8 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
}
if (!avctx->codec)
return AVERROR(EINVAL);
- if (avctx->codec->type != AVMEDIA_TYPE_SUBTITLE) {
- av_log(avctx, AV_LOG_ERROR, "Invalid media type for subtitles\n");
+ if (ffcodec(avctx->codec)->cb_type != FF_CODEC_CB_TYPE_DECODE_SUB) {
+ av_log(avctx, AV_LOG_ERROR, "Codec not subtitle decoder\n");
return AVERROR(EINVAL);
}