thinking about streaming implementation

pull/14/head
Dimitri Diakopoulos 10 years ago
parent fe34756ac5
commit 9130de77b7

@ -55,10 +55,19 @@ struct BaseDecoder
virtual void LoadFromPath(nqr::AudioData * data, const std::string & path) = 0; virtual void LoadFromPath(nqr::AudioData * data, const std::string & path) = 0;
virtual void LoadFromBuffer(nqr::AudioData * data, const std::vector<uint8_t> & memory) = 0; virtual void LoadFromBuffer(nqr::AudioData * data, const std::vector<uint8_t> & memory) = 0;
virtual std::vector<std::string> GetSupportedFileExtensions() = 0; virtual std::vector<std::string> GetSupportedFileExtensions() = 0;
//@todo implement streaming helper methods here
}; };
typedef std::pair<std::string, std::shared_ptr<nqr::BaseDecoder>> DecoderPair; struct StreamBuffer
{
};
struct StreamingDecoder
{
};
typedef std::pair<std::string, std::shared_ptr<nqr::BaseDecoder>> DecoderPair;
class NyquistIO class NyquistIO
{ {

@ -100,7 +100,7 @@ public:
void processMetadata(const FLAC__StreamMetadata_StreamInfo & info) void processMetadata(const FLAC__StreamMetadata_StreamInfo & info)
{ {
// N.B.: "Currently the reference encoder and decoders only support up to 24 bits per sample." // Currently the reference encoder and decoders only support up to 24 bits per sample.
d->sampleRate = info.sample_rate; d->sampleRate = info.sample_rate;
d->channelCount = info.channels; // Assert 1 to 8 d->channelCount = info.channels; // Assert 1 to 8
d->sourceFormat = MakeFormatForBits(info.bits_per_sample, false, true); d->sourceFormat = MakeFormatForBits(info.bits_per_sample, false, true);
@ -115,7 +115,7 @@ public:
} }
/////////////////////// ///////////////////////
// libflab callbacks // // libflac callbacks //
/////////////////////// ///////////////////////
static FLAC__StreamDecoderWriteStatus s_writeCallback(const FLAC__StreamDecoder *, const FLAC__Frame* frame, const FLAC__int32 * const buffer[], void * userPtr) static FLAC__StreamDecoderWriteStatus s_writeCallback(const FLAC__StreamDecoder *, const FLAC__Frame* frame, const FLAC__int32 * const buffer[], void * userPtr)

@ -64,7 +64,8 @@ public:
std::cerr << errorAsString(r) << std::endl; std::cerr << errorAsString(r) << std::endl;
throw std::runtime_error("ov_test_open failed"); throw std::runtime_error("ov_test_open failed");
} }
// N.B.: Don't need to fclose() after an open -- vorbis does this internally
// Don't need to fclose() after an open -- vorbis does this internally
vorbis_info *ovInfo = ov_info(fileHandle, -1); vorbis_info *ovInfo = ov_info(fileHandle, -1);

Loading…
Cancel
Save