[FFmpeg-devel] [PATCH 03/12] avcodec/proresenc_anatoliy: Mark impossible case as unreachable
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Sat May 25 01:04:46 EEST 2024
Should fix Coverity issue 1440385.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
Alternative to https://ffmpeg.org/pipermail/ffmpeg-devel/2024-May/327293.html
libavcodec/proresenc_anatoliy.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/libavcodec/proresenc_anatoliy.c b/libavcodec/proresenc_anatoliy.c
index 2fb96e9cf5..7b7618af9b 100644
--- a/libavcodec/proresenc_anatoliy.c
+++ b/libavcodec/proresenc_anatoliy.c
@@ -845,18 +845,25 @@ static av_cold int prores_encode_init(AVCodecContext *avctx)
}
if (avctx->profile == AV_PROFILE_UNKNOWN) {
- if (avctx->pix_fmt == AV_PIX_FMT_YUV422P10) {
+ switch (avctx->pix_fmt) {
+ case AV_PIX_FMT_YUV422P10:
avctx->profile = AV_PROFILE_PRORES_STANDARD;
av_log(avctx, AV_LOG_INFO,
"encoding with ProRes standard (apcn) profile\n");
- } else if (avctx->pix_fmt == AV_PIX_FMT_YUV444P10) {
+ break;
+ case AV_PIX_FMT_YUV444P10:
avctx->profile = AV_PROFILE_PRORES_4444;
av_log(avctx, AV_LOG_INFO,
"encoding with ProRes 4444 (ap4h) profile\n");
- } else if (avctx->pix_fmt == AV_PIX_FMT_YUVA444P10) {
+ break;
+ case AV_PIX_FMT_YUVA444P10:
avctx->profile = AV_PROFILE_PRORES_4444;
av_log(avctx, AV_LOG_INFO,
"encoding with ProRes 4444+ (ap4h) profile\n");
+ break;
+ default:
+ /* Already checked via AVCodec.pix_fmts. */
+ av_unreachable;
}
} else if (avctx->profile < AV_PROFILE_PRORES_PROXY
|| avctx->profile > AV_PROFILE_PRORES_XQ) {
--
2.40.1
More information about the ffmpeg-devel
mailing list