[vlc-commits] [Git][videolan/vlc][master] 4 commits: avformat: adapt AVOutputFormat API constification

Hugo Beauzée-Luyssen (@chouquette) gitlab at videolan.org
Fri Jan 21 08:42:12 UTC 2022



Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC


Commits:
d0710040 by Romain Vimont at 2022-01-21T08:06:53+00:00
avformat: adapt AVOutputFormat API constification

Refs ffmpeg/56450a0ee4fdda160f4039fc2ae33edfd27765c9

- - - - -
5069e1cc by Romain Vimont at 2022-01-21T08:06:53+00:00
avformat: adapt AVInputFormat API constification

Refs ffmpeg/56450a0ee4fdda160f4039fc2ae33edfd27765c9

- - - - -
3312a960 by Romain Vimont at 2022-01-21T08:06:53+00:00
avcodec: adapt AVCodec API constification

Refs ffmpeg/626535f6a169e2d821b969e0ea77125ba7482113

- - - - -
1d66f795 by Romain Vimont at 2022-01-21T08:06:53+00:00
avformat: adapt size type change

When compiling with FFmpeg 5:

    ../../modules/demux/avformat/demux.c: In function ‘Demux’:
    ../../modules/demux/avformat/demux.c:817:84: warning: passing argument 3 of ‘av_packet_get_side_data’ from incompatible pointer type [-Wincompatible-pointer-types]
      817 |     uint8_t *side_data = av_packet_get_side_data( &pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_data_size );
          |                                                                                    ^~~~~~~~~~~~~~~
          |                                                                                    |
          |                                                                                    int *

Refs ffmpeg/14040a1d913794d9a3fd6406a6d8c2f0e37e0062 (announcement)
Refs ffmpeg/ef6a9e5e311f09fa8032974fa4d0c1e166a959bb (change)

- - - - -


3 changed files:

- modules/codec/avcodec/encoder.c
- modules/demux/avformat/demux.c
- modules/demux/avformat/mux.c


Changes:

=====================================
modules/codec/avcodec/encoder.c
=====================================
@@ -57,6 +57,12 @@
 
 #define RAW_AUDIO_FRAME_SIZE (2048)
 
+#if LIBAVCODEC_VERSION_CHECK(59, 0, 100)
+# define AVC_MAYBE_CONST const
+#else
+# define AVC_MAYBE_CONST
+#endif
+
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -90,7 +96,7 @@ typedef struct
     /*
      * libavcodec properties
      */
-    AVCodec         *p_codec;
+    AVC_MAYBE_CONST AVCodec *p_codec;
     AVCodecContext  *p_context;
 
     /*
@@ -227,7 +233,7 @@ static const uint16_t mpeg4_default_non_intra_matrix[64] = {
 
 static const int DEFAULT_ALIGN = 0;
 
-static void probe_video_frame_rate( encoder_t *p_enc, AVCodecContext *p_context, AVCodec *p_codec )
+static void probe_video_frame_rate( encoder_t *p_enc, AVCodecContext *p_context, AVC_MAYBE_CONST AVCodec *p_codec )
 {
     /* if we don't have i_frame_rate_base, we are probing and just checking if we can find codec
      * so set fps to requested fps if asked by user or input fps is available */
@@ -296,7 +302,7 @@ int InitVideoEnc( vlc_object_t *p_this )
     encoder_t *p_enc = (encoder_t *)p_this;
     encoder_sys_t *p_sys;
     AVCodecContext *p_context;
-    AVCodec *p_codec = NULL;
+    AVC_MAYBE_CONST AVCodec *p_codec = NULL;
     enum AVCodecID i_codec_id;
     const char *psz_namecodec;
     float f_val;


=====================================
modules/demux/avformat/demux.c
=====================================
@@ -51,6 +51,12 @@
 
 # define HAVE_AVUTIL_CODEC_ATTACHMENT 1
 
+#if LIBAVFORMAT_VERSION_CHECK(59, 0, 100)
+# define AVF_MAYBE_CONST const
+#else
+# define AVF_MAYBE_CONST
+#endif
+
 struct avformat_track_s
 {
     es_out_id_t *p_es;
@@ -63,7 +69,7 @@ struct avformat_track_s
  *****************************************************************************/
 typedef struct
 {
-    AVInputFormat  *fmt;
+    AVF_MAYBE_CONST AVInputFormat *fmt;
     AVFormatContext *ic;
 
     struct avformat_track_s *tracks;
@@ -221,7 +227,8 @@ static void FindStreamInfo( demux_t *p_demux, AVDictionary *options )
 }
 
 static int avformat_ProbeDemux( vlc_object_t *p_this,
-                                AVInputFormat **pp_fmt, const char *psz_url )
+                                AVF_MAYBE_CONST AVInputFormat **pp_fmt,
+                                const char *psz_url )
 {
     demux_t       *p_demux = (demux_t*)p_this;
     AVProbeData   pd = { 0 };
@@ -316,7 +323,7 @@ int avformat_OpenDemux( vlc_object_t *p_this )
 {
     demux_t       *p_demux = (demux_t*)p_this;
     demux_sys_t   *p_sys;
-    AVInputFormat *fmt = NULL;
+    AVF_MAYBE_CONST AVInputFormat *fmt = NULL;
     vlc_tick_t    i_start_time = VLC_TICK_INVALID;
     bool          b_can_seek;
     const char    *psz_url;
@@ -813,7 +820,11 @@ static int Demux( demux_t *p_demux )
     }
 
     // handle extra data change, this can happen for FLV
+#if LIBAVUTIL_VERSION_MAJOR < 57
     int side_data_size;
+#else
+    size_t side_data_size;
+#endif
     uint8_t *side_data = av_packet_get_side_data( &pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_data_size );
     if( side_data_size > 0 ) {
         // ignore new extradata which is the same as previous version


=====================================
modules/demux/avformat/mux.c
=====================================
@@ -86,7 +86,11 @@ static int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
  *****************************************************************************/
 int avformat_OpenMux( vlc_object_t *p_this )
 {
+#if LIBAVFORMAT_VERSION_CHECK(59, 0, 100)
+    const AVOutputFormat *file_oformat;
+#else
     AVOutputFormat *file_oformat;
+#endif
     sout_mux_t *p_mux = (sout_mux_t*)p_this;
     bool dummy = !strcmp( p_mux->p_access->psz_access, "dummy");
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/02eb6943cb8c8b548fcb93be050be07925b5b960...1d66f795d6f05a327abbf20a23fd5bcaafdf71c1

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/02eb6943cb8c8b548fcb93be050be07925b5b960...1d66f795d6f05a327abbf20a23fd5bcaafdf71c1
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list