diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-12-09 21:51:36 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-12-09 21:51:36 +0000 |
| commit | 936ff6927ad24daf0ed20776b19b6faa3df9bf83 (patch) | |
| tree | 556123d229c916251ddc96f9a8b3164b4d815e9b /src/lib/audio_decoder.cc | |
| parent | d7013785f7a1d86feb471af826419afa6298e2b8 (diff) | |
| parent | 5757f3ba9d2cf3948bcad2b3f3ddbbf09ad754a5 (diff) | |
Merge branch 'master' of ssh://git.carlh.net/home/carl/git/dcpomatic
Diffstat (limited to 'src/lib/audio_decoder.cc')
| -rw-r--r-- | src/lib/audio_decoder.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index fd0835596..1b1ae70c0 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -32,6 +32,7 @@ using std::cout; using std::map; using boost::shared_ptr; +using boost::optional; AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, shared_ptr<Log> log) : DecoderPart (parent, log) @@ -83,7 +84,7 @@ AudioDecoder::give (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data, void AudioDecoder::flush () { - for (map<AudioStreamPtr, shared_ptr<AudioDecoderStream> >::const_iterator i = _streams.begin(); i != _streams.end(); ++i) { + for (StreamMap::const_iterator i = _streams.begin(); i != _streams.end(); ++i) { i->second->flush (); } } @@ -92,7 +93,7 @@ void AudioDecoder::seek (ContentTime t, bool accurate) { _log->log (String::compose ("AD seek to %1", to_string(t)), LogEntry::TYPE_DEBUG_DECODE); - for (map<AudioStreamPtr, shared_ptr<AudioDecoderStream> >::const_iterator i = _streams.begin(); i != _streams.end(); ++i) { + for (StreamMap::const_iterator i = _streams.begin(); i != _streams.end(); ++i) { i->second->seek (t, accurate); } } @@ -100,7 +101,19 @@ AudioDecoder::seek (ContentTime t, bool accurate) void AudioDecoder::set_fast () { - for (map<AudioStreamPtr, shared_ptr<AudioDecoderStream> >::const_iterator i = _streams.begin(); i != _streams.end(); ++i) { + for (StreamMap::const_iterator i = _streams.begin(); i != _streams.end(); ++i) { i->second->set_fast (); } } + +optional<ContentTime> +AudioDecoder::position () const +{ + optional<ContentTime> pos; + for (StreamMap::const_iterator i = _streams.begin(); i != _streams.end(); ++i) { + if (!pos || (i->second->position() && i->second->position().get() < pos.get())) { + pos = i->second->position(); + } + } + return pos; +} |
