diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-05-16 14:59:50 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-05-16 14:59:50 +0200 |
| commit | eb6f689b8e9d982d73612af2ba5ddc7ab021aec8 (patch) | |
| tree | ac58fbabe3e13fa656d19543320b4a42206073dd /src | |
| parent | 8aa25e2ec75dada5f07a3860d668241821056f61 (diff) | |
| parent | 7a9cadc6fe86c74035dd971685b1acdc8f32d3fc (diff) | |
Merge branch 'main' into v2.17.x
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/dcp_film_encoder.cc | 15 | ||||
| -rw-r--r-- | src/lib/ffmpeg_decoder.cc | 4 | ||||
| -rw-r--r-- | src/lib/player.cc | 81 | ||||
| -rw-r--r-- | src/lib/player.h | 3 | ||||
| -rw-r--r-- | src/lib/util.cc | 2 | ||||
| -rw-r--r-- | src/wx/supporters.cc | 3 | ||||
| -rw-r--r-- | src/wx/video_panel.cc | 4 |
7 files changed, 84 insertions, 28 deletions
diff --git a/src/lib/dcp_film_encoder.cc b/src/lib/dcp_film_encoder.cc index 878ef3c6f..83da57756 100644 --- a/src/lib/dcp_film_encoder.cc +++ b/src/lib/dcp_film_encoder.cc @@ -124,7 +124,14 @@ DCPFilmEncoder::go() _writer.write(_player.get_subtitle_fonts()); } - while (!_player.pass()) {} + int passes = 0; + while (!_player.pass()) { + if ((++passes % 8) == 0) { + auto job = _job.lock(); + DCPOMATIC_ASSERT(job); + job->set_progress(_player.progress()); + } + } for (auto i: get_referenced_reel_assets(_film, _film->playlist())) { _writer.write(i); @@ -159,10 +166,6 @@ void DCPFilmEncoder::audio(shared_ptr<AudioBuffers> data, DCPTime time) { _writer.write(data, time); - - auto job = _job.lock (); - DCPOMATIC_ASSERT (job); - job->set_progress (float(time.get()) / _film->length().get()); } void @@ -190,5 +193,5 @@ DCPFilmEncoder::current_rate() const Frame DCPFilmEncoder::frames_done() const { - return _encoder->video_frames_enqueued(); + return _player.frames_done(); } diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index 17973d000..e80cb92e5 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -89,7 +89,7 @@ FFmpegDecoder::FFmpegDecoder (shared_ptr<const Film> film, shared_ptr<const FFmp _pts_offset = {}; } - if (c->audio) { + if (c->audio && !c->audio->mapping().mapped_output_channels().empty()) { audio = make_shared<AudioDecoder>(this, c->audio, fast); } @@ -239,7 +239,7 @@ FFmpegDecoder::pass () decode_and_process_video_packet (packet); } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index(_format_context, si) && !only_text()->ignore()) { decode_and_process_subtitle_packet (packet); - } else { + } else if (audio) { decode_and_process_audio_packet (packet); } diff --git a/src/lib/player.cc b/src/lib/player.cc index 913d7392f..9ba2f1cb0 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -685,6 +685,39 @@ Player::set_play_referenced () } +pair<shared_ptr<Piece>, optional<DCPTime>> +Player::earliest_piece_and_time() const +{ + auto film = _film.lock(); + DCPOMATIC_ASSERT(film); + + shared_ptr<Piece> earliest_content; + optional<DCPTime> earliest_time; + + for (auto const& piece: _pieces) { + if (piece->done) { + continue; + } + + auto const t = content_time_to_dcp(piece, max(piece->decoder->position(), piece->content->trim_start())); + if (t > piece->content->end(film)) { + piece->done = true; + } else { + + /* Given two choices at the same time, pick the one with texts so we see it before + the video. + */ + if (!earliest_time || t < *earliest_time || (t == *earliest_time && !piece->decoder->text.empty())) { + earliest_time = t; + earliest_content = piece; + } + } + } + + return { earliest_content, earliest_time }; +} + + bool Player::pass () { @@ -708,26 +741,7 @@ Player::pass () shared_ptr<Piece> earliest_content; optional<DCPTime> earliest_time; - - for (auto i: _pieces) { - if (i->done) { - continue; - } - - auto const t = content_time_to_dcp (i, max(i->decoder->position(), i->content->trim_start())); - if (t > i->content->end(film)) { - i->done = true; - } else { - - /* Given two choices at the same time, pick the one with texts so we see it before - the video. - */ - if (!earliest_time || t < *earliest_time || (t == *earliest_time && !i->decoder->text.empty())) { - earliest_time = t; - earliest_content = i; - } - } - } + std::tie(earliest_content, earliest_time) = earliest_piece_and_time(); bool done = false; @@ -1612,3 +1626,30 @@ Player::set_disable_audio_processor() _disable_audio_processor = true; } + +Frame +Player::frames_done() const +{ + auto film = _film.lock(); + DCPOMATIC_ASSERT(film); + + shared_ptr<Piece> earliest_content; + optional<DCPTime> earliest_time; + std::tie(earliest_content, earliest_time) = earliest_piece_and_time(); + + return earliest_time.get_value_or({}).frames_round(film->video_frame_rate()); +} + + +float +Player::progress() const +{ + auto film = _film.lock(); + DCPOMATIC_ASSERT(film); + + shared_ptr<Piece> earliest_content; + optional<DCPTime> earliest_time; + std::tie(earliest_content, earliest_time) = earliest_piece_and_time(); + + return static_cast<float>(earliest_time.get_value_or({}).get()) / film->length().get(); +} diff --git a/src/lib/player.h b/src/lib/player.h index 2502ae536..314031698 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -90,6 +90,8 @@ public: bool pass (); void seek (dcpomatic::DCPTime time, bool accurate); + Frame frames_done() const; + float progress() const; std::vector<std::shared_ptr<dcpomatic::Font>> get_subtitle_fonts (); @@ -157,6 +159,7 @@ private: std::shared_ptr<PlayerVideo> black_player_video_frame (Eyes eyes) const; void emit_video_until(dcpomatic::DCPTime time); void insert_video(std::shared_ptr<PlayerVideo> pv, dcpomatic::DCPTime time, dcpomatic::DCPTime end); + std::pair<std::shared_ptr<Piece>, boost::optional<dcpomatic::DCPTime>> earliest_piece_and_time() const; void video (std::weak_ptr<Piece>, ContentVideo); void audio (std::weak_ptr<Piece>, AudioStreamPtr, ContentAudio); diff --git a/src/lib/util.cc b/src/lib/util.cc index 282011d65..172b8d763 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -848,6 +848,8 @@ audio_channel_types (list<int> mapped, int channels) case dcp::Channel::BSR: ++non_lfe; break; + case dcp::Channel::LC: + case dcp::Channel::RC: case dcp::Channel::HI: case dcp::Channel::VI: case dcp::Channel::MOTION_DATA: diff --git a/src/wx/supporters.cc b/src/wx/supporters.cc index 374beb656..baeba2da9 100644 --- a/src/wx/supporters.cc +++ b/src/wx/supporters.cc @@ -61,6 +61,7 @@ supported_by.Add (wxT ("BFI National Archive")); supported_by.Add (wxT ("Cristian Arias Arévalo")); supported_by.Add (wxT ("Alex Argoitia")); supported_by.Add (wxT ("Esteban Arrangoiz")); +supported_by.Add (wxT ("The Boscov Theater at GoggleWorks Center for the Arts")); supported_by.Add (wxT ("Gunnar Ásgeir Ásgeirsson")); supported_by.Add (wxT ("Andrea Ashton")); supported_by.Add (wxT ("Georges Asmar")); @@ -273,6 +274,7 @@ supported_by.Add (wxT ("Greg Delmage")); supported_by.Add (wxT ("Diemiruaya Deniran")); supported_by.Add (wxT ("Larin Denis")); supported_by.Add (wxT ("Michael Denner")); +supported_by.Add (wxT ("denverdisc.com")); supported_by.Add (wxT ("Nicholas Deppe")); supported_by.Add (wxT ("Alexey Derevyanko")); supported_by.Add (wxT ("Olivier Dermine")); @@ -553,6 +555,7 @@ supported_by.Add (wxT ("Mason Hunsicker")); supported_by.Add (wxT ("Markus Hüsgen")); supported_by.Add (wxT ("Maurice Huvelin")); supported_by.Add (wxT ("Robin Hyden")); +supported_by.Add (wxT ("IAFilm")); supported_by.Add (wxT ("Dayton Movies Inc")); supported_by.Add (wxT ("Buttons Sound Inc")); supported_by.Add (wxT ("Paramount Twin Inc")); diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index 5a91df8fe..65f381fe3 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -100,7 +100,11 @@ VideoPanel::create () int const link_height = 32; #elif defined(DCPOMATIC_OSX) int const crop_width = 56; +#if wxCHECK_VERSION(3, 2, 0) int const link_width = 8 + 15 / dpi_scale_factor(this); +#else + int const link_width = 23; +#endif int const link_height = 28; #else int const crop_width = 56; |
