diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-12-13 10:06:18 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-12-13 10:06:18 +0000 |
| commit | 097a1fb413bbbb89182161d4c1a31daa5419ec96 (patch) | |
| tree | 87d6ed5b14e7554b26f565380b69528ab3ec10ec /src/lib | |
| parent | ea910e250a0fb3b0ad3ce0cf32dd27b24c17cd1d (diff) | |
Time -> DCPTime.
Diffstat (limited to 'src/lib')
34 files changed, 136 insertions, 135 deletions
diff --git a/src/lib/analyse_audio_job.cc b/src/lib/analyse_audio_job.cc index 8186f9de4..3f84bf16d 100644 --- a/src/lib/analyse_audio_job.cc +++ b/src/lib/analyse_audio_job.cc @@ -81,7 +81,7 @@ AnalyseAudioJob::run () } void -AnalyseAudioJob::audio (shared_ptr<const AudioBuffers> b, Time) +AnalyseAudioJob::audio (shared_ptr<const AudioBuffers> b, DCPTime) { for (int i = 0; i < b->frames(); ++i) { for (int j = 0; j < b->channels(); ++j) { diff --git a/src/lib/analyse_audio_job.h b/src/lib/analyse_audio_job.h index 3d4881983..2e93ef500 100644 --- a/src/lib/analyse_audio_job.h +++ b/src/lib/analyse_audio_job.h @@ -33,7 +33,7 @@ public: void run (); private: - void audio (boost::shared_ptr<const AudioBuffers>, Time); + void audio (boost::shared_ptr<const AudioBuffers>, DCPTime); boost::weak_ptr<AudioContent> _content; OutputAudioFrame _done; diff --git a/src/lib/audio_content.cc b/src/lib/audio_content.cc index 0c4586681..de743571b 100644 --- a/src/lib/audio_content.cc +++ b/src/lib/audio_content.cc @@ -39,7 +39,7 @@ int const AudioContentProperty::AUDIO_GAIN = 203; int const AudioContentProperty::AUDIO_DELAY = 204; int const AudioContentProperty::AUDIO_MAPPING = 205; -AudioContent::AudioContent (shared_ptr<const Film> f, Time s) +AudioContent::AudioContent (shared_ptr<const Film> f, DCPTime s) : Content (f, s) , _audio_gain (0) , _audio_delay (0) @@ -157,7 +157,7 @@ AudioContent::technical_summary () const * the `controlling' video content is active. */ AudioContent::Frame -AudioContent::time_to_content_audio_frames (Time t, Time at) const +AudioContent::time_to_content_audio_frames (DCPTime t, DCPTime at) const { shared_ptr<const Film> film = _film.lock (); assert (film); diff --git a/src/lib/audio_content.h b/src/lib/audio_content.h index 10114e10d..e1b38bd97 100644 --- a/src/lib/audio_content.h +++ b/src/lib/audio_content.h @@ -43,7 +43,7 @@ class AudioContent : public virtual Content public: typedef int64_t Frame; - AudioContent (boost::shared_ptr<const Film>, Time); + AudioContent (boost::shared_ptr<const Film>, DCPTime); AudioContent (boost::shared_ptr<const Film>, boost::filesystem::path); AudioContent (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>); AudioContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >); @@ -74,7 +74,7 @@ public: return _audio_delay; } - Frame time_to_content_audio_frames (Time, Time) const; + Frame time_to_content_audio_frames (DCPTime, DCPTime) const; private: /** Gain to apply to audio in dB */ diff --git a/src/lib/audio_merger.h b/src/lib/audio_merger.h index 6ad33fb37..2a1cc761b 100644 --- a/src/lib/audio_merger.h +++ b/src/lib/audio_merger.h @@ -102,7 +102,7 @@ public: } void - clear (Time t) + clear (DCPTime t) { _last_pull = t; _buffers.reset (new AudioBuffers (_buffers->channels(), 0)); diff --git a/src/lib/content.cc b/src/lib/content.cc index f09012765..7db349617 100644 --- a/src/lib/content.cc +++ b/src/lib/content.cc @@ -54,7 +54,7 @@ Content::Content (shared_ptr<const Film> f) } -Content::Content (shared_ptr<const Film> f, Time p) +Content::Content (shared_ptr<const Film> f, DCPTime p) : _film (f) , _position (p) , _trim_start (0) @@ -83,9 +83,9 @@ Content::Content (shared_ptr<const Film> f, shared_ptr<const cxml::Node> node) _paths.push_back ((*i)->content ()); } _digest = node->string_child ("Digest"); - _position = node->number_child<Time> ("Position"); - _trim_start = node->number_child<Time> ("TrimStart"); - _trim_end = node->number_child<Time> ("TrimEnd"); + _position = node->number_child<DCPTime> ("Position"); + _trim_start = node->number_child<DCPTime> ("TrimStart"); + _trim_end = node->number_child<DCPTime> ("TrimEnd"); } Content::Content (shared_ptr<const Film> f, vector<shared_ptr<Content> > c) @@ -146,7 +146,7 @@ Content::signal_changed (int p) } void -Content::set_position (Time p) +Content::set_position (DCPTime p) { { boost::mutex::scoped_lock lm (_mutex); @@ -157,7 +157,7 @@ Content::set_position (Time p) } void -Content::set_trim_start (Time t) +Content::set_trim_start (DCPTime t) { { boost::mutex::scoped_lock lm (_mutex); @@ -168,7 +168,7 @@ Content::set_trim_start (Time t) } void -Content::set_trim_end (Time t) +Content::set_trim_end (DCPTime t) { { boost::mutex::scoped_lock lm (_mutex); @@ -200,7 +200,7 @@ Content::technical_summary () const return String::compose ("%1 %2 %3", path_summary(), digest(), position()); } -Time +DCPTime Content::length_after_trim () const { return full_length() - trim_start() - trim_end(); @@ -210,7 +210,7 @@ Content::length_after_trim () const * @return true if this time is trimmed by our trim settings. */ bool -Content::trimmed (Time t) const +Content::trimmed (DCPTime t) const { return (t < trim_start() || t > (full_length() - trim_end ())); } diff --git a/src/lib/content.h b/src/lib/content.h index 9cf6d866a..1eee02e01 100644 --- a/src/lib/content.h +++ b/src/lib/content.h @@ -49,7 +49,7 @@ class Content : public boost::enable_shared_from_this<Content>, public boost::no { public: Content (boost::shared_ptr<const Film>); - Content (boost::shared_ptr<const Film>, Time); + Content (boost::shared_ptr<const Film>, DCPTime); Content (boost::shared_ptr<const Film>, boost::filesystem::path); Content (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>); Content (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >); @@ -60,7 +60,7 @@ public: virtual std::string technical_summary () const; virtual std::string information () const = 0; virtual void as_xml (xmlpp::Node *) const; - virtual Time full_length () const = 0; + virtual DCPTime full_length () const = 0; virtual std::string identifier () const; boost::shared_ptr<Content> clone () const; @@ -92,41 +92,41 @@ public: return _digest; } - void set_position (Time); + void set_position (DCPTime); - /** Time that this content starts; i.e. the time that the first + /** DCPTime that this content starts; i.e. the time that the first * bit of the content (trimmed or not) will happen. */ - Time position () const { + DCPTime position () const { boost::mutex::scoped_lock lm (_mutex); return _position; } - void set_trim_start (Time); + void set_trim_start (DCPTime); - Time trim_start () const { + DCPTime trim_start () const { boost::mutex::scoped_lock lm (_mutex); return _trim_start; } - void set_trim_end (Time); + void set_trim_end (DCPTime); - Time trim_end () const { + DCPTime trim_end () const { boost::mutex::scoped_lock lm (_mutex); return _trim_end; } - Time end () const { + DCPTime end () const { return position() + length_after_trim() - 1; } - Time length_after_trim () const; + DCPTime length_after_trim () const; void set_change_signals_frequent (bool f) { _change_signals_frequent = f; } - bool trimmed (Time) const; + bool trimmed (DCPTime) const; boost::signals2::signal<void (boost::weak_ptr<Content>, int, bool)> Changed; @@ -145,9 +145,9 @@ protected: private: std::string _digest; - Time _position; - Time _trim_start; - Time _trim_end; + DCPTime _position; + DCPTime _trim_start; + DCPTime _trim_end; bool _change_signals_frequent; }; diff --git a/src/lib/decoder.h b/src/lib/decoder.h index 908d3aae5..aa36d41b4 100644 --- a/src/lib/decoder.h +++ b/src/lib/decoder.h @@ -50,7 +50,7 @@ public: * time. Pass accurate = true to try harder to get close to * the request. */ - virtual void seek (Time time, bool accurate) = 0; + virtual void seek (DCPTime time, bool accurate) = 0; virtual bool done () const = 0; diff --git a/src/lib/ffmpeg_content.cc b/src/lib/ffmpeg_content.cc index b6df2e929..65a8d24f1 100644 --- a/src/lib/ffmpeg_content.cc +++ b/src/lib/ffmpeg_content.cc @@ -445,7 +445,7 @@ FFmpegSubtitleStream::as_xml (xmlpp::Node* root) const FFmpegStream::as_xml (root); } -Time +DCPTime FFmpegContent::full_length () const { shared_ptr<const Film> film = _film.lock (); diff --git a/src/lib/ffmpeg_content.h b/src/lib/ffmpeg_content.h index 7ff159b85..ba73c0f9b 100644 --- a/src/lib/ffmpeg_content.h +++ b/src/lib/ffmpeg_content.h @@ -134,7 +134,7 @@ public: std::string technical_summary () const; std::string information () const; void as_xml (xmlpp::Node *) const; - Time full_length () const; + DCPTime full_length () const; std::string identifier () const; diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc index ed0574c61..2cb18c557 100644 --- a/src/lib/ffmpeg_decoder.cc +++ b/src/lib/ffmpeg_decoder.cc @@ -351,7 +351,7 @@ FFmpegDecoder::minimal_run (boost::function<bool (int)> finished) } bool -FFmpegDecoder::seek_overrun_finished (Time seek) const +FFmpegDecoder::seek_overrun_finished (DCPTime seek) const { return ( _video_position >= _ffmpeg_content->time_to_content_video_frames (seek) || @@ -366,7 +366,7 @@ FFmpegDecoder::seek_final_finished (int n, int done) const } void -FFmpegDecoder::seek_and_flush (Time t) +FFmpegDecoder::seek_and_flush (DCPTime t) { int64_t const initial_v = ((_ffmpeg_content->time_to_content_video_frames (t) / _ffmpeg_content->video_frame_rate()) - _video_pts_offset) / av_q2d (_format_context->streams[_video_stream]->time_base); @@ -394,15 +394,15 @@ FFmpegDecoder::seek_and_flush (Time t) } void -FFmpegDecoder::seek (Time time, bool accurate) +FFmpegDecoder::seek (DCPTime time, bool accurate) { /* If we are doing an accurate seek, our initial shot will be 200ms (200 being a number plucked from the air) earlier than we want to end up. The loop below will hopefully then step through to where we want to be. */ - Time pre_roll = accurate ? (0.2 * TIME_HZ) : 0; - Time initial_seek = time - pre_roll; + DCPTime pre_roll = accurate ? (0.2 * TIME_HZ) : 0; + DCPTime initial_seek = time - pre_roll; if (initial_seek < 0) { initial_seek = 0; } @@ -625,8 +625,8 @@ FFmpegDecoder::decode_subtitle_packet () double const packet_time = static_cast<double> (sub.pts) / AV_TIME_BASE; /* hence start time for this sub */ - Time const from = (packet_time + (double (sub.start_display_time) / 1e3)) * TIME_HZ; - Time const to = (packet_time + (double (sub.end_display_time) / 1e3)) * TIME_HZ; + DCPTime const from = (packet_time + (double (sub.start_display_time) / 1e3)) * TIME_HZ; + DCPTime const to = (packet_time + (double (sub.end_display_time) / 1e3)) * TIME_HZ; AVSubtitleRect const * rect = sub.rects[0]; diff --git a/src/lib/ffmpeg_decoder.h b/src/lib/ffmpeg_decoder.h index f54ee2496..06e0ef8a5 100644 --- a/src/lib/ffmpeg_decoder.h +++ b/src/lib/ffmpeg_decoder.h @@ -52,7 +52,7 @@ public: ~FFmpegDecoder (); void pass (); - void seek (Time time, bool); + void seek (DCPTime time, bool); bool done () const; private: @@ -74,7 +74,7 @@ private: void maybe_add_subtitle (); boost::shared_ptr<AudioBuffers> deinterleave_audio (uint8_t** data, int size); - bool seek_overrun_finished (Time) const; + bool seek_overrun_finished (DCPTime) const; bool seek_final_finished (int, int) const; int minimal_run (boost::function<bool (int)>); void seek_and_flush (int64_t); diff --git a/src/lib/film.cc b/src/lib/film.cc index b61991a45..8e93667d5 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -842,7 +842,7 @@ Film::move_content_later (shared_ptr<Content> c) _playlist->move_later (c); } -Time +DCPTime Film::length () const { return _playlist->length (); @@ -867,7 +867,7 @@ Film::content_paths_valid () const } FrameRateChange -Film::active_frame_rate_change (Time t) const +Film::active_frame_rate_change (DCPTime t) const { return _playlist->active_frame_rate_change (t, video_frame_rate ()); } @@ -891,24 +891,24 @@ Film::playlist_changed () } OutputAudioFrame -Film::time_to_audio_frames (Time t) const +Film::time_to_audio_frames (DCPTime t) const { return t * audio_frame_rate () / TIME_HZ; } OutputVideoFrame -Film::time_to_video_frames (Time t) const +Film::time_to_video_frames (DCPTime t) const { return t * video_frame_rate () / TIME_HZ; } -Time +DCPTime Film::audio_frames_to_time (OutputAudioFrame f) const { return f * TIME_HZ / audio_frame_rate (); } -Time +DCPTime Film::video_frames_to_time (OutputVideoFrame f) const { return f * TIME_HZ / video_frame_rate (); diff --git a/src/lib/film.h b/src/lib/film.h index 6573bd5b7..a0ace9981 100644 --- a/src/lib/film.h +++ b/src/lib/film.h @@ -103,19 +103,19 @@ public: OutputAudioFrame audio_frame_rate () const; - OutputAudioFrame time_to_audio_frames (Time) const; - OutputVideoFrame time_to_video_frames (Time) const; - Time video_frames_to_time (OutputVideoFrame) const; - Time audio_frames_to_time (OutputAudioFrame) const; + OutputAudioFrame time_to_audio_frames (DCPTime) const; + OutputVideoFrame time_to_video_frames (DCPTime) const; + DCPTime video_frames_to_time (OutputVideoFrame) const; + DCPTime audio_frames_to_time (OutputAudioFrame) const; /* Proxies for some Playlist methods */ ContentList content () const; - Time length () const; + DCPTime length () const; bool has_subtitles () const; OutputVideoFrame best_video_frame_rate () const; bool content_paths_valid () const; - FrameRateChange active_frame_rate_change (Time) const; + FrameRateChange active_frame_rate_change (DCPTime) const; libdcp::KDM make_kdm ( diff --git a/src/lib/image_content.cc b/src/lib/image_content.cc index 8eba33f3a..0f9526071 100644 --- a/src/lib/image_content.cc +++ b/src/lib/image_content.cc @@ -120,7 +120,7 @@ ImageContent::set_video_length (VideoContent::Frame len) signal_changed (ContentProperty::LENGTH); } -Time +DCPTime ImageContent::full_length () const { shared_ptr<const Film> film = _film.lock (); diff --git a/src/lib/image_content.h b/src/lib/image_content.h index 47c5a20e3..88c178faa 100644 --- a/src/lib/image_content.h +++ b/src/lib/image_content.h @@ -41,7 +41,7 @@ public: std::string summary () const; std::string technical_summary () const; void as_xml (xmlpp::Node *) const; - Time full_length () const; + DCPTime full_length () const; std::string identifier () const; diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc index bf3bc344b..723690247 100644 --- a/src/lib/image_decoder.cc +++ b/src/lib/image_decoder.cc @@ -77,7 +77,7 @@ ImageDecoder::pass () } void -ImageDecoder::seek (Time time, bool) +ImageDecoder::seek (DCPTime time, bool) { _video_position = _video_content->time_to_content_video_frames (time); } diff --git a/src/lib/image_decoder.h b/src/lib/image_decoder.h index 1f5f0b9d2..346fffdf7 100644 --- a/src/lib/image_decoder.h +++ b/src/lib/image_decoder.h @@ -37,7 +37,7 @@ public: /* Decoder */ void pass (); - void seek (Time, bool); + void seek (DCPTime, bool); bool done () const; private: diff --git a/src/lib/job.cc b/src/lib/job.cc index 9981934ec..05a90524c 100644 --- a/src/lib/job.cc +++ b/src/lib/job.cc @@ -198,7 +198,7 @@ Job::set_state (State s) } } -/** @return Time (in seconds) that this sub-job has been running */ +/** @return DCPTime (in seconds) that this sub-job has been running */ int Job::elapsed_time () const { diff --git a/src/lib/player.cc b/src/lib/player.cc index 184c9811f..be22ae242 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -100,10 +100,10 @@ public: shared_ptr<Content> content; shared_ptr<Decoder> decoder; - /** Time of the last video we emitted relative to the start of the DCP */ - Time video_position; - /** Time of the last audio we emitted relative to the start of the DCP */ - Time audio_position; + /** DCPTime of the last video we emitted relative to the start of the DCP */ + DCPTime video_position; + /** DCPTime of the last audio we emitted relative to the start of the DCP */ + DCPTime audio_position; IncomingVideo repeat_video; int repeat_to_do; @@ -146,7 +146,7 @@ Player::pass () setup_pieces (); } - Time earliest_t = TIME_MAX; + DCPTime earliest_t = TIME_MAX; shared_ptr<Piece> earliest; enum { VIDEO, @@ -218,7 +218,7 @@ Player::pass () } if (_audio) { - boost::optional<Time> audio_done_up_to; + boost::optional<DCPTime> audio_done_up_to; for (list<shared_ptr<Piece> >::iterator i = _pieces.begin(); i != _pieces.end(); ++i) { if ((*i)->decoder->done ()) { continue; @@ -230,7 +230,7 @@ Player::pass () } if (audio_done_up_to) { - TimedAudioBuffers<Time> tb = _audio_merger.pull (audio_done_up_to.get ()); + TimedAudioBuffers<DCPTime> tb = _audio_merger.pull (audio_done_up_to.get ()); Audio (tb.audio, tb.time); _audio_position += _film->audio_frames_to_time (tb.audio->frames ()); } @@ -241,7 +241,7 @@ Player::pass () /** @param extra Amount of extra time to add to the content frame's time (for repeat) */ void -Player::process_video (weak_ptr<Piece> weak_piece, shared_ptr<const Image> image, Eyes eyes, bool same, VideoContent::Frame frame, Time extra) +Player::process_video (weak_ptr<Piece> weak_piece, shared_ptr<const Image> image, Eyes eyes, bool same, VideoContent::Frame frame, DCPTime extra) { /* Keep a note of what came in so that we can repeat it if required */ _last_incoming_video.weak_piece = weak_piece; @@ -264,12 +264,12 @@ Player::process_video (weak_ptr<Piece> weak_piece, shared_ptr<const Image> image return; } - Time const relative_time = (frame * frc.factor() * TIME_HZ / _film->video_frame_rate()); + DCPTime const relative_time = (frame * frc.factor() * TIME_HZ / _film->video_frame_rate()); if (content->trimmed (relative_time)) { return; } - Time const time = content->position() + relative_time + extra - content->trim_start (); + DCPTime const time = content->position() + relative_time + extra - content->trim_start (); float const ratio = content->ratio() ? content->ratio()->ratio() : content->video_size_after_crop().ratio(); libdcp::Size const image_size = fit_ratio_within (ratio, _video_container_size); @@ -333,13 +333,13 @@ Player::process_audio (weak_ptr<Piece> weak_piece, shared_ptr<const AudioBuffers frame = ro.second; } - Time const relative_time = _film->audio_frames_to_time (frame); + DCPTime const relative_time = _film->audio_frames_to_time (frame); if (content->trimmed (relative_time)) { return; } - Time time = content->position() + (content->audio_delay() * TIME_HZ / 1000) + relative_time - content->trim_start (); + DCPTime time = content->position() + (content->audio_delay() * TIME_HZ / 1000) + relative_time - content->trim_start (); /* Remap channels */ shared_ptr<AudioBuffers> dcp_mapped (new AudioBuffers (_film->audio_channels(), audio->frames())); @@ -374,7 +374,7 @@ Player::process_audio (weak_ptr<Piece> weak_piece, shared_ptr<const AudioBuffers void Player::flush () { - TimedAudioBuffers<Time> tb = _audio_merger.flush (); + TimedAudioBuffers<DCPTime> tb = _audio_merger.flush (); if (tb.audio) { Audio (tb.audio, tb.time); _audio_position += _film->audio_frames_to_time (tb.audio->frames ()); @@ -395,7 +395,7 @@ Player::flush () * @return true on error */ void -Player::seek (Time t, bool accurate) +Player::seek (DCPTime t, bool accurate) { if (!_have_valid_pieces) { setup_pieces (); @@ -412,8 +412,8 @@ Player::seek (Time t, bool accurate) } /* s is the offset of t from the start position of this content */ - Time s = t - vc->position (); - s = max (static_cast<Time> (0), s); + DCPTime s = t - vc->position (); + s = max (static_cast<DCPTime> (0), s); s = min (vc->length_after_trim(), s); /* Hence set the piece positions to the `global' time */ @@ -613,7 +613,7 @@ Player::film_changed (Film::Property p) } void -Player::process_subtitle (weak_ptr<Piece> weak_piece, shared_ptr<Image> image, dcpomatic::Rect<double> rect, Time from, Time to) +Player::process_subtitle (weak_ptr<Piece> weak_piece, shared_ptr<Image> image, dcpomatic::Rect<double> rect, DCPTime from, DCPTime to) { _in_subtitle.piece = weak_piece; _in_subtitle.image = image; diff --git a/src/lib/player.h b/src/lib/player.h index 11cc99e77..364d66249 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -50,7 +50,7 @@ public: Eyes eyes; bool same; VideoContent::Frame frame; - Time extra; + DCPTime extra; }; /** A wrapper for an Image which contains some pending operations; these may @@ -84,9 +84,9 @@ public: void disable_audio (); bool pass (); - void seek (Time, bool); + void seek (DCPTime, bool); - Time video_position () const { + DCPTime video_position () const { return _video_position; } @@ -101,10 +101,10 @@ public: * Fourth parameter is true if the image is the same as the last one that was emitted. * Fifth parameter is the time. */ - boost::signals2::signal<void (boost::shared_ptr<PlayerImage>, Eyes, ColourConversion, bool, Time)> Video; + boost::signals2::signal<void (boost::shared_ptr<PlayerImage>, Eyes, ColourConversion, bool, DCPTime)> Video; /** Emitted when some audio data is ready */ - boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, Time)> Audio; + boost::signals2::signal<void (boost::shared_ptr<const AudioBuffers>, DCPTime)> Audio; /** Emitted when something has changed such that if we went back and emitted * the last frame again it would look different. This is not emitted after @@ -118,13 +118,13 @@ private: friend class PlayerWrapper; friend class Piece; - void process_video (boost::weak_ptr<Piece>, boost::shared_ptr<const Image>, Eyes, bool, VideoContent::Frame, Time); + void process_video (boost::weak_ptr<Piece>, boost::shared_ptr<const Image>, Eyes, bool, VideoContent::Frame, DCPTime); void process_audio (boost::weak_ptr<Piece>, boost::shared_ptr<const AudioBuffers>, AudioContent::Frame); - void process_subtitle (boost::weak_ptr<Piece>, boost::shared_ptr<Image>, dcpomatic::Rect<double>, Time, Time); + void process_subtitle (boost::weak_ptr<Piece>, boost::shared_ptr<Image>, dcpomatic::Rect<double>, DCPTime, DCPTime); void setup_pieces (); void playlist_changed (); void content_changed (boost::weak_ptr<Content>, int, bool); - void do_seek (Time, bool); + void do_seek (DCPTime, bool); void flush (); void emit_black (); void emit_silence (OutputAudioFrame); @@ -143,11 +143,11 @@ private: std::list<boost::shared_ptr<Piece> > _pieces; /** The time after the last video that we emitted */ - Time _video_position; + DCPTime _video_position; /** The time after the last audio that we emitted */ - Time _audio_position; + DCPTime _audio_position; - AudioMerger<Time, AudioContent::Frame> _audio_merger; + AudioMerger<DCPTime, AudioContent::Frame> _audio_merger; libdcp::Size _video_container_size; boost::shared_ptr<PlayerImage> _black_frame; @@ -157,15 +157,15 @@ private: boost::weak_ptr<Piece> piece; boost::shared_ptr<Image> image; dcpomatic::Rect<double> rect; - Time from; - Time to; + DCPTime from; + DCPTime to; } _in_subtitle; struct { boost::shared_ptr<Image> image; Position<int> position; - Time from; - Time to; + DCPTime from; + DCPTime to; } _out_subtitle; #ifdef DCPOMATIC_DEBUG diff --git a/src/lib/playlist.cc b/src/lib/playlist.cc index 581235adc..9fc62f8be 100644 --- a/src/lib/playlist.cc +++ b/src/lib/playlist.cc @@ -81,7 +81,7 @@ Playlist::maybe_sequence_video () _sequencing_video = true; ContentList cl = _content; - Time next = 0; + DCPTime next = 0; for (ContentList::iterator i = _content.begin(); i != _content.end(); ++i) { if (!dynamic_pointer_cast<VideoContent> (*i)) { continue; @@ -254,10 +254,10 @@ Playlist::best_dcp_frame_rate () const return best->dcp; } -Time +DCPTime Playlist::length () const { - Time len = 0; + DCPTime len = 0; for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) { len = max (len, (*i)->end() + 1); } @@ -279,10 +279,10 @@ Playlist::reconnect () } } -Time +DCPTime Playlist::video_end () const { - Time end = 0; + DCPTime end = 0; for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) { if (dynamic_pointer_cast<const VideoContent> (*i)) { end = max (end, (*i)->end ()); @@ -293,7 +293,7 @@ Playlist::video_end () const } FrameRateChange -Playlist::active_frame_rate_change (Time t, int dcp_video_frame_rate) const +Playlist::active_frame_rate_change (DCPTime t, int dcp_video_frame_rate) const { for (ContentList::const_iterator i = _content.begin(); i != _content.end(); ++i) { shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (*i); @@ -331,7 +331,7 @@ Playlist::content () const void Playlist::repeat (ContentList c, int n) { - pair<Time, Time> range (TIME_MAX, 0); + pair<DCPTime, DCPTime> range (TIME_MAX, 0); for (ContentList::iterator i = c.begin(); i != c.end(); ++i) { range.first = min (range.first, (*i)->position ()); range.second = max (range.second, (*i)->position ()); @@ -339,7 +339,7 @@ Playlist::repeat (ContentList c, int n) range.second = max (range.second, (*i)->end ()); } - Time pos = range.second; + DCPTime pos = range.second; for (int i = 0; i < n; ++i) { for (ContentList::iterator i = c.begin(); i != c.end(); ++i) { shared_ptr<Content> copy = (*i)->clone (); @@ -372,7 +372,7 @@ Playlist::move_earlier (shared_ptr<Content> c) return; } - Time const p = (*previous)->position (); + DCPTime const p = (*previous)->position (); (*previous)->set_position (p + c->length_after_trim ()); c->set_position (p); sort (_content.begin(), _content.end(), ContentSorter ()); @@ -399,7 +399,7 @@ Playlist::move_later (shared_ptr<Content> c) return; } - Time const p = (*next)->position (); + DCPTime const p = (*next)->position (); (*next)->set_position (c->position ()); c->set_position (p + c->length_after_trim ()); sort (_content.begin(), _content.end(), ContentSorter ()); diff --git a/src/lib/playlist.h b/src/lib/playlist.h index d3cf50a27..a985bf93d 100644 --- a/src/lib/playlist.h +++ b/src/lib/playlist.h @@ -71,11 +71,11 @@ public: std::string video_identifier () const; - Time length () const; + DCPTime length () const; int best_dcp_frame_rate () const; - Time video_end () const; - FrameRateChange active_frame_rate_change (Time, int dcp_frame_rate) const; + DCPTime video_end () const; + FrameRateChange active_frame_rate_change (DCPTime, int dcp_frame_rate) const; void set_sequence_video (bool); void maybe_sequence_video (); diff --git a/src/lib/sndfile_content.cc b/src/lib/sndfile_content.cc index 89db865d5..1c872cf96 100644 --- a/src/lib/sndfile_content.cc +++ b/src/lib/sndfile_content.cc @@ -141,7 +141,7 @@ SndfileContent::as_xml (xmlpp::Node* node) const _audio_mapping.as_xml (node->add_child("AudioMapping")); } -Time +DCPTime SndfileContent::full_length () const { shared_ptr<const Film> film = _film.lock (); diff --git a/src/lib/sndfile_content.h b/src/lib/sndfile_content.h index 701ff16b2..c88764c1b 100644 --- a/src/lib/sndfile_content.h +++ b/src/lib/sndfile_content.h @@ -44,7 +44,7 @@ public: std::string technical_summary () const; std::string information () const; void as_xml (xmlpp::Node *) const; - Time full_length () const; + DCPTime full_length () const; /* AudioContent */ int audio_channels () const { diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc index 0cca25257..b5a7f139b 100644 --- a/src/lib/sndfile_decoder.cc +++ b/src/lib/sndfile_decoder.cc @@ -120,7 +120,7 @@ SndfileDecoder::done () const } void -SndfileDecoder::seek (Time t, bool accurate) +SndfileDecoder::seek (DCPTime t, bool accurate) { /* XXX */ } diff --git a/src/lib/sndfile_decoder.h b/src/lib/sndfile_decoder.h index c3db1c294..470cab956 100644 --- a/src/lib/sndfile_decoder.h +++ b/src/lib/sndfile_decoder.h @@ -30,7 +30,7 @@ public: ~SndfileDecoder (); void pass (); - void seek (Time, bool); + void seek (DCPTime, bool); bool done () const; int audio_channels () const; diff --git a/src/lib/subtitle_decoder.cc b/src/lib/subtitle_decoder.cc index c06f3d718..8dbc01dc2 100644 --- a/src/lib/subtitle_decoder.cc +++ b/src/lib/subtitle_decoder.cc @@ -33,7 +33,7 @@ SubtitleDecoder::SubtitleDecoder (shared_ptr<const Film> f) * Image may be 0 to say that there is no current subtitle. */ void -SubtitleDecoder::subtitle (shared_ptr<Image> image, dcpomatic::Rect<double> rect, Time from, Time to) +SubtitleDecoder::subtitle (shared_ptr<Image> image, dcpomatic::Rect<double> rect, DCPTime from, DCPTime to) { Subtitle (image, rect, from, to); } diff --git a/src/lib/subtitle_decoder.h b/src/lib/subtitle_decoder.h index eeeadbd3f..8a2a0c1b2 100644 --- a/src/lib/subtitle_decoder.h +++ b/src/lib/subtitle_decoder.h @@ -23,7 +23,7 @@ #include "types.h" class Film; -class TimedSubtitle; +class DCPTimedSubtitle; class Image; class SubtitleDecoder : public virtual Decoder @@ -31,8 +31,8 @@ class SubtitleDecoder : public virtual Decoder public: SubtitleDecoder (boost::shared_ptr<const Film>); - boost::signals2::signal<void (boost::shared_ptr<Image>, dcpomatic::Rect<double>, Time, Time)> Subtitle; + boost::signals2::signal<void (boost::shared_ptr<Image>, dcpomatic::Rect<double>, DCPTime, DCPTime)> Subtitle; protected: - void subtitle (boost::shared_ptr<Image>, dcpomatic::Rect<double>, Time, Time); + void subtitle (boost::shared_ptr<Image>, dcpomatic::Rect<double>, DCPTime, DCPTime); }; diff --git a/src/lib/timer.cc b/src/lib/timer.cc index 69a7e3aa9..a20a08b07 100644 --- a/src/lib/timer.cc +++ b/src/lib/timer.cc @@ -31,14 +31,14 @@ using namespace std; /** @param n Name to use when giving output */ -PeriodTimer::PeriodTimer (string n) +PeriodDCPTimer::PeriodDCPTimer (string n) : _name (n) { gettimeofday (&_start, 0); } -/** Destroy PeriodTimer and output the time elapsed since its construction */ -PeriodTimer::~PeriodTimer () +/** Destroy PeriodDCPTimer and output the time elapsed since its construction */ +PeriodDCPTimer::~PeriodDCPTimer () { struct timeval stop; gettimeofday (&stop, 0); @@ -48,7 +48,7 @@ PeriodTimer::~PeriodTimer () /** @param n Name to use when giving output. * @param s Initial state. */ -StateTimer::StateTimer (string n, string s) +StateDCPTimer::StateDCPTimer (string n, string s) : _name (n) { struct timeval t; @@ -59,7 +59,7 @@ StateTimer::StateTimer (string n, string s) /** @param s New state that the caller is in */ void -StateTimer::set_state (string s) +StateDCPTimer::set_state (string s) { double const last = _time; struct timeval t; @@ -74,8 +74,8 @@ StateTimer::set_state (string s) _state = s; } -/** Destroy StateTimer and generate a summary of the state timings on cout */ -StateTimer::~StateTimer () +/** Destroy StateDCPTimer and generate a summary of the state timings on cout */ +StateDCPTimer::~StateDCPTimer () { if (_state.empty ()) { return; diff --git a/src/lib/timer.h b/src/lib/timer.h index 4a5aa12de..8ec392aa6 100644 --- a/src/lib/timer.h +++ b/src/lib/timer.h @@ -29,16 +29,16 @@ #include <map> #include <sys/time.h> -/** @class PeriodTimer +/** @class PeriodDCPTimer * @brief A class to allow timing of a period within the caller. * * On destruction, it will output the time since its construction. */ -class PeriodTimer +class PeriodDCPTimer { public: - PeriodTimer (std::string n); - ~PeriodTimer (); + PeriodDCPTimer (std::string n); + ~PeriodDCPTimer (); private: @@ -48,19 +48,19 @@ private: struct timeval _start; }; -/** @class StateTimer +/** @class StateDCPTimer * @brief A class to allow measurement of the amount of time a program * spends in one of a set of states. * * Once constructed, the caller can call set_state() whenever - * its state changes. When StateTimer is destroyed, it will + * its state changes. When StateDCPTimer is destroyed, it will * output (to cout) a summary of the time spent in each state. */ -class StateTimer +class StateDCPTimer { public: - StateTimer (std::string n, std::string s); - ~StateTimer (); + StateDCPTimer (std::string n, std::string s); + ~StateDCPTimer (); void set_state (std::string s); diff --git a/src/lib/types.h b/src/lib/types.h index 448b6c154..1ab6a94d4 100644 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -38,9 +38,10 @@ class AudioBuffers; */ #define SERVER_LINK_VERSION 1 -typedef int64_t Time; +typedef int64_t DCPTime; #define TIME_MAX INT64_MAX -#define TIME_HZ ((Time) 96000) +#define TIME_HZ ((DCPTime) 96000) +typedef int64_t ContentTime; typedef int64_t OutputAudioFrame; typedef int OutputVideoFrame; typedef std::vector<boost::shared_ptr<Content> > ContentList; diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc index c61a2455f..ebec8b6db 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, Time s, VideoContent::Frame len) +VideoContent::VideoContent (shared_ptr<const Film> f, DCPTime s, VideoContent::Frame len) : Content (f, s) , _video_length (len) , _video_frame_rate (0) @@ -355,7 +355,7 @@ VideoContent::video_size_after_crop () const * is that of the next complete frame which starts after `t'. */ VideoContent::Frame -VideoContent::time_to_content_video_frames (Time t) const +VideoContent::time_to_content_video_frames (DCPTime t) const { shared_ptr<const Film> film = _film.lock (); assert (film); diff --git a/src/lib/video_content.h b/src/lib/video_content.h index effca5c61..f008143fa 100644 --- a/src/lib/video_content.h +++ b/src/lib/video_content.h @@ -43,7 +43,7 @@ public: typedef int Frame; VideoContent (boost::shared_ptr<const Film>); - VideoContent (boost::shared_ptr<const Film>, Time, VideoContent::Frame); + VideoContent (boost::shared_ptr<const Film>, DCPTime, VideoContent::Frame); VideoContent (boost::shared_ptr<const Film>, boost::filesystem::path); VideoContent (boost::shared_ptr<const Film>, boost::shared_ptr<const cxml::Node>); VideoContent (boost::shared_ptr<const Film>, std::vector<boost::shared_ptr<Content> >); @@ -123,7 +123,7 @@ public: libdcp::Size video_size_after_3d_split () const; libdcp::Size video_size_after_crop () const; - VideoContent::Frame time_to_content_video_frames (Time) const; + VideoContent::Frame time_to_content_video_frames (DCPTime) const; protected: void take_from_video_examiner (boost::shared_ptr<VideoExaminer>); |
