From 91f71a29f894c382a7f92cf5fdcb75d9849e2aa7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Tue, 9 Dec 2014 16:30:31 +0000 Subject: [PATCH] Various fixes pointed out by tests. --- src/lib/content.cc | 4 +++- src/lib/image_examiner.cc | 2 +- src/lib/video_content.cc | 5 ++--- src/wx/content_panel.cc | 7 +------ 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/lib/content.cc b/src/lib/content.cc index cc29345a2..ba83e2627 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -139,7 +139,9 @@ Content::examine (shared_ptr job, bool calculate_digest) return; } - job->sub (_("Computing digest")); + if (job) { + job->sub (_("Computing digest")); + } boost::mutex::scoped_lock lm (_mutex); vector p = _paths; diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc index d6c7d0502..e8db326c7 100644 --- a/src/lib/image_examiner.cc +++ b/src/lib/image_examiner.cc @@ -65,7 +65,7 @@ ImageExaminer::ImageExaminer (shared_ptr film, shared_ptrdefault_still_length()); } else { _video_length = ContentTime::from_frames ( - _image_content->number_of_paths (), video_frame_rate().get_value_or (0) + _image_content->number_of_paths (), video_frame_rate().get_value_or (24) ); } } diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 1fe02bae4..1da5d87c1 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -228,9 +228,8 @@ VideoContent::take_from_video_examiner (shared_ptr d) { boost::mutex::scoped_lock lm (_mutex); _video_size = vs; - if (vfr) { - _video_frame_rate = vfr.get (); - } + /* Default video frame rate to 24fps if the examiner doesn't know */ + _video_frame_rate = vfr.get_value_or (24); _video_length = vl; _sample_aspect_ratio = ar; diff --git a/src/wx/content_panel.cc b/src/wx/content_panel.cc index 2dc75f8c2..4d73a608d 100644 --- a/src/wx/content_panel.cc +++ b/src/wx/content_panel.cc @@ -248,12 +248,7 @@ ContentPanel::add_file_clicked () /* XXX: check for lots of files here and do something */ for (unsigned int i = 0; i < paths.GetCount(); ++i) { - shared_ptr c = content_factory (_film, wx_to_std (paths[i])); - shared_ptr ic = dynamic_pointer_cast (c); - if (ic) { - ic->set_video_frame_rate (24); - } - _film->examine_and_add_content (c, true); + _film->examine_and_add_content (content_factory (_film, wx_to_std (paths[i])), true); } d->Destroy (); -- 2.30.2