Bump ffmpeg to 5.1.2 "Riemann"
authorCarl Hetherington <cth@carlh.net>
Fri, 30 Sep 2022 20:46:33 +0000 (22:46 +0200)
committerCarl Hetherington <cth@carlh.net>
Sat, 16 Dec 2023 01:07:37 +0000 (02:07 +0100)
cscript
platform/windows/wscript
src/lib/audio_filter_graph.cc
src/lib/audio_filter_graph.h
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_examiner.cc
src/lib/ffmpeg_file_encoder.cc
wscript

diff --git a/cscript b/cscript
index 50eb211d87f31d6a6474c4cc1164dd1e505cb4a3..2aa3a2546680cd34af5584bef77d3f4593fb9c88 100644 (file)
--- a/cscript
+++ b/cscript
@@ -503,7 +503,7 @@ def dependencies(target, options):
         ffmpeg_options = {}
 
     if target.platform != 'linux' or target.distro != 'arch':
-        deps = [('ffmpeg', '7276e269a93c2ae30e302c34708e8095ac5475e8', ffmpeg_options)]
+        deps = [('ffmpeg', 'b5190a92da64ee196a8afa3ededbfc94d0000c68', ffmpeg_options)]
     else:
         # Use distro-provided FFmpeg on Arch
         deps = []
@@ -519,7 +519,7 @@ def dependencies(target, options):
     deps.append(('openssl', '7f29dd5'))
     if can_build_disk(target):
         deps.append(('lwext4', 'ab082923a791b58478d1d9939d65a0583566ac1f'))
-    deps.append(('ffcmp', '53c853d2935de3f2b0d53777529e48c102afd237'))
+    deps.append(('ffcmp', 'ea340a286078e025dcf9a0c75c6313d318dbf32b'))
 
     return deps
 
index 1dd04f6bfb5bc0458a07c7c713d3e45be30c026b..41c0b12bf4476ed93dd92c0efe0bb78959415ec9 100644 (file)
@@ -196,14 +196,14 @@ File "%cdist_deps%/lib/liblwext4.dll"
         """, file=f)
 
     print("""
-File "%cdist_deps%/bin/avcodec-58.dll"
-File "%cdist_deps%/bin/avfilter-7.dll"
-File "%cdist_deps%/bin/avformat-58.dll"
-File "%cdist_deps%/bin/avutil-56.dll"
-File "%cdist_deps%/bin/avdevice-58.dll"
-File "%cdist_deps%/bin/postproc-55.dll"
-File "%cdist_deps%/bin/swresample-3.dll"
-File "%cdist_deps%/bin/swscale-5.dll"
+File "%cdist_deps%/bin/avcodec-59.dll"
+File "%cdist_deps%/bin/avfilter-8.dll"
+File "%cdist_deps%/bin/avformat-59.dll"
+File "%cdist_deps%/bin/avutil-57.dll"
+File "%cdist_deps%/bin/avdevice-59.dll"
+File "%cdist_deps%/bin/postproc-56.dll"
+File "%cdist_deps%/bin/swresample-4.dll"
+File "%cdist_deps%/bin/swscale-6.dll"
 File "%cdist_deps%/bin/dcp-1.0.dll"
 File "%cdist_deps%/bin/cxml-0.dll"
 File "%cdist_deps%/bin/sub-1.0.dll"
index 4e3052d57c519eccc3f390e01d5f3e4c3ad6da5f..cb888c16206459f50be0e80680f9df6acdad31f4 100644 (file)
@@ -48,11 +48,7 @@ AudioFilterGraph::AudioFilterGraph (int sample_rate, int channels)
        /* FFmpeg doesn't know any channel layouts for any counts between 8 and 16,
           so we need to tell it we're using 16 channels if we are using more than 8.
        */
