Final tweaks and removal of Film::playlist().
[dcpomatic.git] / src / lib / film.cc
index 590acedfd370f56dd04a5b2077c3a5758b78fc9f..f41371892963b1d22df478be6d2a1f15786d2d99 100644 (file)
@@ -72,6 +72,7 @@ using std::map;
 using std::vector;
 using std::setfill;
 using std::min;
+using std::max;
 using std::make_pair;
 using std::endl;
 using std::cout;
@@ -135,7 +136,7 @@ Film::Film (boost::filesystem::path dir, bool log)
        set_isdcf_date_today ();
 
        _playlist_changed_connection = _playlist->Changed.connect (bind (&Film::playlist_changed, this));
-       _playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Film::playlist_content_changed, this, _1, _2));
+       _playlist_content_changed_connection = _playlist->ContentChanged.connect (bind (&Film::playlist_content_changed, this, _1, _2, _3));
        
        /* Make state.directory a complete path without ..s (where possible)
           (Code swiped from Adam Bowen on stackoverflow)
@@ -220,13 +221,13 @@ Film::info_file () const
 }
 
 boost::filesystem::path
-Film::internal_video_mxf_dir () const
+Film::internal_video_asset_dir () const
 {
        return dir ("video");
 }
 
 boost::filesystem::path
-Film::internal_video_mxf_filename () const
+Film::internal_video_asset_filename () const
 {
        return video_identifier() + ".mxf";
 }
@@ -248,12 +249,12 @@ Film::filename_safe_name () const
 }
 
 boost::filesystem::path
-Film::audio_analysis_path (shared_ptr<const Playlist> playlist) const
+Film::audio_analysis_path () const
 {
        boost::filesystem::path p = dir ("analysis");
 
        MD5Digester digester;
-       BOOST_FOREACH (shared_ptr<Content> i, playlist->content ()) {
+       BOOST_FOREACH (shared_ptr<Content> i, content ()) {
                shared_ptr<AudioContent> ac = dynamic_pointer_cast<AudioContent> (i);
                if (!ac) {
                        continue;
@@ -805,6 +806,7 @@ Film::set_audio_processor (AudioProcessor const * processor)
 {
        _audio_processor = processor;
        signal_changed (AUDIO_PROCESSOR);
+       signal_changed (AUDIO_CHANNELS);
 }
 
 void
@@ -893,12 +895,6 @@ Film::cpls () const
        return out;
 }
 
-shared_ptr<Player>
-Film::make_player () const
-{
-       return shared_ptr<Player> (new Player (shared_from_this (), _playlist));
-}
-
 void
 Film::set_signed (bool s)
 {
@@ -920,12 +916,6 @@ Film::set_key (dcp::Key key)
        signal_changed (KEY);
 }
 
-shared_ptr<Playlist>
-Film::playlist () const
-{
-       return _playlist;
-}
-
 ContentList
 Film::content () const
 {
@@ -1017,7 +1007,7 @@ Film::active_frame_rate_change (DCPTime t) const
 }
 
 void
-Film::playlist_content_changed (boost::weak_ptr<Content> c, int p)
+Film::playlist_content_changed (boost::weak_ptr<Content> c, int p, bool frequent)
 {
        if (p == VideoContentProperty::VIDEO_FRAME_RATE) {
                set_video_frame_rate (_playlist->best_dcp_frame_rate ());
@@ -1025,7 +1015,7 @@ Film::playlist_content_changed (boost::weak_ptr<Content> c, int p)
                signal_changed (NAME);
        }
 
-       emit (boost::bind (boost::ref (ContentChanged), c, p));
+       emit (boost::bind (boost::ref (ContentChanged), c, p, frequent));
 }
 
 void
@@ -1132,8 +1122,8 @@ bool
 Film::should_be_enough_disk_space (double& required, double& available, bool& can_hard_link) const
 {
        /* Create a test file and see if we can hard-link it */
-       boost::filesystem::path test = internal_video_mxf_dir() / "test";
-       boost::filesystem::path test2 = internal_video_mxf_dir() / "test2";
+       boost::filesystem::path test = internal_video_asset_dir() / "test";
+       boost::filesystem::path test2 = internal_video_asset_dir() / "test2";
        can_hard_link = true;
        FILE* f = fopen_boost (test, "w");
        if (f) {
@@ -1147,7 +1137,7 @@ Film::should_be_enough_disk_space (double& required, double& available, bool& ca
                boost::filesystem::remove (test2);
        }
 
-       boost::filesystem::space_info s = boost::filesystem::space (internal_video_mxf_dir ());
+       boost::filesystem::space_info s = boost::filesystem::space (internal_video_asset_dir ());
        required = double (required_disk_space ()) / 1073741824.0f;
        if (!can_hard_link) {
                required *= 2;
@@ -1230,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);
+}