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

Comments

asivery March 4, 2023, 12:23 p.m. UTC | #1
Could someone please take a look? This would improve AEA demuxing, right now every AEA file makes ffmpeg crash with an error.
Thank you in advance :)
------- Original Message -------
On Saturday, October 22nd, 2022 at 7:43 PM, asivery <asivery@protonmail.com> wrote:

> 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
Marton Balint March 8, 2023, 11:28 p.m. UTC | #2
On Sat, 4 Mar 2023, asivery wrote:

> Could someone please take a look? This would improve AEA demuxing, right now every AEA file makes ffmpeg crash with an error.

The way I see it, you could simply replace the whole body of 
aea_read_packet() with this single line:

return av_get_packet(s->pb, pkt, s->streams[0]->codecpar->block_align);

Regards,
Marton

> Thank you in advance :)
> ------- Original Message -------
> On Saturday, October 22nd, 2022 at 7:43 PM, asivery <asivery@protonmail.com> wrote:
>
>> 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
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
asivery March 9, 2023, 12:50 a.m. UTC | #3
Thank you very much, indeed that works as well.
Here's the updated patch.

Best regards.

---
diff --git a/libavformat/aea.c b/libavformat/aea.c
index f4b39e4f9e..d16217381b 100644
--- a/libavformat/aea.c
+++ b/libavformat/aea.c
@@ -90,13 +90,7 @@ static int aea_read_header(AVFormatContext *s)
 
 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);
-
-    return ret;
+    return av_get_packet(s->pb, pkt, s->streams[0]->codecpar->block_align);
 }
 
 const AVInputFormat ff_aea_demuxer = {

------- Original Message -------
On Thursday, March 9th, 2023 at 12:28 AM, Marton Balint <cus@passwd.hu> wrote:


> 
> On Sat, 4 Mar 2023, asivery wrote:
> 
> > Could someone please take a look? This would improve AEA demuxing, right now every AEA file makes ffmpeg crash with an error.
> 
> 
> The way I see it, you could simply replace the whole body of
> aea_read_packet() with this single line:
> 
> return av_get_packet(s->pb, pkt, s->streams[0]->codecpar->block_align);
> 
> 
> Regards,
> Marton
> 
> > Thank you in advance :)
> > ------- Original Message -------
> > On Saturday, October 22nd, 2022 at 7:43 PM, asivery asivery@protonmail.com wrote:
> > 
> > > 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
> > > _______________________________________________
> > > ffmpeg-devel mailing list
> > > ffmpeg-devel@ffmpeg.org
> > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> > 
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Marton Balint March 9, 2023, 8:16 p.m. UTC | #4
On Thu, 9 Mar 2023, asivery wrote:

> Thank you very much, indeed that works as well.
> Here's the updated patch.

Will apply, thanks.

Marton

>
> Best regards.
>
> ---
> diff --git a/libavformat/aea.c b/libavformat/aea.c
> index f4b39e4f9e..d16217381b 100644
> --- a/libavformat/aea.c
> +++ b/libavformat/aea.c
> @@ -90,13 +90,7 @@ static int aea_read_header(AVFormatContext *s)
>
> 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);
> -
> -    return ret;
> +    return av_get_packet(s->pb, pkt, s->streams[0]->codecpar->block_align);
> }
>
> const AVInputFormat ff_aea_demuxer = {
>
> ------- Original Message -------
> On Thursday, March 9th, 2023 at 12:28 AM, Marton Balint <cus@passwd.hu> wrote:
>
>
>>
>> On Sat, 4 Mar 2023, asivery wrote:
>>
>>> Could someone please take a look? This would improve AEA demuxing, right now every AEA file makes ffmpeg crash with an error.
>>
>>
>> The way I see it, you could simply replace the whole body of
>> aea_read_packet() with this single line:
>>
>> return av_get_packet(s->pb, pkt, s->streams[0]->codecpar->block_align);
>>
>>
>> Regards,
>> Marton
>>
>>> Thank you in advance :)
>>> ------- Original Message -------
>>> On Saturday, October 22nd, 2022 at 7:43 PM, asivery asivery@protonmail.com wrote:
>>>
>>>> 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
>>>> _______________________________________________
>>>> ffmpeg-devel mailing list
>>>> ffmpeg-devel@ffmpeg.org
>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
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