FFmpeg
webp_anim_dec.c
Go to the documentation of this file.
1 /*
2  * Animated WebP demuxer
3  * Copyright (c) 2020 Pexeso Inc.
4  * Copyright (c) 2026 Ramiro Polla
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 /**
24  * @file
25  * Animated WebP demuxer.
26  */
27 
28 #include "avio_internal.h"
29 #include "demux.h"
30 #include "avformat.h"
31 #include "internal.h"
32 #include "libavutil/intreadwrite.h"
33 #include "libavutil/mem.h"
34 #include "libavutil/opt.h"
35 
36 #define VP8X_FLAG_ANIMATION 0x02
37 #define VP8X_FLAG_XMP_METADATA 0x04
38 #define VP8X_FLAG_EXIF_METADATA 0x08
39 #define VP8X_FLAG_ALPHA 0x10
40 #define VP8X_FLAG_ICC 0x20
41 
42 typedef struct WebPAnimDemuxContext {
43  const AVClass *class;
44 
45  /**
46  * Minimum allowed delay between frames in milliseconds.
47  * Values below this threshold are considered to be invalid
48  * and set to value of default_delay.
49  */
50  int min_delay;
51  int max_delay;
53 
54  /*
55  * loop options
56  */
57  int ignore_loop; ///< ignore loop setting
58  int loop_count; ///< number of times to loop the animation
59  int cur_loop; ///< current loop counter
60 
61  /*
62  * variables for the key frame detection
63  */
64  int cur_frame; ///< number of frames of the current animation file
66 
67  int has_iccp;
68  int has_exif;
69  int has_anim;
70  int has_xmp;
71 
73 
76 
77 /**
78  * Major web browsers display WebPs at ~10-15fps when rate is not
79  * explicitly set or have too low values. We assume default rate to be 10.
80  * Default delay = 1000 microseconds / 10fps = 100 milliseconds per frame.
81  */
82 #define WEBP_DEFAULT_DELAY 100
83 /**
84  * By default delay values less than this threshold considered to be invalid.
85  */
86 #define WEBP_MIN_DELAY 10
87 
88 static int webp_anim_probe(const AVProbeData *p)
89 {
90  const uint8_t *b = p->buf;
91 
92  if (AV_RL32(b) == MKTAG('R', 'I', 'F', 'F') &&
93  AV_RL32(b + 8) == MKTAG('W', 'E', 'B', 'P') &&
94  AV_RL32(b + 12) == MKTAG('V', 'P', '8', 'X') &&
95  AV_RL32(b + 16) == 10 &&
96  (b[20] & VP8X_FLAG_ANIMATION))
97  return AVPROBE_SCORE_MAX;
98 
99  return 0;
100 }
101 
103 {
104  WebPAnimDemuxContext *ctx = s->priv_data;
105  AVIOContext *pb = s->pb;
106  int ret;
107 
108  /* Check for signature. */
109  if (avio_rl32(pb) != MKTAG('R', 'I', 'F', 'F'))
110  return AVERROR_INVALIDDATA;
111  avio_skip(pb, 4); /* file size */
112  if (avio_rl32(pb) != MKTAG('W', 'E', 'B', 'P'))
113  return AVERROR_INVALIDDATA;
114 
115  /* VP8X must be first chunk */
116  if (avio_rl32(pb) != MKTAG('V', 'P', '8', 'X') ||
117  avio_rl32(pb) != 10 /* chunk size */)
118  return AVERROR_INVALIDDATA;
119  ctx->vp8x_flags = avio_r8(pb);
120  if (!(ctx->vp8x_flags & VP8X_FLAG_ANIMATION))
121  return AVERROR_INVALIDDATA;
122  avio_skip(pb, 3);
123 
125  if (!st)
126  return AVERROR(ENOMEM);
127 
128  avpriv_set_pts_info(st, 64, 1, 1000);
132  st->codecpar->width = avio_rl24(pb) + 1;
133  st->codecpar->height = avio_rl24(pb) + 1;
134  st->start_time = 0;
135 
136  int explode = (s->error_recognition & AV_EF_EXPLODE);
137  int loglevel = explode ? AV_LOG_ERROR : AV_LOG_WARNING;
138  while (1) {
139  int64_t offset = avio_tell(pb);
140  uint32_t fourcc = avio_rl32(pb);
141  uint32_t size = avio_rl32(pb);
142 
143  av_log(s, AV_LOG_DEBUG, "Chunk %s of size %u at offset %" PRId64 "\n",
145 
146  if (size == UINT32_MAX)
147  return AVERROR_INVALIDDATA;
148  size += size & 1;
149 
150  if (avio_feof(pb))
151  break;
152 
153  switch (fourcc) {
154  case MKTAG('I', 'C', 'C', 'P'):
155  if (ctx->has_iccp) {
156  av_log(s, loglevel, "Extra ICCP chunk found\n");
157  if (explode)
158  return AVERROR_INVALIDDATA;
159  avio_skip(pb, size);
160  } else {
161  if (!(ctx->vp8x_flags & VP8X_FLAG_ICC)) {
162  av_log(s, loglevel,
163  "ICCP chunk present, but ICC Profile bit not set in the VP8X header\n");
164  if (explode)
165  return AVERROR_INVALIDDATA;
166  }
167 
171  if (!sd)
172  return AVERROR(ENOMEM);
173  ret = avio_read(pb, sd->data, size);
174  if (ret < 0)
175  return ret;
176  ctx->has_iccp = 1;
177  }
178  break;
179  case MKTAG('A', 'N', 'I', 'M'):
180  if (ctx->has_anim) {
181  av_log(s, loglevel, "Extra ANIM chunk found\n");
182  if (explode)
183  return AVERROR_INVALIDDATA;
184  avio_skip(pb, size);
185  } else {
186  if (size != 6)
187  return AVERROR_INVALIDDATA;
188  uint32_t bg_color = avio_rb32(pb);
189  ctx->loop_count = avio_rl16(pb);
190  if (ctx->usebgcolor) {
192  if (!st->codecpar->extradata)
193  return AVERROR(ENOMEM);
194  AV_WB32(st->codecpar->extradata, bg_color);
195  st->codecpar->extradata_size = 4;
196  }
198  "ANIM: background BGRA 0x%08x loop count %d\n",
199  bg_color, ctx->loop_count);
200  ctx->has_anim = 1;
201  }
202  break;
203  case MKTAG('A', 'N', 'M', 'F'):
204  if (!ctx->has_anim) {
205  av_log(s, loglevel,
206  "ANMF chunk present, but no previous ANIM chunk found\n");
207  if (explode)
208  return AVERROR_INVALIDDATA;
209  ctx->loop_count = 1;
210  } else if (!ctx->ignore_loop && ctx->loop_count != 1) {
211  int64_t file_size = avio_size(pb);
212  if (file_size < 0 || offset < 0 ||
213  (ret = ffio_ensure_seekback(pb, file_size - offset)) < 0) {
215  "Could not ensure seekback, will not loop\n");
216  ctx->loop_count = 1;
217  }
218  }
219  ctx->first_anmf_offset = offset;
220  ret = avio_seek(pb, -8, SEEK_CUR);
221  if (ret < 0)
222  return ret;
223  return 0;
224  default:
225  av_log(s, AV_LOG_WARNING, "Skipping chunk: %s\n", av_fourcc2str(fourcc));
226  avio_skip(pb, size);
227  break;
228  }
229  }
230 
231  return AVERROR_INVALIDDATA;
232 }
233 
235 {
236  WebPAnimDemuxContext *ctx = s->priv_data;
237  AVIOContext *pb = s->pb;
238  int ret;
239 
240  int explode = (s->error_recognition & AV_EF_EXPLODE);
241  int loglevel = explode ? AV_LOG_ERROR : AV_LOG_WARNING;
242  while (1) {
243  int64_t offset = avio_tell(pb);
244  uint32_t fourcc = avio_rl32(pb);
245  uint32_t size = avio_rl32(pb);
246 
247  if (size == UINT32_MAX)
248  return AVERROR_INVALIDDATA;
249  size += size & 1;
250 
251  if (avio_feof(pb)) {
252  if (!ctx->ignore_loop &&
253  (ctx->loop_count == 0 || ++ctx->cur_loop < ctx->loop_count)) {
254  ctx->cur_frame = 0;
255  ret = avio_seek(pb, ctx->first_anmf_offset, SEEK_SET);
256  if (ret < 0)
257  return ret;
258  continue;
259  }
260  break;
261  }
262 
263  av_log(s, AV_LOG_DEBUG, "Chunk %s of size %u at offset %" PRId64 "\n",
265 
266  switch (fourcc) {
267  case MKTAG('A', 'N', 'M', 'F'):
268  if (size < 16)
269  return AVERROR_INVALIDDATA;
270  ret = av_get_packet(pb, pkt, size);
271  if (ret < 0)
272  return ret;
273  if (!ctx->cur_frame++)
277  uint32_t duration = AV_RL24(pkt->data + 12);
278  if (duration <= ctx->min_delay)
279  duration = ctx->default_delay;
281  return ret;
282  case MKTAG('E', 'X', 'I', 'F'):
283  if (ctx->has_exif) {
284  av_log(s, loglevel, "Extra EXIF chunk found\n");
285  if (explode)
286  return AVERROR_INVALIDDATA;
287  avio_skip(pb, size);
288  } else {
289  if (!(ctx->vp8x_flags & VP8X_FLAG_EXIF_METADATA)) {
290  av_log(s, loglevel,
291  "EXIF chunk present, but EXIF bit not set in the VP8X header\n");
292  if (explode)
293  return AVERROR_INVALIDDATA;
294  }
295 
296  AVStream *st = s->streams[0];
299  AV_PKT_DATA_EXIF, size, 0);
300  if (!sd)
301  return AVERROR(ENOMEM);
302  ret = avio_read(pb, sd->data, size);
303  if (ret < 0)
304  return ret;
305  ctx->has_exif = 1;
306  }
307  break;
308  case MKTAG('X', 'M', 'P', ' '):
309  if (ctx->has_xmp) {
310  av_log(s, loglevel, "Extra XMP chunk found\n");
311  if (explode)
312  return AVERROR_INVALIDDATA;
313  avio_skip(pb, size);
314  } else {
315  if (!(ctx->vp8x_flags & VP8X_FLAG_XMP_METADATA)) {
316  av_log(s, loglevel,
317  "XMP chunk present, but XMP bit not set in the VP8X header\n");
318  if (explode)
319  return AVERROR_INVALIDDATA;
320  }
321 
322  uint8_t *xmp = av_malloc(size + 1);
323  if (!xmp)
324  return AVERROR(ENOMEM);
325  ret = ffio_read_size(pb, xmp, size);
326  if (ret < 0) {
327  av_free(xmp);
328  return ret;
329  }
330  xmp[size] = '\0';
331  av_dict_set(&s->metadata, "xmp", xmp, AV_DICT_DONT_STRDUP_VAL);
332  ctx->has_xmp = 1;
333  }
334  break;
335  default:
336  av_log(s, AV_LOG_WARNING, "Skipping chunk: %s\n", av_fourcc2str(fourcc));
337  avio_skip(pb, size);
338  break;
339  }
340  }
341 
342  return AVERROR_EOF;
343 }
344 
345 static const AVOption options[] = {
346  { "min_delay", "minimum valid delay between frames (in milliseconds)", offsetof(WebPAnimDemuxContext, min_delay), AV_OPT_TYPE_INT, {.i64 = WEBP_MIN_DELAY}, 0, 1000 * 60, AV_OPT_FLAG_DECODING_PARAM },
347  { "max_webp_delay", "maximum valid delay between frames (in milliseconds)", offsetof(WebPAnimDemuxContext, max_delay), AV_OPT_TYPE_INT, {.i64 = 0xffffff}, 0, 0xffffff, AV_OPT_FLAG_DECODING_PARAM },
348  { "default_delay", "default delay between frames (in milliseconds)", offsetof(WebPAnimDemuxContext, default_delay), AV_OPT_TYPE_INT, {.i64 = WEBP_DEFAULT_DELAY}, 0, 1000 * 60, AV_OPT_FLAG_DECODING_PARAM },
349  { "ignore_loop", "ignore loop setting", offsetof(WebPAnimDemuxContext, ignore_loop), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
350  { "usebgcolor", "use background color from ANIM chunk", offsetof(WebPAnimDemuxContext, usebgcolor), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
351  { NULL },
352 };
353 
354 static const AVClass demuxer_class = {
355  .class_name = "Animated WebP demuxer",
356  .item_name = av_default_item_name,
357  .option = options,
358  .version = LIBAVUTIL_VERSION_INT,
359  .category = AV_CLASS_CATEGORY_DEMUXER,
360 };
361 
363  .p.name = "webp_anim",
364  .p.long_name = NULL_IF_CONFIG_SMALL("Animated WebP"),
365  .p.flags = AVFMT_GENERIC_INDEX,
366  .p.priv_class = &demuxer_class,
367  .priv_data_size = sizeof(WebPAnimDemuxContext),
371 };
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:71
AV_EF_EXPLODE
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: defs.h:51
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
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:53
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
WEBP_DEFAULT_DELAY
#define WEBP_DEFAULT_DELAY
Major web browsers display WebPs at ~10-15fps when rate is not explicitly set or have too low values.
Definition: webp_anim_dec.c:82
int64_t
long long int64_t
Definition: coverity.c:34
AVPacketSideData
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
Definition: packet.h:416
WebPAnimDemuxContext::default_delay
int default_delay
Definition: webp_anim_dec.c:52
AVPacket::data
uint8_t * data
Definition: packet.h:595
AVOption
AVOption.
Definition: opt.h:429
b
#define b
Definition: input.c:43
VP8X_FLAG_XMP_METADATA
#define VP8X_FLAG_XMP_METADATA
Definition: webp_anim_dec.c:37
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:613
avio_size
int64_t avio_size(AVIOContext *s)
Get the filesize.
Definition: aviobuf.c:326
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:650
WebPAnimDemuxContext::cur_frame
int cur_frame
number of frames of the current animation file
Definition: webp_anim_dec.c:64
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:463
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: avformat.c:900
demuxer_class
static const AVClass demuxer_class
Definition: webp_anim_dec.c:354
WebPAnimDemuxContext::max_delay
int max_delay
Definition: webp_anim_dec.c:51
WebPAnimDemuxContext::has_exif
int has_exif
Definition: webp_anim_dec.c:68
WebPAnimDemuxContext::vp8x_flags
int vp8x_flags
Definition: webp_anim_dec.c:65
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:494
AVFMT_GENERIC_INDEX
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:479
avio_rl16
unsigned int avio_rl16(AVIOContext *s)
Definition: aviobuf.c:717
AV_DICT_DONT_STRDUP_VAL
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
Definition: dict.h:79
WebPAnimDemuxContext::min_delay
int min_delay
Minimum allowed delay between frames in milliseconds.
Definition: webp_anim_dec.c:50
avio_rb32
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:764
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
WebPAnimDemuxContext::loop_count
int loop_count
number of times to loop the animation
Definition: webp_anim_dec.c:58
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
WebPAnimDemuxContext::has_anim
int has_anim
Definition: webp_anim_dec.c:69
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
WEBP_MIN_DELAY
#define WEBP_MIN_DELAY
By default delay values less than this threshold considered to be invalid.
Definition: webp_anim_dec.c:86
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:550
AVCodecParameters::width
int width
The width of the video frame in pixels.
Definition: codec_par.h:143
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
AVPacketSideData::data
uint8_t * data
Definition: packet.h:417
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
AVCodecParameters::nb_coded_side_data
int nb_coded_side_data
Amount of entries in coded_side_data.
Definition: codec_par.h:88
av_mallocz
#define av_mallocz(s)
Definition: tableprint_vlc.h:31
AV_CLASS_CATEGORY_DEMUXER
@ AV_CLASS_CATEGORY_DEMUXER
Definition: log.h:33
AVFormatContext
Format I/O context.
Definition: avformat.h:1283
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:769
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AV_PKT_DATA_EXIF
@ AV_PKT_DATA_EXIF
Extensible image file format metadata.
Definition: packet.h:369
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
NULL
#define NULL
Definition: coverity.c:32
VP8X_FLAG_EXIF_METADATA
#define VP8X_FLAG_EXIF_METADATA
Definition: webp_anim_dec.c:38
VP8X_FLAG_ICC
#define VP8X_FLAG_ICC
Definition: webp_anim_dec.c:40
webp_anim_read_packet
static int webp_anim_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: webp_anim_dec.c:234
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:242
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
options
Definition: swscale.c:45
WebPAnimDemuxContext
Definition: webp_anim_dec.c:42
WebPAnimDemuxContext::usebgcolor
int usebgcolor
Definition: webp_anim_dec.c:72
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:75
AV_WB32
#define AV_WB32(p, v)
Definition: intreadwrite.h:415
webp_anim_probe
static int webp_anim_probe(const AVProbeData *p)
Definition: webp_anim_dec.c:88
avio_rl32
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:733
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
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:94
WebPAnimDemuxContext::ignore_loop
int ignore_loop
ignore loop setting
Definition: webp_anim_dec.c:57
size
int size
Definition: twinvq_data.h:10344
webp_anim_read_header
static int webp_anim_read_header(AVFormatContext *s)
Definition: webp_anim_dec.c:102
AV_NOPTS_VALUE
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition: avutil.h:247
AV_RL24
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_RL24
Definition: bytestream.h:93
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:70
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:594
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:606
ffio_ensure_seekback
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
Definition: aviobuf.c:1026
offset
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 offset
Definition: writing_filters.txt:86
AV_CODEC_ID_WEBP_ANIM
@ AV_CODEC_ID_WEBP_ANIM
Definition: codec_id.h:335
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:601
read_header
static int read_header(FFV1Context *f, RangeCoder *c)
Definition: ffv1dec.c:501
AV_PIX_FMT_ARGB
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:99
VP8X_FLAG_ANIMATION
#define VP8X_FLAG_ANIMATION
Definition: webp_anim_dec.c:36
av_malloc
#define av_malloc(s)
Definition: ops_asmgen.c:44
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:588
avio_rl24
unsigned int avio_rl24(AVIOContext *s)
Definition: aviobuf.c:725
avio_internal.h
WebPAnimDemuxContext::first_anmf_offset
int64_t first_anmf_offset
Definition: webp_anim_dec.c:74
WebPAnimDemuxContext::has_iccp
int has_iccp
Definition: webp_anim_dec.c:67
AVCodecParameters::height
int height
The height of the video frame in pixels.
Definition: codec_par.h:150
ff_webp_anim_demuxer
const FFInputFormat ff_webp_anim_demuxer
Definition: webp_anim_dec.c:362
AV_PKT_DATA_ICC_PROFILE
@ AV_PKT_DATA_ICC_PROFILE
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1.
Definition: packet.h:271
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AVFormatContext::max_delay
int max_delay
Definition: avformat.h:1428
WebPAnimDemuxContext::cur_loop
int cur_loop
current loop counter
Definition: webp_anim_dec.c:59
demux.h
AVCodecParameters::coded_side_data
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
Definition: codec_par.h:83
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:98
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:746
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:236
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:81
avformat.h
av_packet_side_data_new
AVPacketSideData * av_packet_side_data_new(AVPacketSideData **psd, int *pnb_sd, enum AVPacketSideDataType type, size_t size, int flags)
Allocate a new packet side data.
Definition: packet.c:695
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
options
static const AVOption options[]
Definition: webp_anim_dec.c:345
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:615
Windows::Graphics::DirectX::Direct3D11::p
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
Definition: vsrc_gfxcapture_winrt.hpp:53
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:321
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:356
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
mem.h
AVCodecParameters::format
int format
Definition: codec_par.h:94
av_free
#define av_free(p)
Definition: tableprint_vlc.h:34
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:57
AVPacket
This structure stores compressed data.
Definition: packet.h:572
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition: opt.h:327
WebPAnimDemuxContext::has_xmp
int has_xmp
Definition: webp_anim_dec.c:70
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:86
FFInputFormat
Definition: demux.h:66
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
ffio_read_size
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:665
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:795
pkt
static AVPacket * pkt
Definition: demux_decode.c:55
fourcc
uint32_t fourcc
Definition: vaapi_decode.c:263
duration
static int64_t duration
Definition: ffplay.c:329
av_fourcc2str
#define av_fourcc2str(fourcc)
Definition: avutil.h:347
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:349