diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-03-04 20:22:47 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-03-04 20:22:47 +0000 |
| commit | 1b1bc528ee5ca1fee1bd33f9fb6f79cd551e3b33 (patch) | |
| tree | d60b9fb573dd8d6ab89036fb8788cd1b1c69aada /src/lib/video_content.cc | |
| parent | 6d8bcba724be622739a749064466901486304cee (diff) | |
New DCPTime/ContentTime types.
Diffstat (limited to 'src/lib/video_content.cc')
| -rw-r--r-- | src/lib/video_content.cc | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index 9d9b58328..b30aa3df4 100644 --- a/src/lib/video_content.cc +++ b/src/lib/video_content.cc @@ -59,7 +59,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f) setup_default_colour_conversion (); } -VideoContent::VideoContent (shared_ptr<const Film> f, DCPTime s, VideoFrame len) +VideoContent::VideoContent (shared_ptr<const Film> f, DCPTime s, ContentTime len) : Content (f, s) , _video_length (len) , _video_frame_rate (0) @@ -83,7 +83,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, shared_ptr<const cxml::Nod : Content (f, node) , _ratio (0) { - _video_length = node->number_child<VideoFrame> ("VideoLength"); + _video_length = ContentTime (node->number_child<int64_t> ("VideoLength")); _video_size.width = node->number_child<int> ("VideoWidth"); _video_size.height = node->number_child<int> ("VideoHeight"); _video_frame_rate = node->number_child<float> ("VideoFrameRate"); @@ -353,21 +353,12 @@ VideoContent::video_size_after_crop () const } /** @param t A time offset from the start of this piece of content. - * @return Corresponding frame index, rounded up so that the frame index - * is that of the next complete frame which starts after `t'. + * @return Corresponding time with respect to the content. */ -VideoFrame -VideoContent::time_to_content_video_frames (DCPTime t) const +ContentTime +VideoContent::dcp_time_to_content_time (DCPTime t) const { shared_ptr<const Film> film = _film.lock (); assert (film); - - /* Here we are converting from time (in the DCP) to a frame number in the content. - Hence we need to use the DCP's frame rate and the double/skip correction, not - the source's rate; source rate will be equal to DCP rate if we ignore - double/skip. There's no need to call Film::active_frame_rate_change() here - as we know that we are it (since we're video). - */ - FrameRateChange frc (video_frame_rate(), film->video_frame_rate()); - return ceil (t * film->video_frame_rate() / (frc.factor() * TIME_HZ)); + return ContentTime (t, FrameRateChange (video_frame_rate(), film->video_frame_rate())); } |
