summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-26 17:31:06 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-04-03 19:12:22 +0200
commita5fcd978011e618e059d889fd82bad0161e5ab05 (patch)
tree9cd0ea5d3ada1595fba9ee393e2fa73217ef764d
parente123295cc8701564e2c710ee95520b2fee7b57c9 (diff)
avcodec/libvpxenc: Avoid unused-variable warning if VP9 enc is disabled
Reviewed-by: James Zern <jzern@google.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavcodec/libvpxenc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index 635cdf7a0e..bcbdc4981e 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -49,6 +49,9 @@
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
+#define IS_VP9(avctx) (CONFIG_LIBVPX_VP9_ENCODER && avctx->codec_id == AV_CODEC_ID_VP9)
+#define IS_VP8(avctx) (CONFIG_LIBVPX_VP8_ENCODER && avctx->codec_id == AV_CODEC_ID_VP8)
+
/**
* Portion of struct vpx_codec_cx_pkt from vpx_encoder.h.
* One encoded frame returned from the library.
@@ -359,8 +362,7 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo,
FrameData fd = { .pts = frame->pts };
int ret;
-#if CONFIG_LIBVPX_VP9_ENCODER
- if (avctx->codec_id == AV_CODEC_ID_VP9 &&
+ if (IS_VP9(avctx) &&
// Keep HDR10+ if it has bit depth higher than 8 and
// it has PQ trc (SMPTE2084).
enccfg->g_bit_depth > 8 && avctx->color_trc == AVCOL_TRC_SMPTE2084) {
@@ -372,7 +374,6 @@ static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo,
return AVERROR(ENOMEM);
}
}
-#endif
fd.duration = frame->duration;
fd.frame_opaque = frame->opaque;