annotate gif.c @ 10600:40af8390d83f libavcodec

Fix dual prime motion compensation in field pictures. Fixes issue1125.
author michael
date Mon, 30 Nov 2009 02:37:03 +0000
parents 38cfe222e1a4
children 099e9b33c1b9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
1 /*
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
2 * GIF encoder.
8629
04423b2f6e0b cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 8591
diff changeset
3 * Copyright (c) 2000 Fabrice Bellard
04423b2f6e0b cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 8591
diff changeset
4 * Copyright (c) 2002 Francois Revol
04423b2f6e0b cosmetics: Remove pointless period after copyright statement non-sentences.
diego
parents: 8591
diff changeset
5 * Copyright (c) 2006 Baptiste Coudurier
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
6 *
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
7 * This file is part of FFmpeg.
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
8 *
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
9 * FFmpeg is free software; you can redistribute it and/or
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
10 * modify it under the terms of the GNU Lesser General Public
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
11 * License as published by the Free Software Foundation; either
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
12 * version 2.1 of the License, or (at your option) any later version.
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
13 *
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
14 * FFmpeg is distributed in the hope that it will be useful,
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
17 * Lesser General Public License for more details.
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
18 *
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
19 * You should have received a copy of the GNU Lesser General Public
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
20 * License along with FFmpeg; if not, write to the Free Software
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
22 */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
23
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
24 /*
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
25 * First version by Francois Revol revol@free.fr
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
26 *
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
27 * Features and limitations:
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
28 * - currently no compression is performed,
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
29 * in fact the size of the data is 9/8 the size of the image in 8bpp
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
30 * - uses only a global standard palette
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
31 * - tested with IE 5.0, Opera for BeOS, NetPositive (BeOS), and Mozilla (BeOS).
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
32 *
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
33 * Reference documents:
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
34 * http://www.goice.co.jp/member/mo/formats/gif.html
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
35 * http://astronomy.swin.edu.au/pbourke/dataformats/gif/
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
36 * http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/GIF89a.txt
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
37 *
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
38 * this url claims to have an LZW algorithm not covered by Unisys patent:
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
39 * http://www.msg.net/utility/whirlgif/gifencod.html
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
40 * could help reduce the size of the files _a lot_...
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
41 * some sites mentions an RLE type compression also.
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
42 */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
43
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
44 #include "avcodec.h"
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
45 #include "bytestream.h"
8591
d1e300c41ed5 cleanup gif, use BISTREAM_WRITER_LE
bcoudurier
parents: 7040
diff changeset
46
d1e300c41ed5 cleanup gif, use BISTREAM_WRITER_LE
bcoudurier
parents: 7040
diff changeset
47 /* The GIF format uses reversed order for bitstreams... */
d1e300c41ed5 cleanup gif, use BISTREAM_WRITER_LE
bcoudurier
parents: 7040
diff changeset
48 /* at least they don't use PDP_ENDIAN :) */
d1e300c41ed5 cleanup gif, use BISTREAM_WRITER_LE
bcoudurier
parents: 7040
diff changeset
49 #define BITSTREAM_WRITER_LE
d1e300c41ed5 cleanup gif, use BISTREAM_WRITER_LE
bcoudurier
parents: 7040
diff changeset
50
9411
4cb7c65fc775 Split bitstream.h, put the bitstream writer stuff in the new file
stefano
parents: 8775
diff changeset
51 #include "put_bits.h"
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
52
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
53 /* bitstream minipacket size */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
54 #define GIF_CHUNKS 100
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
55
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
56 /* GIF header */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
57 static int gif_image_write_header(uint8_t **bytestream,
8773
80a01d448b45 remove dead netscape loop header code in gif encoder, patch by Daniel Verkamp, daniel at drv dot nu
bcoudurier
parents: 8749
diff changeset
58 int width, int height,
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
59 uint32_t *palette)
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
60 {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
61 int i;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
62 unsigned int v;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
63
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
64 bytestream_put_buffer(bytestream, "GIF", 3);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
65 bytestream_put_buffer(bytestream, "89a", 3);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
66 bytestream_put_le16(bytestream, width);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
67 bytestream_put_le16(bytestream, height);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
68
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
69 bytestream_put_byte(bytestream, 0xf7); /* flags: global clut, 256 entries */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
70 bytestream_put_byte(bytestream, 0x1f); /* background color index */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
71 bytestream_put_byte(bytestream, 0); /* aspect ratio */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
72
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
73 /* the global palette */
8774
0a8166d20fd3 remove dead rgb24 code, gif encoder now directly takes palette, patch by Daniel Verkamp, daniel at drv dot nu
bcoudurier
parents: 8773
diff changeset
74 for(i=0;i<256;i++) {
0a8166d20fd3 remove dead rgb24 code, gif encoder now directly takes palette, patch by Daniel Verkamp, daniel at drv dot nu
bcoudurier
parents: 8773
diff changeset
75 v = palette[i];
0a8166d20fd3 remove dead rgb24 code, gif encoder now directly takes palette, patch by Daniel Verkamp, daniel at drv dot nu
bcoudurier
parents: 8773
diff changeset
76 bytestream_put_be24(bytestream, v);
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
77 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
78
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
79 return 0;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
80 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
81
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
82 static int gif_image_write_image(uint8_t **bytestream,
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
83 int x1, int y1, int width, int height,
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
84 const uint8_t *buf, int linesize, int pix_fmt)
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
85 {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
86 PutBitContext p;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
87 uint8_t buffer[200]; /* 100 * 9 / 8 = 113 */
8774
0a8166d20fd3 remove dead rgb24 code, gif encoder now directly takes palette, patch by Daniel Verkamp, daniel at drv dot nu
bcoudurier
parents: 8773
diff changeset
88 int i, left, w;
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
89 const uint8_t *ptr;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
90 /* image block */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
91
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
92 bytestream_put_byte(bytestream, 0x2c);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
93 bytestream_put_le16(bytestream, x1);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
94 bytestream_put_le16(bytestream, y1);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
95 bytestream_put_le16(bytestream, width);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
96 bytestream_put_le16(bytestream, height);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
97 bytestream_put_byte(bytestream, 0x00); /* flags */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
98 /* no local clut */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
99
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
100 bytestream_put_byte(bytestream, 0x08);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
101
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
102 left= width * height;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
103
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
104 init_put_bits(&p, buffer, 130);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
105
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
106 /*
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
107 * the thing here is the bitstream is written as little packets, with a size byte before
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
108 * but it's still the same bitstream between packets (no flush !)
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
109 */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
110 ptr = buf;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
111 w = width;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
112 while(left>0) {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
113
8591
d1e300c41ed5 cleanup gif, use BISTREAM_WRITER_LE
bcoudurier
parents: 7040
diff changeset
114 put_bits(&p, 9, 0x0100); /* clear code */
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
115
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
116 for(i=(left<GIF_CHUNKS)?left:GIF_CHUNKS;i;i--) {
8774
0a8166d20fd3 remove dead rgb24 code, gif encoder now directly takes palette, patch by Daniel Verkamp, daniel at drv dot nu
bcoudurier
parents: 8773
diff changeset
117 put_bits(&p, 9, *ptr++);
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
118 if (--w == 0) {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
119 w = width;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
120 buf += linesize;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
121 ptr = buf;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
122 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
123 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
124
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
125 if(left<=GIF_CHUNKS) {
8591
d1e300c41ed5 cleanup gif, use BISTREAM_WRITER_LE
bcoudurier
parents: 7040
diff changeset
126 put_bits(&p, 9, 0x101); /* end of stream */
d1e300c41ed5 cleanup gif, use BISTREAM_WRITER_LE
bcoudurier
parents: 7040
diff changeset
127 flush_put_bits(&p);
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
128 }
9431
932543edc1d2 Rename pbBufPtr() to put_bits_ptr().
stefano
parents: 9411
diff changeset
129 if(put_bits_ptr(&p) - p.buf > 0) {
932543edc1d2 Rename pbBufPtr() to put_bits_ptr().
stefano
parents: 9411
diff changeset
130 bytestream_put_byte(bytestream, put_bits_ptr(&p) - p.buf); /* byte count of the packet */
932543edc1d2 Rename pbBufPtr() to put_bits_ptr().
stefano
parents: 9411
diff changeset
131 bytestream_put_buffer(bytestream, p.buf, put_bits_ptr(&p) - p.buf); /* the actual buffer */
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
132 p.buf_ptr = p.buf; /* dequeue the bytes off the bitstream */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
133 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
134 left-=GIF_CHUNKS;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
135 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
136 bytestream_put_byte(bytestream, 0x00); /* end of image block */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
137 bytestream_put_byte(bytestream, 0x3b);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
138 return 0;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
139 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
140
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
141 typedef struct {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
142 AVFrame picture;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
143 } GIFContext;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
144
6517
48759bfbd073 Apply 'cold' attribute to init/uninit functions in libavcodec
zuxy
parents: 6152
diff changeset
145 static av_cold int gif_encode_init(AVCodecContext *avctx)
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
146 {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
147 GIFContext *s = avctx->priv_data;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
148
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
149 avctx->coded_frame = &s->picture;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
150 return 0;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
151 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
152
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
153 /* better than nothing gif encoder */
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
154 static int gif_encode_frame(AVCodecContext *avctx, unsigned char *outbuf, int buf_size, void *data)
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
155 {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
156 GIFContext *s = avctx->priv_data;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
157 AVFrame *pict = data;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
158 AVFrame *const p = (AVFrame *)&s->picture;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
159 uint8_t *outbuf_ptr = outbuf;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
160
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
161 *p = *pict;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
162 p->pict_type = FF_I_TYPE;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
163 p->key_frame = 1;
8773
80a01d448b45 remove dead netscape loop header code in gif encoder, patch by Daniel Verkamp, daniel at drv dot nu
bcoudurier
parents: 8749
diff changeset
164 gif_image_write_header(&outbuf_ptr, avctx->width, avctx->height, (uint32_t *)pict->data[1]);
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
165 gif_image_write_image(&outbuf_ptr, 0, 0, avctx->width, avctx->height, pict->data[0], pict->linesize[0], PIX_FMT_PAL8);
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
166 return outbuf_ptr - outbuf;
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
167 }
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
168
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
169 AVCodec gif_encoder = {
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
170 "gif",
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
171 CODEC_TYPE_VIDEO,
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
172 CODEC_ID_GIF,
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
173 sizeof(GIFContext),
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
174 gif_encode_init,
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
175 gif_encode_frame,
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
176 NULL, //encode_end,
10146
38cfe222e1a4 Mark all pix_fmts and supported_framerates compound literals as const.
reimar
parents: 9431
diff changeset
177 .pix_fmts= (const enum PixelFormat[]){PIX_FMT_RGB8, PIX_FMT_BGR8, PIX_FMT_RGB4_BYTE, PIX_FMT_BGR4_BYTE, PIX_FMT_GRAY8, PIX_FMT_PAL8, PIX_FMT_NONE},
7040
e943e1409077 Make AVCodec long_names definition conditional depending on CONFIG_SMALL.
stefano
parents: 6788
diff changeset
178 .long_name= NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"),
4125
f6f67a8bdd09 change gif muxer to simple gif encoder
bcoudurier
parents:
diff changeset
179 };