Add empty playlist list and configuration option.
[dcpomatic.git] / src / lib / resampler.cc
index 4498dccb557533296fc3dd4cb1593a9764848d5d..553180f0832c7a26852b2354bec045b1263faa01 100644 (file)
@@ -67,19 +67,9 @@ Resampler::set_fast ()
        }
 }
 
-pair<shared_ptr<const AudioBuffers>, Frame>
-Resampler::run (shared_ptr<const AudioBuffers> in, Frame frame)
+shared_ptr<const AudioBuffers>
+Resampler::run (shared_ptr<const AudioBuffers> in)
 {
-       if (!_next_in || !_next_out || _next_in.get() != frame) {
-               /* Either there was a discontinuity in the input or this is the first input;
-                  reset _next_out.
-               */
-               _next_out = lrintf (frame * _out_rate / _in_rate);
-       }
-
-       /* Expected next input frame */
-       _next_in = frame + in->frames ();
-
        int in_frames = in->frames ();
        int in_offset = 0;
        int out_offset = 0;
@@ -128,6 +118,8 @@ Resampler::run (shared_ptr<const AudioBuffers> in, Frame frame)
                }
 
                if (data.output_frames_gen == 0) {
+                       delete[] data.data_in;
+                       delete[] data.data_out;
                        break;
                }
 
@@ -152,15 +144,10 @@ Resampler::run (shared_ptr<const AudioBuffers> in, Frame frame)
                delete[] data.data_out;
        }
 
-       Frame out_frame = _next_out.get ();
-
-       /* Expected next output frame */
-       _next_out = _next_out.get() + resampled->frames();
-
-       return make_pair (resampled, out_frame);
+       return resampled;
 }
 
-pair<shared_ptr<const AudioBuffers>, Frame>
+shared_ptr<const AudioBuffers>
 Resampler::flush ()
 {
        shared_ptr<AudioBuffers> out (new AudioBuffers (_channels, 0));
@@ -198,7 +185,7 @@ Resampler::flush ()
        out->set_frames (out_offset);
 
        delete[] buffer;
-       return make_pair (out, _next_out.get ());
+       return out;
 }
 
 void