Am 12.07.23 um 03:22 schrieb James Zern:
On Thu, Jul 6, 2023 at 4:28 AM Thilo Borgmann <[email protected]> wrote:
From: Josef Zlomek <[email protected]>
Adds the demuxer of animated WebP files.
It supports non-animated, animated, truncated, and concatenated files.
Reading from a pipe (and other non-seekable inputs) is also supported.
The WebP demuxer splits the input stream into packets containing one frame.
It also marks the key frames properly.
The loop count is ignored by default (same behaviour as animated PNG and GIF),
it may be enabled by the option '-ignore_loop 0'.
The frame rate is set according to the frame delay in the ANMF chunk.
If the delay is too low, or the image is not animated, the default frame rate
is set to 10 fps, similarly to other WebP libraries and browsers.
The fate suite was updated accordingly.
Signed-off-by: Josef Zlomek <[email protected]>
---
Changelog | 1 +
doc/demuxers.texi | 28 +
libavformat/Makefile | 1 +
libavformat/allformats.c | 1 +
libavformat/version.h | 2 +-
libavformat/webpdec.c | 733 ++++++++++++++++++++
tests/ref/fate/webp-rgb-lena-lossless | 2 +-
tests/ref/fate/webp-rgb-lena-lossless-rgb24 | 2 +-
tests/ref/fate/webp-rgb-lossless | 2 +-
tests/ref/fate/webp-rgb-lossy-q80 | 2 +-
tests/ref/fate/webp-rgba-lossless | 2 +-
tests/ref/fate/webp-rgba-lossy-q80 | 2 +-
12 files changed, 771 insertions(+), 7 deletions(-)
create mode 100644 libavformat/webpdec.c
[...]
+ switch (chunk_type) {
+ case MKTAG('R', 'I', 'F', 'F'):
+ if (avio_tell(pb) != wdc->file_start + 8) {
+ // premature RIFF found, shorten the file size
+ WebPHeaders *tmp =
webp_headers_lower_or_equal(wdc->webp_headers,
+
wdc->num_webp_headers,
+ avio_tell(pb));
+ tmp->webp_size -= wdc->remaining_size;
+ wdc->remaining_size = 0;
[...]
+
+ if (wdc->remaining_size > 0 && avio_feof(pb)) {
+ // premature EOF, shorten the file size
I'm not sure about this. If the file is truncated shouldn't this be
treated as an error?
Either it might be worth trying to decode what is left,
or the size in the header might have even been damaged.
Thanks,
Thilo
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".