39 #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'):
131 if (previous_size > INT_MAX - len)
134 new_size = previous_size +
len;
144 return previous_size;
162 if (len != 13 || tag !=
MKTAG(
'I',
'H',
'D',
'R'))
192 if (acTL_found && ctx->
num_play != 1) {
198 }
else if (offset < 0) {
206 if ((ctx->
num_play == 1 || !acTL_found) &&
211 if (len > 0x7fffffff) {
218 case MKTAG(
'a',
'c',
'T',
'L'):
219 if ((ret =
avio_seek(pb, -8, SEEK_CUR)) < 0 ||
228 case MKTAG(
'f',
'c',
'T',
'L'):
233 if ((ret =
avio_seek(pb, -8, SEEK_CUR)) < 0)
237 if ((ret =
avio_seek(pb, -8, SEEK_CUR)) < 0 ||
253 uint32_t sequence_number,
width,
height, x_offset, y_offset;
254 uint16_t delay_num, delay_den;
271 if (!delay_num || delay_den / delay_num > ctx->
max_fps) {
280 "sequence_number: %"PRId32
", "
282 "height: %"PRIu32
", "
283 "x_offset: %"PRIu32
", "
284 "y_offset: %"PRIu32
", "
285 "delay_num: %"PRIu16
", "
286 "delay_den: %"PRIu16
", "
304 if (sequence_number == 0 ||
346 case MKTAG(
'f',
'c',
'T',
'L'):
356 if (len > 0x7fffffff ||
357 tag !=
MKTAG(
'f',
'd',
'A',
'T') &&
358 tag !=
MKTAG(
'I',
'D',
'A',
'T'))
361 size = 38 + 8 + len + 4 ;
365 if ((ret =
avio_seek(pb, -46, SEEK_CUR)) < 0 ||
375 tag !=
MKTAG(
'f',
'c',
'T',
'L') &&
376 tag !=
MKTAG(
'I',
'E',
'N',
'D')) {
377 if (len > 0x7fffffff)
379 if ((ret =
avio_seek(pb, -8, SEEK_CUR)) < 0 ||
387 if ((ret =
avio_seek(pb, -8, SEEK_CUR)) < 0)
396 case MKTAG(
'I',
'E',
'N',
'D'):
420 {
"ignore_loop",
"ignore loop setting" , offsetof(
APNGDemuxContext, ignore_loop),
422 {
"max_fps" ,
"maximum framerate (0 is no limit)" , offsetof(
APNGDemuxContext, max_fps),
424 {
"default_fps",
"default framerate (0 is as fast as possible)", offsetof(
APNGDemuxContext, default_fps),
445 .priv_class = &demuxer_class,