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
82#define WEBP_DEFAULT_DELAY 100
86#define WEBP_MIN_DELAY 10
90 const uint8_t *
b = p->buf;
146 if (
size == UINT32_MAX)
154 case MKTAG(
'I',
'C',
'C',
'P'):
156 av_log(
s, loglevel,
"Extra ICCP chunk found\n");
163 "ICCP chunk present, but ICC Profile bit not set in the VP8X header\n");
181 case MKTAG(
'A',
'N',
'I',
'M'):
183 av_log(
s, loglevel,
"Extra ANIM chunk found\n");
192 if (
ctx->usebgcolor) {
200 "ANIM: background BGRA 0x%08x loop count %d\n",
201 bg_color,
ctx->loop_count);
205 case MKTAG(
'A',
'N',
'M',
'F'):
206 if (!
ctx->has_anim) {
208 "ANMF chunk present, but no previous ANIM chunk found\n");
212 }
else if (!
ctx->ignore_loop &&
ctx->loop_count != 1) {
214 if (file_size < 0 ||
offset < 0 ||
217 "Could not ensure seekback, will not loop\n");
249 if (
size == UINT32_MAX)
254 if (!
ctx->ignore_loop &&
255 (
ctx->loop_count == 0 || ++
ctx->cur_loop <
ctx->loop_count)) {
269 case MKTAG(
'A',
'N',
'M',
'F'):
275 if (!
ctx->cur_frame++)
284 case MKTAG(
'E',
'X',
'I',
'F'):
286 av_log(
s, loglevel,
"Extra EXIF chunk found\n");
293 "EXIF chunk present, but EXIF bit not set in the VP8X header\n");
312 case MKTAG(
'X',
'M',
'P',
' '):
314 av_log(
s, loglevel,
"Extra XMP chunk found\n");
321 "XMP chunk present, but XMP bit not set in the VP8X header\n");
359 .class_name =
"Animated WebP demuxer",
367 .p.name =
"webp_anim",
static AVFormatContext * ctx
static const AVClass demuxer_class
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int64_t avio_size(AVIOContext *s)
Get the filesize.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
unsigned int avio_rl16(AVIOContext *s)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
unsigned int avio_rl32(AVIOContext *s)
unsigned int avio_rl24(AVIOContext *s)
unsigned int avio_rb32(AVIOContext *s)
int avio_r8(AVIOContext *s)
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int read_probe(const AVProbeData *p)
#define AV_EF_EXPLODE
abort decoding on minor error detection
static int read_header(FFV1Context *f, RangeCoder *c)
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
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.
void av_packet_side_data_remove(AVPacketSideData *sd, int *pnb_sd, enum AVPacketSideDataType type)
Remove side data of the given type from a side data array.
@ AV_PKT_DATA_ICC_PROFILE
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1.
@ AV_PKT_DATA_EXIF
Extensible image file format metadata.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define av_fourcc2str(fourcc)
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define LIBAVUTIL_VERSION_INT
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_CLASS_CATEGORY_DEMUXER
#define MKTAG(a, b, c, d)
Memory handling functions.
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Describe the class of an AVClass context structure.
int extradata_size
Size of the extradata content in bytes.
int height
The height of the video frame in pixels.
int nb_coded_side_data
Amount of entries in coded_side_data.
int width
The width of the video frame in pixels.
enum AVMediaType codec_type
General type of the encoded data.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
This structure stores compressed data.
This structure contains the data a format has to probe a file.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
int cur_frame
number of frames of the current animation file
int cur_loop
current loop counter
int min_delay
Minimum allowed delay between frames in milliseconds.
int loop_count
number of times to loop the animation
int ignore_loop
ignore loop setting
int64_t first_anmf_offset
#define VP8X_FLAG_EXIF_METADATA
#define VP8X_FLAG_ANIMATION
#define VP8X_FLAG_XMP_METADATA
static int webp_anim_probe(const AVProbeData *p)
#define WEBP_DEFAULT_DELAY
Major web browsers display WebPs at ~10-15fps when rate is not explicitly set or have too low values.
static int webp_anim_read_header(AVFormatContext *s)
static int webp_anim_read_packet(AVFormatContext *s, AVPacket *pkt)
#define WEBP_MIN_DELAY
By default delay values less than this threshold considered to be invalid.