]> git.sesse.net Git - ffmpeg/commitdiff
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 02474e907af617660c7920290b23e47944dfecae..7860fd5e2fd7b70a9fc85984d194f20656b4726e 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 */