-       if (_channels > 8) {
-               _channel_layout = av_get_default_channel_layout (16);
-       } else {
-               _channel_layout = av_get_default_channel_layout (_channels);
-       }
+       av_channel_layout_default(&_channel_layout, _channels > 8 ? 16 : _channels);
 
        _in_frame = av_frame_alloc ();
        if (_in_frame == nullptr) {
@@ -69,7 +65,7 @@ string
 AudioFilterGraph::src_parameters () const
 {
        char layout[64];
-       av_get_channel_layout_string (layout, sizeof(layout), 0, _channel_layout);
+       av_channel_layout_describe(&_channel_layout, layout, sizeof(layout));
 
        char buffer[256];
        snprintf (
@@ -88,8 +84,9 @@ AudioFilterGraph::set_parameters (AVFilterContext* context) const
        int r = av_opt_set_int_list (context, "sample_fmts", sample_fmts, AV_SAMPLE_FMT_NONE, AV_OPT_SEARCH_CHILDREN);
        DCPOMATIC_ASSERT (r >= 0);
 
-       int64_t channel_layouts[] = { _channel_layout, -1 };
-       r = av_opt_set_int_list (context, "channel_layouts", channel_layouts, -1, AV_OPT_SEARCH_CHILDREN);
+       char ch_layout[64];
+       av_channel_layout_describe(&_channel_layout, ch_layout, sizeof(ch_layout));
+       r = av_opt_set(context, "ch_layouts", ch_layout, AV_OPT_SEARCH_CHILDREN);
        DCPOMATIC_ASSERT (r >= 0);
 
        int sample_rates[] = { _sample_rate, -1 };
@@ -114,7 +111,7 @@ void
 AudioFilterGraph::process (shared_ptr<AudioBuffers> buffers)
 {
        DCPOMATIC_ASSERT (buffers->frames() > 0);
-       int const process_channels = av_get_channel_layout_nb_channels (_channel_layout);
+       int const process_channels = _channel_layout.nb_channels;
        DCPOMATIC_ASSERT (process_channels >= buffers->channels());
 
        if (buffers->channels() < process_channels) {
@@ -144,8 +141,10 @@ AudioFilterGraph::process (shared_ptr<AudioBuffers> buffers)
        _in_frame->nb_samples = buffers->frames ();
        _in_frame->format = AV_SAMPLE_FMT_FLTP;
        _in_frame->sample_rate = _sample_rate;
-       _in_frame->channel_layout = _channel_layout;
+       _in_frame->ch_layout = _channel_layout;
+LIBDCP_DISABLE_WARNINGS
        _in_frame->channels = process_channels;
+LIBDCP_ENABLE_WARNINGS
 
        int r = av_buffersrc_write_frame (_buffer_src_context, _in_frame);
 
index e5c55fa273b22009564b98fcce92f0f92bee3157..1ac2b071b3c829471f8cd2039a6b334a748ddc94 100644 (file)
@@ -47,7 +47,7 @@ protected:
 private:
        int _sample_rate;
        int _channels;
-       int64_t _channel_layout;
+       AVChannelLayout _channel_layout;
        AVFrame* _in_frame;
 };
 
index 6e9d671a2fa87792e2ea5b58d6b2d9b2e136822c..a260a757b22a5b08aa81e2563162100f800bae33 100644 (file)
@@ -260,7 +260,7 @@ deinterleave_audio(AVFrame* frame)
 
        /* XXX: can't we use swr_convert() to do the format conversion? */
 
-       int const channels = frame->channels;
+       int const channels = frame->ch_layout.nb_channels;
        int const frames = frame->nb_samples;
        int const total_samples = frames * channels;
        auto audio = make_shared<AudioBuffers>(channels, frames);
index ed6f210945960503ac303effc8d731af4554e4d2..d2d1093a9500abac1982adba50b1621ffb941a3b 100644 (file)
@@ -73,14 +73,6 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
                auto codec = _codec_context[i] ? _codec_context[i]->codec : nullptr;
                if (s->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && codec) {
 
-                       /* This is a hack; sometimes it seems that _audio_codec_context->channel_layout isn't set up,
-                          so bodge it here.  No idea why we should have to do this.
-                       */
-
-                       if (s->codecpar->channel_layout == 0) {
-                               s->codecpar->channel_layout = av_get_default_channel_layout (s->codecpar->channels);
-                       }
-
                        DCPOMATIC_ASSERT (_format_context->duration != AV_NOPTS_VALUE);
                        DCPOMATIC_ASSERT (codec->name);
 
@@ -91,7 +83,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
                                        s->id,
                                        s->codecpar->sample_rate,
                                        llrint ((double(_format_context->duration) / AV_TIME_BASE) * s->codecpar->sample_rate),
-                                       s->codecpar->channels,
+                                       s->codecpar->ch_layout.nb_channels,
                                        s->codecpar->bits_per_raw_sample ? s->codecpar->bits_per_raw_sample : s->codecpar->bits_per_coded_sample
                                        )
                                );
index 6d1ad68f79bb79d939e4baf25991b792ef4bbaa9..d7833265d630d130437a5a3bedee49ac6f63f221 100644 (file)
@@ -73,8 +73,7 @@ public:
                _codec_context->bit_rate = channels * 128 * 1024;
                _codec_context->sample_fmt = sample_format;
                _codec_context->sample_rate = frame_rate;
-               _codec_context->channel_layout = av_get_default_channel_layout (channels);
-               _codec_context->channels = channels;
+               av_channel_layout_default(&_codec_context->ch_layout, channels);
 
                int r = avcodec_open2 (_codec_context, _codec, 0);
                if (r < 0) {
@@ -143,7 +142,7 @@ public:
 
                frame->nb_samples = size;
                frame->format = _codec_context->sample_fmt;
-               frame->channels = channels;
+               frame->ch_layout.nb_channels = channels;
                int r = avcodec_fill_audio_frame (frame, channels, _codec_context->sample_fmt, (const uint8_t *) samples, buffer_size, 0);
                DCPOMATIC_ASSERT (r >= 0);
 
diff --git a/wscript b/wscript
index 8ff3a621784b52c574f32a87b344bcd18dcbebe6..da01051f7ed3ed80ce14d7932bb90f83bfee2d3c 100644 (file)
--- a/wscript
+++ b/wscript
@@ -431,7 +431,7 @@ def configure(conf):
                             int main () { av_ebur128_get_true_peaks (0); }\n
                             """,
                    msg='Checking for EBUR128-patched FFmpeg',
-                   uselib='AVCODEC AVFILTER',
+                   uselib='AVCODEC AVFILTER AVUTIL SWRESAMPLE',
                    define_name='DCPOMATIC_HAVE_EBUR128_PATCHED_FFMPEG',
                    mandatory=False)