Remove Film pointer from clone().
[dcpomatic.git] / src / wx / controls.cc
index 62f75fde395db6ec80b94b58da3711f62826bf4c..0fa92b69ada51014c1cca92e30ca7c25546be491 100644 (file)
@@ -214,17 +214,13 @@ Controls::Controls (wxWindow* parent, shared_ptr<FilmViewer> viewer, bool editor
 void
 Controls::add_clicked ()
 {
-       shared_ptr<Content> sel = selected_content ();
+       shared_ptr<Content> sel = selected_content()->clone();
        DCPOMATIC_ASSERT (sel);
        _film->examine_and_add_content (sel);
        bool const ok = display_progress (_("DCP-o-matic"), _("Loading DCP"));
        if (!ok || !report_errors_from_last_job(this)) {
                return;
        }
-       if (_film->content().size() == 1) {
-               /* Put 1 frame of black at the start so when we seek to 0 we don't see anything */
-               sel->set_position (DCPTime::from_frames(1, _film->video_frame_rate()));
-       }
        add_content_to_list (sel, _current_spl_view);
        setup_sensitivity ();
 }
@@ -608,7 +604,7 @@ Controls::add_content_to_list (shared_ptr<Content> content, wxListCtrl* ctrl)
        wxListItem it;
        it.SetId(N);
        it.SetColumn(0);
-       DCPTime length = content->length_after_trim ();
+       DCPTime length = content->length_after_trim (_film);
        int seconds = length.seconds();
        int minutes = seconds / 60;
        seconds -= minutes * 60;
@@ -666,9 +662,9 @@ Controls::update_content_directory ()
                try {
                        shared_ptr<Content> content;
                        if (is_directory(*i) && (is_regular_file(*i / "ASSETMAP") || is_regular_file(*i / "ASSETMAP.xml"))) {
-                               content.reset (new DCPContent(_film, *i));
-                       } else if (i->path().extension() == ".mp4") {
-                               content = content_factory(_film, *i).front();
+                               content.reset (new DCPContent(*i));
+                       } else if (i->path().extension() == ".mp4" || i->path().extension() == ".ecinema") {
+                               content = content_factory(*i).front();
                        }
 
                        if (content) {