mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
Fixed on-demand transcoding.
This commit is contained in:
parent
24e4680bde
commit
a844b31819
@ -59,7 +59,6 @@ TranscodingAudioDataStream::TranscodingAudioDataStream(
|
|||||||
this->bitrate = bitrate;
|
this->bitrate = bitrate;
|
||||||
this->interrupted = false;
|
this->interrupted = false;
|
||||||
this->eof = false;
|
this->eof = false;
|
||||||
this->encoder = nullptr;
|
|
||||||
this->outFile = nullptr;
|
this->outFile = nullptr;
|
||||||
this->detachTolerance = 0;
|
this->detachTolerance = 0;
|
||||||
this->format = format;
|
this->format = format;
|
||||||
@ -196,10 +195,10 @@ PositionType TranscodingAudioDataStream::Read(void *buffer, PositionType bytesTo
|
|||||||
bool hasBuffer = false;
|
bool hasBuffer = false;
|
||||||
|
|
||||||
/* init */
|
/* init */
|
||||||
if (this->decoder && !this->encoder) {
|
if (!this->encoderInitialized) {
|
||||||
hasBuffer = this->decoder->GetBuffer(this->pcmBuffer);
|
hasBuffer = this->decoder->GetBuffer(this->pcmBuffer);
|
||||||
if (hasBuffer) {
|
if (hasBuffer) {
|
||||||
this->encoder->Initialize(
|
this->encoderInitialized = this->encoder->Initialize(
|
||||||
this->pcmBuffer->SampleRate(),
|
this->pcmBuffer->SampleRate(),
|
||||||
this->pcmBuffer->Channels(),
|
this->pcmBuffer->Channels(),
|
||||||
this->bitrate);
|
this->bitrate);
|
||||||
|
@ -98,6 +98,6 @@ class TranscodingAudioDataStream : public musik::core::sdk::IDataStream {
|
|||||||
FILE* outFile;
|
FILE* outFile;
|
||||||
std::string tempFilename, finalFilename;
|
std::string tempFilename, finalFilename;
|
||||||
std::string format;
|
std::string format;
|
||||||
bool interrupted;
|
bool interrupted{ false }, encoderInitialized{ false };
|
||||||
long detachTolerance;
|
long detachTolerance;
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user