[vlc-commits] avformat mux: convert to new avio API ( cherry picked from commit 0011b7043c5c9115bf130068265e90142277d2f6)

Rafaël Carré git at videolan.org
Sun Mar 4 22:42:04 CET 2012


vlc/vlc-2.0 | branch: master | Rafaël Carré <funman at videolan.org> | Sat Mar  3 00:03:12 2012 +0900| [7fba272175f8d508ae1c7ab297555cbe6df83667] | committer: Rafaël Carré

avformat mux: convert to new avio API (cherry picked from commit 0011b7043c5c9115bf130068265e90142277d2f6)

Signed-off-by: KO Myung-Hun <komh at chollian.net>
Signed-off-by: Rafaël Carré <funman at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=7fba272175f8d508ae1c7ab297555cbe6df83667
---

 modules/demux/avformat/mux.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index b12bed1..a3dc29a 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -55,7 +55,11 @@ static const char *const ppsz_mux_options[] = {
  *****************************************************************************/
 struct sout_mux_sys_t
 {
+#if LIBAVFORMAT_VERSION_INT >= ((52<<16)+(105<<8)+0)
+    AVIOContext     *io;
+#else
     ByteIOContext   io;
+#endif
     int             io_buffer_size;
     uint8_t        *io_buffer;
 
@@ -86,7 +90,6 @@ int OpenMux( vlc_object_t *p_this )
     AVOutputFormat *file_oformat;
     sout_mux_t *p_mux = (sout_mux_t*)p_this;
     sout_mux_sys_t *p_sys;
-    AVFormatParameters params, *ap = ¶ms;
     char *psz_mux;
 
     /* Should we call it only once ? */
@@ -133,9 +136,18 @@ int OpenMux( vlc_object_t *p_this )
     /* Create I/O wrapper */
     p_sys->io_buffer_size = 32768;  /* FIXME */
     p_sys->io_buffer = malloc( p_sys->io_buffer_size );
-    init_put_byte( &p_sys->io, p_sys->io_buffer, p_sys->io_buffer_size,
-                   1, p_mux, NULL, IOWrite, IOSeek );
 
+#if (LIBAVFORMAT_VERSION_INT >= ((52<<16)+(105<<8)+0))
+    p_sys->io = avio_alloc_context(
+#else
+    init_put_byte( &p_sys->io,
+#endif
+        p_sys->io_buffer, p_sys->io_buffer_size,
+        1, p_mux, NULL, IOWrite, IOSeek );
+
+
+#if (LIBAVFORMAT_VERSION_INT < ((52<<16)+(105<<8)+0))
+    AVFormatParameters params, *ap = ¶ms;
     memset( ap, 0, sizeof(*ap) );
     if( av_set_parameters( p_sys->oc, ap ) < 0 )
     {
@@ -145,8 +157,13 @@ int OpenMux( vlc_object_t *p_this )
         free( p_sys );
         return VLC_EGENERIC;
     }
+#endif
 
+#if (LIBAVFORMAT_VERSION_INT >= ((52<<16)+(105<<8)+0))
+    p_sys->oc->pb = p_sys->io;
+#else
     p_sys->oc->pb = &p_sys->io;
+#endif
     p_sys->oc->nb_streams = 0;
 
     p_sys->b_write_header = true;



More information about the vlc-commits mailing list