FFmpeg
gifdec.c
Go to the documentation of this file.
1 /*
2  * GIF demuxer
3  * Copyright (c) 2012 Vitaliy E Sugrobov
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * GIF demuxer.
25  */
26 
27 #include "avformat.h"
28 #include "libavutil/bprint.h"
29 #include "libavutil/intreadwrite.h"
30 #include "libavutil/opt.h"
31 #include "internal.h"
32 #include "libavcodec/gif.h"
33 
34 typedef struct GIFDemuxContext {
35  const AVClass *class;
36  /**
37  * Time span in hundredths of second before
38  * the next frame should be drawn on screen.
39  */
40  int delay;
41  /**
42  * Minimum allowed delay between frames in hundredths of
43  * second. Values below this threshold considered to be
44  * invalid and set to value of default_delay.
45  */
46  int min_delay;
47  int max_delay;
49 
50  /**
51  * loop options
52  */
56 
57  int nb_frames;
60 
61 /**
62  * Major web browsers display gifs at ~10-15fps when rate
63  * is not explicitly set or have too low values. We assume default rate to be 10.
64  * Default delay = 100hundredths of second / 10fps = 10hos per frame.
65  */
66 #define GIF_DEFAULT_DELAY 10
67 /**
68  * By default delay values less than this threshold considered to be invalid.
69  */
70 #define GIF_MIN_DELAY 2
71 
72 static int gif_probe(const AVProbeData *p)
73 {
74  /* check magick */
75  if (memcmp(p->buf, gif87a_sig, 6) && memcmp(p->buf, gif89a_sig, 6))
76  return 0;
77 
78  /* width or height contains zero? */
79  if (!AV_RL16(&p->buf[6]) || !AV_RL16(&p->buf[8]))
80  return 0;
81 
82  return AVPROBE_SCORE_MAX;
83 }
84 
85 static int resync(AVIOContext *pb)
86 {
87  int i;
88  for (i = 0; i < 6; i++) {
89  int b = avio_r8(pb);
90  if (b != gif87a_sig[i] && b != gif89a_sig[i])
91  i = -(b != 'G');
92  if (avio_feof(pb))
93  return AVERROR_EOF;
94  }
95  return 0;
96 }
97 
99 {
100  int sb_size, ret = 0;
101 
102  while (0x00 != (sb_size = avio_r8(pb))) {
103  if ((ret = avio_skip(pb, sb_size)) < 0)
104  return ret;
105  }
106 
107  return ret;
108 }
109 
111 {
112  GIFDemuxContext *gdc = s->priv_data;
113  AVIOContext *pb = s->pb;
114  AVStream *st;
115  int type, width, height, ret, n, flags;
116  int64_t nb_frames = 0, duration = 0;
117 
118  if ((ret = resync(pb)) < 0)
119  return ret;
120 
121  gdc->delay = gdc->default_delay;
122  width = avio_rl16(pb);
123  height = avio_rl16(pb);
124  flags = avio_r8(pb);
125  avio_skip(pb, 1);
126  n = avio_r8(pb);
127 
128  if (width == 0 || height == 0)
129  return AVERROR_INVALIDDATA;
130 
131  st = avformat_new_stream(s, NULL);
132  if (!st)
133  return AVERROR(ENOMEM);
134 
135  if (flags & 0x80)
136  avio_skip(pb, 3 * (1 << ((flags & 0x07) + 1)));
137 
138  while ((type = avio_r8(pb)) != GIF_TRAILER) {
139  if (avio_feof(pb))
140  break;
142  int subtype = avio_r8(pb);
143  if (subtype == GIF_COM_EXT_LABEL) {
144  AVBPrint bp;
145  int block_size;
146 
148  while ((block_size = avio_r8(pb)) != 0) {
149  avio_read_to_bprint(pb, &bp, block_size);
150  }
151  av_dict_set(&s->metadata, "comment", bp.str, 0);
152  av_bprint_finalize(&bp, NULL);
153  } else if (subtype == GIF_GCE_EXT_LABEL) {
154  int block_size = avio_r8(pb);
155 
156  if (block_size == 4) {
157  int delay;
158 
159  avio_skip(pb, 1);
160  delay = avio_rl16(pb);
161  if (delay < gdc->min_delay)
162  delay = gdc->default_delay;
163  delay = FFMIN(delay, gdc->max_delay);
164  duration += delay;
165  avio_skip(pb, 1);
166  } else {
167  avio_skip(pb, block_size);
168  }
169  gif_skip_subblocks(pb);
170  } else {
171  gif_skip_subblocks(pb);
172  }
173  } else if (type == GIF_IMAGE_SEPARATOR) {
174  avio_skip(pb, 8);
175  flags = avio_r8(pb);
176  if (flags & 0x80)
177  avio_skip(pb, 3 * (1 << ((flags & 0x07) + 1)));
178  avio_skip(pb, 1);
179  gif_skip_subblocks(pb);
180  nb_frames++;
181  } else {
182  break;
183  }
184  }
185 
186  /* GIF format operates with time in "hundredths of second",
187  * therefore timebase is 1/100 */
188  avpriv_set_pts_info(st, 64, 1, 100);
191  st->codecpar->width = width;
192  st->codecpar->height = height;
193  st->start_time = 0;
194  st->duration = duration;
195  st->nb_frames = nb_frames;
196  if (n) {
197  st->codecpar->sample_aspect_ratio.num = n + 15;
198  st->codecpar->sample_aspect_ratio.den = 64;
199  }
200 
201  /* jump to start because gif decoder needs header data too */
202  if (avio_seek(pb, 0, SEEK_SET) != 0)
203  return AVERROR(EIO);
204 
205  return 0;
206 }
207 
209 {
210  GIFDemuxContext *gdc = s->priv_data;
211  AVIOContext *pb = s->pb;
212  int sb_size, ext_label = avio_r8(pb);
213  int ret;
214 
215  if (ext_label == GIF_GCE_EXT_LABEL) {
216  if ((sb_size = avio_r8(pb)) < 4) {
217  av_log(s, AV_LOG_FATAL, "Graphic Control Extension block's size less than 4.\n");
218  return AVERROR_INVALIDDATA;
219  }
220 
221  /* skip packed fields */
222  if ((ret = avio_skip(pb, 1)) < 0)
223  return ret;
224 
225  gdc->delay = avio_rl16(pb);
226 
227  if (gdc->delay < gdc->min_delay)
228  gdc->delay = gdc->default_delay;
229  gdc->delay = FFMIN(gdc->delay, gdc->max_delay);
230 
231  /* skip the rest of the Graphic Control Extension block */
232  if ((ret = avio_skip(pb, sb_size - 3)) < 0 )
233  return ret;
234  } else if (ext_label == GIF_APP_EXT_LABEL) {
235  uint8_t data[256];
236 
237  sb_size = avio_r8(pb);
238  ret = avio_read(pb, data, sb_size);
239  if (ret < 0 || !sb_size)
240  return ret;
241 
242  if (sb_size == strlen(NETSCAPE_EXT_STR)) {
243  sb_size = avio_r8(pb);
244  ret = avio_read(pb, data, sb_size);
245  if (ret < 0 || !sb_size)
246  return ret;
247 
248  if (sb_size == 3 && data[0] == 1) {
249  gdc->total_iter = AV_RL16(data+1);
250  av_log(s, AV_LOG_DEBUG, "Loop count is %d\n", gdc->total_iter);
251 
252  if (gdc->total_iter == 0)
253  gdc->total_iter = -1;
254  }
255  }
256  }
257 
258  if ((ret = gif_skip_subblocks(pb)) < 0)
259  return ret;
260 
261  return 0;
262 }
263 
265 {
266  GIFDemuxContext *gdc = s->priv_data;
267  AVIOContext *pb = s->pb;
268  int packed_fields, block_label, ct_size,
269  keyframe, frame_parsed = 0, ret;
270  int64_t frame_start = avio_tell(pb), frame_end;
271  unsigned char buf[6];
272 
273  if ((ret = avio_read(pb, buf, 6)) == 6) {
274  keyframe = memcmp(buf, gif87a_sig, 6) == 0 ||
275  memcmp(buf, gif89a_sig, 6) == 0;
276  } else if (ret < 0) {
277  return ret;
278  } else {
279  keyframe = 0;
280  }
281 
282  if (keyframe) {
283 parse_keyframe:
284  /* skip 2 bytes of width and 2 of height */
285  if ((ret = avio_skip(pb, 4)) < 0)
286  return ret;
287 
288  packed_fields = avio_r8(pb);
289 
290  /* skip 1 byte of Background Color Index and 1 byte of Pixel Aspect Ratio */
291  if ((ret = avio_skip(pb, 2)) < 0)
292  return ret;
293 
294  /* global color table presence */
295  if (packed_fields & 0x80) {
296  ct_size = 3 * (1 << ((packed_fields & 0x07) + 1));
297 
298  if ((ret = avio_skip(pb, ct_size)) < 0)
299  return ret;
300  }
301  } else {
302  avio_seek(pb, -ret, SEEK_CUR);
303  ret = AVERROR_EOF;
304  }
305 
306  while (GIF_TRAILER != (block_label = avio_r8(pb)) && !avio_feof(pb)) {
307  if (block_label == GIF_EXTENSION_INTRODUCER) {
308  if ((ret = gif_read_ext (s)) < 0 )
309  goto resync;
310  } else if (block_label == GIF_IMAGE_SEPARATOR) {
311  /* skip to last byte of Image Descriptor header */
312  if ((ret = avio_skip(pb, 8)) < 0)
313  return ret;
314 
315  packed_fields = avio_r8(pb);
316 
317  /* local color table presence */
318  if (packed_fields & 0x80) {
319  ct_size = 3 * (1 << ((packed_fields & 0x07) + 1));
320 
321  if ((ret = avio_skip(pb, ct_size)) < 0)
322  return ret;
323  }
324 
325  /* read LZW Minimum Code Size */
326  if (avio_r8(pb) < 1) {
327  av_log(s, AV_LOG_ERROR, "lzw minimum code size must be >= 1\n");
328  goto resync;
329  }
330 
331  if ((ret = gif_skip_subblocks(pb)) < 0)
332  goto resync;
333 
334  frame_end = avio_tell(pb);
335 
336  if (avio_seek(pb, frame_start, SEEK_SET) != frame_start)
337  return AVERROR(EIO);
338 
340  if (ret < 0)
341  return ret;
342 
343  if (keyframe)
345 
346  pkt->stream_index = 0;
347  pkt->duration = gdc->delay;
348 
349  gdc->nb_frames ++;
350  gdc->last_duration = pkt->duration;
351 
352  /* Graphic Control Extension's scope is single frame.
353  * Remove its influence. */
354  gdc->delay = gdc->default_delay;
355  frame_parsed = 1;
356 
357  break;
358  } else {
359  av_log(s, AV_LOG_ERROR, "invalid block label\n");
360 resync:
361  if (!keyframe)
362  avio_seek(pb, frame_start, SEEK_SET);
363  if ((ret = resync(pb)) < 0)
364  return ret;
365  frame_start = avio_tell(pb) - 6;
366  keyframe = 1;
367  goto parse_keyframe;
368  }
369  }
370 
371  if ((ret >= 0 && !frame_parsed) || ret == AVERROR_EOF) {
372  if (gdc->nb_frames == 1) {
373  s->streams[0]->r_frame_rate = (AVRational) {100, gdc->last_duration};
374  }
375  /* This might happen when there is no image block
376  * between extension blocks and GIF_TRAILER or EOF */
377  if (!gdc->ignore_loop && (block_label == GIF_TRAILER || avio_feof(pb))
378  && (gdc->total_iter < 0 || ++gdc->iter_count < gdc->total_iter))
379  return avio_seek(pb, 0, SEEK_SET);
380  return AVERROR_EOF;
381  } else
382  return ret;
383 }
384 
385 static const AVOption options[] = {
386  { "min_delay" , "minimum valid delay between frames (in hundredths of second)", offsetof(GIFDemuxContext, min_delay) , AV_OPT_TYPE_INT, {.i64 = GIF_MIN_DELAY} , 0, 100 * 60, AV_OPT_FLAG_DECODING_PARAM },
387  { "max_gif_delay", "maximum valid delay between frames (in hundredths of seconds)", offsetof(GIFDemuxContext, max_delay) , AV_OPT_TYPE_INT, {.i64 = 65535} , 0, 65535 , AV_OPT_FLAG_DECODING_PARAM },
388  { "default_delay", "default delay between frames (in hundredths of second)" , offsetof(GIFDemuxContext, default_delay), AV_OPT_TYPE_INT, {.i64 = GIF_DEFAULT_DELAY}, 0, 100 * 60, AV_OPT_FLAG_DECODING_PARAM },
389  { "ignore_loop" , "ignore loop setting (netscape extension)" , offsetof(GIFDemuxContext, ignore_loop) , AV_OPT_TYPE_BOOL,{.i64 = 1} , 0, 1, AV_OPT_FLAG_DECODING_PARAM },
390  { NULL },
391 };
392 
393 static const AVClass demuxer_class = {
394  .class_name = "GIF demuxer",
395  .item_name = av_default_item_name,
396  .option = options,
397  .version = LIBAVUTIL_VERSION_INT,
398  .category = AV_CLASS_CATEGORY_DEMUXER,
399 };
400 
402  .name = "gif",
403  .long_name = NULL_IF_CONFIG_SMALL("CompuServe Graphics Interchange Format (GIF)"),
404  .priv_data_size = sizeof(GIFDemuxContext),
409  .priv_class = &demuxer_class,
410 };
GIF_MIN_DELAY
#define GIF_MIN_DELAY
By default delay values less than this threshold considered to be invalid.
Definition: gifdec.c:70
options
static const AVOption options[]
Definition: gifdec.c:385
AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_UNLIMITED
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: utils.c:760
GIFDemuxContext
Definition: gifdec.c:34
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:56
av_bprint_finalize
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:234
gif_read_header
static int gif_read_header(AVFormatContext *s)
Definition: gifdec.c:110
av_bprint_init
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:68
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
GIFDemuxContext::default_delay
int default_delay
Definition: gifdec.c:48
GIF_TRAILER
#define GIF_TRAILER
Definition: gif.h:42
AVOption
AVOption.
Definition: opt.h:247
b
#define b
Definition: input.c:40
data
const char data[16]
Definition: mxf.c:143
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:391
NETSCAPE_EXT_STR
#define NETSCAPE_EXT_STR
Definition: gif.h:48
GIF_GCE_EXT_LABEL
#define GIF_GCE_EXT_LABEL
Definition: gif.h:45
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:425
GIFDemuxContext::iter_count
int iter_count
Definition: gifdec.c:54
GIFDemuxContext::nb_frames
int nb_frames
Definition: gifdec.c:57
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:458
GIF_COM_EXT_LABEL
#define GIF_COM_EXT_LABEL
Definition: gif.h:46
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:504
AVFMT_GENERIC_INDEX
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:468
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:973
avio_rl16
unsigned int avio_rl16(AVIOContext *s)
Definition: aviobuf.c:743
AVRational::num
int num
Numerator.
Definition: rational.h:59
gif89a_sig
static const uint8_t gif89a_sig[6]
Definition: gif.h:35
frame_start
static int frame_start(MpegEncContext *s)
Definition: mpegvideo_enc.c:1640
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
AVInputFormat
Definition: avformat.h:638
duration
int64_t duration
Definition: movenc.c:64
width
#define width
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:257
GIFDemuxContext::min_delay
int min_delay
Minimum allowed delay between frames in hundredths of second.
Definition: gifdec.c:46
avio_read_to_bprint
int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size)
Read contents of h into print buffer, up to max_size bytes, or up to EOF.
Definition: aviobuf.c:1315
AVCodecParameters::sample_aspect_ratio
AVRational sample_aspect_ratio
Video only.
Definition: codec_par.h:136
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:643
AVProbeData::buf
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:448
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:126
GIF_IMAGE_SEPARATOR
#define GIF_IMAGE_SEPARATOR
Definition: gif.h:44
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
AV_RL16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:94
AV_CLASS_CATEGORY_DEMUXER
@ AV_CLASS_CATEGORY_DEMUXER
Definition: log.h:33
AVFormatContext
Format I/O context.
Definition: avformat.h:1188
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1083
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:527
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
demuxer_class
static const AVClass demuxer_class
Definition: gifdec.c:393
read_probe
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
GIFDemuxContext::ignore_loop
int ignore_loop
Definition: gifdec.c:55
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:446
gif_read_packet
static int gif_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: gifdec.c:264
AVStream::nb_frames
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:975
gif_skip_subblocks
static int gif_skip_subblocks(AVIOContext *pb)
Definition: gifdec.c:98
AVIOContext
Bytestream IO Context.
Definition: avio.h:161
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
gif.h
GIFDemuxContext::last_duration
int last_duration
Definition: gifdec.c:58
resync
static int resync(AVIOContext *pb)
Definition: gifdec.c:85
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:632
height
#define height
GIFDemuxContext::total_iter
int total_iter
loop options
Definition: gifdec.c:53
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:379
AV_CODEC_ID_GIF
@ AV_CODEC_ID_GIF
Definition: codec_id.h:147
bprint.h
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
gif87a_sig
static const uint8_t gif87a_sig[6]
Definition: gif.h:34
AVCodecParameters::height
int height
Definition: codec_par.h:127
GIF_EXTENSION_INTRODUCER
#define GIF_EXTENSION_INTRODUCER
Definition: gif.h:43
AV_OPT_FLAG_DECODING_PARAM
#define AV_OPT_FLAG_DECODING_PARAM
a generic parameter which can be set by the user for demuxing or decoding
Definition: opt.h:278
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
av_get_packet
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
Allocate and read the payload of a packet and initialize its fields with default values.
Definition: utils.c:197
ret
ret
Definition: filter_design.txt:187
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
AVStream
Stream structure.
Definition: avformat.h:923
AV_LOG_FATAL
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
Definition: log.h:174
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:260
AVClass::class_name
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:71
GIFDemuxContext::max_delay
int max_delay
Definition: gifdec.c:47
avformat.h
GIFDemuxContext::delay
int delay
Time span in hundredths of second before the next frame should be drawn on screen.
Definition: gifdec.c:40
gif_read_ext
static int gif_read_ext(AVFormatContext *s)
Definition: gifdec.c:208
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:641
frame_end
static void frame_end(MpegEncContext *s)
Definition: mpegvideo_enc.c:1582
gif_probe
static int gif_probe(const AVProbeData *p)
Definition: gifdec.c:72
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: utils.c:1186
AVPacket::stream_index
int stream_index
Definition: packet.h:375
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:347
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
GIF_APP_EXT_LABEL
#define GIF_APP_EXT_LABEL
Definition: gif.h:47
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:60
AVPacket
This structure stores compressed data.
Definition: packet.h:350
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:241
av_dict_set
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:70
GIF_DEFAULT_DELAY
#define GIF_DEFAULT_DELAY
Major web browsers display gifs at ~10-15fps when rate is not explicitly set or have too low values.
Definition: gifdec.c:66
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
AVStream::start_time
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition: avformat.h:963
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:375
ff_gif_demuxer
const AVInputFormat ff_gif_demuxer
Definition: gifdec.c:401