diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-01 00:25:30 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-01 00:25:30 +0100 |
| commit | ee161be0fb0e93d77d34fb3f13fd562a76738a07 (patch) | |
| tree | 375f5abbb5eac9925bdd62ddff79fe75119b9b54 /src/lib/player.h | |
| parent | 78ea7fcd0d2b78cb9e70f069dad68a1efb3a1141 (diff) | |
Various fixes so that audio_delay_test works again.
Diffstat (limited to 'src/lib/player.h')
| -rw-r--r-- | src/lib/player.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lib/player.h b/src/lib/player.h index 62ba89e6c..b70bd3f64 100644 --- a/src/lib/player.h +++ b/src/lib/player.h @@ -126,6 +126,7 @@ public: private: friend class PlayerWrapper; friend class Piece; + friend class player_overlaps_test; void setup_pieces (); void playlist_changed (); @@ -142,13 +143,22 @@ private: ContentTime dcp_to_content_subtitle (boost::shared_ptr<const Piece> piece, DCPTime t) const; boost::shared_ptr<DCPVideo> black_dcp_video (DCPTime) const; + /** @return Pieces of content type C that overlap a specified time range in the DCP */ template<class C> std::list<boost::shared_ptr<Piece> > - overlaps (DCPTime t) + overlaps (DCPTime from, DCPTime to) { + if (!_have_valid_pieces) { + setup_pieces (); + } + std::list<boost::shared_ptr<Piece> > overlaps; for (typename std::list<boost::shared_ptr<Piece> >::const_iterator i = _pieces.begin(); i != _pieces.end(); ++i) { - if (boost::dynamic_pointer_cast<C> ((*i)->content) && (*i)->content->position() <= t && t < (*i)->content->end()) { + if (!boost::dynamic_pointer_cast<C> ((*i)->content)) { + continue; + } + + if ((*i)->content->position() <= to && (*i)->content->end() >= from) { overlaps.push_back (*i); } } |
