Resequence video (perhaps) on DCP video frame rate change.
authorCarl Hetherington <cth@carlh.net>
Sun, 14 Jul 2013 22:38:45 +0000 (23:38 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 14 Jul 2013 22:38:45 +0000 (23:38 +0100)
src/lib/film.cc
src/lib/playlist.cc
src/lib/playlist.h

index f306006c9872e985d78209be9e3bc1705af0d9a6..295f80ccbaedc7fcedb74e31d2dbd352d8dfee26 100644 (file)
@@ -632,6 +632,9 @@ Film::signal_changed (Property p)
        case Film::CONTENT:
                set_dcp_video_frame_rate (_playlist->best_dcp_frame_rate ());
                break;
+       case Film::DCP_VIDEO_FRAME_RATE:
+               _playlist->maybe_sequence_video ();
+               break;
        default:
                break;
        }
index 9e7f7f5f50f7770503e47b635c550093558a630b..aea6c5f413deaae0f6c95e2a702a596f6e7010ae 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 ();
+       }
+       
+       ContentChanged (c, p);
+}
 
-                       (*i)->set_start (last);
-                       last = (*i)->end ();
+void
+Playlist::maybe_sequence_video ()
+{
+       if (!_sequence_video || _sequencing_video) {
+               return;
+       }
+       
+       _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;
                }
-
-               _sequencing_video = false;
+               
+               (*i)->set_start (last);
+               last = (*i)->end ();
        }
        
-       ContentChanged (c, p);
+       _sequencing_video = false;
 }
 
 string
index cf0f09b31bc0d2d88da6776149941759fcdb49be..805df4d70b3f30eddbc7cb21f1cd34ae50dc3a67 100644 (file)
@@ -86,6 +86,7 @@ public:
        Time video_end () const;
 
        void set_sequence_video (bool);
+       void maybe_sequence_video ();
 
        mutable boost::signals2::signal<void ()> Changed;
        mutable boost::signals2::signal<void (boost::weak_ptr<Content>, int)> ContentChanged;