mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
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:
@@ -22,7 +22,7 @@
|
||||
#define LOVE_SOUND_LULLABY_WAVE_DECODER_H
|
||||
|
||||
// LOVE
|
||||
#include "common/Data.h"
|
||||
#include "common/Stream.h"
|
||||
#include "sound/Decoder.h"
|
||||
|
||||
#include "libraries/Wuff/wuff.h"
|
||||
@@ -34,36 +34,25 @@ namespace sound
|
||||
namespace lullaby
|
||||
{
|
||||
|
||||
// Struct for handling data
|
||||
struct WaveFile
|
||||
{
|
||||
char *data;
|
||||
size_t size;
|
||||
size_t offset;
|
||||
};
|
||||
|
||||
class WaveDecoder : public Decoder
|
||||
{
|
||||
public:
|
||||
|
||||
WaveDecoder(Data *data, int bufferSize);
|
||||
WaveDecoder(Stream *stream, int bufferSize);
|
||||
virtual ~WaveDecoder();
|
||||
|
||||
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;
|
||||
int getSampleRate() 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;
|
||||
int getSampleRate() const override;
|
||||
double getDuration() override;
|
||||
|
||||
private:
|
||||
|
||||
WaveFile dataFile;
|
||||
wuff_handle *handle;
|
||||
wuff_info info;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user