implemented preliminary pre-cacher for audio

FFmpegDecoder now implements an "indexer" for audio, which actually just
extracts the raw PCM audio from an audio codec and saves it to disk
This commit is contained in:
itsmattkc
2019-10-24 16:36:26 +11:00
parent 52f4c59bec
commit 2fdf78df4a
14 changed files with 370 additions and 36 deletions
+39
View File
@@ -0,0 +1,39 @@
#ifndef WAVEAUDIO_H
#define WAVEAUDIO_H
#include <QByteArray>
#include <QFile>
#include "audio/sampleformat.h"
#include "render/audio/audioparams.h"
class WaveOutput
{
public:
WaveOutput(const QString& f,
const AudioRenderingParams& params);
~WaveOutput();
bool open();
void write(const QByteArray& bytes);
void write(const char* bytes, int length);
void close();
private:
template<typename T>
void write_int(QFile* file, T integer);
void switch_endianness(QByteArray &array);
QFile file_;
AudioRenderingParams params_;
int data_length_;
};
#endif // WAVEAUDIO_H