[MPlayer-dev-eng] [PATCH] stream/stream_ffmpeg.c: convert to avio API

Alexis Ballier alexis.ballier at gmail.com
Sat Mar 24 22:19:15 CET 2012


2012/3/24 Reimar Döffinger <Reimar.Doeffinger at gmx.de>:
> On Fri, Mar 23, 2012 at 05:54:21AM -0400, Alexis Ballier wrote:
>> Appears to work fine and unbreaks the build with recent shared ffmpeg.
>
> As mentioned on -cvslog, the avio API has issues and should not
> be used if not necessary at the very least.

to be honest i was expecting comments like that, but:

- Is the buffering that terrible for reading? I mean, this may be
useless but I dont understand how it can hurt. For me, this also
leaves the liberty to the library to fill the buffer with how many
buffer it wishes.
- For writing, you're absolutely right:

> For writing it even loses the ability to report errors completely,
> and it is impossible to know when the data will actually be written
> (since it will only be written when the buffer is full, which might
> be far too late).

adding a call to avio_flush and check the error might resolve this maybe ?

(untested)

--- stream/stream_ffmpeg.c	(revision 34831)
+++ stream/stream_ffmpeg.c	(working copy)
@@ -35,7 +35,8 @@
 static int write_buffer(stream_t *s, char *buffer, int len)
 {
     avio_write(s->priv, buffer, len);
-    return len;
+    avio_flush(s->priv);
+    return (((AVIOContext *)s->priv)->error) ? -1 : len;
 }


More information about the MPlayer-dev-eng mailing list