wrote sample rate conform code into ffmpegdecoder

Audio no longer needs to be the same format/sample rate to play correctly. This
should be the last step to making audio work correctly (minus several
optimizations still yet to be done).
This commit is contained in:
itsmattkc
2019-11-30 02:52:31 +11:00
parent 87394f0c2a
commit 1a54d18862
2 changed files with 170 additions and 91 deletions
+9 -2
View File
@@ -29,8 +29,9 @@ extern "C" {
#include <QVector>
#include "decoder/decoder.h"
#include "audio/sampleformat.h"
#include "decoder/decoder.h"
#include "decoder/waveoutput.h"
/**
* @brief A Decoder derivative that wraps FFmpeg functions as on Olive decoder
@@ -47,7 +48,8 @@ public:
virtual bool Probe(Footage *f) override;
virtual bool Open() override;
virtual FramePtr Retrieve(const rational &timecode, const rational &length = 0) override;
virtual FramePtr RetrieveVideo(const rational &timecode) override;
virtual FramePtr RetrieveAudio(const rational &timecode, const rational &length, const AudioRenderingParams& params) override;
virtual void Close() override;
virtual QString id() override;
@@ -56,7 +58,12 @@ public:
virtual void Conform(const AudioRenderingParams& params) override;
virtual bool SupportsVideo() override;
virtual bool SupportsAudio() override;
private:
void ConformInternal(SwrContext *resampler, WaveOutput *output, const char *in_data, int in_sample_count);
/**
* @brief Handle an error
*