Restore video content frame rate information.
authorCarl Hetherington <cth@carlh.net>
Wed, 24 Jul 2013 22:06:40 +0000 (23:06 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 24 Jul 2013 22:06:40 +0000 (23:06 +0100)
src/lib/util.cc
src/wx/video_panel.cc
src/wx/video_panel.h

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 d0c99f6068484866a26046e71cf5b02c621b5a96..f5306e67fd8e532609893ea1a0557c83e4bc10cf 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;
@@ -187,7 +188,7 @@ VideoPanel::film_content_changed (shared_ptr<Content> c, int property)
                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 +207,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 +244,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,7 +258,7 @@ VideoPanel::setup_scaling_description ()
 
        if (vc->video_size().width && vc->video_size().height) {
                d << wxString::Format (
-                       _("Original video is %dx%d (%.2f:1)\n"),
+                       _("Content video is %dx%d (%.2f:1)\n"),
                        vc->video_size().width, vc->video_size().height,
                        float (vc->video_size().width) / vc->video_size().height
                        );
@@ -297,11 +300,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;
 };