Add some player tests. Fix seek with content at non-DCP frame rate. A few other...
[dcpomatic.git] / src / lib / playlist.cc
index 703a14663448c5468dc10910a3ca5c978d3a96df..0d6462f6c53d439ce3aec96895e29ed941f4bdb0 100644 (file)
@@ -72,25 +72,35 @@ Playlist::~Playlist ()
 void
 Playlist::content_changed (weak_ptr<Content> c, int p)
 {
-       if (p == ContentProperty::LENGTH && _sequence_video && !_sequencing_video) {
-               _sequencing_video = true;
-
-               ContentList cl = _content;
-               sort (cl.begin(), cl.end(), ContentSorter ());
-               Time last = 0;
-               for (ContentList::iterator i = cl.begin(); i != cl.end(); ++i) {
-                       if (!dynamic_pointer_cast<VideoContent> (*i)) {
-                               continue;
-                       }
+       if (p == ContentProperty::LENGTH) {
+               maybe_sequence_video ();
+       }
 
-                       (*i)->set_start (last);
-                       last = (*i)->end ();
-               }
+       ContentChanged (c, p);
+}
 
-               _sequencing_video = false;
+void
+Playlist::maybe_sequence_video ()
+{
+       if (!_sequence_video || _sequencing_video) {
+               return;
        }
        
-       ContentChanged (c, p);
+       _sequencing_video = true;
+       
+       ContentList cl = _content;
+       sort (cl.begin(), cl.end(), ContentSorter ());
+       Time last = 0;
+       for (ContentList::iterator i = cl.begin(); i != cl.end(); ++i) {
+               if (!dynamic_pointer_cast<VideoContent> (*i)) {
+                       continue;
+               }
+               
+               (*i)->set_start (last);
+               last = (*i)->end ();
+       }
+       
+       _sequencing_video = false;
 }
 
 string