aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-05-16 16:43:34 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2025-05-26 03:38:37 +0200
commitef95a8d7b5bec6313639ce30f31a743a75bc51d2 (patch)
tree946b4582ca6331af5088ea7e54e0dffc5fdb40b7
parenta5ff6ea32d9aafc3a8da9ce40c510a6858794c40 (diff)
downloadffmpeg-ef95a8d7b5bec6313639ce30f31a743a75bc51d2.tar.gz
avcodec/mpegvideo_enc: Use av_unreachable() for unreachable code
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/mpegvideo_enc.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 6e9533ebc9..0023e88dc1 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -559,9 +559,10 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
case AV_PIX_FMT_YUV422P:
s->c.chroma_format = CHROMA_422;
break;
+ default:
+ av_unreachable("Already checked via CODEC_PIXFMTS");
case AV_PIX_FMT_YUVJ420P:
case AV_PIX_FMT_YUV420P:
- default:
s->c.chroma_format = CHROMA_420;
break;
}
@@ -992,7 +993,7 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx)
s->c.low_delay = 1;
break;
default:
- return AVERROR(EINVAL);
+ av_unreachable("List contains all codecs using ff_mpv_encode_init()");
}
avctx->has_b_frames = !s->c.low_delay;
@@ -3541,7 +3542,10 @@ static int encode_thread(AVCodecContext *c, void *arg){
}
break;
default:
- av_log(s->c.avctx, AV_LOG_ERROR, "illegal MB type\n");
+ av_unreachable("There is a case for every CANDIDATE_MB_TYPE_* "
+ "except CANDIDATE_MB_TYPE_SKIPPED which is never "
+ "the only candidate (always coupled with INTER) "
+ "so that it never reaches this switch");
}
encode_mb(s, motion_x, motion_y);