FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavformat/apngdec.c
Date: 2024-12-12 01:08:13
Exec Total Coverage
Lines: 166 213 77.9%
Functions: 5 5 100.0%
Branches: 104 170 61.2%

Line Branch Exec Source
1 /*
2 * APNG demuxer
3 * Copyright (c) 2014 Benoit Fouet
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * APNG demuxer.
25 * @see https://wiki.mozilla.org/APNG_Specification
26 * @see http://www.w3.org/TR/PNG
27 */
28
29 #include "avformat.h"
30 #include "avio_internal.h"
31 #include "demux.h"
32 #include "internal.h"
33 #include "libavutil/imgutils.h"
34 #include "libavutil/intreadwrite.h"
35 #include "libavutil/mem.h"
36 #include "libavutil/opt.h"
37 #include "libavcodec/apng.h"
38 #include "libavcodec/png.h"
39 #include "libavcodec/bytestream.h"
40
41 #define DEFAULT_APNG_FPS 15
42
43 typedef struct APNGDemuxContext {
44 const AVClass *class;
45
46 int max_fps;
47 int default_fps;
48
49 int pkt_duration;
50
51 int is_key_frame;
52
53 /*
54 * loop options
55 */
56 int ignore_loop;
57 uint32_t num_frames;
58 uint32_t num_play;
59 uint32_t cur_loop;
60 } APNGDemuxContext;
61
62 /*
63 * To be a valid APNG file, we mandate, in this order:
64 * PNGSIG
65 * IHDR
66 * ...
67 * acTL
68 * ...
69 * IDAT
70 */
71 7186 static int apng_probe(const AVProbeData *p)
72 {
73 GetByteContext gb;
74 7186 int state = 0;
75 uint32_t len, tag;
76
77 7186 bytestream2_init(&gb, p->buf, p->buf_size);
78
79
2/2
✓ Branch 1 taken 47 times.
✓ Branch 2 taken 7139 times.
7186 if (bytestream2_get_be64(&gb) != PNGSIG)
80 7139 return 0;
81
82 for (;;) {
83 210 len = bytestream2_get_be32(&gb);
84
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 210 times.
210 if (len > 0x7fffffff)
85 return 0;
86
87 210 tag = bytestream2_get_le32(&gb);
88 /* we don't check IDAT size, as this is the last tag
89 * we check, and it may be larger than the probe buffer */
90
2/2
✓ Branch 0 taken 167 times.
✓ Branch 1 taken 43 times.
210 if (tag != MKTAG('I', 'D', 'A', 'T') &&
91
2/2
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 163 times.
167 len + 4 > bytestream2_get_bytes_left(&gb))
92 4 return 0;
93
94
4/4
✓ Branch 0 taken 47 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 43 times.
✓ Branch 3 taken 108 times.
206 switch (tag) {
95 47 case MKTAG('I', 'H', 'D', 'R'):
96
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 47 times.
47 if (len != 13)
97 return 0;
98
1/2
✗ Branch 3 not taken.
✓ Branch 4 taken 47 times.
47 if (av_image_check_size(bytestream2_get_be32(&gb), bytestream2_get_be32(&gb), 0, NULL))
99 return 0;
100 47 bytestream2_skip(&gb, 9);
101 47 state++;
102 47 break;
103 8 case MKTAG('a', 'c', 'T', 'L'):
104
2/4
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 if (state != 1 ||
105
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 len != 8 ||
106 8 bytestream2_get_be32(&gb) == 0) /* 0 is not a valid value for number of frames */
107 return 0;
108 8 bytestream2_skip(&gb, 8);
109 8 state++;
110 8 break;
111 43 case MKTAG('I', 'D', 'A', 'T'):
112
2/2
✓ Branch 0 taken 35 times.
✓ Branch 1 taken 8 times.
43 if (state != 2)
113 35 return 0;
114 8 goto end;
115 108 default:
116 /* skip other tags */
117 108 bytestream2_skip(&gb, len + 4);
118 108 break;
119 }
120 }
121
122 8 end:
123 8 return AVPROBE_SCORE_MAX;
124 }
125
126 17 static int append_extradata(AVCodecParameters *par, AVIOContext *pb, int len)
127 {
128 17 int previous_size = par->extradata_size;
129 int new_size, ret;
130 uint8_t *new_extradata;
131
132
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
17 if (len > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - previous_size)
133 return AVERROR_INVALIDDATA;
134
135 17 new_size = previous_size + len;
136 17 new_extradata = av_realloc(par->extradata, new_size + AV_INPUT_BUFFER_PADDING_SIZE);
137
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
17 if (!new_extradata)
138 return AVERROR(ENOMEM);
139 17 memset(new_extradata + new_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
140 17 par->extradata = new_extradata;
141 17 par->extradata_size = new_size;
142
143
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
17 if ((ret = ffio_read_size(pb, par->extradata + previous_size, len)) < 0)
144 return ret;
145
146 17 return previous_size;
147 }
148
149 9 static int apng_read_header(AVFormatContext *s)
150 {
151 9 APNGDemuxContext *ctx = s->priv_data;
152 9 AVIOContext *pb = s->pb;
153 uint32_t len, tag;
154 AVStream *st;
155 9 int acTL_found = 0;
156 int64_t ret;
157
158 /* verify PNGSIG */
159
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
9 if (avio_rb64(pb) != PNGSIG)
160 return AVERROR_INVALIDDATA;
161
162 /* parse IHDR (must be first chunk) */
163 9 len = avio_rb32(pb);
164 9 tag = avio_rl32(pb);
165
2/4
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
9 if (len != 13 || tag != MKTAG('I', 'H', 'D', 'R'))
166 return AVERROR_INVALIDDATA;
167
168 9 st = avformat_new_stream(s, NULL);
169
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if (!st)
170 return AVERROR(ENOMEM);
171
172 /* set the timebase to something large enough (1/100,000 of second)
173 * to hopefully cope with all sane frame durations */
174 9 avpriv_set_pts_info(st, 64, 1, 100000);
175 9 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
176 9 st->codecpar->codec_id = AV_CODEC_ID_APNG;
177 9 st->codecpar->width = avio_rb32(pb);
178 9 st->codecpar->height = avio_rb32(pb);
179
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
9 if ((ret = av_image_check_size(st->codecpar->width, st->codecpar->height, 0, s)) < 0)
180 return ret;
181
182 /* extradata will contain every chunk up to the first fcTL (excluded) */
183 9 ret = ff_alloc_extradata(st->codecpar, len + 12);
184
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 if (ret < 0)
185 return ret;
186 9 AV_WB32(st->codecpar->extradata, len);
187 9 AV_WL32(st->codecpar->extradata+4, tag);
188 9 AV_WB32(st->codecpar->extradata+8, st->codecpar->width);
189 9 AV_WB32(st->codecpar->extradata+12, st->codecpar->height);
190
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
9 if ((ret = ffio_read_size(pb, st->codecpar->extradata + 16, 9)) < 0)
191 return ret;
192
193 while (1) {
194
4/4
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 4 times.
26 if (acTL_found && ctx->num_play != 1) {
195 10 int64_t size = avio_size(pb);
196 10 int64_t offset = avio_tell(pb);
197
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
10 if (size < 0) {
198 return size;
199
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
10 } else if (offset < 0) {
200 return offset;
201
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
10 } else if ((ret = ffio_ensure_seekback(pb, size - offset)) < 0) {
202 av_log(s, AV_LOG_WARNING, "Could not ensure seekback, will not loop\n");
203 ctx->num_play = 1;
204 }
205 }
206
4/4
✓ Branch 0 taken 22 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 10 times.
26 if ((ctx->num_play == 1 || !acTL_found) &&
207
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
16 ((ret = ffio_ensure_seekback(pb, 4 /* len */ + 4 /* tag */)) < 0))
208 return ret;
209
210 26 len = avio_rb32(pb);
211
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 26 times.
26 if (len > INT_MAX - 12)
212 return AVERROR_INVALIDDATA;
213
214 26 tag = avio_rl32(pb);
215
3/3
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 8 times.
26 switch (tag) {
216 9 case MKTAG('a', 'c', 'T', 'L'):
217
1/2
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
9 if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 ||
218
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
9 (ret = append_extradata(st->codecpar, pb, len + 12)) < 0)
219 return ret;
220 9 acTL_found = 1;
221 9 ctx->num_frames = AV_RB32(st->codecpar->extradata + ret + 8);
222 9 ctx->num_play = AV_RB32(st->codecpar->extradata + ret + 12);
223 9 av_log(s, AV_LOG_DEBUG, "num_frames: %"PRIu32", num_play: %"PRIu32"\n",
224 ctx->num_frames, ctx->num_play);
225 9 break;
226 9 case MKTAG('f', 'c', 'T', 'L'):
227
2/4
✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
9 if (!acTL_found || len != APNG_FCTL_CHUNK_SIZE) {
228 return AVERROR_INVALIDDATA;
229 }
230
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
9 if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0)
231 return ret;
232 9 return 0;
233 8 default:
234
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 ||
235
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
8 (ret = append_extradata(st->codecpar, pb, len + 12)) < 0)
236 return ret;
237 }
238 }
239 }
240
241 318 static int decode_fctl_chunk(AVFormatContext *s, APNGDemuxContext *ctx, AVPacket *pkt)
242 {
243 uint32_t sequence_number, width, height, x_offset, y_offset;
244 uint16_t delay_num, delay_den;
245 uint8_t dispose_op, blend_op;
246
247 318 sequence_number = avio_rb32(s->pb);
248 318 width = avio_rb32(s->pb);
249 318 height = avio_rb32(s->pb);
250 318 x_offset = avio_rb32(s->pb);
251 318 y_offset = avio_rb32(s->pb);
252 318 delay_num = avio_rb16(s->pb);
253 318 delay_den = avio_rb16(s->pb);
254 318 dispose_op = avio_r8(s->pb);
255 318 blend_op = avio_r8(s->pb);
256 318 avio_skip(s->pb, 4); /* crc */
257
258 /* default is hundredths of seconds */
259
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 318 times.
318 if (!delay_den)
260 delay_den = 100;
261
2/6
✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 318 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
318 if (!delay_num || (ctx->max_fps && delay_den / delay_num > ctx->max_fps)) {
262 delay_num = 1;
263 delay_den = ctx->default_fps;
264 }
265 318 ctx->pkt_duration = av_rescale_q(delay_num,
266 318 (AVRational){ 1, delay_den },
267 318 s->streams[0]->time_base);
268
269 318 av_log(s, AV_LOG_DEBUG, "%s: "
270 "sequence_number: %"PRId32", "
271 "width: %"PRIu32", "
272 "height: %"PRIu32", "
273 "x_offset: %"PRIu32", "
274 "y_offset: %"PRIu32", "
275 "delay_num: %"PRIu16", "
276 "delay_den: %"PRIu16", "
277 "dispose_op: %d, "
278 "blend_op: %d\n",
279 __func__,
280 sequence_number,
281 width,
282 height,
283 x_offset,
284 y_offset,
285 delay_num,
286 delay_den,
287 dispose_op,
288 blend_op);
289
290
2/2
✓ Branch 0 taken 218 times.
✓ Branch 1 taken 100 times.
318 if (width != s->streams[0]->codecpar->width ||
291
2/4
✓ Branch 0 taken 218 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 218 times.
✗ Branch 3 not taken.
218 height != s->streams[0]->codecpar->height ||
292
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 218 times.
218 x_offset != 0 ||
293 y_offset != 0) {
294
1/2
✓ Branch 0 taken 100 times.
✗ Branch 1 not taken.
100 if (sequence_number == 0 ||
295
1/2
✓ Branch 0 taken 100 times.
✗ Branch 1 not taken.
100 x_offset >= s->streams[0]->codecpar->width ||
296
1/2
✓ Branch 0 taken 100 times.
✗ Branch 1 not taken.
100 width > s->streams[0]->codecpar->width - x_offset ||
297
1/2
✓ Branch 0 taken 100 times.
✗ Branch 1 not taken.
100 y_offset >= s->streams[0]->codecpar->height ||
298
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
100 height > s->streams[0]->codecpar->height - y_offset)
299 return AVERROR_INVALIDDATA;
300 100 ctx->is_key_frame = 0;
301 } else {
302
3/4
✓ Branch 0 taken 9 times.
✓ Branch 1 taken 209 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9 times.
218 if (sequence_number == 0 && dispose_op == APNG_DISPOSE_OP_PREVIOUS)
303 dispose_op = APNG_DISPOSE_OP_BACKGROUND;
304
4/4
✓ Branch 0 taken 217 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 216 times.
✓ Branch 3 taken 1 times.
218 ctx->is_key_frame = dispose_op == APNG_DISPOSE_OP_BACKGROUND ||
305 blend_op == APNG_BLEND_OP_SOURCE;
306 }
307
308 318 return 0;
309 }
310
311 332 static int apng_read_packet(AVFormatContext *s, AVPacket *pkt)
312 {
313 332 APNGDemuxContext *ctx = s->priv_data;
314 int64_t ret;
315 int64_t size;
316 332 AVIOContext *pb = s->pb;
317 uint32_t len, tag;
318
319 /*
320 * fcTL chunk length, in bytes:
321 * 4 (length)
322 * 4 (tag)
323 * 26 (actual chunk)
324 * 4 (crc) bytes
325 * and needed next:
326 * 4 (length)
327 * 4 (tag (must be fdAT or IDAT))
328 */
329 /* if num_play is not 1, then the seekback is already guaranteed */
330
3/4
✓ Branch 0 taken 83 times.
✓ Branch 1 taken 249 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 83 times.
332 if (ctx->num_play == 1 && (ret = ffio_ensure_seekback(pb, 46)) < 0)
331 return ret;
332
333 332 len = avio_rb32(pb);
334 332 tag = avio_rl32(pb);
335
336
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 332 times.
332 if (avio_feof(pb))
337 return AVERROR_EOF;
338
339
2/3
✓ Branch 0 taken 318 times.
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
332 switch (tag) {
340 318 case MKTAG('f', 'c', 'T', 'L'):
341
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 318 times.
318 if (len != APNG_FCTL_CHUNK_SIZE)
342 332 return AVERROR_INVALIDDATA;
343
344
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 318 times.
318 if ((ret = decode_fctl_chunk(s, ctx, pkt)) < 0)
345 return ret;
346
347 /* fcTL must precede fdAT or IDAT */
348 318 len = avio_rb32(pb);
349 318 tag = avio_rl32(pb);
350
3/4
✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 309 times.
318 if (len > 0x7fffffff ||
351
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
9 tag != MKTAG('f', 'd', 'A', 'T') &&
352 tag != MKTAG('I', 'D', 'A', 'T'))
353 return AVERROR_INVALIDDATA;
354
355 318 size = 38 /* fcTL */ + 8 /* len, tag */ + len + 4 /* crc */;
356
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 318 times.
318 if (size > INT_MAX)
357 return AVERROR(EINVAL);
358
359
1/2
✓ Branch 1 taken 318 times.
✗ Branch 2 not taken.
318 if ((ret = avio_seek(pb, -46, SEEK_CUR)) < 0 ||
360
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 318 times.
318 (ret = av_append_packet(pb, pkt, size)) < 0)
361 return ret;
362
363
3/4
✓ Branch 0 taken 78 times.
✓ Branch 1 taken 240 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 78 times.
318 if (ctx->num_play == 1 && (ret = ffio_ensure_seekback(pb, 8)) < 0)
364 return ret;
365
366 318 len = avio_rb32(pb);
367 318 tag = avio_rl32(pb);
368
2/2
✓ Branch 0 taken 4502 times.
✓ Branch 1 taken 309 times.
5129 while (tag &&
369
3/4
✓ Branch 0 taken 4811 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4493 times.
✓ Branch 3 taken 9 times.
9313 tag != MKTAG('f', 'c', 'T', 'L') &&
370 tag != MKTAG('I', 'E', 'N', 'D')) {
371
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4493 times.
4493 if (len > 0x7fffffff)
372 return AVERROR_INVALIDDATA;
373
1/2
✓ Branch 1 taken 4493 times.
✗ Branch 2 not taken.
4493 if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0 ||
374
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 4493 times.
4493 (ret = av_append_packet(pb, pkt, len + 12)) < 0)
375 return ret;
376
3/4
✓ Branch 0 taken 4491 times.
✓ Branch 1 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4491 times.
4493 if (ctx->num_play == 1 && (ret = ffio_ensure_seekback(pb, 8)) < 0)
377 return ret;
378 4493 len = avio_rb32(pb);
379 4493 tag = avio_rl32(pb);
380 }
381
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 318 times.
318 if ((ret = avio_seek(pb, -8, SEEK_CUR)) < 0)
382 return ret;
383
384
2/2
✓ Branch 0 taken 217 times.
✓ Branch 1 taken 101 times.
318 if (ctx->is_key_frame)
385 217 pkt->flags |= AV_PKT_FLAG_KEY;
386 318 pkt->pts = pkt->dts = AV_NOPTS_VALUE;
387 318 pkt->duration = ctx->pkt_duration;
388 318 return ret;
389 14 case MKTAG('I', 'E', 'N', 'D'):
390 14 ctx->cur_loop++;
391
1/6
✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
14 if (ctx->ignore_loop || ctx->num_play >= 1 && ctx->cur_loop == ctx->num_play) {
392 14 avio_seek(pb, -8, SEEK_CUR);
393 14 return AVERROR_EOF;
394 }
395 if ((ret = avio_seek(pb, s->streams[0]->codecpar->extradata_size + 8, SEEK_SET)) < 0)
396 return ret;
397 return 0;
398 default:
399 avpriv_request_sample(s, "In-stream tag=%s (0x%08"PRIX32") len=%"PRIu32,
400 av_fourcc2str(tag), tag, len);
401 avio_skip(pb, len + 4);
402 }
403
404 /* Handle the unsupported yet cases */
405 return AVERROR_PATCHWELCOME;
406 }
407
408 static const AVOption options[] = {
409 { "ignore_loop", "ignore loop setting" , offsetof(APNGDemuxContext, ignore_loop),
410 AV_OPT_TYPE_BOOL, { .i64 = 1 } , 0, 1 , AV_OPT_FLAG_DECODING_PARAM },
411 { "max_fps" , "maximum framerate (0 is no limit)" , offsetof(APNGDemuxContext, max_fps),
412 AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
413 { "default_fps", "default framerate (0 is as fast as possible)", offsetof(APNGDemuxContext, default_fps),
414 AV_OPT_TYPE_INT, { .i64 = DEFAULT_APNG_FPS }, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
415 { NULL },
416 };
417
418 static const AVClass demuxer_class = {
419 .class_name = "APNG demuxer",
420 .item_name = av_default_item_name,
421 .option = options,
422 .version = LIBAVUTIL_VERSION_INT,
423 .category = AV_CLASS_CATEGORY_DEMUXER,
424 };
425
426 const FFInputFormat ff_apng_demuxer = {
427 .p.name = "apng",
428 .p.long_name = NULL_IF_CONFIG_SMALL("Animated Portable Network Graphics"),
429 .p.flags = AVFMT_GENERIC_INDEX,
430 .p.priv_class = &demuxer_class,
431 .priv_data_size = sizeof(APNGDemuxContext),
432 .read_probe = apng_probe,
433 .read_header = apng_read_header,
434 .read_packet = apng_read_packet,
435 };
436