From 18e98b8a0c410be5e1e9eac55052fe0c56901759 Mon Sep 17 00:00:00 2001 From: Marvin Scholz <epirat07@gmail.com> Date: Tue, 30 Nov 2021 18:20:39 +0100 Subject: [PATCH] avcommon: remove libav from version check macros --- modules/codec/avcodec/avcommon.h | 4 ++-- modules/codec/avcodec/avcommon_compat.h | 29 ++++++++++++------------- modules/codec/avcodec/fourcc.c | 4 ++-- modules/codec/avcodec/video.c | 4 ++-- modules/demux/avformat/mux.c | 10 ++++----- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/modules/codec/avcodec/avcommon.h b/modules/codec/avcodec/avcommon.h index 4e1778f963b2..9b98134f64bf 100644 --- a/modules/codec/avcodec/avcommon.h +++ b/modules/codec/avcodec/avcommon.h @@ -303,12 +303,12 @@ 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, 14, 0, 31, 100) +#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, 17, 0, 37, 100) +#if LIBAVUTIL_VERSION_CHECK( 55, 37, 100) case AVCOL_TRC_SMPTE2084: fmt->transfer = TRANSFER_FUNC_SMPTE_ST2084; break; diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h index 90de502d99ce..010b570e0820 100644 --- a/modules/codec/avcodec/avcommon_compat.h +++ b/modules/codec/avcodec/avcommon_compat.h @@ -28,13 +28,13 @@ #include <libavcodec/avcodec.h> -/* LIBAVCODEC_VERSION_CHECK checks for the right version of libav and FFmpeg +/* LIBAVCODEC_VERSION_CHECK checks for the right version of FFmpeg * a is the major version - * b and c the minor and micro versions of libav - * d and e the minor and micro versions of FFmpeg */ -#define LIBAVCODEC_VERSION_CHECK( a, b, c, d, e ) \ - ( (LIBAVCODEC_VERSION_MICRO < 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \ - (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) ) + * b is the minor version + * c is the micro version + */ +#define LIBAVCODEC_VERSION_CHECK( a, b, c ) \ + (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) #ifndef AV_CODEC_FLAG_OUTPUT_CORRUPT # define AV_CODEC_FLAG_OUTPUT_CORRUPT CODEC_FLAG_OUTPUT_CORRUPT @@ -78,20 +78,19 @@ # include <libavutil/avutil.h> -/* LIBAVUTIL_VERSION_CHECK checks for the right version of libav and FFmpeg +/* LIBAVUTIL_VERSION_CHECK checks for the right version of FFmpeg * a is the major version - * b and c the minor and micro versions of libav - * d and e the minor and micro versions of FFmpeg */ -#define LIBAVUTIL_VERSION_CHECK( a, b, c, d, e ) \ - ( (LIBAVUTIL_VERSION_MICRO < 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \ - (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) ) + * b is the minor version + * c is the micro version + */ +#define LIBAVUTIL_VERSION_CHECK( a, b, c ) \ + (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H # include <libavformat/avformat.h> -#define LIBAVFORMAT_VERSION_CHECK( a, b, c, d, e ) \ - ( (LIBAVFORMAT_VERSION_MICRO < 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) || \ - (LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, d, e ) ) ) +#define LIBAVFORMAT_VERSION_CHECK( a, b, c ) \ + (LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, b, c ) ) #endif diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c index de41991ebb51..edab2cbdca8f 100644 --- a/modules/codec/avcodec/fourcc.c +++ b/modules/codec/avcodec/fourcc.c @@ -233,7 +233,7 @@ static const struct vlc_avcodec_fourcc video_codecs[] = { VLC_CODEC_CLLC, AV_CODEC_ID_CLLC }, { VLC_CODEC_MSS2, AV_CODEC_ID_MSS2 }, { VLC_CODEC_VP9, AV_CODEC_ID_VP9 }, -#if LIBAVCODEC_VERSION_CHECK( 57, 26, 0, 83, 101 ) +#if LIBAVCODEC_VERSION_CHECK( 57, 83, 101 ) { VLC_CODEC_AV1, AV_CODEC_ID_AV1 }, #endif { VLC_CODEC_ICOD, AV_CODEC_ID_AIC }, @@ -290,7 +290,7 @@ 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, 0, 0, 1, 100 ) +#if LIBAVCODEC_VERSION_CHECK( 58, 1, 100 ) { VLC_CODEC_MAGICYUV, AV_CODEC_ID_MAGICYUV }, #endif diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c index 594c337486a9..d3ba649f272a 100644 --- a/modules/codec/avcodec/video.c +++ b/modules/codec/avcodec/video.c @@ -842,7 +842,7 @@ 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, 7, 0, 4, 100 ) +#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); @@ -1080,7 +1080,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, 24, 0, 61, 100 ) +#if LIBAVCODEC_VERSION_CHECK( 57, 61, 100 ) # if LIBAVCODEC_VERSION_MICRO >= 100 int64_t av_pts = frame->best_effort_timestamp; # else diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c index 52fe7ef7f9eb..b9c434f0814f 100644 --- a/modules/demux/avformat/mux.c +++ b/modules/demux/avformat/mux.c @@ -61,7 +61,7 @@ typedef struct bool b_write_header; bool b_write_keyframe; bool b_error; -#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 ) +#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 ) bool b_header_done; #endif } sout_mux_sys_t; @@ -76,7 +76,7 @@ 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, 7, 0, 40, 100 ) +#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 @@ -154,7 +154,7 @@ 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, 7, 0, 40, 100 ) +#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 ) p_sys->io->write_data_type = IOWriteTyped; p_sys->b_header_done = false; #endif @@ -423,7 +423,7 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input ) return VLC_SUCCESS; } -#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 ) +#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 ) int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size, enum AVIODataMarkerType type, int64_t time) { @@ -536,7 +536,7 @@ 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, 7, 0, 40, 100 ) +#if LIBAVFORMAT_VERSION_CHECK( 57, 40, 100 ) if( !p_sys->b_header_done ) p_buf->i_flags |= BLOCK_FLAG_HEADER; #endif -- GitLab