Remove in-place translations support.
[dcpomatic.git] / src / lib / player.cc
index ef7ecde5a4d762bdf2dfc86d24344b2f03fd66b8..c03cb97a59f50ad8549f8142279e48a236a801dc 100644 (file)
@@ -191,6 +191,7 @@ Player::Player(Player&& other)
        , _silent(std::move(other._silent))
        , _active_texts(std::move(other._active_texts))
        , _audio_processor(std::move(other._audio_processor))
+       , _disable_audio_processor(other._disable_audio_processor)
        , _playback_length(other._playback_length.load())
        , _subtitle_alignment(other._subtitle_alignment)
 {
@@ -230,6 +231,7 @@ Player::operator=(Player&& other)
        _silent = std::move(other._silent);
        _active_texts = std::move(other._active_texts);
        _audio_processor = std::move(other._audio_processor);
+       _disable_audio_processor = other._disable_audio_processor;
        _playback_length = other._playback_length.load();
        _subtitle_alignment = other._subtitle_alignment;
 
@@ -921,7 +923,7 @@ Player::open_subtitles_for_frame (DCPTime time) const
 
                /* Bitmap subtitles */
                for (auto i: j.bitmap) {
-                       if (!i.image) {
+                       if (!i.image || i.image->size().width == 0 || i.image->size().height == 0) {
                                continue;
                        }
 
@@ -942,7 +944,10 @@ Player::open_subtitles_for_frame (DCPTime time) const
                /* String subtitles (rendered to an image) */
                if (!j.string.empty()) {
                        auto s = render_text(j.string, _video_container_size, time, vfr);
-                       copy (s.begin(), s.end(), back_inserter (captions));
+                       copy_if(s.begin(), s.end(), back_inserter(captions), [](PositionImage const& image) {
+                               return image.image->size().width && image.image->size().height;
+                       });
+
                }
        }
 
@@ -1089,13 +1094,16 @@ Player::video (weak_ptr<Piece> weak_piece, ContentVideo video)
 
        auto const content_video = piece->content->video;
 
+       auto scaled_size = content_video->scaled_size(film->frame_size());
+       DCPOMATIC_ASSERT(scaled_size);
+
        for (auto eyes: eyes_to_emit) {
                _last_video[weak_piece] = std::make_shared<PlayerVideo>(
                        video.image,
                        content_video->actual_crop(),
                        content_video->fade(film, video.frame),
                        scale_for_display(
-                               content_video->scaled_size(film->frame_size()),
+                               *scaled_size,
                                _video_container_size,
                                film->frame_size(),
                                content_video->pixel_quanta()
@@ -1204,7 +1212,7 @@ Player::audio (weak_ptr<Piece> weak_piece, AudioStreamPtr stream, ContentAudio c
 
        /* Process */
 
-       if (_audio_processor) {
+       if (_audio_processor && !_disable_audio_processor) {
                content_audio.audio = _audio_processor->run(content_audio.audio, film->audio_channels());
        }
 
@@ -1628,3 +1636,11 @@ Player::signal_change(ChangeType type, int property)
        Change(type, property, false);
 }
 
+
+/** Must be called from the same thread that calls ::pass() */
+void
+Player::set_disable_audio_processor()
+{
+       _disable_audio_processor = true;
+}
+