summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-11-23 01:15:37 +0000
committerCarl Hetherington <cth@carlh.net>2018-11-23 01:15:37 +0000
commit673ba43fb66eb0dee43807501753749f144254a7 (patch)
tree1c337ccebdc2dc6f25d76d761252976814f34d57 /src
parente13e5cd4cfda39b0a0b77ed8036e14e15f93ec2e (diff)
Remove required Film from content examine.
Diffstat (limited to 'src')
-rw-r--r--src/lib/atmos_mxf_content.cc6
-rw-r--r--src/lib/atmos_mxf_content.h1
-rw-r--r--src/lib/content.h1
-rw-r--r--src/lib/dcp_content.cc11
-rw-r--r--src/lib/dcp_content.h1
-rw-r--r--src/lib/dcp_subtitle_content.cc6
-rw-r--r--src/lib/dcp_subtitle_content.h1
-rw-r--r--src/lib/ffmpeg_content.cc19
-rw-r--r--src/lib/ffmpeg_content.h1
-rw-r--r--src/lib/frame_rate_change.cc11
-rw-r--r--src/lib/frame_rate_change.h1
-rw-r--r--src/lib/image_content.cc6
-rw-r--r--src/lib/image_content.h1
-rw-r--r--src/lib/string_text_file_content.cc6
-rw-r--r--src/lib/string_text_file_content.h1
-rw-r--r--src/lib/video_mxf_content.cc6
-rw-r--r--src/lib/video_mxf_content.h1
-rw-r--r--src/tools/dcpomatic_playlist.cc2
-rw-r--r--src/wx/content_view.cc26
-rw-r--r--src/wx/content_view.h3
-rw-r--r--src/wx/swaroop_controls.cc5
21 files changed, 84 insertions, 32 deletions
diff --git a/src/lib/atmos_mxf_content.cc b/src/lib/atmos_mxf_content.cc
index 4835442d5..5b97edcfd 100644
--- a/src/lib/atmos_mxf_content.cc
+++ b/src/lib/atmos_mxf_content.cc
@@ -96,3 +96,9 @@ AtmosMXFContent::full_length (shared_ptr<const Film> film) const
FrameRateChange const frc (film, shared_from_this());
return DCPTime::from_frames (llrint (_length * frc.factor()), film->video_frame_rate());
}
+
+DCPTime
+AtmosMXFContent::approximate_length () const
+{
+ return DCPTime::from_frames (_length, 24);
+}
diff --git a/src/lib/atmos_mxf_content.h b/src/lib/atmos_mxf_content.h
index 854824c67..05f36c21c 100644
--- a/src/lib/atmos_mxf_content.h
+++ b/src/lib/atmos_mxf_content.h
@@ -38,6 +38,7 @@ public:
std::string summary () const;
void as_xml (xmlpp::Node* node, bool with_path) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
static bool valid_mxf (boost::filesystem::path path);
diff --git a/src/lib/content.h b/src/lib/content.h
index 47f29cb79..552017c64 100644
--- a/src/lib/content.h
+++ b/src/lib/content.h
@@ -91,6 +91,7 @@ public:
virtual void as_xml (xmlpp::Node *, bool with_paths) const;
virtual DCPTime full_length (boost::shared_ptr<const Film>) const = 0;
+ virtual DCPTime approximate_length () const = 0;
virtual std::string identifier () const;
/** @return points at which to split this content when
* REELTYPE_BY_VIDEO_CONTENT is in use.
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index c89eadc3c..ac9f82899 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -212,7 +212,7 @@ DCPContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
AudioStreamPtr as (new AudioStream (examiner->audio_frame_rate(), examiner->audio_length(), examiner->audio_channels()));
audio->set_stream (as);
AudioMapping m = as->mapping ();
- m.make_default (film->audio_processor());
+ m.make_default (film ? film->audio_processor() : 0);
as->set_mapping (m);
}
@@ -345,6 +345,15 @@ DCPContent::full_length (shared_ptr<const Film> film) const
return DCPTime::from_frames (llrint(video->length() * frc.factor()), film->video_frame_rate());
}
+DCPTime
+DCPContent::approximate_length () const
+{
+ if (!video) {
+ return DCPTime();
+ }
+ return DCPTime::from_frames (video->length(), 24);
+}
+
string
DCPContent::identifier () const
{
diff --git a/src/lib/dcp_content.h b/src/lib/dcp_content.h
index 874e1ee31..656c96897 100644
--- a/src/lib/dcp_content.h
+++ b/src/lib/dcp_content.h
@@ -62,6 +62,7 @@ public:
}
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
void examine (boost::shared_ptr<const Film> film, boost::shared_ptr<Job>);
std::string summary () const;
diff --git a/src/lib/dcp_subtitle_content.cc b/src/lib/dcp_subtitle_content.cc
index d25e06188..54bd631cb 100644
--- a/src/lib/dcp_subtitle_content.cc
+++ b/src/lib/dcp_subtitle_content.cc
@@ -88,6 +88,12 @@ DCPSubtitleContent::full_length (shared_ptr<const Film> film) const
return DCPTime (_length, frc);
}
+DCPTime
+DCPSubtitleContent::approximate_length () const
+{
+ return DCPTime (_length, FrameRateChange());
+}
+
string
DCPSubtitleContent::summary () const
{
diff --git a/src/lib/dcp_subtitle_content.h b/src/lib/dcp_subtitle_content.h
index 5eaad0d2f..f5f375eee 100644
--- a/src/lib/dcp_subtitle_content.h
+++ b/src/lib/dcp_subtitle_content.h
@@ -32,6 +32,7 @@ public:
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
private:
ContentTime _length;
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 919200679..f4e4beba9 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -307,7 +307,7 @@ FFmpegContent::examine (shared_ptr<const Film> film, shared_ptr<Job> job)
AudioStreamPtr as = audio->streams().front();
AudioMapping m = as->mapping ();
- m.make_default (film->audio_processor(), first_path);
+ m.make_default (film ? film->audio_processor() : 0, first_path);
as->set_mapping (m);
}
@@ -415,6 +415,23 @@ FFmpegContent::full_length (shared_ptr<const Film> film) const
return longest;
}
+DCPTime
+FFmpegContent::approximate_length () const
+{
+ if (video) {
+ return DCPTime::from_frames (video->length_after_3d_combine(), 24);
+ }
+
+ DCPOMATIC_ASSERT (audio);
+
+ Frame longest = 0;
+ BOOST_FOREACH (AudioStreamPtr i, audio->streams ()) {
+ longest = max (longest, Frame(llrint(i->length())));
+ }
+
+ return DCPTime::from_frames (longest, 24);
+}
+
void
FFmpegContent::set_filters (vector<Filter const *> const & filters)
{
diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h
index b7685bf09..4c612cd3e 100644
--- a/src/lib/ffmpeg_content.h
+++ b/src/lib/ffmpeg_content.h
@@ -64,6 +64,7 @@ public:
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
std::string identifier () const;
diff --git a/src/lib/frame_rate_change.cc b/src/lib/frame_rate_change.cc
index 456b4151e..7b43ccdbc 100644
--- a/src/lib/frame_rate_change.cc
+++ b/src/lib/frame_rate_change.cc
@@ -36,6 +36,17 @@ about_equal (double a, double b)
return (fabs (a - b) < VIDEO_FRAME_RATE_EPSILON);
}
+FrameRateChange::FrameRateChange ()
+ : skip (false)
+ , repeat (1)
+ , change_speed (false)
+ , source (24)
+ , dcp (24)
+ , speed_up (1)
+{
+
+}
+
FrameRateChange::FrameRateChange (double source_, int dcp_)
: skip (false)
, repeat (1)
diff --git a/src/lib/frame_rate_change.h b/src/lib/frame_rate_change.h
index 05660ce82..acb75c0b5 100644
--- a/src/lib/frame_rate_change.h
+++ b/src/lib/frame_rate_change.h
@@ -30,6 +30,7 @@ class Content;
class FrameRateChange
{
public:
+ FrameRateChange ();
FrameRateChange (double, int);
FrameRateChange (boost::shared_ptr<const Film> film, boost::shared_ptr<const Content> content);
FrameRateChange (boost::shared_ptr<const Film> film, Content const * content);
diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc
index c84ba7d29..8902798a4 100644
--- a/src/lib/image_content.cc
+++ b/src/lib/image_content.cc
@@ -139,6 +139,12 @@ ImageContent::full_length (shared_ptr<const Film> film) const
return DCPTime::from_frames (llrint(video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
+DCPTime
+ImageContent::approximate_length () const
+{
+ return DCPTime::from_frames (video->length_after_3d_combine(), 24);
+}
+
string
ImageContent::identifier () const
{
diff --git a/src/lib/image_content.h b/src/lib/image_content.h
index 6a450ef8f..e2a2ec366 100644
--- a/src/lib/image_content.h
+++ b/src/lib/image_content.h
@@ -42,6 +42,7 @@ public:
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
std::string identifier () const;
diff --git a/src/lib/string_text_file_content.cc b/src/lib/string_text_file_content.cc
index 8b740546e..b4362a7d0 100644
--- a/src/lib/string_text_file_content.cc
+++ b/src/lib/string_text_file_content.cc
@@ -94,3 +94,9 @@ StringTextFileContent::full_length (shared_ptr<const Film> film) const
FrameRateChange const frc (film, shared_from_this());
return DCPTime (_length, frc);
}
+
+DCPTime
+StringTextFileContent::approximate_length () const
+{
+ return DCPTime (_length, FrameRateChange());
+}
diff --git a/src/lib/string_text_file_content.h b/src/lib/string_text_file_content.h
index 4932f2a72..936e894d8 100644
--- a/src/lib/string_text_file_content.h
+++ b/src/lib/string_text_file_content.h
@@ -44,6 +44,7 @@ public:
std::string technical_summary () const;
void as_xml (xmlpp::Node *, bool with_paths) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
private:
ContentTime _length;
diff --git a/src/lib/video_mxf_content.cc b/src/lib/video_mxf_content.cc
index def58c5eb..9d2af1a32 100644
--- a/src/lib/video_mxf_content.cc
+++ b/src/lib/video_mxf_content.cc
@@ -123,6 +123,12 @@ VideoMXFContent::full_length (shared_ptr<const Film> film) const
return DCPTime::from_frames (llrint (video->length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
+DCPTime
+VideoMXFContent::approximate_length () const
+{
+ return DCPTime::from_frames (video->length_after_3d_combine(), 24);
+}
+
void
VideoMXFContent::add_properties (list<UserProperty>& p) const
{
diff --git a/src/lib/video_mxf_content.h b/src/lib/video_mxf_content.h
index 6236568b1..25da0def4 100644
--- a/src/lib/video_mxf_content.h
+++ b/src/lib/video_mxf_content.h
@@ -40,6 +40,7 @@ public:
std::string identifier () const;
void as_xml (xmlpp::Node* node, bool with_paths) const;
DCPTime full_length (boost::shared_ptr<const Film> film) const;
+ DCPTime approximate_length () const;
void add_properties (std::list<UserProperty>& p) const;
static bool valid_mxf (boost::filesystem::path path);
diff --git a/src/tools/dcpomatic_playlist.cc b/src/tools/dcpomatic_playlist.cc
index 2c575af36..2bb9ec2a7 100644
--- a/src/tools/dcpomatic_playlist.cc
+++ b/src/tools/dcpomatic_playlist.cc
@@ -46,7 +46,7 @@ class ContentDialog : public wxDialog, public ContentStore
public:
ContentDialog (wxWindow* parent, weak_ptr<Film> film)
: wxDialog (parent, wxID_ANY, _("Add content"), wxDefaultPosition, wxSize(800, 640))
- , _content_view (new ContentView(this, film))
+ , _content_view (new ContentView(this))
{
_content_view->update ();
diff --git a/src/wx/content_view.cc b/src/wx/content_view.cc
index fdc7afcab..035118245 100644
--- a/src/wx/content_view.cc
+++ b/src/wx/content_view.cc
@@ -40,9 +40,8 @@ using boost::weak_ptr;
using boost::optional;
using boost::dynamic_pointer_cast;
-ContentView::ContentView (wxWindow* parent, weak_ptr<Film> film)
+ContentView::ContentView (wxWindow* parent)
: wxListCtrl (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER)
- , _film (film)
{
AppendColumn (wxT(""), wxLIST_FORMAT_LEFT, 80);
/* type */
@@ -66,11 +65,6 @@ ContentView::selected () const
void
ContentView::update ()
{
- shared_ptr<Film> film = _film.lock ();
- if (!film) {
- return;
- }
-
using namespace boost::filesystem;
DeleteAllItems ();
@@ -95,7 +89,7 @@ ContentView::update ()
}
if (content) {
- shared_ptr<ExamineContentJob> job(new ExamineContentJob(film, content));
+ shared_ptr<ExamineContentJob> job(new ExamineContentJob(shared_ptr<Film>(), content));
jm->add (job);
jobs.push_back (job);
}
@@ -133,13 +127,10 @@ ContentView::add (shared_ptr<Content> content)
{
int const N = GetItemCount();
- shared_ptr<Film> film = _film.lock ();
- DCPOMATIC_ASSERT (film);
-
wxListItem it;
it.SetId(N);
it.SetColumn(0);
- DCPTime length = content->length_after_trim (film);
+ DCPTime length = content->approximate_length ();
int h, m, s, f;
length.split (24, h, m, s, f);
it.SetText(wxString::Format("%02d:%02d:%02d", h, m, s));
@@ -170,14 +161,3 @@ ContentView::get (string digest) const
return shared_ptr<Content>();
}
-
-void
-ContentView::set_film (weak_ptr<Film> film)
-{
- if (_film.lock() == film.lock()) {
- return;
- }
-
- _film = film;
- update ();
-}
diff --git a/src/wx/content_view.h b/src/wx/content_view.h
index d27638c05..334e9bb68 100644
--- a/src/wx/content_view.h
+++ b/src/wx/content_view.h
@@ -30,13 +30,12 @@ class Film;
class ContentView : public wxListCtrl, public ContentStore
{
public:
- ContentView (wxWindow* parent, boost::weak_ptr<Film> film);
+ ContentView (wxWindow* parent);
boost::shared_ptr<Content> selected () const;
void update ();
boost::shared_ptr<Content> get (std::string digest) const;
- void set_film (boost::weak_ptr<Film> film);
private:
void add (boost::shared_ptr<Content> content);
diff --git a/src/wx/swaroop_controls.cc b/src/wx/swaroop_controls.cc
index 538d34942..dc65f1b85 100644
--- a/src/wx/swaroop_controls.cc
+++ b/src/wx/swaroop_controls.cc
@@ -51,7 +51,7 @@ SwaroopControls::SwaroopControls (wxWindow* parent, shared_ptr<FilmViewer> viewe
left_sizer->Add (_spl_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
- _content_view = new ContentView (this, _film);
+ _content_view = new ContentView (this);
left_sizer->Add (_content_view, 1, wxALL | wxEXPAND, DCPOMATIC_SIZER_GAP);
_current_spl_view = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxLC_NO_HEADER);
@@ -240,9 +240,6 @@ void
SwaroopControls::set_film (shared_ptr<Film> film)
{
Controls::set_film (film);
-
- _content_view->set_film (film);
update_playlist_directory ();
-
setup_sensitivity ();
}