summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-25 09:54:06 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-25 09:54:06 +0100
commitec7c27b80a07bffcdb175512fa6d3811c277d959 (patch)
tree1fcdfdecd9e7a5e5650c16e14062b9aef8c15e4a /src
parent871fd0585082b5e00b5b0053dadd298b9ddf60b6 (diff)
parent595f564a52d69d0401f5622c7d81cacda679005c (diff)
Merge branch '1.0' of ssh://carlh.dnsalias.org/home/carl/git/dvdomatic into 1.0
Diffstat (limited to 'src')
-rw-r--r--src/lib/ffmpeg_content.cc3
-rw-r--r--src/lib/sndfile_content.cc1
-rw-r--r--src/lib/still_image_content.cc3
-rw-r--r--src/lib/util.cc8
-rw-r--r--src/lib/video_content.cc14
-rw-r--r--src/lib/video_content.h2
-rw-r--r--src/wx/dir_picker_ctrl.cc5
-rw-r--r--src/wx/film_editor.cc4
-rw-r--r--src/wx/job_manager_view.cc26
-rw-r--r--src/wx/job_manager_view.h2
-rw-r--r--src/wx/timeline.cc25
-rw-r--r--src/wx/video_panel.cc48
-rw-r--r--src/wx/video_panel.h4
13 files changed, 100 insertions, 45 deletions
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 901cb53cf..24378ed3d 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -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
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc
index 713b80dcb..2ca00cf6d 100644
--- a/src/lib/sndfile_content.cc
+++ b/src/lib/sndfile_content.cc
@@ -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());
}
diff --git a/src/lib/still_image_content.cc b/src/lib/still_image_content.cc
index e829e205d..d0600f52e 100644
--- a/src/lib/still_image_content.cc
+++ b/src/lib/still_image_content.cc
@@ -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
diff --git a/src/lib/util.cc b/src/lib/util.cc
index affbe3b00..183ff7d8b 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -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);
}
}
}
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index d70ece340..f61518ec0 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -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);
+}
diff --git a/src/lib/video_content.h b/src/lib/video_content.h
index 513e1f598..97ef6a9fa 100644
--- a/src/lib/video_content.h
+++ b/src/lib/video_content.h
@@ -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>);
diff --git a/src/wx/dir_picker_ctrl.cc b/src/wx/dir_picker_ctrl.cc
index ec7854764..962dd50ec 100644
--- a/src/wx/dir_picker_ctrl.cc
+++ b/src/wx/dir_picker_ctrl.cc
@@ -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 ();
}
diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc
index 74cb295bf..cb14f70e7 100644
--- a/src/wx/film_editor.cc
+++ b/src/wx/film_editor.cc
@@ -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
diff --git a/src/wx/job_manager_view.cc b/src/wx/job_manager_view.cc
index d45d6e65d..20f885a9b 100644
--- a/src/wx/job_manager_view.cc
+++ b/src/wx/job_manager_view.cc
@@ -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 ();
+ }
+}
diff --git a/src/wx/job_manager_view.h b/src/wx/job_manager_view.h
index 465311837..c4bb1e218 100644
--- a/src/wx/job_manager_view.h
+++ b/src/wx/job_manager_view.h
@@ -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;
diff --git a/src/wx/timeline.cc b/src/wx/timeline.cc
index 90fcf8d5c..8b0e4762a 100644
--- a/src/wx/timeline.cc
+++ b/src/wx/timeline.cc
@@ -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;
diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc
index d0c99f606..edf4505c9 100644
--- a/src/wx/video_panel.cc
+++ b/src/wx/video_panel.cc
@@ -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 ();
}
diff --git a/src/wx/video_panel.h b/src/wx/video_panel.h
index 4bd526d49..5a2281150 100644
--- a/src/wx/video_panel.h
+++ b/src/wx/video_panel.h
@@ -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;
};