[vlc-commits] [Git][videolan/vlc][master] codec/demux: pump libavcodec/libavformat requirements

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jun 21 15:23:05 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
931e9f34 by Ilkka Ollakka at 2024-06-21T13:58:55+00:00
codec/demux: pump libavcodec/libavformat requirements

pump to ffmpeg 4.2

Debian stable is in 5.1-series and ubuntu Focal (20.04 LTS) is in 4.2 version

- - - - -


8 changed files:

- configure.ac
- modules/codec/avcodec/avcommon.h
- modules/codec/avcodec/chroma.c
- modules/codec/avcodec/directx_va.c
- modules/codec/avcodec/fourcc.c
- modules/codec/avcodec/video.c
- modules/demux/avformat/demux.c
- modules/demux/avformat/mux.c


Changes:

=====================================
configure.ac
=====================================
@@ -2602,9 +2602,9 @@ AS_HELP_STRING([--enable-merge-ffmpeg], [merge FFmpeg-based plugins (default dis
 ])
 AM_CONDITIONAL([MERGE_FFMPEG], [test "$enable_merge_ffmpeg" != "no"])
 
-dnl We need >=57.37.100 from ffmpeg
-dnl 7fc329e2dd6226dfecaa4a1d7adf353bf2773726  include libavutil 55.22.101
-PKG_HAVE_WITH_MODULES([AVCODEC], [libavcodec >= 57.37.100 libavutil >= 55.22.101],
+dnl We require ffmpeg >= 4.2
+dnl Ubuntu Focal (20.04 LTS) has 4.2, debian stable (bookworm) has 5.1
+PKG_HAVE_WITH_MODULES([AVCODEC], [libavcodec >= 58.54.100 libavutil >= 56.31.100],
                        [libavcodec codec (default enabled)], [yes])
 
 dnl
@@ -2764,7 +2764,7 @@ AS_HELP_STRING([--enable-avformat], [libavformat containers (default enabled)]),
 ])
 have_avformat="no"
 AS_IF([test "${enable_avformat}" != "no"], [
-  PKG_CHECK_MODULES(AVFORMAT,[libavformat >= 53.21.0 libavcodec libavutil], [
+  PKG_CHECK_MODULES(AVFORMAT,[libavformat >= 58.29.100 libavcodec libavutil], [
       have_avformat="yes"
       VLC_SAVE_FLAGS
       CPPFLAGS="${CPPFLAGS} ${AVFORMAT_CFLAGS}"


=====================================
modules/codec/avcodec/avcommon.h
=====================================
@@ -115,10 +115,6 @@ static inline void vlc_init_avformat(vlc_object_t *obj)
 
     avformat_network_init();
 
-#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 9, 100))
-    av_register_all();
-#endif
-
     vlc_avcodec_unlock();
 }
 #endif
@@ -131,9 +127,6 @@ static inline void vlc_init_avcodec(vlc_object_t *obj)
 
     vlc_init_avutil(obj);
 
-#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 10, 100))
-    avcodec_register_all();
-#endif
 
     vlc_avcodec_unlock();
 }
@@ -301,12 +294,9 @@ static inline void get_video_color_settings( const AVCodecContext *ctx,
         case AVCOL_TRC_BT2020_12:
             fmt->transfer = TRANSFER_FUNC_BT2020;
             break;
-#if LIBAVUTIL_VERSION_CHECK( 55, 31, 100)
         case AVCOL_TRC_ARIB_STD_B67:
             fmt->transfer = TRANSFER_FUNC_ARIB_B67;
             break;
-#endif
-#if LIBAVUTIL_VERSION_CHECK( 55, 37, 100)
         case AVCOL_TRC_SMPTE2084:
             fmt->transfer = TRANSFER_FUNC_SMPTE_ST2084;
             break;
@@ -316,7 +306,6 @@ static inline void get_video_color_settings( const AVCodecContext *ctx,
         case AVCOL_TRC_GAMMA28:
             fmt->transfer = TRANSFER_FUNC_BT470_BG;
             break;
-#endif
         default:
             break;
     }


=====================================
modules/codec/avcodec/chroma.c
=====================================
@@ -101,10 +101,8 @@ static const struct
     {VLC_CODEC_YUVA_444_10L, AV_PIX_FMT_YUVA444P10LE,  COLOR_RANGE_UNDEF },
     {VLC_CODEC_YUVA_444_10B, AV_PIX_FMT_YUVA444P10BE,  COLOR_RANGE_UNDEF },
 
-#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(56, 24, 101)
     {VLC_CODEC_YUVA_444_12L, AV_PIX_FMT_YUVA444P12LE,  COLOR_RANGE_UNDEF },
     {VLC_CODEC_YUVA_444_12B, AV_PIX_FMT_YUVA444P12BE,  COLOR_RANGE_UNDEF },
-#endif
 
     {VLC_CODEC_I444_9L, AV_PIX_FMT_YUV444P9LE,  COLOR_RANGE_UNDEF },
     {VLC_CODEC_I444_9B, AV_PIX_FMT_YUV444P9BE,  COLOR_RANGE_UNDEF },


=====================================
modules/codec/avcodec/directx_va.c
=====================================
@@ -295,13 +295,8 @@ static const directx_va_mode_t DXVA_MODES[] = {
 
     /* VPx */
     { "VP8",                                                                          &DXVA_ModeVP8_VLD,                      8, {1, 1}, 0, NULL, 0 },
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 57, 17, 100 )
     { "VP9 profile 0",                                                                &DXVA_ModeVP9_VLD_Profile0,             8, {1, 1}, AV_CODEC_ID_VP9, PROF_VP9_MAIN, 0 },
     { "VP9 profile 2",                                                                &DXVA_ModeVP9_VLD_10bit_Profile2,       10, {1, 1}, AV_CODEC_ID_VP9, PROF_VP9_10, 0 },
-#else
-    { "VP9 profile 0",                                                                &DXVA_ModeVP9_VLD_Profile0,             8, {1, 1}, 0, NULL, 0 },
-    { "VP9 profile 2",                                                                &DXVA_ModeVP9_VLD_10bit_Profile2,       10, {1, 1}, 0, NULL, 0 },
-#endif
     { "VP9 profile Intel",                                                            &DXVA_ModeVP9_VLD_Intel,                8, {1, 1}, 0, NULL, 0 },
 
     /* AV1 */


=====================================
modules/codec/avcodec/fourcc.c
=====================================
@@ -160,9 +160,7 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
     { VLC_CODEC_KMVC, AV_CODEC_ID_KMVC },
     { VLC_CODEC_FLASHSV, AV_CODEC_ID_FLASHSV },
     { VLC_CODEC_CAVS, AV_CODEC_ID_CAVS },
-#if LIBAVCODEC_VERSION_CHECK(58, 22, 100)
     { VLC_CODEC_CAVS2, AV_CODEC_ID_AVS2 },
-#endif
 #if LIBAVCODEC_VERSION_CHECK(58, 109, 100)
     { VLC_CODEC_CAVS3, AV_CODEC_ID_AVS3 },
 #endif
@@ -223,9 +221,7 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
     /* AV_CODEC_ID_IFF_BYTERUN1 */
     { VLC_CODEC_KGV1, AV_CODEC_ID_KGV1 },
     { VLC_CODEC_YOP, AV_CODEC_ID_YOP },
-#if LIBAVCODEC_VERSION_CHECK( 58, 53, 100 )
     { VLC_CODEC_VP4, AV_CODEC_ID_VP4 },
-#endif
     { VLC_CODEC_VP8, AV_CODEC_ID_VP8 },
     /* AV_CODEC_ID_PICTOR */
     /* AV_CODEC_ID_ANSI */
@@ -256,9 +252,7 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
     { VLC_CODEC_MSS2, AV_CODEC_ID_MSS2 },
     { VLC_CODEC_VP9, AV_CODEC_ID_VP9 },
     { VLC_CODEC_VP9ALPHA_ES, AV_CODEC_ID_VP9 },
-#if LIBAVCODEC_VERSION_CHECK( 57, 83, 101 )
     { VLC_CODEC_AV1, AV_CODEC_ID_AV1 },
-#endif
     { VLC_CODEC_ICOD, AV_CODEC_ID_AIC },
     /* AV_CODEC_ID_ESCAPE130 */
     { VLC_CODEC_G2M4, AV_CODEC_ID_G2M },
@@ -316,33 +310,19 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
     /* ffmpeg only: AV_CODEC_ID_SNOW */
     /* ffmpeg only: AV_CODEC_ID_SMVJPEG */
 
-#if LIBAVCODEC_VERSION_CHECK( 58, 1, 100 )
     { VLC_CODEC_MAGICYUV, AV_CODEC_ID_MAGICYUV },
-#endif
 
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 57, 24, 102 )
     { VLC_CODEC_CINEFORM, AV_CODEC_ID_CFHD },
-#endif
 
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 57, 70, 100 )
     { VLC_CODEC_PIXLET, AV_CODEC_ID_PIXLET },
-#endif
 
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 57, 71, 101 )
     { VLC_CODEC_SPEEDHQ, AV_CODEC_ID_SPEEDHQ },
-#endif
 
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 57, 79, 100 )
     { VLC_CODEC_FMVC, AV_CODEC_ID_FMVC },
-#endif
 
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 58, 24, 100 )
     { VLC_CODEC_IMM4, AV_CODEC_ID_IMM4 },
