Tidy up with some typedefs.
authorCarl Hetherington <cth@carlh.net>
Mon, 5 Mar 2018 01:12:32 +0000 (01:12 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 5 Mar 2018 01:12:32 +0000 (01:12 +0000)
src/lib/audio_decoder.cc
src/lib/audio_decoder.h

index c0f00780ad58cb852fed8c6e65a1d559aa17e075..b4aa2bacda401b35d7ca3c5420b210545a9f5450 100644 (file)
@@ -70,7 +70,7 @@ AudioDecoder::emit (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data,
        }
 
        shared_ptr<Resampler> resampler;
-       map<AudioStreamPtr, shared_ptr<Resampler> >::iterator i = _resamplers.find(stream);
+       ResamplerMap::iterator i = _resamplers.find(stream);
        if (i != _resamplers.end ()) {
                resampler = i->second;
        } else {
@@ -106,7 +106,7 @@ AudioDecoder::emit (AudioStreamPtr stream, shared_ptr<const AudioBuffers> data,
 ContentTime
 AudioDecoder::stream_position (AudioStreamPtr stream) const
 {
-       map<AudioStreamPtr, Frame>::const_iterator i = _positions.find (stream);
+       PositionMap::const_iterator i = _positions.find (stream);
        DCPOMATIC_ASSERT (i != _positions.end ());
        return ContentTime::from_frames (i->second, _content->resampled_frame_rate());
 }
@@ -115,7 +115,7 @@ ContentTime
 AudioDecoder::position () const
 {
        optional<ContentTime> p;
-       for (map<AudioStreamPtr, Frame>::const_iterator i = _positions.begin(); i != _positions.end(); ++i) {
+       for (PositionMap::const_iterator i = _positions.begin(); i != _positions.end(); ++i) {
                ContentTime const ct = stream_position (i->first);
                if (!p || ct < *p) {
                        p = ct;
@@ -128,12 +128,12 @@ AudioDecoder::position () const
 void
 AudioDecoder::seek ()
 {
-       for (map<AudioStreamPtr, shared_ptr<Resampler> >::iterator i = _resamplers.begin(); i != _resamplers.end(); ++i) {
+       for (ResamplerMap::iterator i = _resamplers.begin(); i != _resamplers.end(); ++i) {
                i->second->flush ();
                i->second->reset ();
        }
 
-       for (map<AudioStreamPtr, Frame>::iterator i = _positions.begin(); i != _positions.end(); ++i) {
+       for (PositionMap::iterator i = _positions.begin(); i != _positions.end(); ++i) {
                i->second = 0;
        }
 }
@@ -141,7 +141,7 @@ AudioDecoder::seek ()
 void
 AudioDecoder::flush ()
 {
-       for (map<AudioStreamPtr, shared_ptr<Resampler> >::iterator i = _resamplers.begin(); i != _resamplers.end(); ++i) {
+       for (ResamplerMap::iterator i = _resamplers.begin(); i != _resamplers.end(); ++i) {
                shared_ptr<const AudioBuffers> ro = i->second->flush ();
                if (ro->frames() > 0) {
                        Data (i->first, ContentAudio (ro, _positions[i->first]));
index d422503a78b4a643afee95493ff2c3a6a09ec85d..8765be42674c3fd8a41323c5bf865dfdab2d7071 100644 (file)
@@ -63,8 +63,10 @@ private:
        /** Frame after the last one that was emitted from Data (i.e. at the resampled rate, if applicable)
         *  for each AudioStream.
         */
-       std::map<AudioStreamPtr, Frame> _positions;
-       std::map<AudioStreamPtr, boost::shared_ptr<Resampler> > _resamplers;
+       typedef std::map<AudioStreamPtr, Frame> PositionMap;
+       PositionMap _positions;
+       typedef std::map<AudioStreamPtr, boost::shared_ptr<Resampler> > ResamplerMap;
+       ResamplerMap _resamplers;
 
        bool _fast;
 };