Final tweaks and removal of Film::playlist().
authorCarl Hetherington <cth@carlh.net>
Wed, 17 Jun 2015 15:21:01 +0000 (16:21 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 17 Jun 2015 15:21:01 +0000 (16:21 +0100)
src/lib/film.cc
src/lib/film.h
src/wx/content_menu.cc
src/wx/timeline.cc
src/wx/timeline.h
test/frame_rate_test.cc

index 769ef72b6f56b2337469cde50c61a86d439fd170..f41371892963b1d22df478be6d2a1f15786d2d99 100644 (file)
@@ -916,12 +916,6 @@ Film::set_key (dcp::Key key)
        signal_changed (KEY);
 }
 
-shared_ptr<Playlist>
-Film::playlist () const
-{
-       return _playlist;
-}
-
 ContentList
 Film::content () const
 {
@@ -1226,3 +1220,15 @@ Film::audio_output_names () const
 
        return vector<string> (n.begin(), n.begin() + audio_channels ());
 }
+
+void
+Film::repeat_content (ContentList c, int n)
+{
+       _playlist->repeat (c, n);
+}
+
+void
+Film::remove_content (ContentList c)
+{
+       _playlist->remove (c);
+}
index da1c09d2fa5739e2f209b2d9cb3bb97831ea2769..f268bc5b7c6050737c8bb5730d7db8b33ebb71c2 100644 (file)
@@ -101,8 +101,6 @@ public:
 
        std::vector<CPLSummary> cpls () const;
 
-       boost::shared_ptr<Playlist> playlist () const;
-
        int audio_frame_rate () const;
 
        uint64_t required_disk_space () const;
@@ -141,6 +139,8 @@ public:
        void make_audio_mapping_default (AudioMapping & mapping) const;
        std::vector<std::string> audio_output_names () const;
 
+       void repeat_content (ContentList, int);
+       
        /** Identifiers for the parts of our state;
            used for signalling changes.
        */
@@ -256,6 +256,7 @@ public:
        void examine_and_add_content (boost::shared_ptr<Content>);
        void add_content (boost::shared_ptr<Content>);
        void remove_content (boost::shared_ptr<Content>);
+       void remove_content (ContentList);
        void move_content_earlier (boost::shared_ptr<Content>);
        void move_content_later (boost::shared_ptr<Content>);
        void set_dcp_content_type (DCPContentType const *);
index daadab7d7d6ce15cb53ce2869a10ce9e7370b3a6..2e9fe43fe6333568792dbeaf1e1845dffe57c41c 100644 (file)
@@ -122,12 +122,12 @@ ContentMenu::repeat ()
                return;
        }
 
-       shared_ptr<const Film> film = _film.lock ();
+       shared_ptr<Film> film = _film.lock ();
        if (!film) {
                return;
        }
 
-       film->playlist()->repeat (_content, d->number ());
+       film->repeat_content (_content, d->number ());
        d->Destroy ();
 
        _content.clear ();
@@ -170,7 +170,7 @@ ContentMenu::remove ()
                return;
        }
 
-       shared_ptr<const Film> film = _film.lock ();
+       shared_ptr<Film> film = _film.lock ();
        if (!film) {
                return;
        }
@@ -210,7 +210,7 @@ ContentMenu::remove ()
        }
 
        if (!handled) {
-               film->playlist()->remove (_content);
+               film->remove_content (_content);
        }
 
        _content.clear ();
index b0197ad3dd12a19abb2b357b517197b5b69d9c05..3929cf1c24d1cdb48ad5d96e96905f579be4544c 100644 (file)
@@ -64,12 +64,12 @@ Timeline::Timeline (wxWindow* parent, ContentPanel* cp, shared_ptr<Film> film)
        Bind (wxEVT_MOTION,     boost::bind (&Timeline::mouse_moved, this, _1));
        Bind (wxEVT_SIZE,       boost::bind (&Timeline::resized,     this));
 
-       playlist_changed ();
+       film_changed (Film::CONTENT);
 
        SetMinSize (wxSize (640, tracks() * track_height() + 96));
 
-       _playlist_changed_connection = film->playlist()->Changed.connect (bind (&Timeline::playlist_changed, this));
-       _playlist_content_changed_connection = film->playlist()->ContentChanged.connect (bind (&Timeline::playlist_content_changed, this, _2));
+       _film_changed_connection = film->Changed.connect (bind (&Timeline::film_changed, this, _1));
+       _film_content_changed_connection = film->ContentChanged.connect (bind (&Timeline::film_content_changed, this, _2));
 }
 
 void
@@ -90,10 +90,12 @@ Timeline::paint ()
 }
 
 void
-Timeline::playlist_changed ()
+Timeline::film_changed (Film::Property p)
 {
-       ensure_ui_thread ();
-       recreate_views ();
+       if (p == Film::CONTENT) {
+               ensure_ui_thread ();
+               recreate_views ();
+       }
 }
 
 void
@@ -107,7 +109,7 @@ Timeline::recreate_views ()
        _views.clear ();
        _views.push_back (_time_axis_view);
 
-       ContentList content = fl->playlist()->content ();
+       ContentList content = fl->content ();
 
        for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
                if (dynamic_pointer_cast<VideoContent> (*i)) {
@@ -131,7 +133,7 @@ Timeline::recreate_views ()
 }
 
 void
