PR #22891 opened by Ramiro Polla (ramiro)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22891
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22891.patch

And another small misc apngdec patch.


>From c02a547d996fdd81b2a20cd5378ce776ecff9652 Mon Sep 17 00:00:00 2001
From: Ramiro Polla <[email protected]>
Date: Mon, 20 Apr 2026 23:01:59 +0200
Subject: [PATCH 1/2] avformat/apngdec: remove unused function argument

---
 libavformat/apngdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c
index c51cb3c889..80b731be00 100644
--- a/libavformat/apngdec.c
+++ b/libavformat/apngdec.c
@@ -238,7 +238,7 @@ static int apng_read_header(AVFormatContext *s)
     }
 }
 
-static int decode_fctl_chunk(AVFormatContext *s, APNGDemuxContext *ctx, 
AVPacket *pkt)
+static int decode_fctl_chunk(AVFormatContext *s, APNGDemuxContext *ctx)
 {
     uint32_t sequence_number, width, height, x_offset, y_offset;
     uint16_t delay_num, delay_den;
@@ -341,7 +341,7 @@ static int apng_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         if (len != APNG_FCTL_CHUNK_SIZE)
             return AVERROR_INVALIDDATA;
 
-        if ((ret = decode_fctl_chunk(s, ctx, pkt)) < 0)
+        if ((ret = decode_fctl_chunk(s, ctx)) < 0)
             return ret;
 
         /* fcTL may be followed by other chunks before fdAT or IDAT */
-- 
2.52.0


>From bc0a290904e5b9be65c4c31a821089157f81b042 Mon Sep 17 00:00:00 2001
From: Ramiro Polla <[email protected]>
Date: Tue, 21 Apr 2026 15:23:17 +0200
Subject: [PATCH 2/2] avformat/apngdec: fix playback of piped apng files

The check for avio_size() made apng_read_header() return an error
instead of just disabling looping.
---
 libavformat/apngdec.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libavformat/apngdec.c b/libavformat/apngdec.c
index 80b731be00..7d560bdddd 100644
--- a/libavformat/apngdec.c
+++ b/libavformat/apngdec.c
@@ -194,11 +194,8 @@ static int apng_read_header(AVFormatContext *s)
         if (acTL_found && ctx->num_play != 1) {
             int64_t size   = avio_size(pb);
             int64_t offset = avio_tell(pb);
-            if (size < 0) {
-                return size;
-            } else if (offset < 0) {
-                return offset;
-            } else if ((ret = ffio_ensure_seekback(pb, size - offset)) < 0) {
+            if (size < 0 || offset < 0 ||
+                (ret = ffio_ensure_seekback(pb, size - offset)) < 0) {
                 av_log(s, AV_LOG_WARNING, "Could not ensure seekback, will not 
loop\n");
                 ctx->num_play = 1;
             }
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to