diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-11-04 21:03:15 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-11-09 20:15:19 +0100 |
| commit | c49bd081b3b06f9c036b63af6f2ffe05db059134 (patch) | |
| tree | b1de58ac1849eb2348790eeb669efd490e95147f /src/lib | |
| parent | d78820e4b4c9d24bef4c2ddd522900ca11d00fa7 (diff) | |
Add remove_stream_ids().
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/ffmpeg_content.cc | 23 | ||||
| -rw-r--r-- | src/lib/ffmpeg_content.h | 5 | ||||
| -rw-r--r-- | src/lib/ffmpeg_stream.h | 4 |
3 files changed, 32 insertions, 0 deletions
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<const Content> 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<FFmpegAudioStream>(stream)) { + ffmpeg->unset_id(); + ffmpeg->set_index(index++); + } + } + } + + for (auto stream: _subtitle_streams) { + if (auto ffmpeg = dynamic_pointer_cast<FFmpegSubtitleStream>(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<const Film> film, std::list<UserProperty> &) 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; |
