[vlc-commits] [Git][videolan/vlc][master] 8 commits: avcodec: remove local AV_VERSION_INT

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Jun 21 13:55:54 UTC 2024



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
99d1644e by Steve Lhomme at 2024-06-21T15:36:03+02:00
avcodec: remove local AV_VERSION_INT

It was added in libavutil 49.6.0 [1]. Even in 3.0 we require 52.0.0.

[1] https://github.com/FFmpeg/FFmpeg/commit/e97ac1e6f5dc3a8ba2e7dc7519a6f8fb356b8a4d

- - - - -
644049eb by Steve Lhomme at 2024-06-21T15:36:03+02:00
avcodec: use LIBAVCODEC_VERSION_CHECK instead version value

This is how it used to be when libav was also supported.

We don't check for FFmpeg LIBAVCODEC_VERSION_INT values
since 8cf02acd84a1e099e15037d7c1e4dce6e8888df9.

- - - - -
f504ce6c by Steve Lhomme at 2024-06-21T15:36:03+02:00
avcodec: use LIBAVUTIL_VERSION_CHECK instead version value

This is how it used to be when libav was also supported.

- - - - -
195f0c98 by Steve Lhomme at 2024-06-21T15:36:03+02:00
avcodec: fix libavutil version check for av_channel_layout_default()

It was added in c41899a3770cb4510e15b223fa34d129305b1589 which
was libavutil 57.23.100 at the time but the minor version was not updated in
that commit so we check 57.24.100.

The same check applies for av_channel_layout_copy() added in the same commit.

This is part of FFmpeg 5.1.

https://github.com/FFmpeg/FFmpeg/commit/086a8048061bf9fb4c63943f6962db48175f655c

- - - - -
597bdb8e by Steve Lhomme at 2024-06-21T15:36:03+02:00
avcodec: fix libavcodec version check for AVCodecParameters.ch_layout

It was added in 276c06726fbd2f784d51189870bd834e9284812f which
was libavcodec 59.23.100 at the time but the minor version was not updated in
that commit so we check 59.24.100.

This is part of FFmpeg 5.1.

It was erroneously removed in a55ec32ab3760d9edb6f05481cd3a981aa42878d.

https://github.com/FFmpeg/FFmpeg/commit/276c06726fbd2f784d51189870bd834e9284812f

Co-authored-by: François Cartegnie <fcvlcdev at free.fr>

- - - - -
8fd918b8 by Steve Lhomme at 2024-06-21T15:36:04+02:00
avcodec: fix libavcodec version check for AVCodecContext.ch_layout

It was added in 548aeb93834b8425c86d1ce60fddc1d41805724d which
was libavcodec 59.23.100 at the time but the minor version was not updated in
that commit so we check 59.24.100.

This is part of FFmpeg 5.1.

https://github.com/FFmpeg/FFmpeg/commit/548aeb93834b8425c86d1ce60fddc1d41805724d

Co-authored-by: François Cartegnie <fcvlcdev at free.fr>

- - - - -
f2371558 by Steve Lhomme at 2024-06-21T15:36:04+02:00
avcodec: fix libavutil version check for AVFrame.ch_layout

It was added in db6efa1815e217ed76f39aee8b15ee5c64698537 which
was libavutil 57.23.100 at the time but the minor version was not updated in
that commit so we check 57.24.100.

This is part of FFmpeg 5.1.

https://github.com/FFmpeg/FFmpeg/commit/db6efa1815e217ed76f39aee8b15ee5c64698537

- - - - -
3ae93ce8 by Steve Lhomme at 2024-06-21T15:36:49+02:00
configure: enable VDPAU if libavcodec has been found

`enable_avcodec` is set to "no" if the pkg-config check above fails.
And the version we check is higher than the previous requirement
(57.37.100 vs 56.19.100)

- - - - -


8 changed files:

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


Changes:

=====================================
configure.ac
=====================================
@@ -3437,16 +3437,8 @@ AM_CONDITIONAL([HAVE_VDPAU], [test "${have_vdpau}" = "yes"])
 
 have_avcodec_vdpau="no"
 AS_IF([test "${have_vdpau}" = "yes" -a "${enable_avcodec}" != "no"], [
-  PKG_CHECK_EXISTS([libavcodec >= 56.19.100], [
-    have_avcodec_vdpau="yes"
-    AC_MSG_NOTICE([VDPAU decoding acceleration activated])
-  ], [
-    AS_IF([test -n "${enable_vdpau}"], [
-      AC_MSG_ERROR([libavcodec >= 56.10.0 is required for VDPAU decoding.])
-    ], [
-      AC_MSG_WARN([libavcodec >= 56.10.0 are required for VDPAU decoding.])
-    ])
-  ])
+  have_avcodec_vdpau="yes"
+  AC_MSG_NOTICE([VDPAU decoding acceleration activated])
 ])
 AM_CONDITIONAL([HAVE_AVCODEC_VDPAU], [test "${have_avcodec_vdpau}" = "yes"])
 


=====================================
modules/codec/avcodec/audio.c
=====================================
@@ -138,7 +138,7 @@ static int OpenAudioCodec( decoder_t *p_dec )
     }
 
     ctx->sample_rate = p_dec->fmt_in->audio.i_rate;
-#if LIBAVUTIL_VERSION_CHECK(57, 24, 100)
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
     av_channel_layout_default( &ctx->ch_layout, p_dec->fmt_in->audio.i_channels );
 #else
     ctx->channels = p_dec->fmt_in->audio.i_channels;
