MCPcopy Create free account
hub / github.com/clangen/musikcube / GetBuffer

Method GetBuffer

src/plugins/ffmpegdecoder/FfmpegDecoder.cpp:225–254  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225bool FfmpegDecoder::GetBuffer(IBuffer *buffer) {
226 if (this->ioContext) {
227 buffer->SetSampleRate((long) RESOLVE_SAMPLE_RATE());
228 buffer->SetChannels((long) this->channels);
229 buffer->SetSamples(0);
230
231 if (!this->eof) {
232 if (!this->resampler && !this->InitializeResampler()) {
233 this->exhausted = true;
234 logError("unable to initialize resampler. marking as done.");
235 return false;
236 }
237
238 if (av_audio_fifo_size(this->outputFifo) < this->preferredFrameSize) {
239 if (!this->RefillFifoQueue()) {
240 this->FlushAndFinalizeDecoder();
241 this->DrainResamplerToFifoQueue();
242 this->eof = true;
243 }
244 }
245 }
246 if (this->ReadFromFifoAndWriteToBuffer(buffer)) {
247 return true;
248 }
249 }
250
251 ::debug->Info(TAG, "finished decoding.");
252 this->exhausted = true;
253 return false;
254}
255
256double FfmpegDecoder::GetDuration() {
257 return this->duration;

Callers

nothing calls this directly

Calls 9

RefillFifoQueueMethod · 0.95
logErrorFunction · 0.70
SetSampleRateMethod · 0.45
SetChannelsMethod · 0.45
SetSamplesMethod · 0.45
InfoMethod · 0.45

Tested by

no test coverage detected