diff options
Diffstat (limited to 'src/pcm/GlueResampler.hxx')
-rw-r--r-- | src/pcm/GlueResampler.hxx | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/pcm/GlueResampler.hxx b/src/pcm/GlueResampler.hxx index a7e0a84f2..7bd923bab 100644 --- a/src/pcm/GlueResampler.hxx +++ b/src/pcm/GlueResampler.hxx @@ -22,22 +22,41 @@ #include "check.h" #include "AudioFormat.hxx" -#include "PcmResample.hxx" +#include "FormatConverter.hxx" class Error; +class PcmResampler; template<typename T> struct ConstBuffer; +/** + * A glue class that integrates a #PcmResampler and automatically + * converts source data to the sample format required by the + * #PcmResampler instance. + */ class GluePcmResampler { - PcmResampler resampler; + PcmResampler *const resampler; + + SampleFormat src_sample_format, requested_sample_format; + SampleFormat output_sample_format; - AudioFormat src_format; - unsigned new_sample_rate; + /** + * This object converts input data to the sample format + * requested by the #PcmResampler. + */ + PcmFormatConverter format_converter; public: + GluePcmResampler(); + ~GluePcmResampler(); + bool Open(AudioFormat src_format, unsigned new_sample_rate, Error &error); void Close(); + SampleFormat GetOutputSampleFormat() const { + return output_sample_format; + } + ConstBuffer<void> Resample(ConstBuffer<void> src, Error &error); }; |