@@ -407,7 +407,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
         ret = avcodec_receive_frame( ctx, frame );
         if( ret == 0 )
         {
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
+#if LIBAVUTIL_VERSION_CHECK(57, 24, 100)
             int channels = frame->ch_layout.nb_channels;
 #else
             int channels = ctx->channels;


=====================================
modules/codec/avcodec/avcodec.h
=====================================
@@ -217,8 +217,3 @@ int ffmpeg_OpenCodec( decoder_t *p_dec, AVCodecContext *, const AVCodec * );
    "for encoding the audio bitstream. It takes the following options: " \
    "main, low, ssr (not supported),ltp, hev1, hev2 (default: low). " \
    "hev1 and hev2 are currently supported only with libfdk-aac enabled libavcodec" )
-
-#ifndef AV_VERSION_INT
-#   define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c))
-#endif
-


=====================================
modules/codec/avcodec/chroma.c
=====================================
@@ -33,6 +33,7 @@
  * Only libavutil can be depended on here.
  */
 #include "chroma.h"
+#include "avcommon_compat.h"
 
 /*****************************************************************************
  * Chroma fourcc -> libavutil pixfmt mapping
@@ -121,7 +122,7 @@ static const struct
     {VLC_CODEC_UYVY, AV_PIX_FMT_UYVY422,  COLOR_RANGE_UNDEF },
     {VLC_CODEC_YVYU, AV_PIX_FMT_YVYU422,  COLOR_RANGE_UNDEF },
 
-#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(57, 34, 100)
+#if LIBAVUTIL_VERSION_CHECK(57, 34, 100)
     {VLC_CODEC_VUYA, AV_PIX_FMT_VUYX,     COLOR_RANGE_UNDEF },
 #endif
 


=====================================
modules/codec/avcodec/directx_va.c
=====================================
@@ -305,7 +305,7 @@ static const directx_va_mode_t DXVA_MODES[] = {
     { "VP9 profile Intel",                                                            &DXVA_ModeVP9_VLD_Intel,                8, {1, 1}, 0, NULL, 0 },
 
     /* AV1 */
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 58, 112, 103 )
+#if LIBAVCODEC_VERSION_CHECK( 58, 112, 103 )
     { "AV1 Main profile 8",                                                           &DXVA_ModeAV1_VLD_Profile0,             8, {1, 1}, AV_CODEC_ID_AV1, PROF_AV1_MAIN, 0 },
     { "AV1 Main profile 10",                                                          &DXVA_ModeAV1_VLD_Profile0,            10, {1, 1}, AV_CODEC_ID_AV1, PROF_AV1_MAIN, 0 },
     { "AV1 High profile 8",                                                           &DXVA_ModeAV1_VLD_Profile1,             8, {1, 1}, AV_CODEC_ID_AV1, PROF_AV1_HIGH, 0 },


=====================================
modules/codec/avcodec/encoder.c
=====================================
@@ -778,7 +778,7 @@ int InitVideoEnc( vlc_object_t *p_this )
         int i_channels_src = 0;
 
         msg_Dbg( p_enc, "Creating channel order for reordering");
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
         av_channel_layout_default( &p_context->ch_layout, p_enc->fmt_out.audio.i_channels );
         uint64_t channel_mask = p_context->ch_layout.u.mask;
 #else
@@ -933,7 +933,7 @@ errmsg:
 
         if( p_enc->fmt_out.audio.i_channels > 2 )
         {
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
             av_channel_layout_default( &p_context->ch_layout, 2 );
 #else
             p_context->channels = 2;
@@ -1298,7 +1298,7 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, uns
     av_frame_unref( p_sys->frame );
     p_sys->frame->format     = p_sys->p_context->sample_fmt;
     p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
     av_channel_layout_copy(&p_sys->frame->ch_layout, &p_sys->p_context->ch_layout);
 #else
     p_sys->frame->channel_layout = p_sys->p_context->channel_layout;
@@ -1432,7 +1432,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
         else
             p_sys->frame->nb_samples = p_sys->i_frame_size;
         p_sys->frame->format = p_sys->p_context->sample_fmt;
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
         av_channel_layout_copy(&p_sys->frame->ch_layout, &p_sys->p_context->ch_layout);
 #else
         p_sys->frame->channel_layout = p_sys->p_context->channel_layout;


=====================================
modules/codec/avcodec/fourcc.c
=====================================
@@ -344,11 +344,11 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
     { VLC_CODEC_AGM, AV_CODEC_ID_AGM },
 #endif
 
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 58, 56, 100 )
+#if LIBAVCODEC_VERSION_CHECK( 58, 56, 100 )
     { VLC_CODEC_IMM5, AV_CODEC_ID_IMM5 },
 #endif
 
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 58, 85, 100 )
+#if LIBAVCODEC_VERSION_CHECK( 58, 85, 100 )
     { VLC_CODEC_NOTCHLC, AV_CODEC_ID_NOTCHLC },
 #endif
 


=====================================
modules/demux/avformat/mux.c
=====================================
@@ -271,7 +271,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
     {
     case AUDIO_ES:
         codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
         av_channel_layout_default( &codecpar->ch_layout, fmt->audio.i_channels );
 #else
         codecpar->channels = fmt->audio.i_channels;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c20f510de2266e7ec13d80209a96cd21e25af141...3ae93ce884fa8b4bea879bb05b17a554ac888234

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