Audio source decoding improvements.

- Streaming sources now also stream the file contents instead of loading it into memory, by default. Added a new stream type enum parameter to newSource ("file" or "memory").
- Audio file decoding now chooses the most appropriate decoder based on the file contents instead of the file extension.
- Videos now stream audio from the file instead of loading all of the video file into memory for use with audio decoding.
This commit is contained in:
Alex Szpakowski
2022-04-21 19:57:32 -03:00
parent d5865e160c
commit c09fef8e79
20 changed files with 318 additions and 468 deletions
+13 -13
View File
@@ -26,7 +26,7 @@
#ifndef LOVE_NO_MODPLUG
// LOVE
#include "common/Data.h"
#include "common/Stream.h"
#include "sound/Decoder.h"
// libmodplug
@@ -47,28 +47,28 @@ class ModPlugDecoder : public Decoder
{
public:
ModPlugDecoder(Data *data, int bufferSize);
ModPlugDecoder(Stream *stream, int bufferSize);
virtual ~ModPlugDecoder();
static bool accepts(const std::string &ext);
love::sound::Decoder *clone();
int decode();
bool seek(double s);
bool rewind();
bool isSeekable();
int getChannelCount() const;
int getBitDepth() const;
double getDuration();
love::sound::Decoder *clone() override;
int decode() override;
bool seek(double s) override;
bool rewind() override;
bool isSeekable() override;
int getChannelCount() const override;
int getBitDepth() const override;
double getDuration() override;
private:
StrongRef<Data> data;
ModPlugFile *plug;
ModPlug_Settings settings;
double duration;
}; // Decoder
}; // ModPlugDecoder
} // lullaby
} // sound