-#endif
 
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 58, 49, 100 )
     { VLC_CODEC_AGM, AV_CODEC_ID_AGM },
-#endif
 
 #if LIBAVCODEC_VERSION_CHECK( 58, 56, 100 )
     { VLC_CODEC_IMM5, AV_CODEC_ID_IMM5 },
@@ -467,9 +447,7 @@ static const struct vlc_avcodec_fourcc audio_codecs[] =
     /* AV_CODEC_ID_WESTWOOD_SND1 */
     { VLC_CODEC_GSM, AV_CODEC_ID_GSM },
     { VLC_CODEC_QDM2, AV_CODEC_ID_QDM2 },
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 71, 100))
     { VLC_CODEC_QDMC, AV_CODEC_ID_QDMC },
-#endif
     { VLC_CODEC_COOK, AV_CODEC_ID_COOK },
     { VLC_CODEC_TRUESPEECH, AV_CODEC_ID_TRUESPEECH },
     { VLC_CODEC_TTA, AV_CODEC_ID_TTA },
@@ -486,9 +464,7 @@ static const struct vlc_avcodec_fourcc audio_codecs[] =
     { VLC_CODEC_NELLYMOSER, AV_CODEC_ID_NELLYMOSER },
     { VLC_CODEC_MUSEPACK8, AV_CODEC_ID_MUSEPACK8 },
     { VLC_CODEC_SPEEX, AV_CODEC_ID_SPEEX },
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58, 13, 100))
     { VLC_CODEC_CODEC2, AV_CODEC_ID_CODEC2 },
