[FFmpeg-devel] [PATCH 2/4] avformat/psxstr: fix demuxing I/O error at EOF

aybe aybe aybe.one at hotmail.com
Tue Jan 2 04:52:11 EET 2024


This second patch fixes the following error at the end of a .STR stream conversion:

[in#0/psxstr @ 0000000000681e80] Error during demuxing: I/O error

It's been a bit of trial and error as I've never used ffmpeg, but returning AVERROR_EOF appears to be the way to go (doesn't complain anymore).

Signed-off-by: aybe <aybe at users.noreply.github.com>
---
  libavformat/psxstr.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c
index bb56b05688..72d14b9792 100644
--- a/libavformat/psxstr.c
+++ b/libavformat/psxstr.c
@@ -165,8 +165,12 @@ static int str_read_packet(AVFormatContext *s,
      AVStream *st;

      while (1) {
+        int read = avio_read(pb, sector, RAW_CD_SECTOR_SIZE);

-        if (avio_read(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
+        if (read == AVERROR_EOF)
+            return AVERROR_EOF;
+
+        if (read != RAW_CD_SECTOR_SIZE)
              return AVERROR(EIO);

          channel = sector[0x11];
--
2.41.0.windows.1


More information about the ffmpeg-devel mailing list