diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-06-23 15:09:30 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-06-23 15:09:30 +0100 |
| commit | 9824173a79ce723068296b3a44499101408c24f2 (patch) | |
| tree | 35d679a7bb8c008c74ec965eb04d767eefe20629 /src/lib/audio_decoder.cc | |
| parent | d72aed1f6cfd2f3fcb2d8f0026ded1a6d30c6cb7 (diff) | |
Attempts to simplify black-filling logic in Player.
Diffstat (limited to 'src/lib/audio_decoder.cc')
| -rw-r--r-- | src/lib/audio_decoder.cc | 11 |
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; } |
