From c49bd081b3b06f9c036b63af6f2ffe05db059134 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 4 Nov 2025 21:03:15 +0100 Subject: Add remove_stream_ids(). --- src/lib/ffmpeg_content.cc | 23 +++++++++++++++++++++++ src/lib/ffmpeg_content.h | 5 +++++ src/lib/ffmpeg_stream.h | 4 ++++ 3 files changed, 32 insertions(+) (limited to 'src/lib') diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index 7e749c656..322553586 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -724,3 +724,26 @@ FFmpegContent::take_settings_from(shared_ptr c) _filters = fc->_filters; } + +void +FFmpegContent::remove_stream_ids() +{ + int index = 0; + + if (audio) { + for (auto stream: audio->streams()) { + if (auto ffmpeg = dynamic_pointer_cast(stream)) { + ffmpeg->unset_id(); + ffmpeg->set_index(index++); + } + } + } + + for (auto stream: _subtitle_streams) { + if (auto ffmpeg = dynamic_pointer_cast(stream)) { + ffmpeg->unset_id(); + ffmpeg->set_index(index++); + } + } +} + diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index c5cf1bdf5..975569ba6 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -113,6 +113,11 @@ public: void signal_subtitle_stream_changed(); + /** Remove all IDs from any streams we have. This is only for working around changes + * to stream identification in 2.18.26. + */ + void remove_stream_ids(); + private: void add_properties(std::shared_ptr film, std::list &) const override; diff --git a/src/lib/ffmpeg_stream.h b/src/lib/ffmpeg_stream.h index 1583e5221..8bdb5e1a4 100644 --- a/src/lib/ffmpeg_stream.h +++ b/src/lib/ffmpeg_stream.h @@ -58,6 +58,10 @@ public: _id = boost::none; } + void set_index(int index) { + _index = index; + } + int index(AVFormatContext const * c) const; std::string name; -- cgit v1.2.3