From 9824173a79ce723068296b3a44499101408c24f2 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 23 Jun 2017 15:09:30 +0100 Subject: Attempts to simplify black-filling logic in Player. --- src/lib/audio_decoder.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/lib/audio_decoder.cc') diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index 4b77a8afb..69d86c57b 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -93,12 +93,21 @@ AudioDecoder::emit (AudioStreamPtr stream, shared_ptr data, _positions[stream] += data->frames(); } +/** @return Time just after the last thing that was emitted from a given stream */ +ContentTime +AudioDecoder::stream_position (AudioStreamPtr stream) const +{ + map::const_iterator i = _positions.find (stream); + DCPOMATIC_ASSERT (i != _positions.end ()); + return ContentTime::from_frames (i->second, _content->resampled_frame_rate()); +} + ContentTime AudioDecoder::position () const { optional p; for (map::const_iterator i = _positions.begin(); i != _positions.end(); ++i) { - ContentTime const ct = ContentTime::from_frames (i->second, _content->resampled_frame_rate()); + ContentTime const ct = stream_position (i->first); if (!p || ct < *p) { p = ct; } -- cgit v1.2.3