ffconv/include/ffcpp/Resampler.h

32 lines
707 B
C++

#ifndef FFCONV_RESAMPLER_H
#define FFCONV_RESAMPLER_H
#include "Frame.h"
extern "C" {
#include <libswresample/swresample.h>
}
namespace ffcpp {
class Resampler {
private:
SwrContext* _swrContext;
int _dstChannelLayout;
AVSampleFormat _dstSampleFormat;
int _dstSampleRate;
public:
Resampler(int inChannelLayout, int inSampleRate, AVSampleFormat inSampleFormat,
int outChannelLayout, int outSampleRate, AVSampleFormat outSampleFormat);
Resampler(AVCodecContext* decoderCtx, AVCodecContext* encoderCtx);
~Resampler();
Frame resample(Frame& inFrame);
static bool needResampling(AVCodecContext *decoderCtx, AVCodecContext *encoderCtx);
};
}
#endif //FFCONV_RESAMPLER_H