mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +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->interrupted = false;
|
||||
this->eof = false;
|
||||
this->encoder = nullptr;
|
||||
this->outFile = nullptr;
|
||||
this->detachTolerance = 0;
|
||||
this->format = format;
|
||||
@ -196,10 +195,10 @@ PositionType TranscodingAudioDataStream::Read(void *buffer, PositionType bytesTo
|
||||
bool hasBuffer = false;
|
||||
|
||||
/* init */
|
||||
if (this->decoder && !this->encoder) {
|
||||
if (!this->encoderInitialized) {
|
||||
hasBuffer = this->decoder->GetBuffer(this->pcmBuffer);
|
||||
if (hasBuffer) {
|
||||
this->encoder->Initialize(
|
||||
this->encoderInitialized = this->encoder->Initialize(
|
||||
this->pcmBuffer->SampleRate(),
|
||||
this->pcmBuffer->Channels(),
|
||||
this->bitrate);
|
||||
|
@ -98,6 +98,6 @@ class TranscodingAudioDataStream : public musik::core::sdk::IDataStream {
|
||||
FILE* outFile;
|
||||
std::string tempFilename, finalFilename;
|
||||
std::string format;
|
||||
bool interrupted;
|
||||
bool interrupted{ false }, encoderInitialized{ false };
|
||||
long detachTolerance;
|
||||
};
|
Loading…
Reference in New Issue
Block a user