Go to the documentation of this file.
40 #define DEFAULT_APNG_FPS 15
78 if (bytestream2_get_be64(&gb) !=
PNGSIG)
82 len = bytestream2_get_be32(&gb);
86 tag = bytestream2_get_le32(&gb);
89 if (
tag !=
MKTAG(
'I',
'D',
'A',
'T') &&
94 case MKTAG(
'I',
'H',
'D',
'R'):
102 case MKTAG(
'a',
'c',
'T',
'L'):
105 bytestream2_get_be32(&gb) == 0)
110 case MKTAG(
'I',
'D',
'A',
'T'):
129 uint8_t *new_extradata;
134 new_size = previous_size +
len;
145 return previous_size;
193 if (acTL_found &&
ctx->num_play != 1) {
205 if ((
ctx->num_play == 1 || !acTL_found) &&
210 if (
len > INT_MAX - 12)
215 case MKTAG(
'a',
'c',
'T',
'L'):
223 ctx->num_frames,
ctx->num_play);
225 case MKTAG(
'f',
'c',
'T',
'L'):
242 uint32_t sequence_number,
width,
height, x_offset, y_offset;
243 uint16_t delay_num, delay_den;
244 uint8_t dispose_op, blend_op;
260 if (!delay_num || (
ctx->max_fps && delay_den / delay_num >
ctx->max_fps)) {
262 delay_den =
ctx->default_fps;
266 s->streams[0]->time_base);
269 "sequence_number: %"PRId32
", "
271 "height: %"PRIu32
", "
272 "x_offset: %"PRIu32
", "
273 "y_offset: %"PRIu32
", "
274 "delay_num: %"PRIu16
", "
275 "delay_den: %"PRIu16
", "
289 if (
width !=
s->streams[0]->codecpar->width ||
290 height !=
s->streams[0]->codecpar->height ||
293 if (sequence_number == 0 ||
294 x_offset >=
s->streams[0]->codecpar->width ||
295 width >
s->streams[0]->codecpar->width - x_offset ||
296 y_offset >=
s->streams[0]->codecpar->height ||
297 height >
s->streams[0]->codecpar->height - y_offset)
299 ctx->is_key_frame = 0;
339 case MKTAG(
'f',
'c',
'T',
'L'):
349 if (
len > 0x7fffffff ||
370 if (
len > 0x7fffffff)
383 if (
ctx->is_key_frame)
388 case MKTAG(
'I',
'E',
'N',
'D'):
390 if (
ctx->ignore_loop ||
ctx->num_play >= 1 &&
ctx->cur_loop ==
ctx->num_play) {
394 if ((
ret =
avio_seek(pb,
s->streams[0]->codecpar->extradata_size + 8, SEEK_SET)) < 0)
408 {
"ignore_loop",
"ignore loop setting" , offsetof(
APNGDemuxContext, ignore_loop),
410 {
"max_fps" ,
"maximum framerate (0 is no limit)" , offsetof(
APNGDemuxContext, max_fps),
412 {
"default_fps",
"default framerate (0 is as fast as possible)", offsetof(
APNGDemuxContext, default_fps),
#define AV_LOG_WARNING
Something somehow does not look correct.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
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
enum AVMediaType codec_type
General type of the encoded data.
This struct describes the properties of an encoded stream.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define APNG_FCTL_CHUNK_SIZE
#define AVERROR_EOF
End of file.
static int apng_read_header(AVFormatContext *s)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int buf_size
Size of buf except extra allocated bytes.
int64_t avio_size(AVIOContext *s)
Get the filesize.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
unsigned int avio_rb32(AVIOContext *s)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
@ APNG_DISPOSE_OP_PREVIOUS
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ APNG_DISPOSE_OP_BACKGROUND
@ AV_CLASS_CATEGORY_DEMUXER
static int apng_read_packet(AVFormatContext *s, AVPacket *pkt)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
static int read_header(FFV1Context *f)
Describe the class of an AVClass context structure.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Rational number (pair of numerator and denominator).
const char * av_default_item_name(void *ptr)
Return the context name.
uint64_t avio_rb64(AVIOContext *s)
This structure contains the data a format has to probe a file.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
int extradata_size
Size of the extradata content in bytes.
unsigned int avio_rl32(AVIOContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int decode_fctl_chunk(AVFormatContext *s, APNGDemuxContext *ctx, AVPacket *pkt)
#define AV_NOPTS_VALUE
Undefined timestamp value.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int avio_r8(AVIOContext *s)
static int append_extradata(AVCodecParameters *par, AVIOContext *pb, int len)
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
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
int flags
A combination of AV_PKT_FLAG values.
static const AVOption options[]
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
unsigned int avio_rb16(AVIOContext *s)
static int apng_probe(const AVProbeData *p)
#define AV_INPUT_BUFFER_PADDING_SIZE
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
static int read_probe(const AVProbeData *p)
#define avpriv_request_sample(...)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
static const AVClass demuxer_class
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
#define av_fourcc2str(fourcc)
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
const FFInputFormat ff_apng_demuxer