diff options
| author | Carl Hetherington <cth@carlh.net> | 2020-06-21 21:10:10 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2021-04-25 00:12:02 +0200 |
| commit | dd3862c76cc158fe7cda50cfb4ef11d07a2483e2 (patch) | |
| tree | e75a99e6f821834dca2d70a82922fdef91d8c516 /src/lib/audio_decoder.cc | |
| parent | 151f5c81fade29e9bebea9904fd85975351b7b78 (diff) | |
Had a go, gave up.
Diffstat (limited to 'src/lib/audio_decoder.cc')
| -rw-r--r-- | src/lib/audio_decoder.cc | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index 77c9b0695..5f7ec3730 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -25,6 +25,7 @@ #include "dcpomatic_log.h" #include "log.h" #include "resampler.h" +#include "resampler_manager.h" #include "compose.hpp" #include <iostream> @@ -99,9 +100,9 @@ AudioDecoder::emit (shared_ptr<const Film> film, AudioStreamPtr stream, shared_p _positions[stream] = time.frames_round (resampled_rate); } - shared_ptr<Resampler> resampler; + auto resampler = _resampler_manager->get (this, stream, _fast); auto i = _resamplers.find(stream); - if (i != _resamplers.end()) { + if (i != _resamplers.end ()) { resampler = i->second; } else { if (stream->frame_rate() != resampled_rate) { @@ -175,13 +176,7 @@ AudioDecoder::seek () void AudioDecoder::flush () { - for (auto const& i: _resamplers) { - auto ro = i.second->flush (); - if (ro->frames() > 0) { - Data (i.first, ContentAudio (ro, _positions[i.first])); - _positions[i.first] += ro->frames(); - } - } + _resampler_manager->maybe_flush (this); if (_content->delay() < 0) { /* Finish off with the gap caused by the delay */ |
