Merge branch '1.0' of ssh://carlh.dnsalias.org/home/carl/git/dvdomatic into 1.0
authorCarl Hetherington <cth@carlh.net>
Thu, 25 Jul 2013 08:54:06 +0000 (09:54 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 25 Jul 2013 08:54:06 +0000 (09:54 +0100)
13 files changed:
src/lib/ffmpeg_content.cc
src/lib/sndfile_content.cc
src/lib/still_image_content.cc
src/lib/util.cc
src/lib/video_content.cc
src/lib/video_content.h
src/wx/dir_picker_ctrl.cc
src/wx/film_editor.cc
src/wx/job_manager_view.cc
src/wx/job_manager_view.h
src/wx/timeline.cc
src/wx/video_panel.cc
src/wx/video_panel.h

index 901cb53cf6ac8454995745703866e2af32c668d8..24378ed3da0aebb2e64adea52e4ead5fa5f88344 100644 (file)
@@ -166,7 +166,8 @@ FFmpegContent::examine (shared_ptr<Job> job)
 string
 FFmpegContent::summary () const
 {
-       return String::compose (_("%1 [movie]"), path());
+       /* Get the string() here so that the name does not have quotes around it */
+       return String::compose (_("%1 [movie]"), path().filename().string());
 }
 
 string
index 713b80dcb331d815f7c30e0dabdea25389c651cc..2ca00cf6dc6c508812cc08feb9fd5365a8d5130c 100644 (file)
@@ -55,6 +55,7 @@ SndfileContent::SndfileContent (shared_ptr<const Film> f, shared_ptr<const cxml:
 string
 SndfileContent::summary () const
 {
+       /* Get the string() here so that the name does not have quotes around it */
        return String::compose (_("%1 [audio]"), path().filename().string());
 }
 
index e829e205d49b3cbe04442e9bca3710840de26d0b..d0600f52e078cfa04a5792808cabf0e6d13830a3 100644 (file)
@@ -48,7 +48,8 @@ StillImageContent::StillImageContent (shared_ptr<const Film> f, shared_ptr<const
 string
 StillImageContent::summary () const
 {
-       return String::compose (_("%1 [still]"), path());
+       /* Get the string() here so that the name does not have quotes around it */
+       return String::compose (_("%1 [still]"), path().filename().string());
 }
 
 string
index affbe3b002db82d96cbf2064a279e289f1cf01e5..183ff7d8b6431aeda75aaf235a5fda1c7c58ac3f 100644 (file)
@@ -742,17 +742,17 @@ FrameRateConversion::FrameRateConversion (float source, int dcp)
        change_speed = !about_equal (source * factor(), dcp);
 
        if (!skip && !repeat && !change_speed) {
-               description = _("DCP and source have the same rate.\n");
+               description = _("Content and DCP have the same rate.\n");
        } else {
                if (skip) {
-                       description = _("DCP will use every other frame of the source.\n");
+                       description = _("DCP will use every other frame of the content.\n");
                } else if (repeat) {
-                       description = _("Each source frame will be doubled in the DCP.\n");
+                       description = _("Each content frame will be doubled in the DCP.\n");
                }
 
                if (change_speed) {
                        float const pc = dcp * 100 / (source * factor());
-                       description += String::compose (_("DCP will run at %1%% of the source speed.\n"), pc);
+                       description += String::compose (_("DCP will run at %1%% of the content speed.\n"), pc);
                }
        }
 }
index d70ece3404dcad3308583ea63e2c2207f9b54493..f61518ec0f5b72f80a8ec936bcebc92ece04cdad 100644 (file)
@@ -243,3 +243,17 @@ VideoContent::technical_summary () const
 {
        return String::compose ("video: length %1, size %2x%3, rate %4", video_length(), video_size().width, video_size().height, video_frame_rate());
 }
+
+libdcp::Size
+VideoContent::video_size_after_3d_split () const
+{
+       libdcp::Size const s = video_size ();
+       switch (video_frame_type ()) {
+       case VIDEO_FRAME_TYPE_2D:
+               return s;
+       case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
+               return libdcp::Size (s.width / 2, s.height);
+       }
+
+       assert (false);
+}
index 513e1f598afc502bef634547897b6b531a9f9b68..97ef6a9fae710fba1b5e7482542b817514d6490a 100644 (file)
@@ -88,6 +88,8 @@ public:
                return _ratio;
        }
 
+       libdcp::Size video_size_after_3d_split () const;
+
 protected:
        void take_from_video_examiner (boost::shared_ptr<VideoExaminer>);
 
index ec7854764e048c435819e129467c33a051f0a28f..962dd50ece04b58c72df5d233ec08efdca90da95 100644 (file)
@@ -68,7 +68,8 @@ void
 DirPickerCtrl::browse_clicked (wxCommandEvent &)
 {
        wxDirDialog* d = new wxDirDialog (this);
-       d->ShowModal ();
-       SetPath (d->GetPath ());
+       if (d->ShowModal () == wxID_OK) {
+               SetPath (d->GetPath ());
+       }
        d->Destroy ();
 }
index 74cb295bf4efd3f7dc6539d473c456ba4c1f85c0..cb14f70e786676af544b46afea0737eae26a2778 100644 (file)
@@ -497,8 +497,6 @@ FilmEditor::set_film (shared_ptr<Film> f)
 {
        set_general_sensitivity (f != 0);
 
-       content_selection_changed ();
-
        if (_film == f) {
                return;
        }
@@ -534,6 +532,8 @@ FilmEditor::set_film (shared_ptr<Film> f)
        if (!_film->content().empty ()) {
                set_selection (_film->content().front ());
        }
+
+       content_selection_changed ();
 }
 
 void
index d45d6e65de0e8e0fba637d7c038e56d6cdf3d28a..20f885a9b284cf7b8b0b12256413bf1ea3f618f3 100644 (file)
@@ -43,6 +43,7 @@ public:
                , _window (window)
                , _panel (panel)
                , _table (table)
+               , _needs_pulse (false)
        {
                int n = 0;
                
@@ -83,6 +84,15 @@ public:
                panel->FitInside ();
        }
 
+       void maybe_pulse ()
+       {
+               if (_job->running() && _needs_pulse) {
+                       _gauge->Pulse ();
+               }
+
+               _needs_pulse = true;
+       }
+
 private:
 
        void progress ()
@@ -91,9 +101,7 @@ private:
                if (p >= 0) {
                        checked_set (_message, _job->status ());
                        _gauge->SetValue (p * 100);
-               } else {
-                       checked_set (_message, wx_to_std (_("Running")));
-                       _gauge->Pulse ();
+                       _needs_pulse = false;
                }
 
                _table->Layout ();
@@ -148,6 +156,7 @@ private:
        wxButton* _cancel;
        wxButton* _pause;
        wxButton* _details;
+       bool _needs_pulse;
 };
 
 /** Must be called in the GUI thread */
