[FFmpeg-devel] [PATCH] avcodec/encode: Avoid building implementation when encoders are disabled

Michael Niedermayer michael at niedermayer.cc
Sat Jul 17 00:31:03 EEST 2021


This could also be moved into a separate file.

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 libavcodec/encode.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/libavcodec/encode.c b/libavcodec/encode.c
index a569904f2c..ecf0e6e4bd 100644
--- a/libavcodec/encode.c
+++ b/libavcodec/encode.c
@@ -30,6 +30,8 @@
 #include "frame_thread_encoder.h"
 #include "internal.h"
 
+#if CONFIG_ENCODERS
+
 int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
 {
     if (size < 0 || size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
@@ -555,3 +557,48 @@ int ff_encode_preinit(AVCodecContext *avctx)
 
     return 0;
 }
+#else // CONFIG_ENCODERS
+
+
+int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
+{
+    return AVERROR(ENOSYS);
+}
+
+int avcodec_default_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int flags)
+{
+    return AVERROR(ENOSYS);
+}
+
+int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
+{
+    return AVERROR(ENOSYS);
+}
+
+int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
+                            const AVSubtitle *sub)
+{
+    return AVERROR(ENOSYS);
+}
+
+int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
+{
+    return AVERROR(ENOSYS);
+}
+
+int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame)
+{
+    return AVERROR(ENOSYS);
+}
+
+int attribute_align_arg avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
+{
+    return AVERROR(ENOSYS);
+}
+
+int ff_encode_preinit(AVCodecContext *avctx)
+{
+    return AVERROR(ENOSYS);
+}
+
+#endif// !CONFIG_ENCODERS
-- 
2.17.1



More information about the ffmpeg-devel mailing list