examples/avio_reading: return AVERROR_EOF at EOF.
authorNicolas George <george@nsup.org>
Fri, 27 Oct 2017 18:46:27 +0000 (20:46 +0200)
committerJan Ekström <jeebjp@gmail.com>
Sun, 29 Oct 2017 17:40:52 +0000 (19:40 +0200)
Signed-off-by: Nicolas George <george@nsup.org>
doc/examples/avio_reading.c

index 02474e9..7860fd5 100644 (file)
@@ -44,6 +44,8 @@ static int read_packet(void *opaque, uint8_t *buf, int buf_size)
     struct buffer_data *bd = (struct buffer_data *)opaque;
     buf_size = FFMIN(buf_size, bd->size);
 
+    if (!buf_size)
+        return AVERROR_EOF;
     printf("ptr:%p size:%zu\n", bd->ptr, bd->size);
 
     /* copy internal buffer data to buf */