[FFmpeg-devel] [PATCH] remove CONFIG_ZLIB checks from lclenc.c
Reimar Döffinger
Reimar.Doeffinger
Sat May 30 20:21:04 CEST 2009
Hello,
currently the lclenc.c code is completely unusable without zlib and also
will not be compiled if it is not available.
So I propose to remove all those #if CONFIG_ZLIB and just assume it is
available.
I guess it was done like this to ease adding a mszh or whatever encoder,
but this wasn't done the last five years and I have some doubts it would
be done in the next 5, and even if I think it is questionable to have
them share a file just because they share some code.
Any objections?
Btw. I also think that the lcldec.c code might be better using
CONFIG_ZLIB_DECODER instead of CONFIG_ZLIB, having code like
> if (avctx->codec_id == CODEC_ID_ZLIB)
> print an error...
when there is no zlib_decoder and thus no decoder registered for
CODEC_ID_ZLIB seems like useless bloat and would only "protect" against
severe usage errors.
-------------- next part --------------
Index: libavcodec/lclenc.c
===================================================================
--- libavcodec/lclenc.c (revision 18996)
+++ libavcodec/lclenc.c (working copy)
@@ -45,9 +45,7 @@
#include "put_bits.h"
#include "lcl.h"
-#if CONFIG_ZLIB
#include <zlib.h>
-#endif
/*
* Decoder context
@@ -70,9 +68,7 @@
unsigned int max_comp_size;
// Compression buffer
unsigned char* comp_buf;
-#if CONFIG_ZLIB
z_stream zstream;
-#endif
} LclEncContext;
/*
@@ -87,11 +83,6 @@
int i;
int zret; // Zlib return code
-#if !CONFIG_ZLIB
- av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled in.\n");
- return -1;
-#else
-
init_put_bits(&c->pb, buf, buf_size);
*p = *pict;
@@ -131,7 +122,6 @@
flush_put_bits(&c->pb);
return c->zstream.total_out;
-#endif
}
/*
@@ -144,11 +134,6 @@
LclEncContext *c = avctx->priv_data;
int zret; // Zlib return code
-#if !CONFIG_ZLIB
- av_log(avctx, AV_LOG_ERROR, "Zlib support not compiled.\n");
- return 1;
-#else
-
c->avctx= avctx;
assert(avctx->width && avctx->height);
@@ -199,7 +184,6 @@
}
return 0;
-#endif
}
/*
@@ -213,9 +197,7 @@
av_freep(&avctx->extradata);
av_freep(&c->comp_buf);
-#if CONFIG_ZLIB
deflateEnd(&(c->zstream));
-#endif
return 0;
}
More information about the ffmpeg-devel
mailing list