-#endif
     { VLC_CODEC_WMAS, AV_CODEC_ID_WMAVOICE },
     { VLC_CODEC_WMAP, AV_CODEC_ID_WMAPRO },
     { VLC_CODEC_WMAL, AV_CODEC_ID_WMALOSSLESS },
@@ -544,9 +520,7 @@ static const struct vlc_avcodec_fourcc spu_codecs[] =
     { VLC_CODEC_SSA, AV_CODEC_ID_SSA },
     { VLC_CODEC_TX3G, AV_CODEC_ID_MOV_TEXT },
     { VLC_CODEC_BD_PG, AV_CODEC_ID_HDMV_PGS_SUBTITLE },
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 71, 100))
     { VLC_CODEC_BD_TEXT, AV_CODEC_ID_HDMV_TEXT_SUBTITLE },
-#endif
     { VLC_CODEC_TELETEXT, AV_CODEC_ID_DVB_TELETEXT },
     /* AV_CODEC_ID_SRT */
     /* ffmpeg only: AV_CODEC_ID_MICRODVD */


=====================================
modules/codec/avcodec/video.c
=====================================
@@ -55,9 +55,7 @@
 # include <libavutil/dovi_meta.h>
 #endif
 
-#if LIBAVUTIL_VERSION_CHECK( 56, 25, 100 )
-# include <libavutil/hdr_dynamic_metadata.h>
-#endif
+#include <libavutil/hdr_dynamic_metadata.h>
 
 #include "../../packetizer/av1_obu.h"
 #include "../../packetizer/av1.h"
