#include "audio_decoder.h"
#include "audio_buffers.h"
#include "audio_content.h"
#include "audio_decoder.h"
#include "audio_buffers.h"
#include "audio_content.h"
AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, bool fast)
: DecoderPart (parent)
, _content (content)
, _fast (fast)
{
/* Set up _positions so that we have one for each stream */
AudioDecoder::AudioDecoder (Decoder* parent, shared_ptr<const AudioContent> content, bool fast)
: DecoderPart (parent)
, _content (content)
, _fast (fast)
{
/* Set up _positions so that we have one for each stream */
/** @param time_already_delayed true if the delay should not be added to time */
void
AudioDecoder::emit (shared_ptr<const Film> film, AudioStreamPtr stream, shared_ptr<const AudioBuffers> data, ContentTime time, bool time_already_delayed)
/** @param time_already_delayed true if the delay should not be added to time */
void
AudioDecoder::emit (shared_ptr<const Film> film, AudioStreamPtr stream, shared_ptr<const AudioBuffers> data, ContentTime time, bool time_already_delayed)
if (_positions[stream] == 0) {
/* This is the first data we have received since initialisation or seek. Set
the position based on the ContentTime that was given. After this first time
if (_positions[stream] == 0) {
/* This is the first data we have received since initialisation or seek. Set
the position based on the ContentTime that was given. After this first time
/** @return Time just after the last thing that was emitted from a given stream */
ContentTime
AudioDecoder::stream_position (shared_ptr<const Film> film, AudioStreamPtr stream) const
{
/** @return Time just after the last thing that was emitted from a given stream */
ContentTime
AudioDecoder::stream_position (shared_ptr<const Film> film, AudioStreamPtr stream) const
{
DCPOMATIC_ASSERT (i != _positions.end ());
return ContentTime::from_frames (i->second, _content->resampled_frame_rate(film));
}
DCPOMATIC_ASSERT (i != _positions.end ());
return ContentTime::from_frames (i->second, _content->resampled_frame_rate(film));
}
- for (PositionMap::const_iterator i = _positions.begin(); i != _positions.end(); ++i) {
- ContentTime const ct = stream_position (film, i->first);
+ for (auto i: _positions) {
+ auto const ct = stream_position (film, i.first);
- for (ResamplerMap::iterator i = _resamplers.begin(); i != _resamplers.end(); ++i) {
- shared_ptr<const AudioBuffers> ro = i->second->flush ();
+ for (auto const& i: _resamplers) {
+ auto ro = i.second->flush ();
- Data (i->first, ContentAudio (ro, _positions[i->first]));
- _positions[i->first] += ro->frames();
+ Data (i.first, ContentAudio (ro, _positions[i.first]));
+ _positions[i.first] += ro->frames();