[vlc-devel] modules/codec/ffmpeg/mux.c oddness

Olivier Houchard cognet at ci0.org
Wed Feb 14 17:34:32 CET 2007

[Please keep me on the Cc: list, as I did not subscribe to vlc-devel]


In modules/codec/ffmpeg/mux.c, IOWrite(), the callback used by ffmpeg to write
into the buffer, wrongly assumes sout_AccessWrite() returns the number of bytes
written. It is true for the "file" access_out, however it is wrong for others,
such as http, which just returns 0 on success. I applied the attached patch,
which just returns the value returned by sout_AccessWrite() to ffmpeg. That
should work, as ffmpeg assumes any negative value to be an error, and just
discards any >= 0 value. 
Most other muxers just ignore the return value of sout_AccessWrite().

Or did I miss something obvious ?

Thanks !

-------------- next part --------------
Index: mux.c
--- mux.c	(revision 18829)
+++ mux.c	(working copy)
@@ -442,7 +442,7 @@
     if( buf_size > 0 ) memcpy( p_buf->p_buffer, buf, buf_size );
     i_ret = sout_AccessOutWrite( p_mux->p_access, p_buf );
-    return i_ret ? i_ret : -1;
+    return i_ret;
 static offset_t IOSeek( void *opaque, offset_t offset, int whence )

More information about the vlc-devel mailing list