-Timeline::playlist_content_changed (int property)
+Timeline::film_content_changed (int property)
 {
        ensure_ui_thread ();
 
index cab0ea0e08525bc36221cbf401c360ee9b750757..2afd0d1945e7fb167510572d21f2e613bbbce117 100644 (file)
 
 */
 
+#include "content_menu.h"
+#include "timeline_content_view.h"
+#include "lib/util.h"
+#include "lib/rect.h"
+#include "lib/film.h"
+#include <wx/wx.h>
 #include <boost/shared_ptr.hpp>
 #include <boost/weak_ptr.hpp>
 #include <boost/signals2.hpp>
-#include <wx/wx.h>
-#include "lib/util.h"
-#include "lib/rect.h"
-#include "content_menu.h"
-#include "timeline_content_view.h"
 
 class Film;
 class ContentPanel;
@@ -78,8 +79,8 @@ private:
        void left_up (wxMouseEvent &);
        void right_down (wxMouseEvent &);
        void mouse_moved (wxMouseEvent &);
-       void playlist_changed ();
-       void playlist_content_changed (int);
+       void film_changed (Film::Property);
+       void film_content_changed (int);
        void resized ();
        void assign_tracks ();
        void set_position_from_event (wxMouseEvent &);
@@ -105,6 +106,6 @@ private:
        ContentMenu _menu;
        bool _snap;
 
-       boost::signals2::scoped_connection _playlist_changed_connection;
-       boost::signals2::scoped_connection _playlist_content_changed_connection;
+       boost::signals2::scoped_connection _film_changed_connection;
+       boost::signals2::scoped_connection _film_content_changed_connection;
 };
index 39a64504d70207b60667e908c810be140a47decb..cf3dc261275ee64d6b4c746b814e2ecc523aeed4 100644 (file)
@@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        Config::instance()->set_allowed_dcp_frame_rates (afr);
 
        content->_video_frame_rate = 60;
-       int best = film->playlist()->best_dcp_frame_rate ();
+       int best = film->best_video_frame_rate ();
        FrameRateChange frc = FrameRateChange (60, best);
        BOOST_CHECK_EQUAL (best, 30);
        BOOST_CHECK_EQUAL (frc.skip, true);
@@ -62,7 +62,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
        
        content->_video_frame_rate = 50;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (50, best);
        BOOST_CHECK_EQUAL (best, 25);
        BOOST_CHECK_EQUAL (frc.skip, true);
@@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
        content->_video_frame_rate = 48;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (48, best);
        BOOST_CHECK_EQUAL (best, 24);
        BOOST_CHECK_EQUAL (frc.skip, true);
@@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
        content->_video_frame_rate = 30;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (30, best);
        BOOST_CHECK_EQUAL (best, 30);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -89,7 +89,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
        content->_video_frame_rate = 29.97;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (29.97, best);
        BOOST_CHECK_EQUAL (best, 30);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 30 / 29.97, 0.1);
        
        content->_video_frame_rate = 25;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (25, best);
        BOOST_CHECK_EQUAL (best, 25);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -107,7 +107,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
        content->_video_frame_rate = 24;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (24, best);
        BOOST_CHECK_EQUAL (best, 24);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -116,7 +116,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
        content->_video_frame_rate = 14.5;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (14.5, best);
        BOOST_CHECK_EQUAL (best, 30);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -125,7 +125,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 15 / 14.5, 0.1);
 
        content->_video_frame_rate = 12.6;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (12.6, best);
        BOOST_CHECK_EQUAL (best, 25);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 25 / 25.2, 0.1);
 
        content->_video_frame_rate = 12.4;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (12.4, best);
        BOOST_CHECK_EQUAL (best, 25);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -143,7 +143,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 25 / 24.8, 0.1);
 
        content->_video_frame_rate = 12;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (12, best);
        BOOST_CHECK_EQUAL (best, 24);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -161,7 +161,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        Config::instance()->set_allowed_dcp_frame_rates (afr);
 
        content->_video_frame_rate = 60;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (60, best);
        BOOST_CHECK_EQUAL (best, 60);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
        
        content->_video_frame_rate = 50;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (50, best);
        BOOST_CHECK_EQUAL (best, 50);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -179,7 +179,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        BOOST_CHECK_CLOSE (frc.speed_up, 1, 0.1);
 
        content->_video_frame_rate = 48;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (48, best);
        BOOST_CHECK_EQUAL (best, 48);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -202,7 +202,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_single)
        Config::instance()->set_allowed_dcp_frame_rates (afr);
 
        content->_video_frame_rate = 25;
-       best = film->playlist()->best_dcp_frame_rate ();
+       best = film->best_video_frame_rate ();
        frc = FrameRateChange (25, best);
        BOOST_CHECK_EQUAL (best, 24);
        BOOST_CHECK_EQUAL (frc.skip, false);
@@ -234,7 +234,7 @@ BOOST_AUTO_TEST_CASE (best_dcp_frame_rate_test_double)
 
        A->_video_frame_rate = 30;
        B->_video_frame_rate = 24;
-       BOOST_CHECK_EQUAL (film->playlist()->best_dcp_frame_rate(), 25);
+       BOOST_CHECK_EQUAL (film->best_video_frame_rate(), 25);
 }
 
 BOOST_AUTO_TEST_CASE (audio_sampling_rate_test)