@@ -664,12 +662,6 @@ static int InitVideoDecCommon( decoder_t *p_dec )
         case AV_CODEC_ID_MPEG2VIDEO:
             p_context->thread_type &= ~FF_THREAD_SLICE;
             /* fall through */
-# if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 1, 0))
-        case AV_CODEC_ID_H264:
-        case AV_CODEC_ID_VC1:
-        case AV_CODEC_ID_WMV3:
-            p_context->thread_type &= ~FF_THREAD_FRAME;
-# endif
         default:
             break;
     }
@@ -1074,7 +1066,6 @@ static void map_dovi_metadata( vlc_video_dovi_metadata_t *out,
 }
 #endif
 
-#if LIBAVUTIL_VERSION_CHECK( 56, 25, 100 )
 static void map_hdrplus_metadata( vlc_video_hdr_dynamic_metadata_t *out,
                                   const AVDynamicHDRPlus *data )
 {
@@ -1105,7 +1096,6 @@ static void map_hdrplus_metadata( vlc_video_hdr_dynamic_metadata_t *out,
             out->bezier_curve_anchors[i] = av_q2d( pars->bezier_curve_anchors[i] );
     }
 }
-#endif
 
 static int DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p_pic )
 {
@@ -1165,7 +1155,6 @@ static int DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p_
         }
 #undef FROM_AVRAT
     }
-#if (LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 55, 60, 100 ))
     const AVFrameSideData *metadata_lt =
             av_frame_get_side_data( frame,
                                     AV_FRAME_DATA_CONTENT_LIGHT_LEVEL );
@@ -1183,7 +1172,6 @@ static int DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p_
             format_changed = true;
         }
     }
-#endif
 
     const AVFrameSideData *p_stereo3d_data =
             av_frame_get_side_data( frame,
@@ -1217,12 +1205,10 @@ static int DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p_
             p_pic->format.multiview_mode = MULTIVIEW_2D;
             break;
         }
-#if LIBAVUTIL_VERSION_CHECK( 56, 4, 100 )
         p_pic->format.b_multiview_right_eye_first = stereo_data->flags & AV_STEREO3D_FLAG_INVERT;
         p_pic->b_multiview_left_eye = (stereo_data->view == AV_STEREO3D_VIEW_LEFT);
 
         p_dec->fmt_out.video.b_multiview_right_eye_first = p_pic->format.b_multiview_right_eye_first;
-#endif
 
         if (p_dec->fmt_out.video.multiview_mode != p_pic->format.multiview_mode)
         {
@@ -1272,7 +1258,6 @@ static int DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p_
     }
 #endif
 
-#if LIBAVUTIL_VERSION_CHECK( 56, 25, 100 )
     const AVFrameSideData *p_hdrplus = av_frame_get_side_data( frame, AV_FRAME_DATA_DYNAMIC_HDR_PLUS );
     if( p_hdrplus )
     {
@@ -1282,7 +1267,6 @@ static int DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p_
             return VLC_ENOMEM;
         map_hdrplus_metadata( dst, (AVDynamicHDRPlus *) p_hdrplus->data );
     }
-#endif
 
     const AVFrameSideData *p_icc = av_frame_get_side_data( frame, AV_FRAME_DATA_ICC_PROFILE );
     if( p_icc )
@@ -1502,11 +1486,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         vlc_mutex_lock(&p_sys->lock);
 
         /* Compute the PTS */
-#if LIBAVCODEC_VERSION_CHECK( 57, 61, 100 )
         int64_t av_pts = frame->best_effort_timestamp;
-#else
-        int64_t av_pts = frame->pkt_pts;
-#endif
         if( av_pts == AV_NOPTS_VALUE )
             av_pts = frame->pkt_dts;
 
@@ -2074,14 +2054,6 @@ no_reuse:
     if (!can_hwaccel)
         return swfmt;
 
-#if !LIBAVCODEC_VERSION_CHECK(57, 83, 101)
-    if (p_context->active_thread_type)
-    {
-        msg_Warn(p_dec, "thread type %d: disabling hardware acceleration",
-                 p_context->active_thread_type);
-        return swfmt;
-    }
-#endif
 
     vlc_mutex_lock(&p_sys->lock);
 


