diff options
author | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-12-03 00:25:28 +0300 |
---|---|---|
committer | Baptiste Coudurier <baptiste.coudurier@gmail.com> | 2009-12-03 00:25:28 +0300 |
commit | ab3faa8bf119b9e8a3b7b30ba4e2d2e857c9df32 (patch) | |
tree | 6bb9209e28348fb2dc94ac6a25fad811c87888f9 /libavcodec/gif.c | |
parent | af7436ae1d26d3431377410775e62f12b5c4c0d5 (diff) |
pass avctx as argument instead of width and height
Originally committed as revision 20710 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/gif.c')
-rw-r--r-- | libavcodec/gif.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/libavcodec/gif.c b/libavcodec/gif.c index 80c13ae4e9..fae1366e01 100644 --- a/libavcodec/gif.c +++ b/libavcodec/gif.c @@ -58,17 +58,16 @@ typedef struct { } GIFContext; /* GIF header */ -static int gif_image_write_header(uint8_t **bytestream, - int width, int height, - uint32_t *palette) +static int gif_image_write_header(AVCodecContext *avctx, + uint8_t **bytestream, uint32_t *palette) { int i; unsigned int v; bytestream_put_buffer(bytestream, "GIF", 3); bytestream_put_buffer(bytestream, "89a", 3); - bytestream_put_le16(bytestream, width); - bytestream_put_le16(bytestream, height); + bytestream_put_le16(bytestream, avctx->width); + bytestream_put_le16(bytestream, avctx->height); bytestream_put_byte(bytestream, 0xf7); /* flags: global clut, 256 entries */ bytestream_put_byte(bytestream, 0x1f); /* background color index */ @@ -83,8 +82,7 @@ static int gif_image_write_header(uint8_t **bytestream, return 0; } -static int gif_image_write_image(uint8_t **bytestream, - int width, int height, +static int gif_image_write_image(AVCodecContext *avctx, uint8_t **bytestream, const uint8_t *buf, int linesize) { PutBitContext p; @@ -96,14 +94,14 @@ static int gif_image_write_image(uint8_t **bytestream, bytestream_put_byte(bytestream, 0x2c); bytestream_put_le16(bytestream, 0); bytestream_put_le16(bytestream, 0); - bytestream_put_le16(bytestream, width); - bytestream_put_le16(bytestream, height); + bytestream_put_le16(bytestream, avctx->width); + bytestream_put_le16(bytestream, avctx->height); bytestream_put_byte(bytestream, 0x00); /* flags */ /* no local clut */ bytestream_put_byte(bytestream, 0x08); - left= width * height; + left= avctx->width * avctx->height; init_put_bits(&p, buffer, 130); @@ -112,7 +110,7 @@ static int gif_image_write_image(uint8_t **bytestream, * but it's still the same bitstream between packets (no flush !) */ ptr = buf; - w = width; + w = avctx->width; while(left>0) { put_bits(&p, 9, 0x0100); /* clear code */ @@ -120,7 +118,7 @@ static int gif_image_write_image(uint8_t **bytestream, for(i=(left<GIF_CHUNKS)?left:GIF_CHUNKS;i;i--) { put_bits(&p, 9, *ptr++); if (--w == 0) { - w = width; + w = avctx->width; buf += linesize; ptr = buf; } @@ -161,8 +159,8 @@ static int gif_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int bu *p = *pict; p->pict_type = FF_I_TYPE; p->key_frame = 1; - gif_image_write_header(&outbuf_ptr, avctx->width, avctx->height, (uint32_t *)pict->data[1]); - gif_image_write_image(&outbuf_ptr, avctx->width, avctx->height, pict->data[0], pict->linesize[0]); + gif_image_write_header(avctx, &outbuf_ptr, (uint32_t *)pict->data[1]); + gif_image_write_image(avctx, &outbuf_ptr, pict->data[0], pict->linesize[0]); return outbuf_ptr - outbuf; } |