You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1431 lines
59 KiB
1431 lines
59 KiB
2 months ago
|
From 8fef83731a6b7324ffd03933272fcfd9b08a2cb0 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Thu, 7 Nov 2024 07:20:57 +0100
|
||
|
Subject: [PATCH 01/15] avcommon: rename LIBAVUTIL_VERSION_CHECK to
|
||
|
LIBAV_UTIL_VERSION_CHECK
|
||
|
|
||
|
The LIBAVUTIL_VERSION_CHECK form will be for checks also done in 4.0.
|
||
|
|
||
|
No functional changes.
|
||
|
---
|
||
|
modules/codec/avcodec/audio.c | 2 +-
|
||
|
modules/codec/avcodec/avcommon_compat.h | 6 +++---
|
||
|
modules/codec/avcodec/chroma.c | 2 +-
|
||
|
modules/codec/avcodec/encoder.c | 2 +-
|
||
|
modules/codec/avcodec/va.c | 2 +-
|
||
|
modules/codec/avcodec/video.c | 6 +++---
|
||
|
6 files changed, 10 insertions(+), 10 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||
|
index c74757c76ae..44335ec3cce 100644
|
||
|
--- a/modules/codec/avcodec/audio.c
|
||
|
+++ b/modules/codec/avcodec/audio.c
|
||
|
@@ -41,7 +41,7 @@
|
||
|
#include <libavcodec/avcodec.h>
|
||
|
#include <libavutil/mem.h>
|
||
|
|
||
|
-#define API_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_CHECK( 52, 2, 6, 0, 100))
|
||
|
+#define API_CHANNEL_LAYOUT (LIBAV_UTIL_VERSION_CHECK( 52, 2, 6, 0, 100))
|
||
|
|
||
|
#if API_CHANNEL_LAYOUT
|
||
|
# include <libavutil/channel_layout.h>
|
||
|
diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
|
||
|
index 561ad83f99f..bb2b9ae03e5 100644
|
||
|
--- a/modules/codec/avcodec/avcommon_compat.h
|
||
|
+++ b/modules/codec/avcodec/avcommon_compat.h
|
||
|
@@ -86,15 +86,15 @@
|
||
|
#ifdef HAVE_LIBAVUTIL_AVUTIL_H
|
||
|
# include <libavutil/avutil.h>
|
||
|
|
||
|
-/* LIBAVUTIL_VERSION_CHECK checks for the right version of libav and FFmpeg
|
||
|
+/* LIBAV_UTIL_VERSION_CHECK checks for the right version of libav and 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 ) \
|
||
|
+#define LIBAV_UTIL_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 ) ) )
|
||
|
|
||
|
-#if !LIBAVUTIL_VERSION_CHECK( 52, 11, 0, 32, 100 )
|
||
|
+#if !LIBAV_UTIL_VERSION_CHECK( 52, 11, 0, 32, 100 )
|
||
|
# define AV_PIX_FMT_FLAG_HWACCEL PIX_FMT_HWACCEL
|
||
|
#endif
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/chroma.c b/modules/codec/avcodec/chroma.c
|
||
|
index cb9634db597..da20bcb10b3 100644
|
||
|
--- a/modules/codec/avcodec/chroma.c
|
||
|
+++ b/modules/codec/avcodec/chroma.c
|
||
|
@@ -180,7 +180,7 @@ static const struct
|
||
|
{VLC_CODEC_GBR_PLANAR_16B, AV_PIX_FMT_GBRP16BE, 0, 0, 0 },
|
||
|
|
||
|
/* XYZ */
|
||
|
-#if LIBAVUTIL_VERSION_CHECK(52, 10, 0, 25, 100)
|
||
|
+#if LIBAV_UTIL_VERSION_CHECK(52, 10, 0, 25, 100)
|
||
|
{VLC_CODEC_XYZ12, AV_PIX_FMT_XYZ12, 0xfff0, 0xfff0, 0xfff0},
|
||
|
#endif
|
||
|
{ 0, 0, 0, 0, 0 }
|
||
|
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
|
||
|
index ae746c99fc8..c9a34d8f0da 100644
|
||
|
--- a/modules/codec/avcodec/encoder.c
|
||
|
+++ b/modules/codec/avcodec/encoder.c
|
||
|
@@ -47,7 +47,7 @@
|
||
|
#include "avcodec.h"
|
||
|
#include "avcommon.h"
|
||
|
|
||
|
-#define API_CHANNEL_LAYOUT (LIBAVUTIL_VERSION_CHECK( 52, 2, 6, 0, 100))
|
||
|
+#define API_CHANNEL_LAYOUT (LIBAV_UTIL_VERSION_CHECK( 52, 2, 6, 0, 100))
|
||
|
|
||
|
#if API_CHANNEL_LAYOUT
|
||
|
# include <libavutil/channel_layout.h>
|
||
|
diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
|
||
|
index 0feb03b974f..06de54ddcf0 100644
|
||
|
--- a/modules/codec/avcodec/va.c
|
||
|
+++ b/modules/codec/avcodec/va.c
|
||
|
@@ -58,7 +58,7 @@ vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum PixelFormat swfmt)
|
||
|
}
|
||
|
break;
|
||
|
|
||
|
-#if LIBAVUTIL_VERSION_CHECK(54, 13, 1, 24, 100)
|
||
|
+#if LIBAV_UTIL_VERSION_CHECK(54, 13, 1, 24, 100)
|
||
|
case AV_PIX_FMT_D3D11VA_VLD:
|
||
|
switch (swfmt)
|
||
|
{
|
||
|
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
|
||
|
index 8c892dd3f48..deefd3076a9 100644
|
||
|
--- a/modules/codec/avcodec/video.c
|
||
|
+++ b/modules/codec/avcodec/video.c
|
||
|
@@ -257,12 +257,12 @@ static int lavc_GetVideoFormat(decoder_t *dec, video_format_t *restrict fmt,
|
||
|
case AVCOL_TRC_BT2020_12:
|
||
|
fmt->transfer = TRANSFER_FUNC_BT2020;
|
||
|
break;
|
||
|
-#if LIBAVUTIL_VERSION_CHECK( 55, 14, 0, 31, 100)
|
||
|
+#if LIBAV_UTIL_VERSION_CHECK( 55, 14, 0, 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 LIBAV_UTIL_VERSION_CHECK( 55, 17, 0, 37, 100)
|
||
|
case AVCOL_TRC_SMPTE2084:
|
||
|
fmt->transfer = TRANSFER_FUNC_SMPTE_ST2084;
|
||
|
break;
|
||
|
@@ -687,7 +687,7 @@ static int ffmpeg_OpenVa(decoder_t *p_dec, AVCodecContext *p_context,
|
||
|
static const enum PixelFormat hwfmts[] =
|
||
|
{
|
||
|
#ifdef _WIN32
|
||
|
-#if LIBAVUTIL_VERSION_CHECK(54, 13, 1, 24, 100)
|
||
|
+#if LIBAV_UTIL_VERSION_CHECK(54, 13, 1, 24, 100)
|
||
|
AV_PIX_FMT_D3D11VA_VLD,
|
||
|
#endif
|
||
|
AV_PIX_FMT_DXVA2_VLD,
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From 5efaca393b7388d629bba920127eb5465325c436 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Wed, 19 Jun 2024 13:56:31 +0200
|
||
|
Subject: [PATCH 02/15] avcommon: use a specific macro to check the FFmpeg
|
||
|
libavutil version
|
||
|
|
||
|
This macro doesn't check for libav which is assumed to not have to relevant
|
||
|
code. This is the same macro name used in VLC 4.0.
|
||
|
---
|
||
|
modules/codec/avcodec/avcommon_compat.h | 6 +++++-
|
||
|
modules/codec/avcodec/chroma.c | 8 ++++----
|
||
|
modules/codec/avcodec/video.c | 7 ++++---
|
||
|
3 files changed, 13 insertions(+), 8 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
|
||
|
index bb2b9ae03e5..5bade93b3c5 100644
|
||
|
--- a/modules/codec/avcodec/avcommon_compat.h
|
||
|
+++ b/modules/codec/avcodec/avcommon_compat.h
|
||
|
@@ -86,7 +86,11 @@
|
||
|
#ifdef HAVE_LIBAVUTIL_AVUTIL_H
|
||
|
# include <libavutil/avutil.h>
|
||
|
|
||
|
-/* LIBAV_UTIL_VERSION_CHECK checks for the right version of libav and FFmpeg
|
||
|
+/* check the FFmpeg libavutil version */
|
||
|
+#define LIBAVUTIL_VERSION_CHECK( a, d, e ) \
|
||
|
+ (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( a, d, e ) )
|
||
|
+
|
||
|
+/* LIBAV_UTIL_VERSION_CHECK checks for the right libavutil version of libav and 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 */
|
||
|
diff --git a/modules/codec/avcodec/chroma.c b/modules/codec/avcodec/chroma.c
|
||
|
index da20bcb10b3..156fb0beec8 100644
|
||
|
--- a/modules/codec/avcodec/chroma.c
|
||
|
+++ b/modules/codec/avcodec/chroma.c
|
||
|
@@ -86,7 +86,7 @@ static const struct
|
||
|
{VLC_CODEC_I420_9B, AV_PIX_FMT_YUV420P9BE, 0, 0, 0 },
|
||
|
{VLC_CODEC_I420_10L, AV_PIX_FMT_YUV420P10LE, 0, 0, 0 },
|
||
|
{VLC_CODEC_I420_10B, AV_PIX_FMT_YUV420P10BE, 0, 0, 0 },
|
||
|
-#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 54, 17, 100 ) )
|
||
|
+#if LIBAVUTIL_VERSION_CHECK( 54, 17, 100 )
|
||
|
{VLC_CODEC_I420_12L, AV_PIX_FMT_YUV420P12LE, 0, 0, 0 },
|
||
|
{VLC_CODEC_I420_12B, AV_PIX_FMT_YUV420P12BE, 0, 0, 0 },
|
||
|
#endif
|
||
|
@@ -100,7 +100,7 @@ static const struct
|
||
|
{VLC_CODEC_I422_9B, AV_PIX_FMT_YUV422P9BE, 0, 0, 0 },
|
||
|
{VLC_CODEC_I422_10L, AV_PIX_FMT_YUV422P10LE, 0, 0, 0 },
|
||
|
{VLC_CODEC_I422_10B, AV_PIX_FMT_YUV422P10BE, 0, 0, 0 },
|
||
|
-#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 54, 17, 100 ) )
|
||
|
+#if LIBAVUTIL_VERSION_CHECK( 54, 17, 100 )
|
||
|
{VLC_CODEC_I422_12L, AV_PIX_FMT_YUV422P12LE, 0, 0, 0 },
|
||
|
{VLC_CODEC_I422_12B, AV_PIX_FMT_YUV422P12BE, 0, 0, 0 },
|
||
|
#endif
|
||
|
@@ -116,7 +116,7 @@ static const struct
|
||
|
{VLC_CODEC_I444_9B, AV_PIX_FMT_YUV444P9BE, 0, 0, 0 },
|
||
|
{VLC_CODEC_I444_10L, AV_PIX_FMT_YUV444P10LE, 0, 0, 0 },
|
||
|
{VLC_CODEC_I444_10B, AV_PIX_FMT_YUV444P10BE, 0, 0, 0 },
|
||
|
-#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 54, 17, 100 ) )
|
||
|
+#if LIBAVUTIL_VERSION_CHECK( 54, 17, 100 )
|
||
|
{VLC_CODEC_I444_12L, AV_PIX_FMT_YUV444P12LE, 0, 0, 0 },
|
||
|
{VLC_CODEC_I444_12B, AV_PIX_FMT_YUV444P12BE, 0, 0, 0 },
|
||
|
#endif
|
||
|
@@ -145,7 +145,7 @@ static const struct
|
||
|
VLC_RGB( VLC_CODEC_RGB32, AV_PIX_FMT_0BGR32, AV_PIX_FMT_0RGB32, 0x000000ff, 0x0000ff00, 0x00ff0000 )
|
||
|
#endif
|
||
|
|
||
|
-#if (LIBAVUTIL_VERSION_MICRO == 0 || LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 55, 0, 100 ) )
|
||
|
+#if (LIBAVUTIL_VERSION_MICRO == 0 || LIBAVUTIL_VERSION_CHECK( 55, 0, 100 ) )
|
||
|
#ifdef WORDS_BIGENDIAN
|
||
|
{VLC_CODEC_RGBA64, AV_PIX_FMT_RGBA64BE, 0, 0, 0 },
|
||
|
#else /* !WORDS_BIGENDIAN */
|
||
|
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
|
||
|
index deefd3076a9..d3284da8aed 100644
|
||
|
--- a/modules/codec/avcodec/video.c
|
||
|
+++ b/modules/codec/avcodec/video.c
|
||
|
@@ -39,7 +39,8 @@
|
||
|
#include <libavcodec/avcodec.h>
|
||
|
#include <libavutil/mem.h>
|
||
|
#include <libavutil/pixdesc.h>
|
||
|
-#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 55, 16, 101 ) )
|
||
|
+#include "avcommon_compat.h"
|
||
|
+#if LIBAVUTIL_VERSION_CHECK( 55, 16, 101 )
|
||
|
#include <libavutil/mastering_display_metadata.h>
|
||
|
#endif
|
||
|
|
||
|
@@ -995,7 +996,7 @@ static int DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p_
|
||
|
decoder_sys_t *p_sys = p_dec->p_sys;
|
||
|
bool format_changed = false;
|
||
|
|
||
|
-#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 55, 16, 101 ) )
|
||
|
+#if LIBAVUTIL_VERSION_CHECK( 55, 16, 101 )
|
||
|
#define FROM_AVRAT(default_factor, avrat) \
|
||
|
(uint64_t)(default_factor) * (avrat).num / (avrat).den
|
||
|
const AVFrameSideData *metadata =
|
||
|
@@ -1050,7 +1051,7 @@ static int DecodeSidedata( decoder_t *p_dec, const AVFrame *frame, picture_t *p_
|
||
|
#undef FROM_AVRAT
|
||
|
}
|
||
|
#endif
|
||
|
-#if (LIBAVUTIL_VERSION_MICRO >= 100 && LIBAVUTIL_VERSION_INT >= AV_VERSION_INT( 55, 60, 100 ) )
|
||
|
+#if LIBAVUTIL_VERSION_CHECK( 55, 60, 100 )
|
||
|
const AVFrameSideData *metadata_lt =
|
||
|
av_frame_get_side_data( frame,
|
||
|
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL );
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From 554a97ab33cd680b60731ec85fd9122329291725 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Thu, 7 Nov 2024 07:22:26 +0100
|
||
|
Subject: [PATCH 03/15] avcommon: rename LIBAVFORMAT_VERSION_CHECK to
|
||
|
LIBAV_FORMAT_VERSION_CHECK
|
||
|
|
||
|
The LIBAVFORMAT_VERSION_CHECK form will be for checks also done in 4.0.
|
||
|
|
||
|
No functional changes.
|
||
|
---
|
||
|
modules/codec/avcodec/avcommon_compat.h | 2 +-
|
||
|
modules/demux/avformat/mux.c | 10 +++++-----
|
||
|
2 files changed, 6 insertions(+), 6 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
|
||
|
index 5bade93b3c5..d0096bc1bbb 100644
|
||
|
--- a/modules/codec/avcodec/avcommon_compat.h
|
||
|
+++ b/modules/codec/avcodec/avcommon_compat.h
|
||
|
@@ -126,7 +126,7 @@
|
||
|
#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
|
||
|
# include <libavformat/avformat.h>
|
||
|
|
||
|
-#define LIBAVFORMAT_VERSION_CHECK( a, b, c, d, e ) \
|
||
|
+#define LIBAV_FORMAT_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 ) ) )
|
||
|
|
||
|
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
|
||
|
index 033a87bdaaa..182e94587ad 100644
|
||
|
--- a/modules/demux/avformat/mux.c
|
||
|
+++ b/modules/demux/avformat/mux.c
|
||
|
@@ -61,7 +61,7 @@ struct sout_mux_sys_t
|
||
|
bool b_write_header;
|
||
|
bool b_write_keyframe;
|
||
|
bool b_error;
|
||
|
-#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
|
||
|
+#if LIBAV_FORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
|
||
|
bool b_header_done;
|
||
|
#endif
|
||
|
};
|
||
|
@@ -80,7 +80,7 @@ static int IOWrite( void *opaque, uint8_t *buf, int buf_size );
|
||
|
static int IOWrite( void *opaque, const uint8_t *buf, int buf_size );
|
||
|
#endif
|
||
|
static int64_t IOSeek( void *opaque, int64_t offset, int whence );
|
||
|
-#if LIBAVFORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
|
||
|
+#if LIBAV_FORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
|
||
|
# if FF_API_AVIO_WRITE_NONCONST
|
||
|
static int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
|
||
|
enum AVIODataMarkerType type, int64_t time);
|
||
|
@@ -168,7 +168,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 LIBAV_FORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
|
||
|
p_sys->io->write_data_type = IOWriteTyped;
|
||
|
p_sys->b_header_done = false;
|
||
|
#endif
|
||
|
@@ -419,7 +419,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 LIBAV_FORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
|
||
|
# if FF_API_AVIO_WRITE_NONCONST
|
||
|
int IOWriteTyped(void *opaque, uint8_t *buf, int buf_size,
|
||
|
enum AVIODataMarkerType type, int64_t time)
|
||
|
@@ -545,7 +545,7 @@ static int IOWrite( void *opaque, const 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 LIBAV_FORMAT_VERSION_CHECK( 57, 7, 0, 40, 100 )
|
||
|
if( !p_sys->b_header_done )
|
||
|
p_buf->i_flags |= BLOCK_FLAG_HEADER;
|
||
|
#endif
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From d406a3127635afcba2436cbc9cbb3efbdc826331 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Wed, 19 Jun 2024 13:57:24 +0200
|
||
|
Subject: [PATCH 04/15] avcommon: use a specific macro to check the FFmpeg
|
||
|
libavformat version
|
||
|
|
||
|
This macro doesn't check for libav which is assumed to not have to relevant
|
||
|
code. This is the same macro name used in VLC 4.0.
|
||
|
---
|
||
|
modules/codec/avcodec/avcommon.h | 2 +-
|
||
|
modules/codec/avcodec/avcommon_compat.h | 8 ++++++++
|
||
|
modules/demux/avformat/demux.c | 3 +--
|
||
|
modules/demux/avformat/mux.c | 11 ++++-------
|
||
|
4 files changed, 14 insertions(+), 10 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/avcommon.h b/modules/codec/avcodec/avcommon.h
|
||
|
index ff5dba06c92..aa0c0b88b85 100644
|
||
|
--- a/modules/codec/avcodec/avcommon.h
|
||
|
+++ b/modules/codec/avcodec/avcommon.h
|
||
|
@@ -106,7 +106,7 @@ static inline void vlc_init_avformat(vlc_object_t *obj)
|
||
|
|
||
|
avformat_network_init();
|
||
|
|
||
|
-#if (LIBAVFORMAT_VERSION_MICRO < 100) || (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 9, 100))
|
||
|
+#if (LIBAVFORMAT_VERSION_MICRO < 100) || !(LIBAVFORMAT_VERSION_CHECK(58, 9, 100))
|
||
|
av_register_all();
|
||
|
#endif
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
|
||
|
index d0096bc1bbb..3feab3a657e 100644
|
||
|
--- a/modules/codec/avcodec/avcommon_compat.h
|
||
|
+++ b/modules/codec/avcodec/avcommon_compat.h
|
||
|
@@ -126,6 +126,14 @@
|
||
|
#ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
|
||
|
# include <libavformat/avformat.h>
|
||
|
|
||
|
+/* check the FFmpeg libavformat version */
|
||
|
+#define LIBAVFORMAT_VERSION_CHECK( a, d, e ) \
|
||
|
+ (LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT( a, d, e ) )
|
||
|
+
|
||
|
+/* LIBAV_FORMAT_VERSION_CHECK checks for the right libavformat version of libav and 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 LIBAV_FORMAT_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 ) ) )
|
||
|
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
|
||
|
index 830dc0157e2..39d2366cef2 100644
|
||
|
--- a/modules/demux/avformat/demux.c
|
||
|
+++ b/modules/demux/avformat/demux.c
|
||
|
@@ -52,8 +52,7 @@
|
||
|
|
||
|
# define HAVE_AVUTIL_CODEC_ATTACHMENT 1
|
||
|
|
||
|
-#if LIBAVFORMAT_VERSION_MICRO >= 100 && \
|
||
|
- LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(59, 0, 100)
|
||
|
+#if LIBAVFORMAT_VERSION_CHECK(59, 0, 100)
|
||
|
# define AVF_MAYBE_CONST const
|
||
|
#else
|
||
|
# define AVF_MAYBE_CONST
|
||
|
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
|
||
|
index 182e94587ad..664a646734c 100644
|
||
|
--- a/modules/demux/avformat/mux.c
|
||
|
+++ b/modules/demux/avformat/mux.c
|
||
|
@@ -95,8 +95,7 @@ int IOWriteTyped(void *opaque, const uint8_t *buf, int buf_size,
|
||
|
*****************************************************************************/
|
||
|
int avformat_OpenMux( vlc_object_t *p_this )
|
||
|
{
|
||
|
-#if LIBAVFORMAT_VERSION_MICRO >= 100 && \
|
||
|
- LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(59, 0, 100)
|
||
|
+#if LIBAVFORMAT_VERSION_CHECK(59, 0, 100)
|
||
|
const AVOutputFormat *file_oformat;
|
||
|
#else
|
||
|
AVOutputFormat *file_oformat;
|
||
|
@@ -104,8 +103,7 @@ 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_MICRO >= 100) \
|
||
|
- && (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 7, 100)) )
|
||
|
+#if LIBAVFORMAT_VERSION_MICRO >= 100 && !(LIBAVFORMAT_VERSION_CHECK(58, 7, 100))
|
||
|
if( dummy && strlen(p_mux->p_access->psz_path)
|
||
|
>= sizeof (((AVFormatContext *)NULL)->filename) )
|
||
|
return VLC_EGENERIC;
|
||
|
@@ -144,8 +142,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_MICRO >= 100) \
|
||
|
- && (LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(58, 7, 100)) )
|
||
|
+#if LIBAVFORMAT_VERSION_CHECK(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 );
|
||
|
@@ -397,7 +394,7 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
|
||
|
pkt->dts = p_data->i_dts * p_stream->time_base.den /
|
||
|
CLOCK_FREQ / p_stream->time_base.num;
|
||
|
|
||
|
-#if LIBAVFORMAT_VERSION_MICRO >= 100 && LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(59, 2, 103)
|
||
|
+#if LIBAVFORMAT_VERSION_MICRO >= 100 && !(LIBAVFORMAT_VERSION_CHECK(59, 2, 103))
|
||
|
/* this is another hack to prevent libavformat from triggering the "non monotone timestamps" check in avformat/utils.c */
|
||
|
p_stream->cur_dts = ( p_data->i_dts * p_stream->time_base.den /
|
||
|
CLOCK_FREQ / p_stream->time_base.num ) - 1;
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From 930ddc0d0fec55fff6c2ed0ffcc904773bae6622 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Thu, 7 Nov 2024 07:23:27 +0100
|
||
|
Subject: [PATCH 05/15] avcommon: rename LIBAVCODEC_VERSION_CHECK to
|
||
|
LIBAV_CODEC_VERSION_CHECK
|
||
|
|
||
|
The LIBAVCODEC_VERSION_CHECK form will be for checks also done in 4.0.
|
||
|
|
||
|
No functional changes.
|
||
|
---
|
||
|
modules/codec/avcodec/audio.c | 8 ++++----
|
||
|
modules/codec/avcodec/avcommon_compat.h | 4 ++--
|
||
|
modules/codec/avcodec/d3d11va.c | 4 ++--
|
||
|
modules/codec/avcodec/encoder.c | 10 +++++-----
|
||
|
modules/codec/avcodec/fourcc.c | 14 +++++++-------
|
||
|
modules/codec/avcodec/video.c | 2 +-
|
||
|
6 files changed, 21 insertions(+), 21 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||
|
index 44335ec3cce..7a979e96e19 100644
|
||
|
--- a/modules/codec/avcodec/audio.c
|
||
|
+++ b/modules/codec/avcodec/audio.c
|
||
|
@@ -142,7 +142,7 @@ static int OpenAudioCodec( decoder_t *p_dec )
|
||
|
}
|
||
|
|
||
|
ctx->sample_rate = p_dec->fmt_in.audio.i_rate;
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 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;
|
||
|
@@ -402,7 +402,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, 999, 999, 24, 100)
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
int channels = frame->ch_layout.nb_channels;
|
||
|
#else
|
||
|
int channels = ctx->channels;
|
||
|
@@ -592,7 +592,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
|
||
|
p_dec->fmt_out.audio.i_rate = p_sys->p_context->sample_rate;
|
||
|
|
||
|
/* */
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
if( p_sys->i_previous_channels == p_sys->p_context->ch_layout.nb_channels &&
|
||
|
p_sys->i_previous_layout == p_sys->p_context->ch_layout.u.mask )
|
||
|
return;
|
||
|
@@ -617,7 +617,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
|
||
|
|
||
|
int i_channels_src = 0, channel_count;
|
||
|
uint64_t channel_layout_mask;
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
channel_layout_mask = p_sys->p_context->ch_layout.u.mask;
|
||
|
channel_count = p_sys->p_context->ch_layout.nb_channels;
|
||
|
#elif API_CHANNEL_LAYOUT
|
||
|
diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
|
||
|
index 3feab3a657e..b504fcd8218 100644
|
||
|
--- a/modules/codec/avcodec/avcommon_compat.h
|
||
|
+++ b/modules/codec/avcodec/avcommon_compat.h
|
||
|
@@ -30,11 +30,11 @@
|
||
|
#ifdef HAVE_LIBAVCODEC_AVCODEC_H
|
||
|
#include <libavcodec/avcodec.h>
|
||
|
|
||
|
-/* LIBAVCODEC_VERSION_CHECK checks for the right version of libav and FFmpeg
|
||
|
+/* LIBAV_CODEC_VERSION_CHECK checks for the right version of libav and 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 ) \
|
||
|
+#define LIBAV_CODEC_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 ) ) )
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
|
||
|
index 5260628364f..e1c10d31188 100644
|
||
|
--- a/modules/codec/avcodec/d3d11va.c
|
||
|
+++ b/modules/codec/avcodec/d3d11va.c
|
||
|
@@ -76,7 +76,7 @@ vlc_module_end()
|
||
|
* So we get the surfaces from the decoder pool when needed. We don't need to
|
||
|
* extract the decoded surface into the decoder picture anymore.
|
||
|
*/
|
||
|
-#define D3D11_DIRECT_DECODE LIBAVCODEC_VERSION_CHECK( 57, 30, 3, 72, 101 )
|
||
|
+#define D3D11_DIRECT_DECODE LIBAV_CODEC_VERSION_CHECK( 57, 30, 3, 72, 101 )
|
||
|
|
||
|
#include <initguid.h> /* must be last included to not redefine existing GUIDs */
|
||
|
|
||
|
@@ -764,7 +764,7 @@ static int DxCreateDecoderSurfaces(vlc_va_t *va, int codec_id,
|
||
|
assert(texDesc.Format == sys->render);
|
||
|
assert(texDesc.BindFlags & D3D11_BIND_DECODER);
|
||
|
|
||
|
-#if !LIBAVCODEC_VERSION_CHECK( 57, 27, 2, 61, 102 )
|
||
|
+#if !LIBAV_CODEC_VERSION_CHECK( 57, 27, 2, 61, 102 )
|
||
|
if (pic->p_sys->slice_index != surface_idx)
|
||
|
{
|
||
|
msg_Warn(va, "d3d11va requires decoding slices to be the first in the texture (%d/%d)",
|
||
|
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
|
||
|
index c9a34d8f0da..9cf9a7d0607 100644
|
||
|
--- a/modules/codec/avcodec/encoder.c
|
||
|
+++ b/modules/codec/avcodec/encoder.c
|
||
|
@@ -183,7 +183,7 @@ static const uint64_t pi_channels_map[][2] =
|
||
|
{ AV_CH_STEREO_RIGHT, 0 },
|
||
|
};
|
||
|
|
||
|
-# if !LIBAVCODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+# if !LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
static const uint32_t channel_mask[][2] = {
|
||
|
{0,0},
|
||
|
{AOUT_CHAN_CENTER, AV_CH_LAYOUT_MONO},
|
||
|
@@ -765,7 +765,7 @@ int InitVideoEnc( vlc_object_t *p_this )
|
||
|
uint32_t order_mask = 0;
|
||
|
int i_channels_src = 0;
|
||
|
msg_Dbg( p_enc, "Creating channel order for reordering");
|
||
|
-# if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+# if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 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
|
||
|
@@ -918,7 +918,7 @@ errmsg:
|
||
|
|
||
|
if( p_enc->fmt_out.audio.i_channels > 2 )
|
||
|
{
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
av_channel_layout_default( &p_context->ch_layout, 2 );
|
||
|
#else
|
||
|
p_context->channels = 2;
|
||
|
@@ -1282,7 +1282,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, 999, 999, 24, 100)
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 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;
|
||
|
@@ -1417,7 +1417,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
|
||
|
p_sys->frame->pts = date_Get( &p_sys->buffer_date ) * p_sys->p_context->time_base.den /
|
||
|
CLOCK_FREQ / p_sys->p_context->time_base.num;
|
||
|
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 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;
|
||
|
diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
|
||
|
index 97f3188211d..3aea6b58ff0 100644
|
||
|
--- a/modules/codec/avcodec/fourcc.c
|
||
|
+++ b/modules/codec/avcodec/fourcc.c
|
||
|
@@ -230,7 +230,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 LIBAV_CODEC_VERSION_CHECK( 57, 26, 0, 83, 101 )
|
||
|
{ VLC_CODEC_AV1, AV_CODEC_ID_AV1 },
|
||
|
#endif
|
||
|
{ VLC_CODEC_ICOD, AV_CODEC_ID_AIC },
|
||
|
@@ -285,19 +285,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( 57, 999, 999, 24, 102 )
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 24, 102 )
|
||
|
{ VLC_CODEC_CINEFORM, AV_CODEC_ID_CFHD },
|
||
|
#endif
|
||
|
|
||
|
-#if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 70, 100 )
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 70, 100 )
|
||
|
{ VLC_CODEC_PIXLET, AV_CODEC_ID_PIXLET },
|
||
|
#endif
|
||
|
|
||
|
-#if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 71, 101 )
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 71, 101 )
|
||
|
{ VLC_CODEC_SPEEDHQ, AV_CODEC_ID_SPEEDHQ },
|
||
|
#endif
|
||
|
|
||
|
-#if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 79, 100 )
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 79, 100 )
|
||
|
{ VLC_CODEC_FMVC, AV_CODEC_ID_FMVC },
|
||
|
#endif
|
||
|
};
|
||
|
@@ -414,7 +414,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_CHECK( 57, 999, 999, 71, 100 )
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 71, 100 )
|
||
|
{ VLC_CODEC_QDMC, AV_CODEC_ID_QDMC },
|
||
|
#endif
|
||
|
{ VLC_CODEC_COOK, AV_CODEC_ID_COOK },
|
||
|
@@ -482,7 +482,7 @@ static const struct vlc_avcodec_fourcc spu_codecs[] =
|
||
|
{ VLC_CODEC_SSA, AV_CODEC_ID_SSA },
|
||
|
/* AV_CODEC_ID_MOV_TEXT */
|
||
|
{ VLC_CODEC_BD_PG, AV_CODEC_ID_HDMV_PGS_SUBTITLE },
|
||
|
-#if LIBAVCODEC_VERSION_CHECK( 57, 999, 999, 71, 100 )
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 71, 100 )
|
||
|
{ VLC_CODEC_BD_TEXT, AV_CODEC_ID_HDMV_TEXT_SUBTITLE },
|
||
|
#endif
|
||
|
{ VLC_CODEC_TELETEXT, AV_CODEC_ID_DVB_TELETEXT },
|
||
|
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
|
||
|
index d3284da8aed..552c602edf6 100644
|
||
|
--- a/modules/codec/avcodec/video.c
|
||
|
+++ b/modules/codec/avcodec/video.c
|
||
|
@@ -1307,7 +1307,7 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
|
||
|
}
|
||
|
|
||
|
/* Compute the PTS */
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(57, 24, 0, 61, 100)
|
||
|
+#if LIBAV_CODEC_VERSION_CHECK(57, 24, 0, 61, 100)
|
||
|
# if LIBAVCODEC_VERSION_MICRO >= 100
|
||
|
vlc_tick_t i_pts = frame->best_effort_timestamp;
|
||
|
# else
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From ce084152c9bade041ca18e19c3b264e4e134c6c3 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Wed, 19 Jun 2024 13:59:15 +0200
|
||
|
Subject: [PATCH 06/15] avcommon: use a specific macro to check the FFmpeg
|
||
|
libavcodec version
|
||
|
|
||
|
This macro doesn't check for libav which is assumed to not have to relevant
|
||
|
code. This is the same macro name used in VLC 4.0.
|
||
|
---
|
||
|
modules/codec/avcodec/audio.c | 8 ++++----
|
||
|
modules/codec/avcodec/avcommon.h | 2 +-
|
||
|
modules/codec/avcodec/avcommon_compat.h | 4 ++++
|
||
|
modules/codec/avcodec/directx_va.c | 4 ++--
|
||
|
modules/codec/avcodec/encoder.c | 13 ++++++-------
|
||
|
modules/codec/avcodec/fourcc.c | 18 ++++++++----------
|
||
|
modules/codec/avcodec/video.c | 3 +--
|
||
|
modules/demux/avformat/demux.c | 2 +-
|
||
|
modules/demux/avformat/mux.c | 2 +-
|
||
|
9 files changed, 28 insertions(+), 28 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||
|
index 7a979e96e19..a3f67f7bd93 100644
|
||
|
--- a/modules/codec/avcodec/audio.c
|
||
|
+++ b/modules/codec/avcodec/audio.c
|
||
|
@@ -142,7 +142,7 @@ static int OpenAudioCodec( decoder_t *p_dec )
|
||
|
}
|
||
|
|
||
|
ctx->sample_rate = p_dec->fmt_in.audio.i_rate;
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAVCODEC_VERSION_CHECK(59, 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;
|
||
|
@@ -402,7 +402,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
|
||
|
ret = avcodec_receive_frame( ctx, frame );
|
||
|
if( ret == 0 )
|
||
|
{
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
|
||
|
int channels = frame->ch_layout.nb_channels;
|
||
|
#else
|
||
|
int channels = ctx->channels;
|
||
|
@@ -592,7 +592,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
|
||
|
p_dec->fmt_out.audio.i_rate = p_sys->p_context->sample_rate;
|
||
|
|
||
|
/* */
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
|
||
|
if( p_sys->i_previous_channels == p_sys->p_context->ch_layout.nb_channels &&
|
||
|
p_sys->i_previous_layout == p_sys->p_context->ch_layout.u.mask )
|
||
|
return;
|
||
|
@@ -617,7 +617,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
|
||
|
|
||
|
int i_channels_src = 0, channel_count;
|
||
|
uint64_t channel_layout_mask;
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
|
||
|
channel_layout_mask = p_sys->p_context->ch_layout.u.mask;
|
||
|
channel_count = p_sys->p_context->ch_layout.nb_channels;
|
||
|
#elif API_CHANNEL_LAYOUT
|
||
|
diff --git a/modules/codec/avcodec/avcommon.h b/modules/codec/avcodec/avcommon.h
|
||
|
index aa0c0b88b85..10ad13dc5f8 100644
|
||
|
--- a/modules/codec/avcodec/avcommon.h
|
||
|
+++ b/modules/codec/avcodec/avcommon.h
|
||
|
@@ -123,7 +123,7 @@ static inline void vlc_init_avcodec(vlc_object_t *obj)
|
||
|
|
||
|
vlc_init_avutil(obj);
|
||
|
|
||
|
-#if (LIBAVFORMAT_VERSION_MICRO < 100) || (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 10, 100))
|
||
|
+#if (LIBAVFORMAT_VERSION_MICRO < 100) || !(LIBAVCODEC_VERSION_CHECK(58, 10, 100))
|
||
|
avcodec_register_all();
|
||
|
#endif
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/avcommon_compat.h b/modules/codec/avcodec/avcommon_compat.h
|
||
|
index b504fcd8218..ac02c06d233 100644
|
||
|
--- a/modules/codec/avcodec/avcommon_compat.h
|
||
|
+++ b/modules/codec/avcodec/avcommon_compat.h
|
||
|
@@ -30,6 +30,10 @@
|
||
|
#ifdef HAVE_LIBAVCODEC_AVCODEC_H
|
||
|
#include <libavcodec/avcodec.h>
|
||
|
|
||
|
+/* check the FFmpeg libavutil version */
|
||
|
+#define LIBAVCODEC_VERSION_CHECK( a, d, e ) \
|
||
|
+ (LIBAVCODEC_VERSION_MICRO >= 100 && LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( a, d, e ) )
|
||
|
+
|
||
|
/* LIBAV_CODEC_VERSION_CHECK checks for the right version of libav and FFmpeg
|
||
|
* a is the major version
|
||
|
* b and c the minor and micro versions of libav
|
||
|
diff --git a/modules/codec/avcodec/directx_va.c b/modules/codec/avcodec/directx_va.c
|
||
|
index 5b7980fd97d..36a5d61a559 100644
|
||
|
--- a/modules/codec/avcodec/directx_va.c
|
||
|
+++ b/modules/codec/avcodec/directx_va.c
|
||
|
@@ -284,7 +284,7 @@ static const directx_va_mode_t DXVA_MODES[] = {
|
||
|
|
||
|
/* VPx */
|
||
|
{ "VP8", &DXVA_ModeVP8_VLD, 8, 0, NULL },
|
||
|
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 57, 17, 100 ) && LIBAVCODEC_VERSION_MICRO >= 100
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 57, 17, 100 )
|
||
|
{ "VP9 profile 0", &DXVA_ModeVP9_VLD_Profile0, 8, AV_CODEC_ID_VP9, PROF_VP9_MAIN },
|
||
|
{ "VP9 profile 2", &DXVA_ModeVP9_VLD_10bit_Profile2, 10, AV_CODEC_ID_VP9, PROF_VP9_10 },
|
||
|
#else
|
||
|
@@ -294,7 +294,7 @@ static const directx_va_mode_t DXVA_MODES[] = {
|
||
|
{ "VP9 profile Intel", &DXVA_ModeVP9_VLD_Intel, 8, 0, NULL },
|
||
|
|
||
|
/* AV1 */
|
||
|
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 58, 112, 103 ) && LIBAVCODEC_VERSION_MICRO >= 100
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 58, 112, 103 )
|
||
|
{ "AV1 Main profile 8", &DXVA_ModeAV1_VLD_Profile0, 8, AV_CODEC_ID_AV1, PROF_AV1_MAIN },
|
||
|
{ "AV1 Main profile 10", &DXVA_ModeAV1_VLD_Profile0, 10, AV_CODEC_ID_AV1, PROF_AV1_MAIN },
|
||
|
{ "AV1 High profile 8", &DXVA_ModeAV1_VLD_Profile1, 8, AV_CODEC_ID_AV1, PROF_AV1_HIGH },
|
||
|
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
|
||
|
index 9cf9a7d0607..2014b8afaf5 100644
|
||
|
--- a/modules/codec/avcodec/encoder.c
|
||
|
+++ b/modules/codec/avcodec/encoder.c
|
||
|
@@ -61,8 +61,7 @@
|
||
|
|
||
|
#define RAW_AUDIO_FRAME_SIZE (2048)
|
||
|
|
||
|
-#if LIBAVCODEC_VERSION_MICRO >= 100 && \
|
||
|
- LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59, 0, 100)
|
||
|
+#if LIBAVCODEC_VERSION_CHECK(59, 0, 100)
|
||
|
# define AVC_MAYBE_CONST const
|
||
|
#else
|
||
|
# define AVC_MAYBE_CONST
|
||
|
@@ -183,7 +182,7 @@ static const uint64_t pi_channels_map[][2] =
|
||
|
{ AV_CH_STEREO_RIGHT, 0 },
|
||
|
};
|
||
|
|
||
|
-# if !LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+# if !LIBAVCODEC_VERSION_CHECK(59, 24, 100)
|
||
|
static const uint32_t channel_mask[][2] = {
|
||
|
{0,0},
|
||
|
{AOUT_CHAN_CENTER, AV_CH_LAYOUT_MONO},
|
||
|
@@ -765,7 +764,7 @@ int InitVideoEnc( vlc_object_t *p_this )
|
||
|
uint32_t order_mask = 0;
|
||
|
int i_channels_src = 0;
|
||
|
msg_Dbg( p_enc, "Creating channel order for reordering");
|
||
|
-# if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+# if LIBAVCODEC_VERSION_CHECK(59, 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
|
||
|
@@ -918,7 +917,7 @@ errmsg:
|
||
|
|
||
|
if( p_enc->fmt_out.audio.i_channels > 2 )
|
||
|
{
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
|
||
|
av_channel_layout_default( &p_context->ch_layout, 2 );
|
||
|
#else
|
||
|
p_context->channels = 2;
|
||
|
@@ -1282,7 +1281,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 LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAVCODEC_VERSION_CHECK(59, 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;
|
||
|
@@ -1417,7 +1416,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
|
||
|
p_sys->frame->pts = date_Get( &p_sys->buffer_date ) * p_sys->p_context->time_base.den /
|
||
|
CLOCK_FREQ / p_sys->p_context->time_base.num;
|
||
|
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK(59, 999, 999, 24, 100)
|
||
|
+#if LIBAVCODEC_VERSION_CHECK(59, 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;
|
||
|
diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
|
||
|
index 3aea6b58ff0..d75c21ffa49 100644
|
||
|
--- a/modules/codec/avcodec/fourcc.c
|
||
|
+++ b/modules/codec/avcodec/fourcc.c
|
||
|
@@ -182,12 +182,10 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
|
||
|
/* AV_CODEC_ID_V210X */
|
||
|
{ VLC_CODEC_TMV, AV_CODEC_ID_TMV },
|
||
|
{ VLC_CODEC_V210, AV_CODEC_ID_V210 },
|
||
|
-#if LIBAVCODEC_VERSION_MICRO >= 100
|
||
|
-# if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 59, 42, 102 )
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 59, 42, 102 )
|
||
|
{ VLC_CODEC_VUYA, AV_CODEC_ID_RAWVIDEO },
|
||
|
-# elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 54, 50, 100 )
|
||
|
+#elif LIBAVCODEC_VERSION_CHECK( 54, 50, 100 )
|
||
|
{ VLC_CODEC_VUYA, AV_CODEC_ID_AYUV },
|
||
|
-# endif
|
||
|
#endif
|
||
|
/* AV_CODEC_ID_DPX */
|
||
|
{ VLC_CODEC_MAD, AV_CODEC_ID_MAD },
|
||
|
@@ -285,19 +283,19 @@ static const struct vlc_avcodec_fourcc video_codecs[] =
|
||
|
/* ffmpeg only: AV_CODEC_ID_SNOW */
|
||
|
/* ffmpeg only: AV_CODEC_ID_SMVJPEG */
|
||
|
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 24, 102 )
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 57, 24, 102 )
|
||
|
{ VLC_CODEC_CINEFORM, AV_CODEC_ID_CFHD },
|
||
|
#endif
|
||
|
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 70, 100 )
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 57, 70, 100 )
|
||
|
{ VLC_CODEC_PIXLET, AV_CODEC_ID_PIXLET },
|
||
|
#endif
|
||
|
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 71, 101 )
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 57, 71, 101 )
|
||
|
{ VLC_CODEC_SPEEDHQ, AV_CODEC_ID_SPEEDHQ },
|
||
|
#endif
|
||
|
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 79, 100 )
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 57, 79, 100 )
|
||
|
{ VLC_CODEC_FMVC, AV_CODEC_ID_FMVC },
|
||
|
#endif
|
||
|
};
|
||
|
@@ -414,7 +412,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 LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 71, 100 )
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 57, 71, 100 )
|
||
|
{ VLC_CODEC_QDMC, AV_CODEC_ID_QDMC },
|
||
|
#endif
|
||
|
{ VLC_CODEC_COOK, AV_CODEC_ID_COOK },
|
||
|
@@ -482,7 +480,7 @@ static const struct vlc_avcodec_fourcc spu_codecs[] =
|
||
|
{ VLC_CODEC_SSA, AV_CODEC_ID_SSA },
|
||
|
/* AV_CODEC_ID_MOV_TEXT */
|
||
|
{ VLC_CODEC_BD_PG, AV_CODEC_ID_HDMV_PGS_SUBTITLE },
|
||
|
-#if LIBAV_CODEC_VERSION_CHECK( 57, 999, 999, 71, 100 )
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 57, 71, 100 )
|
||
|
{ VLC_CODEC_BD_TEXT, AV_CODEC_ID_HDMV_TEXT_SUBTITLE },
|
||
|
#endif
|
||
|
{ VLC_CODEC_TELETEXT, AV_CODEC_ID_DVB_TELETEXT },
|
||
|
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
|
||
|
index 552c602edf6..c306e916c7d 100644
|
||
|
--- a/modules/codec/avcodec/video.c
|
||
|
+++ b/modules/codec/avcodec/video.c
|
||
|
@@ -1824,8 +1824,7 @@ no_reuse:
|
||
|
if (!can_hwaccel)
|
||
|
return swfmt;
|
||
|
|
||
|
-#if (LIBAVCODEC_VERSION_MICRO >= 100) \
|
||
|
- && (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(57, 83, 101))
|
||
|
+#if (LIBAVCODEC_VERSION_MICRO >= 100) && !(LIBAVCODEC_VERSION_CHECK(57, 83, 101))
|
||
|
if (p_context->active_thread_type)
|
||
|
{
|
||
|
msg_Warn(p_dec, "thread type %d: disabling hardware acceleration",
|
||
|
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
|
||
|
index 39d2366cef2..9975b0f47b6 100644
|
||
|
--- a/modules/demux/avformat/demux.c
|
||
|
+++ b/modules/demux/avformat/demux.c
|
||
|
@@ -400,7 +400,7 @@ int avformat_OpenDemux( vlc_object_t *p_this )
|
||
|
es_format_Init( &es_fmt, AUDIO_ES, fcc );
|
||
|
es_fmt.i_original_fourcc = CodecTagToFourcc( cp->codec_tag );
|
||
|
es_fmt.i_bitrate = cp->bit_rate;
|
||
|
-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 59, 24, 100 ) && LIBAVCODEC_VERSION_MICRO >= 100
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 59, 24, 100 )
|
||
|
es_fmt.audio.i_channels = cp->ch_layout.nb_channels;
|
||
|
#else
|
||
|
es_fmt.audio.i_channels = cp->channels;
|
||
|
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
|
||
|
index 664a646734c..a48190c93ca 100644
|
||
|
--- a/modules/demux/avformat/mux.c
|
||
|
+++ b/modules/demux/avformat/mux.c
|
||
|
@@ -273,7 +273,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_INT >= AV_VERSION_INT( 59, 24, 100 ) && LIBAVCODEC_VERSION_MICRO >= 100
|
||
|
+#if LIBAVCODEC_VERSION_CHECK( 59, 24, 100 )
|
||
|
av_channel_layout_default( &codecpar->ch_layout, fmt->audio.i_channels );
|
||
|
#else
|
||
|
codecpar->channels = fmt->audio.i_channels;
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From 534564b289db7ee966abf888207258c3e6828c98 Mon Sep 17 00:00:00 2001
|
||
|
From: Zhao Zhili <quinkblack@foxmail.com>
|
||
|
Date: Fri, 11 Jun 2021 18:02:34 +0800
|
||
|
Subject: [PATCH 07/15] codec: avcodec: check open codec return value
|
||
|
|
||
|
(cherry picked from commit 21ab6be22e7c1831cebf023fd53bd7ffbfad22f6) (edited)
|
||
|
edited:
|
||
|
- on 3.0 DecodeBlock returns a picture_t, not an error code
|
||
|
---
|
||
|
modules/codec/avcodec/audio.c | 7 ++++++-
|
||
|
modules/codec/avcodec/video.c | 11 +++++++----
|
||
|
2 files changed, 13 insertions(+), 5 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||
|
index a3f67f7bd93..e8436754f4a 100644
|
||
|
--- a/modules/codec/avcodec/audio.c
|
||
|
+++ b/modules/codec/avcodec/audio.c
|
||
|
@@ -309,7 +309,12 @@ static int DecodeBlock( decoder_t *p_dec, block_t **pp_block )
|
||
|
&& !avcodec_is_open( ctx ) )
|
||
|
{
|
||
|
InitDecoderConfig( p_dec, ctx );
|
||
|
- OpenAudioCodec( p_dec );
|
||
|
+ if( OpenAudioCodec( p_dec ) < 0 )
|
||
|
+ {
|
||
|
+ if( pp_block != NULL && *pp_block != NULL )
|
||
|
+ block_Release( *pp_block );
|
||
|
+ return VLCDEC_ECRITICAL;
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
if( !avcodec_is_open( ctx ) )
|
||
|
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
|
||
|
index c306e916c7d..096a0b7940e 100644
|
||
|
--- a/modules/codec/avcodec/video.c
|
||
|
+++ b/modules/codec/avcodec/video.c
|
||
|
@@ -1114,17 +1114,20 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block, bool *error
|
||
|
bool eos_spotted = false;
|
||
|
|
||
|
|
||
|
- block_t *p_block;
|
||
|
+ block_t *p_block = pp_block ? *pp_block : NULL;
|
||
|
vlc_tick_t current_time;
|
||
|
|
||
|
if( !p_context->extradata_size && p_dec->fmt_in.i_extra )
|
||
|
{
|
||
|
ffmpeg_InitCodec( p_dec );
|
||
|
- if( !avcodec_is_open( p_context ) )
|
||
|
- OpenVideoCodec( p_dec );
|
||
|
+ if( !avcodec_is_open( p_context ) && OpenVideoCodec(p_dec) < 0 )
|
||
|
+ {
|
||
|
+ if( p_block != NULL )
|
||
|
+ block_Release( p_block );
|
||
|
+ return NULL;
|
||
|
+ }
|
||
|
}
|
||
|
|
||
|
- p_block = pp_block ? *pp_block : NULL;
|
||
|
if(!p_block && !(p_sys->p_codec->capabilities & AV_CODEC_CAP_DELAY) )
|
||
|
return NULL;
|
||
|
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From b2b54eb1efa3ecc72a4a64d0d962cab0676fbce1 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Fri, 6 Jan 2023 10:16:09 +0100
|
||
|
Subject: [PATCH 08/15] avcodec: use ARRAY_SIZE instead of custom code
|
||
|
|
||
|
(cherry picked from commit 28c80ee47e6cdf961f501eed9d4837956b38afd1)
|
||
|
---
|
||
|
modules/codec/avcodec/audio.c | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||
|
index e8436754f4a..20744010433 100644
|
||
|
--- a/modules/codec/avcodec/audio.c
|
||
|
+++ b/modules/codec/avcodec/audio.c
|
||
|
@@ -558,7 +558,7 @@ vlc_fourcc_t GetVlcAudioFormat( int fmt )
|
||
|
[AV_SAMPLE_FMT_FLTP] = VLC_CODEC_FL32,
|
||
|
[AV_SAMPLE_FMT_DBLP] = VLC_CODEC_FL64,
|
||
|
};
|
||
|
- if( (sizeof(fcc) / sizeof(fcc[0])) > (unsigned)fmt )
|
||
|
+ if( ARRAY_SIZE(fcc) > (unsigned)fmt )
|
||
|
return fcc[fmt];
|
||
|
return VLC_CODEC_S16N;
|
||
|
}
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From 763dc3eba52cb7633a84f44dcde19602fca5eac7 Mon Sep 17 00:00:00 2001
|
||
|
From: Ilkka Ollakka <ileoo@videolan.org>
|
||
|
Date: Wed, 5 Jul 2023 15:09:57 +0300
|
||
|
Subject: [PATCH 09/15] avcodec/audio: make channel mapping array 0 terminated
|
||
|
|
||
|
Also change pi_channels_src to be only AOUT_CHAN_MAX instead of same
|
||
|
size as mapping array.
|
||
|
|
||
|
(cherry picked from commit 0ff86bf8a28a080340f600cb8561815fc43e3b4a) (rebased)
|
||
|
rebased:
|
||
|
- the code around is slightly different
|
||
|
---
|
||
|
modules/codec/avcodec/audio.c | 6 +++---
|
||
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||
|
index 20744010433..04c540173bf 100644
|
||
|
--- a/modules/codec/avcodec/audio.c
|
||
|
+++ b/modules/codec/avcodec/audio.c
|
||
|
@@ -585,6 +585,7 @@ static const uint64_t pi_channels_map[][2] =
|
||
|
{ AV_CH_TOP_BACK_RIGHT, 0 },
|
||
|
{ AV_CH_STEREO_LEFT, 0 },
|
||
|
{ AV_CH_STEREO_RIGHT, 0 },
|
||
|
+ { 0, 0 },
|
||
|
};
|
||
|
|
||
|
static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
|
||
|
@@ -617,8 +618,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
- const unsigned i_order_max = sizeof(pi_channels_map)/sizeof(*pi_channels_map);
|
||
|
- uint32_t pi_order_src[i_order_max];
|
||
|
+ uint32_t pi_order_src[AOUT_CHAN_MAX] = { 0 };
|
||
|
|
||
|
int i_channels_src = 0, channel_count;
|
||
|
uint64_t channel_layout_mask;
|
||
|
@@ -637,7 +637,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
|
||
|
|
||
|
if( channel_layout_mask )
|
||
|
{
|
||
|
- for( unsigned i = 0; i < i_order_max
|
||
|
+ for( unsigned i = 0; pi_channels_map[i][0]
|
||
|
&& i_channels_src < channel_count; i++ )
|
||
|
{
|
||
|
if( channel_layout_mask & pi_channels_map[i][0] )
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From d1fb5c6cb372d2233046064db174daf1987c1211 Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
|
||
|
Date: Mon, 10 Jun 2024 11:10:37 +0700
|
||
|
Subject: [PATCH 10/15] codec: avcodec: fix ch_layout requirement
|
||
|
|
||
|
refs #28667
|
||
|
|
||
|
(cherry picked from commit 41778535dcae8b145ebfaa0392de281e470a91bf) (edited)
|
||
|
edited:
|
||
|
- on 3.0 the audio check was still using a LIBAVCODEC_VERSION_CHECK check
|
||
|
- the mux/demux checks were already there with different spaces
|
||
|
---
|
||
|
modules/codec/avcodec/audio.c | 2 +-
|
||
|
modules/demux/avformat/demux.c | 2 +-
|
||
|
modules/demux/avformat/mux.c | 2 +-
|
||
|
3 files changed, 3 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||
|
index 04c540173bf..979256c400a 100644
|
||
|
--- a/modules/codec/avcodec/audio.c
|
||
|
+++ b/modules/codec/avcodec/audio.c
|
||
|
@@ -142,7 +142,7 @@ static int OpenAudioCodec( decoder_t *p_dec )
|
||
|
}
|
||
|
|
||
|
ctx->sample_rate = p_dec->fmt_in.audio.i_rate;
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
|
||
|
+#if 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;
|
||
|
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
|
||
|
index 9975b0f47b6..c49f7eb4fc0 100644
|
||
|
--- a/modules/demux/avformat/demux.c
|
||
|
+++ b/modules/demux/avformat/demux.c
|
||
|
@@ -400,7 +400,7 @@ int avformat_OpenDemux( vlc_object_t *p_this )
|
||
|
es_format_Init( &es_fmt, AUDIO_ES, fcc );
|
||
|
es_fmt.i_original_fourcc = CodecTagToFourcc( cp->codec_tag );
|
||
|
es_fmt.i_bitrate = cp->bit_rate;
|
||
|
-#if LIBAVCODEC_VERSION_CHECK( 59, 24, 100 )
|
||
|
+#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
|
||
|
es_fmt.audio.i_channels = cp->ch_layout.nb_channels;
|
||
|
#else
|
||
|
es_fmt.audio.i_channels = cp->channels;
|
||
|
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
|
||
|
index a48190c93ca..090ed9f5bfa 100644
|
||
|
--- a/modules/demux/avformat/mux.c
|
||
|
+++ b/modules/demux/avformat/mux.c
|
||
|
@@ -273,7 +273,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)
|
||
|
av_channel_layout_default( &codecpar->ch_layout, fmt->audio.i_channels );
|
||
|
#else
|
||
|
codecpar->channels = fmt->audio.i_channels;
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From 0bcb306b7c05549a795b901ae33d6c7204456716 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Tue, 18 Jun 2024 15:34:10 +0200
|
||
|
Subject: [PATCH 11/15] ffmpeg: 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
|
||
|
(cherry picked from commit 195f0c98599b55950c49a62f98d9d3495be310df) (rebased)
|
||
|
rebased:
|
||
|
- the code around is slightly different
|
||
|
---
|
||
|
modules/codec/avcodec/encoder.c | 8 ++++----
|
||
|
modules/demux/avformat/mux.c | 2 +-
|
||
|
2 files changed, 5 insertions(+), 5 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
|
||
|
index 2014b8afaf5..ec63c9c5439 100644
|
||
|
--- a/modules/codec/avcodec/encoder.c
|
||
|
+++ b/modules/codec/avcodec/encoder.c
|
||
|
@@ -764,7 +764,7 @@ int InitVideoEnc( vlc_object_t *p_this )
|
||
|
uint32_t order_mask = 0;
|
||
|
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
|
||
|
@@ -917,7 +917,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;
|
||
|
@@ -1281,7 +1281,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;
|
||
|
@@ -1416,7 +1416,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
|
||
|
p_sys->frame->pts = date_Get( &p_sys->buffer_date ) * p_sys->p_context->time_base.den /
|
||
|
CLOCK_FREQ / p_sys->p_context->time_base.num;
|
||
|
|
||
|
-#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;
|
||
|
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
|
||
|
index 090ed9f5bfa..bf65ca36716 100644
|
||
|
--- a/modules/demux/avformat/mux.c
|
||
|
+++ b/modules/demux/avformat/mux.c
|
||
|
@@ -273,7 +273,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 LIBAVUTIL_VERSION_CHECK(57, 24, 100)
|
||
|
av_channel_layout_default( &codecpar->ch_layout, fmt->audio.i_channels );
|
||
|
#else
|
||
|
codecpar->channels = fmt->audio.i_channels;
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From 38f9638ec71c2fe917dfd99ac2e1795b3357cfc3 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Tue, 18 Jun 2024 16:04:41 +0200
|
||
|
Subject: [PATCH 12/15] ffmpeg: fix libavcodec version check for
|
||
|
AVCodecParameters.ch_layout
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
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@free.fr>
|
||
|
(cherry picked from commit 597bdb8e0784101b5f412feba3309558ad5b8862)
|
||
|
---
|
||
|
modules/demux/avformat/mux.c | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
|
||
|
index bf65ca36716..d8be5d1d9f5 100644
|
||
|
--- a/modules/demux/avformat/mux.c
|
||
|
+++ b/modules/demux/avformat/mux.c
|
||
|
@@ -273,7 +273,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
|
||
|
{
|
||
|
case AUDIO_ES:
|
||
|
codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
|
||
|
-#if LIBAVUTIL_VERSION_CHECK(57, 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;
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From 0939d55b81e916ff303f92f301257c2e0885fdb9 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Wed, 19 Jun 2024 13:41:04 +0200
|
||
|
Subject: [PATCH 13/15] avcodec: fix libavcodec version check for
|
||
|
AVCodecContext.ch_layout
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
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@free.fr>
|
||
|
(cherry picked from commit 8fd918b8787b8d077decf1a2b955ab0c7b964bf3) (rebased)
|
||
|
rebased:
|
||
|
- on 3.0 fmt_in is not a pointer
|
||
|
---
|
||
|
modules/codec/avcodec/audio.c | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||
|
index 979256c400a..fb22f033005 100644
|
||
|
--- a/modules/codec/avcodec/audio.c
|
||
|
+++ b/modules/codec/avcodec/audio.c
|
||
|
@@ -142,7 +142,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;
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From e5072b340425e786b9e376cdf4bff4962c6e32f2 Mon Sep 17 00:00:00 2001
|
||
|
From: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
Date: Wed, 19 Jun 2024 08:36:40 +0200
|
||
|
Subject: [PATCH 14/15] ffmpeg: 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
|
||
|
(cherry picked from commit f237155887f049f8befef2fdfadae7b60f697b0d)
|
||
|
---
|
||
|
modules/codec/avcodec/audio.c | 2 +-
|
||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||
|
index fb22f033005..c27771aeb2e 100644
|
||
|
--- a/modules/codec/avcodec/audio.c
|
||
|
+++ b/modules/codec/avcodec/audio.c
|
||
|
@@ -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;
|
||
|
--
|
||
|
GitLab
|
||
|
|
||
|
|
||
|
From 1713be552f9e26260a3ac33ce04ab89f660780cc Mon Sep 17 00:00:00 2001
|
||
|
From: =?UTF-8?q?Fran=C3=A7ois=20Cartegnie?= <fcvlcdev@free.fr>
|
||
|
Date: Thu, 20 Jun 2024 13:12:37 +0200
|
||
|
Subject: [PATCH 15/15] avcodec: add a define to test for
|
||
|
AVCodecContext.ch_layout availability
|
||
|
|
||
|
Co-authored-by: Steve Lhomme <robux4@ycbcr.xyz>
|
||
|
(cherry picked from commit 3abf93735df97cc2c96e11028b76067547c27eb7) (rebased)
|
||
|
rebased:
|
||
|
- on 3.0 the fmt_in is not a pointer
|
||
|
- the code around is slightly different due to the use of API_CHANNEL_LAYOUT
|
||
|
---
|
||
|
modules/codec/avcodec/audio.c | 8 +++++---
|
||
|
modules/codec/avcodec/encoder.c | 12 +++++++-----
|
||
|
2 files changed, 12 insertions(+), 8 deletions(-)
|
||
|
|
||
|
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
|
||
|
index c27771aeb2e..b6186d6ec56 100644
|
||
|
--- a/modules/codec/avcodec/audio.c
|
||
|
+++ b/modules/codec/avcodec/audio.c
|
||
|
@@ -41,6 +41,8 @@
|
||
|
#include <libavcodec/avcodec.h>
|
||
|
#include <libavutil/mem.h>
|
||
|
|
||
|
+#define API_CHANNEL_LAYOUT_STRUCT (LIBAVCODEC_VERSION_CHECK(59, 24, 100)) // AVCodecContext.ch_layout
|
||
|
+
|
||
|
#define API_CHANNEL_LAYOUT (LIBAV_UTIL_VERSION_CHECK( 52, 2, 6, 0, 100))
|
||
|
|
||
|
#if API_CHANNEL_LAYOUT
|
||
|
@@ -142,7 +144,7 @@ static int OpenAudioCodec( decoder_t *p_dec )
|
||
|
}
|
||
|
|
||
|
ctx->sample_rate = p_dec->fmt_in.audio.i_rate;
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
|
||
|
+#if API_CHANNEL_LAYOUT_STRUCT && 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;
|
||
|
@@ -598,7 +600,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
|
||
|
p_dec->fmt_out.audio.i_rate = p_sys->p_context->sample_rate;
|
||
|
|
||
|
/* */
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
|
||
|
+#if API_CHANNEL_LAYOUT_STRUCT
|
||
|
if( p_sys->i_previous_channels == p_sys->p_context->ch_layout.nb_channels &&
|
||
|
p_sys->i_previous_layout == p_sys->p_context->ch_layout.u.mask )
|
||
|
return;
|
||
|
@@ -622,7 +624,7 @@ static void SetupOutputFormat( decoder_t *p_dec, bool b_trust )
|
||
|
|
||
|
int i_channels_src = 0, channel_count;
|
||
|
uint64_t channel_layout_mask;
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
|
||
|
+#if API_CHANNEL_LAYOUT_STRUCT
|
||
|
channel_layout_mask = p_sys->p_context->ch_layout.u.mask;
|
||
|
channel_count = p_sys->p_context->ch_layout.nb_channels;
|
||
|
#elif API_CHANNEL_LAYOUT
|
||
|
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
|
||
|
index ec63c9c5439..b0d31269244 100644
|
||
|
--- a/modules/codec/avcodec/encoder.c
|
||
|
+++ b/modules/codec/avcodec/encoder.c
|
||
|
@@ -47,6 +47,8 @@
|
||
|
#include "avcodec.h"
|
||
|
#include "avcommon.h"
|
||
|
|
||
|
+#define API_CHANNEL_LAYOUT_STRUCT (LIBAVCODEC_VERSION_CHECK(59, 24, 100)) // AVCodecContext.ch_layout
|
||
|
+
|
||
|
#define API_CHANNEL_LAYOUT (LIBAV_UTIL_VERSION_CHECK( 52, 2, 6, 0, 100))
|
||
|
|
||
|
#if API_CHANNEL_LAYOUT
|
||
|
@@ -182,7 +184,7 @@ static const uint64_t pi_channels_map[][2] =
|
||
|
{ AV_CH_STEREO_RIGHT, 0 },
|
||
|
};
|
||
|
|
||
|
-# if !LIBAVCODEC_VERSION_CHECK(59, 24, 100)
|
||
|
+# if !API_CHANNEL_LAYOUT_STRUCT
|
||
|
static const uint32_t channel_mask[][2] = {
|
||
|
{0,0},
|
||
|
{AOUT_CHAN_CENTER, AV_CH_LAYOUT_MONO},
|
||
|
@@ -764,7 +766,7 @@ int InitVideoEnc( vlc_object_t *p_this )
|
||
|
uint32_t order_mask = 0;
|
||
|
int i_channels_src = 0;
|
||
|
msg_Dbg( p_enc, "Creating channel order for reordering");
|
||
|
-# if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
|
||
|
+# if API_CHANNEL_LAYOUT_STRUCT && 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
|
||
|
@@ -917,7 +919,7 @@ errmsg:
|
||
|
|
||
|
if( p_enc->fmt_out.audio.i_channels > 2 )
|
||
|
{
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
|
||
|
+#if API_CHANNEL_LAYOUT_STRUCT && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
|
||
|
av_channel_layout_default( &p_context->ch_layout, 2 );
|
||
|
#else
|
||
|
p_context->channels = 2;
|
||
|
@@ -1281,7 +1283,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) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
|
||
|
+#if API_CHANNEL_LAYOUT_STRUCT && 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;
|
||
|
@@ -1416,7 +1418,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
|
||
|
p_sys->frame->pts = date_Get( &p_sys->buffer_date ) * p_sys->p_context->time_base.den /
|
||
|
CLOCK_FREQ / p_sys->p_context->time_base.num;
|
||
|
|
||
|
-#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
|
||
|
+#if API_CHANNEL_LAYOUT_STRUCT && 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;
|
||
|
--
|
||
|
GitLab
|
||
|
|