More fixes for errors / crashes / misbehaviour with content changes
[dcpomatic.git] / src / lib / playlist.cc
index a55893291138d4b46a0b3b20d43d898349db1624..1bb0ad0d6cda449354ed0eae1da435d59e649131 100644 (file)
@@ -64,6 +64,18 @@ Playlist::~Playlist ()
        reconnect ();
 }
 
+void
+Playlist::content_may_change ()
+{
+       ContentMayChange ();
+}
+
+void
+Playlist::content_not_changed ()
+{
+       ContentNotChanged ();
+}
+
 void
 Playlist::content_changed (weak_ptr<Content> content, int property, bool frequent)
 {
@@ -135,7 +147,7 @@ Playlist::maybe_sequence ()
 
        DCPTime next;
        BOOST_FOREACH (shared_ptr<Content> i, _content) {
-               if (i->caption.empty() || find (placed.begin(), placed.end(), i) != placed.end()) {
+               if (i->text.empty() || find (placed.begin(), placed.end(), i) != placed.end()) {
                        continue;
                }
 
@@ -156,7 +168,7 @@ Playlist::video_identifier () const
 
        BOOST_FOREACH (shared_ptr<const Content> i, _content) {
                bool burn = false;
-               BOOST_FOREACH (shared_ptr<TextContent> j, i->caption) {
+               BOOST_FOREACH (shared_ptr<TextContent> j, i->text) {
                        if (j->burn()) {
                                burn = true;
                        }
@@ -350,7 +362,9 @@ Playlist::reconnect ()
        _content_connections.clear ();
 
        BOOST_FOREACH (shared_ptr<Content> i, _content) {
-               _content_connections.push_back (i->Changed.connect (bind (&Playlist::content_changed, this, _1, _2, _3)));
+               _content_connections.push_back (i->MayChange.connect(boost::bind(&Playlist::content_may_change, this)));
+               _content_connections.push_back (i->Changed.connect(boost::bind(&Playlist::content_changed, this, _1, _2, _3)));
+               _content_connections.push_back (i->NotChanged.connect(boost::bind(&Playlist::content_not_changed, this)));
        }
 }
 
@@ -368,11 +382,11 @@ Playlist::video_end () const
 }
 
 DCPTime
-Playlist::caption_end () const
+Playlist::text_end () const
 {
        DCPTime end;
        BOOST_FOREACH (shared_ptr<Content> i, _content) {
-               if (!i->caption.empty ()) {
+               if (!i->text.empty ()) {
                        end = max (end, i->end ());
                }
        }