Patches attached. - Andreas
From 8be9ae98dd8c880dd459cddb3192c67294d25186 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <andreas.rheinha...@outlook.com> Date: Fri, 16 May 2025 16:43:34 +0200 Subject: [PATCH 1/4] avcodec/mpegvideo_enc: Use av_unreachable() for unreachable code
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavcodec/mpegvideo_enc.c | 10 +++++++--- 1 file 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); -- 2.45.2
From c3bbb56ba29fa89bcb5732f263f127d15124fba2 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <andreas.rheinha...@outlook.com> Date: Fri, 16 May 2025 18:24:38 +0200 Subject: [PATCH 2/4] avcodec/msmpeg4dec: Use av_unreachable() for unreachable code Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavcodec/msmpeg4dec.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c index df67d43542..ddb990b1a0 100644 --- a/libavcodec/msmpeg4dec.c +++ b/libavcodec/msmpeg4dec.c @@ -379,6 +379,8 @@ av_cold int ff_msmpeg4_decode_init(AVCodecContext *avctx) break; case MSMP4_WMV2: break; + default: + av_unreachable("List contains all cases using ff_msmpeg4_decode_init()"); } s->slice_height= s->mb_height; //to avoid 1/0 if the first frame is not a keyframe @@ -472,6 +474,8 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) ms->dc_table_index = get_bits1(&s->gb); s->inter_intra_pred= 0; break; + default: + av_unreachable("ff_msmpeg4_decode_picture_header() only used by MSMP4V1-3, WMV1"); } s->no_rounding = 1; if(s->avctx->debug&FF_DEBUG_PICT_INFO) @@ -523,6 +527,8 @@ int ff_msmpeg4_decode_picture_header(MpegEncContext * s) s->inter_intra_pred = s->width*s->height < 320*240 && ms->bit_rate <= II_BITRATE; break; + default: + av_unreachable("ff_msmpeg4_decode_picture_header() only used by MSMP4V1-3, WMV1"); } if(s->avctx->debug&FF_DEBUG_PICT_INFO) -- 2.45.2
From 3619f0f736bf91c45fea89dee81bbf97663d0a4d Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <andreas.rheinha...@outlook.com> Date: Fri, 16 May 2025 18:38:41 +0200 Subject: [PATCH 3/4] avcodec/h263dec: Use av_unreachable() for unreachable code Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavcodec/h263dec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index c36070e23c..eb4c48f68c 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -150,9 +150,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) s->h263_flv = 1; break; default: - av_log(avctx, AV_LOG_ERROR, "Unsupported codec %d\n", - avctx->codec->id); - return AVERROR(ENOSYS); + av_unreachable("Switch contains a case for every codec using ff_h263_decode_init()"); } if (avctx->codec_tag == AV_RL32("L263") || avctx->codec_tag == AV_RL32("S263")) -- 2.45.2
From 4ca5d0fa3587e1de7d698e16d7eea7c98d432fdf Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <andreas.rheinha...@outlook.com> Date: Wed, 21 May 2025 12:55:48 +0200 Subject: [PATCH 4/4] avcodec/pcm: Use av_unreachable() for unreachable code Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> --- libavcodec/pcm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index bff61f2195..68b1945194 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -327,6 +327,8 @@ static av_cold av_unused int pcm_lut_decode_init(AVCodecContext *avctx) PCMLUTDecode *s = avctx->priv_data; switch (avctx->codec_id) { + default: + av_unreachable("pcm_lut_decode_init() only used with alaw, mulaw and vidc"); case AV_CODEC_ID_PCM_ALAW: for (int i = 0; i < 256; i++) s->table[i] = alaw2linear(i); -- 2.45.2
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".