1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-08-03 01:39:58 +02:00

tiffenc: Check zlib support for deflate option during initialization

This converts a misleading error about an option not found to a more
meaningful one.
This commit is contained in:
Vittorio Giovara 2016-06-26 20:08:54 -04:00
parent 9f732e4c99
commit 6c445990e6

View File

@ -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 },
};