X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Ftiffenc.c;h=f59816ec8253f17154ed7268692e0c06d0f7f58a;hb=9e1ddc08208d7b484d5d97d4e169c75b91e3ff21;hp=3d37d2e08497ac5ecfe3b98ebc3dbd2aaa5e6301;hpb=7c282d0c758dc5e9593312da1c191cdf76de0303;p=ffmpeg diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index 3d37d2e0849..f59816ec825 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -265,6 +265,9 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, s->subsampling[0] = 1; s->subsampling[1] = 1; + if (!desc) + return AVERROR(EINVAL); + avctx->bits_per_coded_sample = s->bpp = av_get_bits_per_pixel(desc); s->bpp_tab_size = desc->nb_components; @@ -521,6 +524,15 @@ fail: static av_cold int encode_init(AVCodecContext *avctx) { TiffEncoderContext *s = avctx->priv_data; + +#if !CONFIG_ZLIB + 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; @@ -551,9 +563,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 }, };