diff mbox series

[FFmpeg-devel,1/4] avcodec/mpegvideo_enc: Ignore ICC profile size when not MJPEG

Message ID DU2PR01MB79504B2664BE0DBFB86271748FEA9@DU2PR01MB7950.eurprd01.prod.exchangelabs.com
State Accepted
Commit 4487dd8bb5b3f34cf5d8601a331387f56319f594
Headers show
Series [FFmpeg-devel,1/4] avcodec/mpegvideo_enc: Ignore ICC profile size when not MJPEG | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt April 11, 2022, 11:49 p.m. UTC
MJPEG is the only mpegvideo-based encoder making use of it.
Fixes linking failures in case mpegvideo_enc.c is compiled
with AMV, LJPEG and MJPEG encoders disabled.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/mpegvideo_enc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 40bcf09c0b..4a5e5a5059 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -1687,8 +1687,11 @@  int ff_mpv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
         size_t pkt_size = growing_buffer ? FFMAX(s->mb_width*s->mb_height*64+10000, avctx->internal->byte_buffer_size) - AV_INPUT_BUFFER_PADDING_SIZE
                                               :
                                               s->mb_width*s->mb_height*(MAX_MB_BYTES+100)+10000;
-        if ((ret = ff_mjpeg_add_icc_profile_size(avctx, s->new_picture, &pkt_size)) < 0)
-            return ret;
+        if (CONFIG_MJPEG_ENCODER && avctx->codec_id == AV_CODEC_ID_MJPEG) {
+            ret = ff_mjpeg_add_icc_profile_size(avctx, s->new_picture, &pkt_size);
+            if (ret < 0)
+                return ret;
+        }
         if ((ret = ff_alloc_packet(avctx, pkt, pkt_size)) < 0)
             return ret;
         if (s->mb_info) {