diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-12-16 22:50:25 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-03-12 00:43:51 +0100 |
| commit | afed87b4f64f8cb4d99a0cad0eda664a604a10f7 (patch) | |
| tree | f754078b5dbeca175c663ffd0c3b901c929eb243 | |
| parent | 5d53e906d6f73ad9f9ae85a423a18f5814904bdb (diff) | |
Use std::vector and emplace_back(), lengthen variable name.
| -rw-r--r-- | src/lib/film.cc | 18 | ||||
| -rw-r--r-- | src/lib/film.h | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/lib/film.cc b/src/lib/film.cc index d747efb0e..d94ef0af3 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -1804,15 +1804,16 @@ Film::audio_analysis_finished () /* XXX */ } -list<DCPTimePeriod> + +vector<DCPTimePeriod> Film::reels () const { - list<DCPTimePeriod> p; + vector<DCPTimePeriod> periods; auto const len = length(); switch (reel_type ()) { case ReelType::SINGLE: - p.push_back (DCPTimePeriod (DCPTime (), len)); + periods.emplace_back(DCPTime(), len); break; case ReelType::BY_VIDEO_CONTENT: { @@ -1837,7 +1838,7 @@ Film::reels () const for (auto t: split_points) { if (last && (t - *last) >= DCPTime::from_seconds(1)) { /* Period from *last to t is long enough; use it and start a new one */ - p.push_back (DCPTimePeriod(*last, t)); + periods.emplace_back(*last, t); last = t; } else if (!last) { /* That was the first time, so start a new period */ @@ -1845,8 +1846,8 @@ Film::reels () const } } - if (!p.empty()) { - p.back().to = split_points.back(); + if (!periods.empty()) { + periods.back().to = split_points.back(); } break; } @@ -1859,16 +1860,17 @@ Film::reels () const Frame const reel_in_frames = max(_reel_length / ((j2k_bandwidth() / video_frame_rate()) / 8), static_cast<Frame>(video_frame_rate())); while (current < len) { DCPTime end = min (len, current + DCPTime::from_frames (reel_in_frames, video_frame_rate ())); - p.push_back (DCPTimePeriod (current, end)); + periods.emplace_back(current, end); current = end; } break; } } - return p; + return periods; } + /** @param period A period within the DCP * @return Name of the content which most contributes to the given period. */ diff --git a/src/lib/film.h b/src/lib/film.h index 036bbed7e..a5cefa4d4 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -186,7 +186,7 @@ public: return _playlist; } - std::list<dcpomatic::DCPTimePeriod> reels () const; + std::vector<dcpomatic::DCPTimePeriod> reels() const; std::list<int> mapped_audio_channels () const; boost::optional<dcp::LanguageTag> audio_language () const { |
