Files
oak-editor/app/render/audioparams.h
T
itsmattkc 16f4ec8468 began audio conform code in ffmpegdecoder
For accuracy, whenever we need to perform an audio resample, we need to do it
in advance. This is in a process called "conforming" and this commit introduces
the framework by which the decoder can automatically conform an audio stream
to arbitrary parameters for accurate rendering.
2019-11-29 02:10:28 +11:00

50 lines
1.2 KiB
C++

#ifndef AUDIOPARAMS_H
#define AUDIOPARAMS_H
#include <QtMath>
#include "audio/sampleformat.h"
#include "common/rational.h"
class AudioParams
{
public:
AudioParams();
AudioParams(const int& sample_rate, const uint64_t& channel_layout);
const int& sample_rate() const;
const uint64_t& channel_layout() const;
private:
int sample_rate_;
uint64_t channel_layout_;
};
class AudioRenderingParams : public AudioParams {
public:
AudioRenderingParams();
AudioRenderingParams(const int& sample_rate, const uint64_t& channel_layout, const SampleFormat& format);
AudioRenderingParams(const AudioParams& params, const SampleFormat& format);
int time_to_bytes(const rational& time) const;
int time_to_samples(const rational& time) const;
int samples_to_bytes(const int& samples) const;
int bytes_to_samples(const int &bytes) const;
int channel_count() const;
int bytes_per_sample_per_channel() const;
int bits_per_sample() const;
bool is_valid() const;
const SampleFormat& format() const;
bool operator==(const AudioRenderingParams& other);
bool operator!=(const AudioRenderingParams& other);
private:
SampleFormat format_;
};
#endif // AUDIOPARAMS_H