[MPlayer-dev-eng] [PATCH] demux lavf: mp_read: Propagate EOF

Alexander Strasser eclipse7 at gmx.net
Sun Nov 12 23:16:52 EET 2017

Return AVERROR_EOF from mp_read callback, if stream->eof is non-zero.

Fixes ticket #2335

Signed-off-by: Alexander Strasser <eclipse7 at gmx.net>

Please look at the ticket for more details.

Although there was a patch committed in FFmpeg, that avoids
the problem for now, I don't want to wait until the next bump
re-introduces the problem.

 libmpdemux/demux_lavf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 7cb77f7f0..cf960f51a 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -90,6 +90,8 @@ static int mp_read(void *opaque, uint8_t *buf, int size) {
     int ret;
     ret=stream_read(stream, buf, size);
+    if (!ret && stream->eof)
+      ret = AVERROR_EOF;
     mp_msg(MSGT_HEADER,MSGL_DBG2,"%d=mp_read(%p, %p, %d), pos: %"PRId64", eof:%d\n",
            ret, stream, buf, size, stream_tell(stream), stream->eof);

More information about the MPlayer-dev-eng mailing list