diff options
author | Paul B Mahol <onemda@gmail.com> | 2012-07-10 02:40:39 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2012-07-10 21:32:58 +0000 |
commit | ca16f88c75f84a054d6bd71fe3f6fbaf508a1623 (patch) | |
tree | a7e1a543e6a7d2cc6df6ef40429692655fe92850 | |
parent | 5a9d6993cb331bebd5e760582a1575f49936894f (diff) | |
download | ffmpeg-ca16f88c75f84a054d6bd71fe3f6fbaf508a1623.tar.gz |
tiffenc: add .init
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r-- | libavcodec/tiffenc.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c index 41d73bfbbd..685ce372d4 100644 --- a/libavcodec/tiffenc.c +++ b/libavcodec/tiffenc.c @@ -215,6 +215,18 @@ static void pack_yuv(TiffEncoderContext * s, uint8_t * dst, int lnum) } } +static av_cold int encode_init(AVCodecContext *avctx) +{ + TiffEncoderContext *s = avctx->priv_data; + + avctx->coded_frame= &s->picture; + avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; + avctx->coded_frame->key_frame = 1; + s->avctx = avctx; + + return 0; +} + static int encode_frame(AVCodecContext * avctx, AVPacket *pkt, const AVFrame *pict, int *got_packet) { @@ -234,12 +246,7 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt, uint8_t *yuv_line = NULL; int shift_h, shift_v; - s->avctx = avctx; - *p = *pict; - p->pict_type = AV_PICTURE_TYPE_I; - p->key_frame = 1; - avctx->coded_frame= &s->picture; s->width = avctx->width; s->height = avctx->height; @@ -487,6 +494,7 @@ AVCodec ff_tiff_encoder = { .type = AVMEDIA_TYPE_VIDEO, .id = CODEC_ID_TIFF, .priv_data_size = sizeof(TiffEncoderContext), + .init = encode_init, .encode2 = encode_frame, .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_RGB24, PIX_FMT_PAL8, PIX_FMT_GRAY8, PIX_FMT_GRAY8A, PIX_FMT_GRAY16LE, |