Fix detection of same-frame to speed up simple encodes (#548).
authorCarl Hetherington <cth@carlh.net>
Mon, 8 Jun 2015 13:58:53 +0000 (14:58 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 8 Jun 2015 13:58:53 +0000 (14:58 +0100)
src/lib/player.cc
src/lib/player.h
src/lib/player_video.cc
src/wx/film_viewer.cc

index 0ddd835ad38dfa25ecf4448f438d7ac57c9eca46..215b48ee444f83c9025d29e08c05890958425996 100644 (file)
@@ -74,6 +74,7 @@ Player::Player (shared_ptr<const Film> f, shared_ptr<const Playlist> p)
        , _playlist (p)
        , _have_valid_pieces (false)
        , _ignore_video (false)
+       , _burn_subtitles (f->burn_subtitles ())
 {
        _playlist_changed_connection = _playlist->Changed.connect (bind (&Player::playlist_changed, this));
        _playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Player::content_changed, this, _1, _2, _3));
@@ -385,7 +386,7 @@ Player::get_video (DCPTime time, bool accurate)
        copy (c.begin(), c.end(), back_inserter (sub_images));
 
        /* Text subtitles (rendered to an image) */
-       if (!ps.text.empty ()) {
+       if (_burn_subtitles && !ps.text.empty ()) {
                list<PositionImage> s = render_subtitles (ps.text, _video_container_size);
                copy (s.begin (), s.end (), back_inserter (sub_images));
        }
@@ -631,3 +632,12 @@ Player::set_ignore_video ()
 {
        _ignore_video = true;
 }
+
+/** Set whether or not this player should burn text subtitles into the image.
+ *  @param burn true to burn subtitles, false to not.
+ */
+void
+Player::set_burn_subtitles (bool burn)
+{
+       _burn_subtitles = burn;
+}
index 14aee002a22d1ea5b0dfa06e1ec240ff27f3c01b..52dffec24656a1edadcefab42756ea73bb6844d2 100644 (file)
@@ -93,6 +93,8 @@ public:
 
        void set_video_container_size (dcp::Size);
        void set_ignore_video ();
+       void set_enable_subtitles (bool enable);
+       void set_burn_subtitles (bool burn);
 
        PlayerStatistics const & statistics () const;
        
@@ -158,6 +160,8 @@ private:
 
        /** true if the player should ignore all video; i.e. never produce any */
        bool _ignore_video;
+       /** true if the player should burn subtitles into the video */
+       bool _burn_subtitles;
 
        boost::shared_ptr<AudioProcessor> _audio_processor;
 
index 81e01329a5b641ac1869d2f158b645375d364bd1..0375fa01bbb726a80b43b53ef6c7d4c714ee2714 100644 (file)
@@ -197,8 +197,7 @@ PlayerVideo::inter_position () const
 bool
 PlayerVideo::same (shared_ptr<const PlayerVideo> other) const
 {
-       if (_in != other->_in ||
-           _crop != other->_crop ||
+       if (_crop != other->_crop ||
            _fade.get_value_or(0) != other->_fade.get_value_or(0) ||
            _inter_size != other->_inter_size ||
            _out_size != other->_out_size ||
@@ -206,6 +205,7 @@ PlayerVideo::same (shared_ptr<const PlayerVideo> other) const
            _part != other->_part ||
            _colour_conversion != other->_colour_conversion ||
            !_subtitle.same (other->_subtitle)) {
+
                return false;
        }
 
index 0938d52a4cdd094af5cfe0255addf9376e5b52e1..e33a3c118dc92eedf9f63bb1b79c88c88d1834d8 100644 (file)
@@ -144,6 +144,11 @@ FilmViewer::set_film (shared_ptr<Film> f)
                _film.reset ();
                return;
        }
+
+       /* Always burn in subtitles, even if we are set not to, otherwise we won't see them
+          in the preview.
+       */
+       _player->set_burn_subtitles (true);
        
        _film_connection = _film->Changed.connect (boost::bind (&FilmViewer::film_changed, this, _1));