Signal when streams change and rebuild player pieces when it happens.
[dcpomatic.git] / src / lib / player.cc
index 212bcfe45612f8d2264c03ebc923a7429f319507..c7d7b2f441ddd4aff76d4cdd7ee6ee2667e108c7 100644 (file)
@@ -206,14 +206,15 @@ Player::playlist_content_changed (weak_ptr<Content> w, int property, bool freque
                property == ContentProperty::TRIM_END ||
                property == ContentProperty::PATH ||
                property == VideoContentProperty::FRAME_TYPE ||
+               property == VideoContentProperty::COLOUR_CONVERSION ||
+               property == AudioContentProperty::STREAMS ||
                property == DCPContentProperty::NEEDS_ASSETS ||
                property == DCPContentProperty::NEEDS_KDM ||
                property == SubtitleContentProperty::COLOUR ||
                property == SubtitleContentProperty::EFFECT ||
                property == SubtitleContentProperty::EFFECT_COLOUR ||
                property == FFmpegContentProperty::SUBTITLE_STREAM ||
-               property == FFmpegContentProperty::FILTERS ||
-               property == VideoContentProperty::COLOUR_CONVERSION
+               property == FFmpegContentProperty::FILTERS
                ) {
 
                _have_valid_pieces = false;
@@ -876,6 +877,10 @@ Player::text_subtitle_start (weak_ptr<Piece> wp, ContentTextSubtitle subtitle)
        PlayerSubtitles ps;
        DCPTime const from (content_time_to_dcp (piece, subtitle.from()));
 
+       if (from > piece->content->end()) {
+               return;
+       }
+
        BOOST_FOREACH (dcp::SubtitleString s, subtitle.subs) {
                s.set_h_position (s.h_position() + piece->content->subtitle->x_offset ());
                s.set_v_position (s.v_position() + piece->content->subtitle->y_offset ());
@@ -918,6 +923,10 @@ Player::subtitle_stop (weak_ptr<Piece> wp, ContentTime to)
 
        DCPTime const dcp_to = content_time_to_dcp (piece, to);
 
+       if (dcp_to > piece->content->end()) {
+               return;
+       }
+
        pair<PlayerSubtitles, DCPTime> from = _active_subtitles.add_to (wp, dcp_to);
 
        if (piece->content->subtitle->use() && !_always_burn_subtitles && !piece->content->subtitle->burn()) {