summaryrefslogtreecommitdiff
path: root/src/lib/audio_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-06-23 15:09:30 +0100
committerCarl Hetherington <cth@carlh.net>2017-06-23 15:09:30 +0100
commit9824173a79ce723068296b3a44499101408c24f2 (patch)
tree35d679a7bb8c008c74ec965eb04d767eefe20629 /src/lib/audio_decoder.cc
parentd72aed1f6cfd2f3fcb2d8f0026ded1a6d30c6cb7 (diff)
Attempts to simplify black-filling logic in Player.
Diffstat (limited to 'src/lib/audio_decoder.cc')
-rw-r--r--src/lib/audio_decoder.cc11
1 files changed, 10 insertions, 1 deletions
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<const AudioBuffers> 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<AudioStreamPtr, Frame>::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<ContentTime> p;
for (map<AudioStreamPtr, Frame>::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;
}