=====================================
modules/demux/avformat/demux.c
=====================================
@@ -60,12 +60,6 @@
 # define AVF_MAYBE_CONST
 #endif
 
-#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 80, 100))
-static void avio_context_free(AVIOContext **io)
-{
-    av_freep(io);
-}
-#endif
 
 struct avformat_track_s
 {


=====================================
modules/demux/avformat/mux.c
=====================================
@@ -62,9 +62,7 @@ typedef struct
     bool     b_write_header;
     bool     b_write_keyframe;
     bool     b_error;
-#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
     bool     b_header_done;
-#endif
 } sout_mux_sys_t;
 
 /*****************************************************************************
@@ -77,10 +75,8 @@ static int Mux      ( sout_mux_t * );
 
 static int IOWrite( void *opaque, uint8_t *buf, int buf_size );
 static int64_t IOSeek( void *opaque, int64_t offset, int whence );
-#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
 static int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
                               enum AVIODataMarkerType type, int64_t time);
-#endif
 
 /*****************************************************************************
  * Open
@@ -95,11 +91,6 @@ int avformat_OpenMux( vlc_object_t *p_this )
     sout_mux_t *p_mux = (sout_mux_t*)p_this;
     bool dummy = !strcmp( p_mux->p_access->psz_access, "dummy");
 
-#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 7, 100))
-    if( dummy && strlen(p_mux->p_access->psz_path)
-                              >= sizeof (((AVFormatContext *)NULL)->filename) )
-        return VLC_EGENERIC;
-#endif
 
     msg_Dbg( p_mux, "using %s %s", AVPROVIDER(LIBAVFORMAT), LIBAVFORMAT_IDENT );
 
@@ -134,11 +125,7 @@ int avformat_OpenMux( vlc_object_t *p_this )
     p_sys->oc->oformat = file_oformat;
     /* If we use dummy access, let avformat write output */
     if( dummy )
-#if (LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(58, 7, 100))
         p_sys->oc->url = av_strdup(p_mux->p_access->psz_path);
-#else
-        strcpy( p_sys->oc->filename, p_mux->p_access->psz_path );
-#endif
 
     /* Create I/O wrapper */
     p_sys->io_buffer_size = 10 * 1024 * 1024;  /* FIXME */
@@ -157,10 +144,8 @@ int avformat_OpenMux( vlc_object_t *p_this )
     p_sys->b_write_header = true;
     p_sys->b_write_keyframe = false;
     p_sys->b_error = false;
-#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
     p_sys->io->write_data_type = IOWriteTyped;
     p_sys->b_header_done = false;
-#endif
     if( var_GetBool( p_mux, "sout-avformat-reset-ts" ) )
         p_sys->oc->avoid_negative_ts = AVFMT_AVOID_NEG_TS_MAKE_ZERO;
 
@@ -258,11 +243,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         return VLC_EGENERIC;
     }
 
-#if (LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 5, 0))
     AVCodecParameters *codecpar = stream->codecpar;
-#else
-    AVCodecContext *codecpar = stream->codec;
-#endif
 
     unsigned int i_bitrate = fmt->i_bitrate;
     unsigned int i_frame_rate = fmt->video.i_frame_rate;
@@ -435,7 +416,6 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
     return VLC_SUCCESS;
 }
 
-#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
 int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
                               enum AVIODataMarkerType type, int64_t time)
 {
@@ -447,7 +427,6 @@ int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
         p_sys->b_header_done = true;
     return IOWrite(opaque, buf, buf_size);
 }
-#endif
 
 /*****************************************************************************
  * Mux: multiplex available data in input fifos
@@ -548,10 +527,8 @@ static int IOWrite( void *opaque, uint8_t *buf, int buf_size )
 
     if( p_sys->b_write_header )
         p_buf->i_flags |= BLOCK_FLAG_HEADER;
-#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 )
     if( !p_sys->b_header_done )
         p_buf->i_flags |= BLOCK_FLAG_HEADER;
-#endif
 
     if( p_sys->b_write_keyframe )
     {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/931e9f34cec5cfbc939672e0691e41fde19e94f5

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/931e9f34cec5cfbc939672e0691e41fde19e94f5
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