| 223 | } |
| 224 | |
| 225 | bool 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 | |
| 256 | double FfmpegDecoder::GetDuration() { |
| 257 | return this->duration; |
nothing calls this directly
no test coverage detected