tiffenc: fix packet size calculation

Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
Tristan Matthews 2014-06-13 10:57:12 -04:00 committed by Anton Khirnov
parent fe4d5fe936
commit 4910684492
1 changed files with 5 additions and 3 deletions

View File

@ -218,6 +218,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
int is_yuv = 0;
uint8_t *yuv_line = NULL;
int shift_h, shift_v;
int packet_size;
const AVPixFmtDescriptor *pfd;
s->avctx = avctx;
@ -288,10 +289,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
strips = (s->height - 1) / s->rps + 1;
packet_size = avctx->height * ((avctx->width * s->bpp + 7) >> 3) * 2 +
avctx->height * 4 + FF_MIN_BUFFER_SIZE;
if (!pkt->data &&
(ret = av_new_packet(pkt,
avctx->width * avctx->height * s->bpp * 2 +
avctx->height * 4 + FF_MIN_BUFFER_SIZE)) < 0) {
(ret = av_new_packet(pkt, packet_size)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret;
}