pcm/Resampler: add method Reset()

Hook for src_reset(), not yet used.
This commit is contained in:
Max Kellermann 2017-01-11 15:26:48 +01:00
parent bece023028
commit 3dcb082015
5 changed files with 24 additions and 0 deletions

View File

@ -65,6 +65,12 @@ GluePcmResampler::Close()
resampler->Close();
}
void
GluePcmResampler::Reset()
{
resampler->Reset();
}
ConstBuffer<void>
GluePcmResampler::Resample(ConstBuffer<void> src)
{

View File

@ -55,6 +55,11 @@ public:
return output_sample_format;
}
/**
* @see PcmResampler::Reset()
*/
void Reset();
ConstBuffer<void> Resample(ConstBuffer<void> src);
};

View File

@ -114,6 +114,12 @@ LibsampleratePcmResampler::Close()
state = src_delete(state);
}
void
LibsampleratePcmResampler::Reset()
{
src_reset(state);
}
inline ConstBuffer<float>
LibsampleratePcmResampler::Resample2(ConstBuffer<float> src)
{

View File

@ -44,6 +44,7 @@ class LibsampleratePcmResampler final : public PcmResampler {
public:
AudioFormat Open(AudioFormat &af, unsigned new_sample_rate) override;
void Close() override;
void Reset() override;
ConstBuffer<void> Resample(ConstBuffer<void> src) override;
private:

View File

@ -54,6 +54,12 @@ public:
*/
virtual void Close() = 0;
/**
* Reset the filter's state, e.g. drop/flush buffers.
*/
virtual void Reset() {
}
/**
* Resamples a block of PCM data.
*