[vlc-commits] [Git][videolan/vlc][master] mux: avformat: fix avio callbacks signature with ffmpeg 6.1

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Jul 11 14:14:08 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
503c04fa by François Cartegnie at 2024-07-11T13:57:43+00:00
mux: avformat: fix avio callbacks signature with ffmpeg 6.1

API signature changes introduced depending on a positive define,
then removed later, making it break prior or post removal...

- - - - -


2 changed files:

- modules/codec/avcodec/avcommon_compat.h
- modules/demux/avformat/mux.c


Changes:

=====================================
modules/codec/avcodec/avcommon_compat.h
=====================================
@@ -75,6 +75,9 @@
 #ifndef  FF_MAX_B_FRAMES
 # define  FF_MAX_B_FRAMES 16 // FIXME: remove this
 #endif
+#ifndef FF_API_AVIO_WRITE_NONCONST // removed in ffmpeg 7
+# define FF_API_AVIO_WRITE_NONCONST (LIBAVFORMAT_VERSION_MAJOR < 61)
+#endif
 
 # include <libavutil/avutil.h>
 


=====================================
modules/demux/avformat/mux.c
=====================================
@@ -73,10 +73,16 @@ static int AddStream( sout_mux_t *, sout_input_t * );
 static void DelStream( sout_mux_t *, sout_input_t * );
 static int Mux      ( sout_mux_t * );
 
+#if FF_API_AVIO_WRITE_NONCONST
 static int IOWrite( void *opaque, uint8_t *buf, int buf_size );
-static int64_t IOSeek( void *opaque, int64_t offset, int whence );
 static int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
-                              enum AVIODataMarkerType type, int64_t time);
+                        enum AVIODataMarkerType type, int64_t time);
+#else
+static int IOWrite( void *opaque, const uint8_t *buf, int buf_size );
+int IOWriteTyped(void *opaque, const uint8_t *buf, int buf_size,
+                 enum AVIODataMarkerType type, int64_t time);
+#endif
+static int64_t IOSeek( void *opaque, int64_t offset, int whence );
 
 /*****************************************************************************
  * Open
@@ -416,8 +422,13 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
     return VLC_SUCCESS;
 }
 
+#if FF_API_AVIO_WRITE_NONCONST
 int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
                               enum AVIODataMarkerType type, int64_t time)
+#else
+int IOWriteTyped(void *opaque, const uint8_t *buf, int buf_size,
+                 enum AVIODataMarkerType type, int64_t time)
+#endif
 {
     VLC_UNUSED(time);
 
@@ -512,7 +523,11 @@ static int Control( sout_mux_t *p_mux, int i_query, va_list args )
 /*****************************************************************************
  * I/O wrappers for libavformat
  *****************************************************************************/
+#if FF_API_AVIO_WRITE_NONCONST
 static int IOWrite( void *opaque, uint8_t *buf, int buf_size )
+#else
+static int IOWrite( void *opaque, const uint8_t *buf, int buf_size )
+#endif
 {
     sout_mux_t *p_mux = opaque;
     sout_mux_sys_t *p_sys = p_mux->p_sys;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/503c04fad9239420be26d67aab4d5f63c53eb4f7

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/503c04fad9239420be26d67aab4d5f63c53eb4f7
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list