summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-05-27 02:09:22 +0100
committerCarl Hetherington <cth@carlh.net>2015-05-27 02:09:22 +0100
commit387304bc9147933b68eda2b38ba8cac0d250e87e (patch)
tree0697a08182c94193a3424d44d5f7af4231f0ade3 /src/lib
parentfd2b1840496fa121727b7e835843c8beeaebd5eb (diff)
Untested use of Frame for video/audio content lengths.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/audio_content.cc4
-rw-r--r--src/lib/audio_content.h2
-rw-r--r--src/lib/audio_examiner.h2
-rw-r--r--src/lib/config.h1
-rw-r--r--src/lib/dcp_content.cc3
-rw-r--r--src/lib/dcp_examiner.cc4
-rw-r--r--src/lib/dcp_examiner.h8
-rw-r--r--src/lib/ffmpeg_content.cc13
-rw-r--r--src/lib/ffmpeg_content.h2
-rw-r--r--src/lib/ffmpeg_examiner.cc11
-rw-r--r--src/lib/ffmpeg_examiner.h4
-rw-r--r--src/lib/image_content.cc9
-rw-r--r--src/lib/image_content.h4
-rw-r--r--src/lib/image_decoder.cc2
-rw-r--r--src/lib/image_examiner.cc6
-rw-r--r--src/lib/image_examiner.h4
-rw-r--r--src/lib/single_stream_audio_content.cc4
-rw-r--r--src/lib/single_stream_audio_content.h6
-rw-r--r--src/lib/sndfile_content.cc3
-rw-r--r--src/lib/sndfile_decoder.cc6
-rw-r--r--src/lib/sndfile_decoder.h4
-rw-r--r--src/lib/video_content.cc41
-rw-r--r--src/lib/video_content.h22
-rw-r--r--src/lib/video_examiner.h4
24 files changed, 85 insertions, 84 deletions
diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc
index 53160fdb0..def123fb1 100644
--- a/src/lib/audio_content.cc
+++ b/src/lib/audio_content.cc
@@ -188,9 +188,9 @@ string
AudioContent::technical_summary () const
{
return String::compose (
- "audio: channels %1, length %2, content rate %3, resampled rate %4",
+ "audio: channels %1, length %2 frames, content rate %3, resampled rate %4",
audio_channels(),
- audio_length().seconds(),
+ audio_length(),
audio_frame_rate(),
resampled_audio_frame_rate()
);
diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h
index f4a537b30..cb14c70cb 100644
--- a/src/lib/audio_content.h
+++ b/src/lib/audio_content.h
@@ -68,7 +68,7 @@ public:
/** @return number of audio channels in the content */
virtual int audio_channels () const = 0;
/** @return the length of the audio in the content */
- virtual ContentTime audio_length () const = 0;
+ virtual Frame audio_length () const = 0;
/** @return the frame rate of the content */
virtual int audio_frame_rate () const = 0;
virtual AudioMapping audio_mapping () const = 0;
diff --git a/src/lib/audio_examiner.h b/src/lib/audio_examiner.h
index d6d4dbe97..a5f055984 100644
--- a/src/lib/audio_examiner.h
+++ b/src/lib/audio_examiner.h
@@ -30,6 +30,6 @@ public:
virtual ~AudioExaminer () {}
virtual int audio_channels () const = 0;
- virtual ContentTime audio_length () const = 0;
+ virtual Frame audio_length () const = 0;
virtual int audio_frame_rate () const = 0;
};
diff --git a/src/lib/config.h b/src/lib/config.h
index b39e7af3a..20529911b 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -449,6 +449,7 @@ private:
/** Default ISDCF metadata for newly-created Films */
ISDCFMetadata _default_isdcf_metadata;
boost::optional<std::string> _language;
+ /** Default length of still image content (seconds) */
int _default_still_length;
Ratio const * _default_container;
DCPContentType const * _default_dcp_content_type;
diff --git a/src/lib/dcp_content.cc b/src/lib/dcp_content.cc
index 51c7f8549..0c8968531 100644
--- a/src/lib/dcp_content.cc
+++ b/src/lib/dcp_content.cc
@@ -141,7 +141,8 @@ DCPContent::full_length () const
{
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
- return DCPTime (video_length (), FrameRateChange (video_frame_rate (), film->video_frame_rate ()));
+ FrameRateChange const frc (video_frame_rate (), film->video_frame_rate ());
+ return DCPTime::from_frames (rint (video_length () * frc.factor ()), film->video_frame_rate ());
}
string
diff --git a/src/lib/dcp_examiner.cc b/src/lib/dcp_examiner.cc
index 9dbac14d0..a0d13a722 100644
--- a/src/lib/dcp_examiner.cc
+++ b/src/lib/dcp_examiner.cc
@@ -81,7 +81,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content)
throw DCPError (_("Mismatched video sizes in DCP"));
}
- _video_length += ContentTime::from_frames ((*i)->main_picture()->duration(), _video_frame_rate.get ());
+ _video_length += (*i)->main_picture()->duration();
}
if ((*i)->main_sound ()) {
@@ -99,7 +99,7 @@ DCPExaminer::DCPExaminer (shared_ptr<const DCPContent> content)
throw DCPError (_("Mismatched audio frame rates in DCP"));
}
- _audio_length += ContentTime::from_frames ((*i)->main_sound()->duration(), _video_frame_rate.get ());
+ _audio_length += (*i)->main_sound()->duration();
}
if ((*i)->main_subtitle ()) {
diff --git a/src/lib/dcp_examiner.h b/src/lib/dcp_examiner.h
index 26957b3e4..bf083e8ec 100644
--- a/src/lib/dcp_examiner.h
+++ b/src/lib/dcp_examiner.h
@@ -39,7 +39,7 @@ public:
return _video_size.get_value_or (dcp::Size (1998, 1080));
}
- ContentTime video_length () const {
+ Frame video_length () const {
return _video_length;
}
@@ -59,7 +59,7 @@ public:
return _audio_channels.get_value_or (0);
}
- ContentTime audio_length () const {
+ Frame audio_length () const {
return _audio_length;
}
@@ -74,10 +74,10 @@ public:
private:
boost::optional<float> _video_frame_rate;
boost::optional<dcp::Size> _video_size;
- ContentTime _video_length;
+ Frame _video_length;
boost::optional<int> _audio_channels;
boost::optional<int> _audio_frame_rate;
- ContentTime _audio_length;
+ Frame _audio_length;
std::string _name;
bool _has_subtitles;
bool _encrypted;
diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc
index 187d61953..9acc883fd 100644
--- a/src/lib/ffmpeg_content.cc
+++ b/src/lib/ffmpeg_content.cc
@@ -249,14 +249,18 @@ FFmpegContent::set_audio_stream (shared_ptr<FFmpegAudioStream> s)
signal_changed (FFmpegContentProperty::AUDIO_STREAM);
}
-ContentTime
+Frame
FFmpegContent::audio_length () const
{
if (!audio_stream ()) {
- return ContentTime ();
+ return 0;
}
- return video_length ();
+ /* We're talking about the content's audio length here, at the content's frame
+ rate. We assume it's the same as the video's length, and we can just convert
+ using the content's rates.
+ */
+ return (video_length () / video_frame_rate ()) * audio_frame_rate ();
}
int
@@ -300,7 +304,8 @@ FFmpegContent::full_length () const
{
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
- return DCPTime (video_length_after_3d_combine(), FrameRateChange (video_frame_rate (), film->video_frame_rate ()));
+ FrameRateChange const frc (video_frame_rate (), film->video_frame_rate ());
+ return DCPTime::from_frames (rint (video_length_after_3d_combine() * frc.factor()), film->video_frame_rate());
}
AudioMapping
diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h
index bc1872ac1..cff5eaed8 100644
--- a/src/lib/ffmpeg_content.h
+++ b/src/lib/ffmpeg_content.h
@@ -69,7 +69,7 @@ public:
/* AudioContent */
int audio_channels () const;
- ContentTime audio_length () const;
+ Frame audio_length () const;
int audio_frame_rate () const;
AudioMapping audio_mapping () const;
void set_audio_mapping (AudioMapping);
diff --git a/src/lib/ffmpeg_examiner.cc b/src/lib/ffmpeg_examiner.cc
index 8afd4c164..eea99e1e8 100644
--- a/src/lib/ffmpeg_examiner.cc
+++ b/src/lib/ffmpeg_examiner.cc
@@ -70,7 +70,7 @@ FFmpegExaminer::FFmpegExaminer (shared_ptr<const FFmpegContent> c, shared_ptr<Jo
/* See if the header has duration information in it */
_need_video_length = _format_context->duration == AV_NOPTS_VALUE;
if (!_need_video_length) {
- _video_length = ContentTime::from_seconds (double (_format_context->duration) / AV_TIME_BASE);
+ _video_length = (double (_format_context->duration) / AV_TIME_BASE) * video_frame_rate().get ();
} else if (job) {
job->sub (_("Finding length"));
job->set_progress_unknown ();
@@ -126,7 +126,9 @@ FFmpegExaminer::video_packet (AVCodecContext* context)
_first_video = frame_time (_format_context->streams[_video_stream]);
}
if (_need_video_length) {
- _video_length = frame_time (_format_context->streams[_video_stream]).get_value_or (ContentTime ());
+ _video_length = frame_time (
+ _format_context->streams[_video_stream]
+ ).get_value_or (ContentTime ()).frames (video_frame_rate().get ());
}
}
}
@@ -195,11 +197,10 @@ FFmpegExaminer::video_size () const
}
/** @return Length according to our content's header */
-ContentTime
+Frame
FFmpegExaminer::video_length () const
{
- ContentTime const length = ContentTime::from_seconds (double (_format_context->duration) / AV_TIME_BASE);
- return ContentTime (max (ContentTime (1), _video_length));
+ return max (Frame (1), _video_length);
}
optional<float>
diff --git a/src/lib/ffmpeg_examiner.h b/src/lib/ffmpeg_examiner.h
index 34d4b1e0d..d6149446a 100644
--- a/src/lib/ffmpeg_examiner.h
+++ b/src/lib/ffmpeg_examiner.h
@@ -31,7 +31,7 @@ public:
boost::optional<float> video_frame_rate () const;
dcp::Size video_size () const;
- ContentTime video_length () const;
+ Frame video_length () const;
boost::optional<float> sample_aspect_ratio () const;
std::vector<boost::shared_ptr<FFmpegSubtitleStream> > subtitle_streams () const {
@@ -62,7 +62,7 @@ private:
/** Video length, either obtained from the header or derived by running
* through the whole file.
*/
- ContentTime _video_length;
+ Frame _video_length;
bool _need_video_length;
boost::optional<ContentTime> _last_subtitle_start;
diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc
index 54ac56eae..c0004e59c 100644
--- a/src/lib/image_content.cc
+++ b/src/lib/image_content.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -126,7 +126,7 @@ ImageContent::examine (shared_ptr<Job> job)
}
void
-ImageContent::set_video_length (ContentTime len)
+ImageContent::set_video_length (Frame len)
{
{
boost::mutex::scoped_lock lm (_mutex);
@@ -141,7 +141,8 @@ ImageContent::full_length () const
{
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
- return DCPTime (video_length_after_3d_combine(), FrameRateChange (video_frame_rate(), film->video_frame_rate()));
+ FrameRateChange const frc (video_frame_rate(), film->video_frame_rate());
+ return DCPTime::from_frames (rint (video_length_after_3d_combine() * frc.factor ()), film->video_frame_rate ());
}
string
@@ -149,7 +150,7 @@ ImageContent::identifier () const
{
SafeStringStream s;
s << VideoContent::identifier ();
- s << "_" << video_length().get();
+ s << "_" << video_length();
return s.str ();
}
diff --git a/src/lib/image_content.h b/src/lib/image_content.h
index 83a02a166..11c932153 100644
--- a/src/lib/image_content.h
+++ b/src/lib/image_content.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@ public:
/* VideoContent */
void set_default_colour_conversion ();
- void set_video_length (ContentTime);
+ void set_video_length (Frame);
bool still () const;
void set_video_frame_rate (float);
};
diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc
index 250c8f845..10eee2f6d 100644
--- a/src/lib/image_decoder.cc
+++ b/src/lib/image_decoder.cc
@@ -45,7 +45,7 @@ ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c)
bool
ImageDecoder::pass (PassReason)
{
- if (_video_position >= _image_content->video_length().frames (_image_content->video_frame_rate ())) {
+ if (_video_position >= _image_content->video_length()) {
return true;
}
diff --git a/src/lib/image_examiner.cc b/src/lib/image_examiner.cc
index 1fd9cd554..502e8adbe 100644
--- a/src/lib/image_examiner.cc
+++ b/src/lib/image_examiner.cc
@@ -68,11 +68,9 @@ ImageExaminer::ImageExaminer (shared_ptr<const Film> film, shared_ptr<const Imag
}
if (content->still ()) {
- _video_length = ContentTime::from_seconds (Config::instance()->default_still_length());
+ _video_length = Config::instance()->default_still_length() * video_frame_rate().get_value_or (24);
} else {
- _video_length = ContentTime::from_frames (
- _image_content->number_of_paths (), video_frame_rate().get_value_or (24)
- );
+ _video_length = _image_content->number_of_paths ();
}
}
diff --git a/src/lib/image_examiner.h b/src/lib/image_examiner.h
index 1917a23f3..937a565f3 100644
--- a/src/lib/image_examiner.h
+++ b/src/lib/image_examiner.h
@@ -32,7 +32,7 @@ public:
boost::optional<float> video_frame_rate () const;
dcp::Size video_size () const;
- ContentTime video_length () const {
+ Frame video_length () const {
return _video_length;
}
@@ -40,5 +40,5 @@ private:
boost::weak_ptr<const Film> _film;
boost::shared_ptr<const ImageContent> _image_content;
boost::optional<dcp::Size> _video_size;
- ContentTime _video_length;
+ Frame _video_length;
};
diff --git a/src/lib/single_stream_audio_content.cc b/src/lib/single_stream_audio_content.cc
index 4547ae600..b470d1a99 100644
--- a/src/lib/single_stream_audio_content.cc
+++ b/src/lib/single_stream_audio_content.cc
@@ -52,7 +52,7 @@ SingleStreamAudioContent::SingleStreamAudioContent (shared_ptr<const Film> f, cx
, _audio_mapping (node->node_child ("AudioMapping"), version)
{
_audio_channels = node->number_child<int> ("AudioChannels");
- _audio_length = ContentTime (node->number_child<ContentTime::Type> ("AudioLength"));
+ _audio_length = node->number_child<Frame> ("AudioLength");
_audio_frame_rate = node->number_child<int> ("AudioFrameRate");
}
@@ -73,7 +73,7 @@ SingleStreamAudioContent::as_xml (xmlpp::Node* node) const
{
AudioContent::as_xml (node);
node->add_child("AudioChannels")->add_child_text (raw_convert<string> (audio_channels ()));
- node->add_child("AudioLength")->add_child_text (raw_convert<string> (audio_length().get ()));
+ node->add_child("AudioLength")->add_child_text (raw_convert<string> (audio_length ()));
node->add_child("AudioFrameRate")->add_child_text (raw_convert<string> (audio_frame_rate ()));
_audio_mapping.as_xml (node->add_child("AudioMapping"));
}
diff --git a/src/lib/single_stream_audio_content.h b/src/lib/single_stream_audio_content.h
index fcfaf14ca..d1d512d67 100644
--- a/src/lib/single_stream_audio_content.h
+++ b/src/lib/single_stream_audio_content.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -45,7 +45,7 @@ public:
return _audio_channels;
}
- ContentTime audio_length () const {
+ Frame audio_length () const {
boost::mutex::scoped_lock lm (_mutex);
return _audio_length;
}
@@ -66,7 +66,7 @@ public:
protected:
int _audio_channels;
- ContentTime _audio_length;
+ Frame _audio_length;
int _audio_frame_rate;
AudioMapping _audio_mapping;
};
diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc
index 9f9ea351e..363c11b09 100644
--- a/src/lib/sndfile_content.cc
+++ b/src/lib/sndfile_content.cc
@@ -93,6 +93,7 @@ SndfileContent::full_length () const
{
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
- return DCPTime (audio_length(), film->active_frame_rate_change (position ()));
+ FrameRateChange const frc = film->active_frame_rate_change (position ());
+ return DCPTime::from_frames (audio_length() / frc.speed_up, film->audio_frame_rate ());
}
diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc
index 09059a8b0..ecd1a7e16 100644
--- a/src/lib/sndfile_decoder.cc
+++ b/src/lib/sndfile_decoder.cc
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -116,10 +116,10 @@ SndfileDecoder::audio_channels () const
return _info.channels;
}
-ContentTime
+Frame
SndfileDecoder::audio_length () const
{
- return ContentTime::from_frames (_info.frames, audio_frame_rate ());
+ return _info.frames;
}
int
diff --git a/src/lib/sndfile_decoder.h b/src/lib/sndfile_decoder.h
index 68c8633a0..932394626 100644
--- a/src/lib/sndfile_decoder.h
+++ b/src/lib/sndfile_decoder.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@ public:
~SndfileDecoder ();
int audio_channels () const;
- ContentTime audio_length () const;
+ Frame audio_length () const;
int audio_frame_rate () const;
private:
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index db9a2a5e8..0397647ef 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -70,7 +70,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f)
set_default_colour_conversion ();
}
-VideoContent::VideoContent (shared_ptr<const Film> f, DCPTime s, ContentTime len)
+VideoContent::VideoContent (shared_ptr<const Film> f, DCPTime s, Frame len)
: Content (f, s)
, _video_length (len)
, _video_frame_rate (0)
@@ -96,14 +96,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, cxml::ConstNodePtr node, i
_video_size.width = node->number_child<int> ("VideoWidth");
_video_size.height = node->number_child<int> ("VideoHeight");
_video_frame_rate = node->number_child<float> ("VideoFrameRate");
-
- if (version < 32) {
- /* DCP-o-matic 1.0 branch */
- _video_length = ContentTime::from_frames (node->number_child<int64_t> ("VideoLength"), _video_frame_rate);
- } else {
- _video_length = ContentTime (node->number_child<ContentTime::Type> ("VideoLength"));
- }
-
+ _video_length = node->number_child<Frame> ("VideoLength");
_video_frame_type = static_cast<VideoFrameType> (node->number_child<int> ("VideoFrameType"));
_sample_aspect_ratio = node->optional_number_child<float> ("SampleAspectRatio");
_crop.left = node->number_child<int> ("LeftCrop");
@@ -125,8 +118,8 @@ VideoContent::VideoContent (shared_ptr<const Film> f, cxml::ConstNodePtr node, i
_colour_conversion = ColourConversion (node->node_child ("ColourConversion"), version);
}
if (version >= 32) {
- _fade_in = ContentTime (node->number_child<int64_t> ("FadeIn"));
- _fade_out = ContentTime (node->number_child<int64_t> ("FadeOut"));
+ _fade_in = node->number_child<Frame> ("FadeIn");
+ _fade_out = node->number_child<Frame> ("FadeOut");
}
}
@@ -185,7 +178,7 @@ void
VideoContent::as_xml (xmlpp::Node* node) const
{
boost::mutex::scoped_lock lm (_mutex);
- node->add_child("VideoLength")->add_child_text (raw_convert<string> (_video_length.get ()));
+ node->add_child("VideoLength")->add_child_text (raw_convert<string> (_video_length));
node->add_child("VideoWidth")->add_child_text (raw_convert<string> (_video_size.width));
node->add_child("VideoHeight")->add_child_text (raw_convert<string> (_video_size.height));
node->add_child("VideoFrameRate")->add_child_text (raw_convert<string> (_video_frame_rate));
@@ -198,8 +191,8 @@ VideoContent::as_xml (xmlpp::Node* node) const
if (_colour_conversion) {
_colour_conversion.get().as_xml (node->add_child("ColourConversion"));
}
- node->add_child("FadeIn")->add_child_text (raw_convert<string> (_fade_in.get ()));
- node->add_child("FadeOut")->add_child_text (raw_convert<string> (_fade_out.get ()));
+ node->add_child("FadeIn")->add_child_text (raw_convert<string> (_fade_in));
+ node->add_child("FadeOut")->add_child_text (raw_convert<string> (_fade_out));
}
void
@@ -216,7 +209,7 @@ VideoContent::take_from_video_examiner (shared_ptr<VideoExaminer> d)
/* These examiner calls could call other content methods which take a lock on the mutex */
dcp::Size const vs = d->video_size ();
optional<float> const vfr = d->video_frame_rate ();
- ContentTime vl = d->video_length ();
+ Frame vl = d->video_length ();
optional<float> const ar = d->sample_aspect_ratio ();
{
@@ -235,7 +228,7 @@ VideoContent::take_from_video_examiner (shared_ptr<VideoExaminer> d)
shared_ptr<const Film> film = _film.lock ();
DCPOMATIC_ASSERT (film);
- LOG_GENERAL ("Video length obtained from header as %1 frames", _video_length.frames (_video_frame_rate));
+ LOG_GENERAL ("Video length obtained from header as %1 frames", _video_length);
set_default_colour_conversion ();
@@ -355,8 +348,8 @@ string
VideoContent::technical_summary () const
{
string s = String::compose (
- N_("video: length %1, size %2x%3, rate %4"),
- video_length_after_3d_combine().seconds(),
+ N_("video: length %1 frames, size %2x%3, rate %4"),
+ video_length_after_3d_combine(),
video_size().width,
video_size().height,
video_frame_rate()
@@ -413,7 +406,7 @@ VideoContent::set_colour_conversion (ColourConversion c)
}
void
-VideoContent::set_fade_in (ContentTime t)
+VideoContent::set_fade_in (Frame t)
{
{
boost::mutex::scoped_lock lm (_mutex);
@@ -424,7 +417,7 @@ VideoContent::set_fade_in (ContentTime t)
}
void
-VideoContent::set_fade_out (ContentTime t)
+VideoContent::set_fade_out (Frame t)
{
{
boost::mutex::scoped_lock lm (_mutex);
@@ -487,13 +480,13 @@ VideoContent::fade (Frame f) const
{
DCPOMATIC_ASSERT (f >= 0);
- if (f < fade_in().frames (video_frame_rate ())) {
- return float (f) / _fade_in.frames (video_frame_rate ());
+ if (f < fade_in()) {
+ return float (f) / fade_in();
}
- Frame fade_out_start = ContentTime (video_length() - fade_out()).frames (video_frame_rate ());
+ Frame fade_out_start = video_length() - fade_out();
if (f >= fade_out_start) {
- return 1 - float (f - fade_out_start) / fade_out().frames (video_frame_rate ());
+ return 1 - float (f - fade_out_start) / fade_out();
}
return optional<float> ();
diff --git a/src/lib/video_content.h b/src/lib/video_content.h
index 72bad21f8..abc9c5fa3 100644
--- a/src/lib/video_content.h
+++ b/src/lib/video_content.h
@@ -44,7 +44,7 @@ class VideoContent : public virtual Content
{
public:
VideoContent (boost::shared_ptr<const Film>);
- VideoContent (boost::shared_ptr<const Film>, DCPTime, ContentTime);
+ VideoContent (boost::shared_ptr<const Film>, DCPTime, Frame);
VideoContent (boost::shared_ptr<const Film>, boost::filesystem::path);
VideoContent (boost::shared_ptr<const Film>, cxml::ConstNodePtr, int);
VideoContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >);
@@ -55,15 +55,15 @@ public:
virtual void set_default_colour_conversion ();
- ContentTime video_length () const {
+ Frame video_length () const {
boost::mutex::scoped_lock lm (_mutex);
return _video_length;
}
- ContentTime video_length_after_3d_combine () const {
+ Frame video_length_after_3d_combine () const {
boost::mutex::scoped_lock lm (_mutex);
if (_video_frame_type == VIDEO_FRAME_TYPE_3D_ALTERNATE) {
- return ContentTime (_video_length.get() / 2);
+ return _video_length / 2;
}
return _video_length;
@@ -91,8 +91,8 @@ public:
void unset_colour_conversion (bool signal = true);
void set_colour_conversion (ColourConversion);
- void set_fade_in (ContentTime);
- void set_fade_out (ContentTime);
+ void set_fade_in (Frame);
+ void set_fade_out (Frame);
VideoFrameType video_frame_type () const {
boost::mutex::scoped_lock lm (_mutex);
@@ -140,12 +140,12 @@ public:
return _sample_aspect_ratio;
}
- ContentTime fade_in () const {
+ Frame fade_in () const {
boost::mutex::scoped_lock lm (_mutex);
return _fade_in;
}
- ContentTime fade_out () const {
+ Frame fade_out () const {
boost::mutex::scoped_lock lm (_mutex);
return _fade_out;
}
@@ -165,7 +165,7 @@ public:
protected:
void take_from_video_examiner (boost::shared_ptr<VideoExaminer>);
- ContentTime _video_length;
+ Frame _video_length;
float _video_frame_rate;
boost::optional<ColourConversion> _colour_conversion;
@@ -185,8 +185,8 @@ private:
if there is one.
*/
boost::optional<float> _sample_aspect_ratio;
- ContentTime _fade_in;
- ContentTime _fade_out;
+ Frame _fade_in;
+ Frame _fade_out;
};
#endif
diff --git a/src/lib/video_examiner.h b/src/lib/video_examiner.h
index 2dcacfc34..f8d247d15 100644
--- a/src/lib/video_examiner.h
+++ b/src/lib/video_examiner.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -34,7 +34,7 @@ public:
virtual ~VideoExaminer () {}
virtual boost::optional<float> video_frame_rate () const = 0;
virtual dcp::Size video_size () const = 0;
- virtual ContentTime video_length () const = 0;
+ virtual Frame video_length () const = 0;
virtual boost::optional<float> sample_aspect_ratio () const {
return boost::optional<float> ();
}