summaryrefslogtreecommitdiff
path: root/src/lib
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/lib
parente13e5cd4cfda39b0a0b77ed8036e14e15f93ec2e (diff)
Remove required Film from content examine.
Diffstat (limited to 'src/lib')
-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
17 files changed, 78 insertions, 2 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);