Justin Ruggles <[email protected]> added the comment:
i have no idea if the attached patch is correct, but it fixes the crash
______________________________________________
Libav issue tracker <[email protected]>
<https://roundup.libav.org/issue2658>
______________________________________________
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index 049b28f..a10b833 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -223,7 +223,6 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
*p = *pict;
p->pict_type = FF_I_TYPE;
p->key_frame = 1;
- avctx->coded_frame= &s->picture;
s->compr = TIFF_PACKBITS;
if (avctx->compression_level == 0) {
@@ -442,12 +441,22 @@ fail:
return ret;
}
+static av_cold int encode_init(AVCodecContext *avctx)
+{
+ TiffEncoderContext *s = avctx->priv_data;
+
+ avcodec_get_frame_defaults((AVFrame*)&s->picture);
+ avctx->coded_frame = (AVFrame*)&s->picture;
+
+ return 0;
+}
+
AVCodec ff_tiff_encoder = {
"tiff",
AVMEDIA_TYPE_VIDEO,
CODEC_ID_TIFF,
sizeof(TiffEncoderContext),
- NULL,
+ encode_init,
encode_frame,
NULL,
NULL,