aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2016-06-26 20:08:54 -0400
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-06-29 15:25:42 -0400
commit6c445990e64124ad64c79423dfd3764520648c89 (patch)
tree6ea591f5efacf5ef8571d8c51776fc362bbc7bc9
parent9f732e4c996243c1e57c2bbbec6c8b94c37a7a22 (diff)
downloadffmpeg-6c445990e64124ad64c79423dfd3764520648c89.tar.gz
tiffenc: Check zlib support for deflate option during initialization
This converts a misleading error about an option not found to a more meaningful one.
-rw-r--r--libavcodec/tiffenc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 24312f0dc5..8791c54987 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -492,6 +492,16 @@ fail:
static av_cold int encode_init(AVCodecContext *avctx)
{
+#if !CONFIG_ZLIB
+ TiffEncoderContext *s = avctx->priv_data;
+
+ if (s->compr == TIFF_DEFLATE) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Deflate compression needs zlib compiled in\n");
+ return AVERROR(ENOSYS);
+ }
+#endif
+
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
@@ -509,9 +519,7 @@ static const AVOption options[] = {
{ "packbits", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TIFF_PACKBITS }, 0, 0, VE, "compression_algo" },
{ "raw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TIFF_RAW }, 0, 0, VE, "compression_algo" },
{ "lzw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TIFF_LZW }, 0, 0, VE, "compression_algo" },
-#if CONFIG_ZLIB
{ "deflate", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TIFF_DEFLATE }, 0, 0, VE, "compression_algo" },
-#endif
{ NULL },
};