* [FFmpeg-devel] [PATCH] lavf: return AVERROR_EOF rather than EIO on EOF
@ 2023-03-27 8:00 Anton Khirnov
2023-03-27 8:27 ` Paul B Mahol
2023-03-27 17:42 ` Marton Balint
0 siblings, 2 replies; 5+ messages in thread
From: Anton Khirnov @ 2023-03-27 8:00 UTC (permalink / raw)
To: ffmpeg-devel
---
libavformat/anm.c | 2 +-
libavformat/dauddec.c | 2 +-
libavformat/filmstripdec.c | 2 +-
libavformat/idroqdec.c | 2 +-
libavformat/sol.c | 3 ++-
libavformat/vc1test.c | 2 +-
6 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/libavformat/anm.c b/libavformat/anm.c
index 7feba4ed1e7..f2ac6958a9a 100644
--- a/libavformat/anm.c
+++ b/libavformat/anm.c
@@ -172,7 +172,7 @@ static int read_packet(AVFormatContext *s,
int tmp, record_size;
if (avio_feof(s->pb))
- return AVERROR(EIO);
+ return AVERROR_EOF;
if (anm->page < 0)
return anm->page;
diff --git a/libavformat/dauddec.c b/libavformat/dauddec.c
index dbbd39a3b40..0cbf7e4e368 100644
--- a/libavformat/dauddec.c
+++ b/libavformat/dauddec.c
@@ -41,7 +41,7 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
AVIOContext *pb = s->pb;
int ret, size;
if (avio_feof(pb))
- return AVERROR(EIO);
+ return AVERROR_EOF;
size = avio_rb16(pb);
avio_rb16(pb); // unknown
ret = av_get_packet(pb, pkt, size);
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
index 2b6ba63fcf0..000f807181d 100644
--- a/libavformat/filmstripdec.c
+++ b/libavformat/filmstripdec.c
@@ -86,7 +86,7 @@ static int read_packet(AVFormatContext *s,
AVStream *st = s->streams[0];
if (avio_feof(s->pb))
- return AVERROR(EIO);
+ return AVERROR_EOF;
pkt->dts = avio_tell(s->pb) / (st->codecpar->width * (int64_t)(st->codecpar->height + film->leading) * 4);
pkt->size = av_get_packet(s->pb, pkt, st->codecpar->width * st->codecpar->height * 4);
avio_skip(s->pb, st->codecpar->width * (int64_t) film->leading * 4);
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index c9fc972780a..01ea2bb77ba 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -107,7 +107,7 @@ static int roq_read_packet(AVFormatContext *s,
while (!packet_read) {
if (avio_feof(s->pb))
- return AVERROR(EIO);
+ return AVERROR_EOF;
/* get the next chunk preamble */
if ((ret = avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
diff --git a/libavformat/sol.c b/libavformat/sol.c
index b92cfb36fee..a276642728c 100644
--- a/libavformat/sol.c
+++ b/libavformat/sol.c
@@ -127,7 +127,8 @@ static int sol_read_packet(AVFormatContext *s,
int ret;
if (avio_feof(s->pb))
- return AVERROR(EIO);
+ return AVERROR_EOF;
+
ret= av_get_packet(s->pb, pkt, MAX_SIZE);
if (ret < 0)
return ret;
diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
index 67edc699c5f..f63ffee69bb 100644
--- a/libavformat/vc1test.c
+++ b/libavformat/vc1test.c
@@ -101,7 +101,7 @@ static int vc1t_read_packet(AVFormatContext *s,
uint32_t pts;
if(avio_feof(pb))
- return AVERROR(EIO);
+ return AVERROR_EOF;
frame_size = avio_rl24(pb);
if(avio_r8(pb) & 0x80)
--
2.39.1
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavf: return AVERROR_EOF rather than EIO on EOF
2023-03-27 8:00 [FFmpeg-devel] [PATCH] lavf: return AVERROR_EOF rather than EIO on EOF Anton Khirnov
@ 2023-03-27 8:27 ` Paul B Mahol
2023-03-27 17:42 ` Marton Balint
1 sibling, 0 replies; 5+ messages in thread
From: Paul B Mahol @ 2023-03-27 8:27 UTC (permalink / raw)
To: FFmpeg development discussions and patches
LGTM
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavf: return AVERROR_EOF rather than EIO on EOF
2023-03-27 8:00 [FFmpeg-devel] [PATCH] lavf: return AVERROR_EOF rather than EIO on EOF Anton Khirnov
2023-03-27 8:27 ` Paul B Mahol
@ 2023-03-27 17:42 ` Marton Balint
2023-03-27 19:08 ` Marton Balint
1 sibling, 1 reply; 5+ messages in thread
From: Marton Balint @ 2023-03-27 17:42 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Mon, 27 Mar 2023, Anton Khirnov wrote:
> ---
> libavformat/anm.c | 2 +-
> libavformat/dauddec.c | 2 +-
> libavformat/filmstripdec.c | 2 +-
> libavformat/idroqdec.c | 2 +-
> libavformat/sol.c | 3 ++-
> libavformat/vc1test.c | 2 +-
> 6 files changed, 7 insertions(+), 6 deletions(-)
Aren't these supposed to return AVERROR_INVALIDDATA? Beacuse these are
most likely premature EOF-s when the file is truncated.
Regards,
Marton
>
> diff --git a/libavformat/anm.c b/libavformat/anm.c
> index 7feba4ed1e7..f2ac6958a9a 100644
> --- a/libavformat/anm.c
> +++ b/libavformat/anm.c
> @@ -172,7 +172,7 @@ static int read_packet(AVFormatContext *s,
> int tmp, record_size;
>
> if (avio_feof(s->pb))
> - return AVERROR(EIO);
> + return AVERROR_EOF;
>
> if (anm->page < 0)
> return anm->page;
> diff --git a/libavformat/dauddec.c b/libavformat/dauddec.c
> index dbbd39a3b40..0cbf7e4e368 100644
> --- a/libavformat/dauddec.c
> +++ b/libavformat/dauddec.c
> @@ -41,7 +41,7 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
> AVIOContext *pb = s->pb;
> int ret, size;
> if (avio_feof(pb))
> - return AVERROR(EIO);
> + return AVERROR_EOF;
> size = avio_rb16(pb);
> avio_rb16(pb); // unknown
> ret = av_get_packet(pb, pkt, size);
> diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
> index 2b6ba63fcf0..000f807181d 100644
> --- a/libavformat/filmstripdec.c
> +++ b/libavformat/filmstripdec.c
> @@ -86,7 +86,7 @@ static int read_packet(AVFormatContext *s,
> AVStream *st = s->streams[0];
>
> if (avio_feof(s->pb))
> - return AVERROR(EIO);
> + return AVERROR_EOF;
> pkt->dts = avio_tell(s->pb) / (st->codecpar->width * (int64_t)(st->codecpar->height + film->leading) * 4);
> pkt->size = av_get_packet(s->pb, pkt, st->codecpar->width * st->codecpar->height * 4);
> avio_skip(s->pb, st->codecpar->width * (int64_t) film->leading * 4);
> diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
> index c9fc972780a..01ea2bb77ba 100644
> --- a/libavformat/idroqdec.c
> +++ b/libavformat/idroqdec.c
> @@ -107,7 +107,7 @@ static int roq_read_packet(AVFormatContext *s,
> while (!packet_read) {
>
> if (avio_feof(s->pb))
> - return AVERROR(EIO);
> + return AVERROR_EOF;
>
> /* get the next chunk preamble */
> if ((ret = avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
> diff --git a/libavformat/sol.c b/libavformat/sol.c
> index b92cfb36fee..a276642728c 100644
> --- a/libavformat/sol.c
> +++ b/libavformat/sol.c
> @@ -127,7 +127,8 @@ static int sol_read_packet(AVFormatContext *s,
> int ret;
>
> if (avio_feof(s->pb))
> - return AVERROR(EIO);
> + return AVERROR_EOF;
> +
> ret= av_get_packet(s->pb, pkt, MAX_SIZE);
> if (ret < 0)
> return ret;
> diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
> index 67edc699c5f..f63ffee69bb 100644
> --- a/libavformat/vc1test.c
> +++ b/libavformat/vc1test.c
> @@ -101,7 +101,7 @@ static int vc1t_read_packet(AVFormatContext *s,
> uint32_t pts;
>
> if(avio_feof(pb))
> - return AVERROR(EIO);
> + return AVERROR_EOF;
>
> frame_size = avio_rl24(pb);
> if(avio_r8(pb) & 0x80)
> --
> 2.39.1
>
> _______________________________________________
> 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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavf: return AVERROR_EOF rather than EIO on EOF
2023-03-27 17:42 ` Marton Balint
@ 2023-03-27 19:08 ` Marton Balint
2023-03-27 19:22 ` Anton Khirnov
0 siblings, 1 reply; 5+ messages in thread
From: Marton Balint @ 2023-03-27 19:08 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Mon, 27 Mar 2023, Marton Balint wrote:
>
>
> On Mon, 27 Mar 2023, Anton Khirnov wrote:
>
>> ---
>> libavformat/anm.c | 2 +-
>> libavformat/dauddec.c | 2 +-
>> libavformat/filmstripdec.c | 2 +-
>> libavformat/idroqdec.c | 2 +-
>> libavformat/sol.c | 3 ++-
>> libavformat/vc1test.c | 2 +-
>> 6 files changed, 7 insertions(+), 6 deletions(-)
>
> Aren't these supposed to return AVERROR_INVALIDDATA? Beacuse these are most
> likely premature EOF-s when the file is truncated.
Disregard my comment, I can see now that these are all in the
beginning of read_packet().
Regards,
Marton
>
> Regards,
> Marton
>
>>
>> diff --git a/libavformat/anm.c b/libavformat/anm.c
>> index 7feba4ed1e7..f2ac6958a9a 100644
>> --- a/libavformat/anm.c
>> +++ b/libavformat/anm.c
>> @@ -172,7 +172,7 @@ static int read_packet(AVFormatContext *s,
>> int tmp, record_size;
>>
>> if (avio_feof(s->pb))
>> - return AVERROR(EIO);
>> + return AVERROR_EOF;
>>
>> if (anm->page < 0)
>> return anm->page;
>> diff --git a/libavformat/dauddec.c b/libavformat/dauddec.c
>> index dbbd39a3b40..0cbf7e4e368 100644
>> --- a/libavformat/dauddec.c
>> +++ b/libavformat/dauddec.c
>> @@ -41,7 +41,7 @@ static int daud_packet(AVFormatContext *s, AVPacket
>> @@ *pkt) {
>> AVIOContext *pb = s->pb;
>> int ret, size;
>> if (avio_feof(pb))
>> - return AVERROR(EIO);
>> + return AVERROR_EOF;
>> size = avio_rb16(pb);
>> avio_rb16(pb); // unknown
>> ret = av_get_packet(pb, pkt, size);
>> diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
>> index 2b6ba63fcf0..000f807181d 100644
>> --- a/libavformat/filmstripdec.c
>> +++ b/libavformat/filmstripdec.c
>> @@ -86,7 +86,7 @@ static int read_packet(AVFormatContext *s,
>> AVStream *st = s->streams[0];
>>
>> if (avio_feof(s->pb))
>> - return AVERROR(EIO);
>> + return AVERROR_EOF;
>> pkt->dts = avio_tell(s->pb) / (st->codecpar->width *
>> (int64_t)(st->codecpar->height + film->leading) * 4);
>> pkt->size = av_get_packet(s->pb, pkt, st->codecpar->width *
>> st->codecpar->height * 4);
>> avio_skip(s->pb, st->codecpar->width * (int64_t) film->leading * 4);
>> diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
>> index c9fc972780a..01ea2bb77ba 100644
>> --- a/libavformat/idroqdec.c
>> +++ b/libavformat/idroqdec.c
>> @@ -107,7 +107,7 @@ static int roq_read_packet(AVFormatContext *s,
>> while (!packet_read) {
>>
>> if (avio_feof(s->pb))
>> - return AVERROR(EIO);
>> + return AVERROR_EOF;
>>
>> /* get the next chunk preamble */
>> if ((ret = avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
>> diff --git a/libavformat/sol.c b/libavformat/sol.c
>> index b92cfb36fee..a276642728c 100644
>> --- a/libavformat/sol.c
>> +++ b/libavformat/sol.c
>> @@ -127,7 +127,8 @@ static int sol_read_packet(AVFormatContext *s,
>> int ret;
>>
>> if (avio_feof(s->pb))
>> - return AVERROR(EIO);
>> + return AVERROR_EOF;
>> +
>> ret= av_get_packet(s->pb, pkt, MAX_SIZE);
>> if (ret < 0)
>> return ret;
>> diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
>> index 67edc699c5f..f63ffee69bb 100644
>> --- a/libavformat/vc1test.c
>> +++ b/libavformat/vc1test.c
>> @@ -101,7 +101,7 @@ static int vc1t_read_packet(AVFormatContext *s,
>> uint32_t pts;
>>
>> if(avio_feof(pb))
>> - return AVERROR(EIO);
>> + return AVERROR_EOF;
>>
>> frame_size = avio_rl24(pb);
>> if(avio_r8(pb) & 0x80)
>> --
>> 2.39.1
>>
>> _______________________________________________
>> 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".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH] lavf: return AVERROR_EOF rather than EIO on EOF
2023-03-27 19:08 ` Marton Balint
@ 2023-03-27 19:22 ` Anton Khirnov
0 siblings, 0 replies; 5+ messages in thread
From: Anton Khirnov @ 2023-03-27 19:22 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Quoting Marton Balint (2023-03-27 21:08:54)
>
>
> On Mon, 27 Mar 2023, Marton Balint wrote:
>
> >
> >
> > On Mon, 27 Mar 2023, Anton Khirnov wrote:
> >
> >> ---
> >> libavformat/anm.c | 2 +-
> >> libavformat/dauddec.c | 2 +-
> >> libavformat/filmstripdec.c | 2 +-
> >> libavformat/idroqdec.c | 2 +-
> >> libavformat/sol.c | 3 ++-
> >> libavformat/vc1test.c | 2 +-
> >> 6 files changed, 7 insertions(+), 6 deletions(-)
> >
> > Aren't these supposed to return AVERROR_INVALIDDATA? Beacuse these are most
> > likely premature EOF-s when the file is truncated.
>
> Disregard my comment, I can see now that these are all in the
> beginning of read_packet().
Yeah, I picked just those where it was clear that it's an actual EOF.
There's a bunch of other EIO uses left that should probably be
INVALIDDATA, watches pelcome.
--
Anton Khirnov
_______________________________________________
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".
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-03-27 19:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27 8:00 [FFmpeg-devel] [PATCH] lavf: return AVERROR_EOF rather than EIO on EOF Anton Khirnov
2023-03-27 8:27 ` Paul B Mahol
2023-03-27 17:42 ` Marton Balint
2023-03-27 19:08 ` Marton Balint
2023-03-27 19:22 ` Anton Khirnov
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git