@@ -171,6 +180,10 @@ JobManagerView::JobManagerView (wxWindow* parent, Buttons buttons)
 
        SetScrollRate (0, 32);
 
+       Bind (wxEVT_TIMER, boost::bind (&JobManagerView::periodic, this));
+       _timer.reset (new wxTimer (this));
+       _timer->Start (1000);
+       
        JobManager::instance()->JobAdded.connect (bind (&JobManagerView::job_added, this, _1));
 }
 
@@ -183,3 +196,10 @@ JobManagerView::job_added (weak_ptr<Job> j)
        }
 }
 
+void
+JobManagerView::periodic ()
+{
+       for (list<shared_ptr<JobRecord> >::iterator i = _job_records.begin(); i != _job_records.end(); ++i) {
+               (*i)->maybe_pulse ();
+       }
+}
index 4653118378676e8ccbb8529984a4f7fbf00cad50..c4bb1e2189b6e32850a0694c52e65121c957a316 100644 (file)
@@ -42,9 +42,11 @@ public:
 
 private:
        void job_added (boost::weak_ptr<Job>);
+       void periodic ();
 
        wxPanel* _panel;
        wxFlexGridSizer* _table;
+       boost::shared_ptr<wxTimer> _timer;
                
        std::list<boost::shared_ptr<JobRecord> > _job_records;
        Buttons _buttons;
