diff mbox series

[FFmpeg-devel] libavformat/aea EOF Patch

Message ID sJ6JMKMJMWo51PXENJQKWxAf6onp8so19hgZ7Eubr9CV8Zd4MPXUsP4TkcGTqFJv2W2nug4aw9qPv17T2PrraU2NpcrFyxPV2qLbM82pWK0=@protonmail.com
State New
Headers show
Series [FFmpeg-devel] libavformat/aea EOF Patch | expand

Checks

Context Check Description
yinshiyou/configure_loongarch64 warning Failed to apply patch
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

asivery Oct. 22, 2022, 5:43 p.m. UTC
Hello,
This patch aims to fix a problem I've noticed while working with AEA (Sony ATRAC1 comtainer) files.
Right now FFmpeg always exits with an "Input/Output error" when dealing with AEA files.
This patch solves that issue by returning AVERROR_EOF once the end of file is encountered, instead of always returning AVERROR(EIO).

I am sending this patch again because of an incorrect mime type of the first one.

Best regards,Asivery
diff mbox series

Patch

From cc127ff24d82a04611fac14cf4114a2262f87111 Mon Sep 17 00:00:00 2001
From: asivery <asivery@protonmail.com>
Date: Tue, 27 Sep 2022 00:13:10 +0200
Subject: [PATCH] avformat/aea: Make it so the AEA demuxer returns EOF at the
 end of file instead of EIO

Signed-off-by: asivery <asivery@protonmail.com>
---
 libavformat/aea.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavformat/aea.c b/libavformat/aea.c
index f4b39e4f9e..d721398cf5 100644
--- a/libavformat/aea.c
+++ b/libavformat/aea.c
@@ -93,8 +93,11 @@  static int aea_read_packet(AVFormatContext *s, AVPacket *pkt)
     int ret = av_get_packet(s->pb, pkt, s->streams[0]->codecpar->block_align);
 
     pkt->stream_index = 0;
-    if (ret <= 0)
-        return AVERROR(EIO);
+    if (ret <= 0){
+        if(ret < 0)
+            return ret;
+        return AVERROR_EOF;
+    }
 
     return ret;
 }
-- 
2.34.1