diff mbox series

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

Message ID 20210716213103.25787-1-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel] avcodec/encode: Avoid building implementation when encoders are disabled
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Michael Niedermayer July 16, 2021, 9:31 p.m. UTC
This could also be moved into a separate file.

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

Patch

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