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;
163 if (len != 13 || tag !=
MKTAG(
'I',
'H',
'D',
'R'))
193 if (acTL_found && ctx->
num_play != 1) {
199 }
else if (offset < 0) {
207 if ((ctx->
num_play == 1 || !acTL_found) &&
212 if (len > 0x7fffffff) {
219 case MKTAG(
'a',
'c',
'T',
'L'):
220 if ((ret =
avio_seek(pb, -8, SEEK_CUR)) < 0 ||
229 case MKTAG(
'f',
'c',
'T',
'L'):
234 if ((ret =
avio_seek(pb, -8, SEEK_CUR)) < 0)
238 if ((ret =
avio_seek(pb, -8, SEEK_CUR)) < 0 ||
254 uint32_t sequence_number,
width,
height, x_offset, y_offset;
255 uint16_t delay_num, delay_den;
272 if (!delay_num || delay_den / delay_num > ctx->
max_fps) {
281 "sequence_number: %"PRId32
", "
283 "height: %"PRIu32
", "
284 "x_offset: %"PRIu32
", "
285 "y_offset: %"PRIu32
", "
286 "delay_num: %"PRIu16
", "
287 "delay_den: %"PRIu16
", "
305 if (sequence_number == 0 ||
347 case MKTAG(
'f',
'c',
'T',
'L'):
357 if (len > 0x7fffffff ||
358 tag !=
MKTAG(
'f',
'd',
'A',
'T') &&
359 tag !=
MKTAG(
'I',
'D',
'A',
'T'))
362 size = 38 + 8 + len + 4 ;
366 if ((ret =
avio_seek(pb, -46, SEEK_CUR)) < 0 ||
376 tag !=
MKTAG(
'f',
'c',
'T',
'L') &&
377 tag !=
MKTAG(
'I',
'E',
'N',
'D')) {
378 if (len > 0x7fffffff)
380 if ((ret =
avio_seek(pb, -8, SEEK_CUR)) < 0 ||
388 if ((ret =
avio_seek(pb, -8, SEEK_CUR)) < 0)
397 case MKTAG(
'I',
'E',
'N',
'D'):
421 {
"ignore_loop",
"ignore loop setting" , offsetof(
APNGDemuxContext, ignore_loop),
423 {
"max_fps" ,
"maximum framerate (0 is no limit)" , offsetof(
APNGDemuxContext, max_fps),
425 {
"default_fps",
"default framerate (0 is as fast as possible)", offsetof(
APNGDemuxContext, default_fps),
446 .priv_class = &demuxer_class,