index 90fcf8d5c74c26340a3f60e5371023e505a0c801..8b0e4762a6ac9f6b888bb9190b23c9da686cb4ef 100644 (file)
@@ -74,10 +74,10 @@ private:
 class ContentView : public View
 {
 public:
-       ContentView (Timeline& tl, shared_ptr<Content> c, int t)
+       ContentView (Timeline& tl, shared_ptr<Content> c)
                : View (tl)
                , _content (c)
-               , _track (t)
+               , _track (0)
                , _selected (false)
        {
                _content_connection = c->Changed.connect (bind (&ContentView::content_changed, this, _2, _3));
@@ -197,8 +197,8 @@ private:
 class AudioContentView : public ContentView
 {
 public:
-       AudioContentView (Timeline& tl, shared_ptr<Content> c, int t)
-               : ContentView (tl, c, t)
+       AudioContentView (Timeline& tl, shared_ptr<Content> c)
+               : ContentView (tl, c)
        {}
        
 private:
@@ -216,8 +216,8 @@ private:
 class VideoContentView : public ContentView
 {
 public:
-       VideoContentView (Timeline& tl, shared_ptr<Content> c, int t)
-               : ContentView (tl, c, t)
+       VideoContentView (Timeline& tl, shared_ptr<Content> c)
+               : ContentView (tl, c)
        {}
 
 private:       
@@ -385,10 +385,10 @@ Timeline::playlist_changed ()
 
        for (ContentList::iterator i = content.begin(); i != content.end(); ++i) {
                if (dynamic_pointer_cast<VideoContent> (*i)) {
-                       _views.push_back (shared_ptr<View> (new VideoContentView (*this, *i, 0)));
+                       _views.push_back (shared_ptr<View> (new VideoContentView (*this, *i)));
                }
                if (dynamic_pointer_cast<AudioContent> (*i)) {
-                       _views.push_back (shared_ptr<View> (new AudioContentView (*this, *i, 0)));
+                       _views.push_back (shared_ptr<View> (new AudioContentView (*this, *i)));
                }
        }
 
@@ -415,7 +415,7 @@ Timeline::assign_tracks ()
                }
        
                shared_ptr<Content> acv_content = acv->content();
-               
+
                int t = 1;
                while (1) {
                        ViewList::iterator j = _views.begin();
@@ -429,8 +429,11 @@ Timeline::assign_tracks ()
                                shared_ptr<Content> test_content = test->content();
                                        
                                if (test && test->track() == t) {
-                                       if ((acv_content->start() < test_content->start() && test_content->start() < acv_content->end()) ||
-                                           (acv_content->start() < test_content->end()   && test_content->end()   < acv_content->end())) {
+                                       bool const no_overlap =
+                                               (acv_content->start() < test_content->start() && acv_content->end() < test_content->start()) ||
+                                               (acv_content->start() > test_content->end()   && acv_content->end() > test_content->end());
+                                       
+                                       if (!no_overlap) {
                                                /* we have an overlap on track `t' */
                                                ++t;
                                                break;
index d0c99f6068484866a26046e71cf5b02c621b5a96..edf4505c91e936c43a39ddfe170144015fef4be6 100644 (file)
@@ -71,14 +71,6 @@ VideoPanel::VideoPanel (FilmEditor* e)
        grid->Add (_ratio, wxGBPosition (r, 1));
        ++r;
 
-       _scaling_description = new wxStaticText (this, wxID_ANY, wxT ("\n \n \n \n"), wxDefaultPosition, wxDefaultSize);
-       grid->Add (_scaling_description, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
-       wxFont font = _scaling_description->GetFont();
-       font.SetStyle(wxFONTSTYLE_ITALIC);
-       font.SetPointSize(font.GetPointSize() - 1);
-       _scaling_description->SetFont(font);
-       ++r;
-
        {
                add_label_to_grid_bag_sizer (grid, this, _("Filters"), true, wxGBPosition (r, 0));
                wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
@@ -90,6 +82,14 @@ VideoPanel::VideoPanel (FilmEditor* e)
        }
        ++r;
 
+       _description = new wxStaticText (this, wxID_ANY, wxT ("\n \n \n \n \n"), wxDefaultPosition, wxDefaultSize);
+       grid->Add (_description, wxGBPosition (r, 0), wxGBSpan (1, 2), wxEXPAND | wxALIGN_CENTER_VERTICAL | wxALL, 6);
+       wxFont font = _description->GetFont();
+       font.SetStyle(wxFONTSTYLE_ITALIC);
+       font.SetPointSize(font.GetPointSize() - 1);
+       _description->SetFont(font);
+       ++r;
+
        _left_crop->SetRange (0, 1024);
        _top_crop->SetRange (0, 1024);
        _right_crop->SetRange (0, 1024);
@@ -167,7 +167,8 @@ VideoPanel::film_changed (Film::Property property)
 {
        switch (property) {
        case Film::CONTAINER:
-               setup_scaling_description ();
+       case Film::VIDEO_FRAME_RATE:
+               setup_description ();
                break;
        default:
                break;
@@ -182,12 +183,13 @@ VideoPanel::film_content_changed (shared_ptr<Content> c, int property)
 
        if (property == VideoContentProperty::VIDEO_FRAME_TYPE) {
                checked_set (_frame_type, vc ? vc->video_frame_type () : VIDEO_FRAME_TYPE_2D);
+               setup_description ();
        } else if (property == VideoContentProperty::VIDEO_CROP) {
                checked_set (_left_crop,   vc ? vc->crop().left : 0);
                checked_set (_right_crop,  vc ? vc->crop().right        : 0);
                checked_set (_top_crop,    vc ? vc->crop().top  : 0);
                checked_set (_bottom_crop, vc ? vc->crop().bottom : 0);
-               setup_scaling_description ();
+               setup_description ();
        } else if (property == VideoContentProperty::VIDEO_RATIO) {
                if (vc) {
                        int n = 0;
@@ -206,7 +208,9 @@ VideoPanel::film_content_changed (shared_ptr<Content> c, int property)
                } else {
                        checked_set (_ratio, -1);
                }
-               setup_scaling_description ();
+               setup_description ();
+       } else if (property == VideoContentProperty::VIDEO_FRAME_RATE) {
+               setup_description ();
        } else if (property == FFmpegContentProperty::FILTERS) {
                if (fc) {
                        pair<string, string> p = Filter::ffmpeg_strings (fc->filters ());
@@ -241,11 +245,11 @@ VideoPanel::edit_filters_clicked ()
 }
 
 void
-VideoPanel::setup_scaling_description ()
+VideoPanel::setup_description ()
 {
        shared_ptr<VideoContent> vc = _editor->selected_video_content ();
        if (!vc) {
-               _scaling_description->SetLabel ("");
+               _description->SetLabel ("");
                return;
        }
 
@@ -255,16 +259,16 @@ VideoPanel::setup_scaling_description ()
 
        if (vc->video_size().width && vc->video_size().height) {
                d << wxString::Format (
-                       _("Original video is %dx%d (%.2f:1)\n"),
-                       vc->video_size().width, vc->video_size().height,
-                       float (vc->video_size().width) / vc->video_size().height
+                       _("Content video is %dx%d (%.2f:1)\n"),
+                       vc->video_size_after_3d_split().width, vc->video_size_after_3d_split().height,
+                       float (vc->video_size_after_3d_split().width) / vc->video_size_after_3d_split().height
                        );
                ++lines;
        }
 
        Crop const crop = vc->crop ();
        if ((crop.left || crop.right || crop.top || crop.bottom) && vc->video_size() != libdcp::Size (0, 0)) {
-               libdcp::Size cropped = vc->video_size ();
+               libdcp::Size cropped = vc->video_size_after_3d_split ();
                cropped.width -= crop.left + crop.right;
                cropped.height -= crop.top + crop.bottom;
                d << wxString::Format (
@@ -297,11 +301,17 @@ VideoPanel::setup_scaling_description ()
                }
        }
 
-       for (int i = lines; i < 4; ++i) {
+       d << wxString::Format (_("Content frame rate %.4f\n"), vc->video_frame_rate ());
+       ++lines;
+       FrameRateConversion frc (vc->video_frame_rate(), _editor->film()->video_frame_rate ());
+       d << frc.description << "\n";
+       ++lines;
+
+       for (int i = lines; i < 6; ++i) {
                d << wxT ("\n ");
        }
 
-       _scaling_description->SetLabel (d);
+       _description->SetLabel (d);
        _sizer->Layout ();
 }
 
index 4bd526d499d0cd1c7d85c7425f64991211d17da7..5a22811505239289ef4cd016de58cad6f9ccf424 100644 (file)
@@ -42,7 +42,7 @@ private:
        void ratio_changed ();
        void frame_type_changed ();
 
-       void setup_scaling_description ();
+       void setup_description ();
 
        wxChoice* _frame_type;
        wxSpinCtrl* _left_crop;
@@ -51,7 +51,7 @@ private:
        wxSpinCtrl* _bottom_crop;
        wxChoice* _ratio;
        wxStaticText* _ratio_description;
-       wxStaticText* _scaling_description;
+       wxStaticText* _description;
        wxStaticText* _filters;
        wxButton* _filters_button;
 };