| 302 | } |
| 303 | |
| 304 | bool decoderVVDec::decodeNextFrame() |
| 305 | { |
| 306 | if (this->decoderState != DecoderState::RetrieveFrames) |
| 307 | { |
| 308 | DEBUG_vvdec("decoderVVDec::decodeNextFrame: Wrong decoder state."); |
| 309 | return false; |
| 310 | } |
| 311 | |
| 312 | if (this->flushing) |
| 313 | { |
| 314 | // This is our way of moving the decoder to the next picture when flushing. |
| 315 | auto ret = this->lib.vvdec_flush(this->decoder, &this->currentFrame); |
| 316 | if (ret == VVDEC_EOF) |
| 317 | { |
| 318 | DEBUG_vvdec("decoderVVDec::pushData: Flushing returned EOF"); |
| 319 | this->decoderState = DecoderState::EndOfBitstream; |
| 320 | return false; |
| 321 | } |
| 322 | else if (ret != VVDEC_OK) |
| 323 | return setErrorB("Error sendling flush to decoder"); |
| 324 | DEBUG_vvdec("decoderVVDec::pushData: Flushing to next pixture. %s", |
| 325 | this->currentFrame != nullptr ? " frameAvailable" : ""); |
| 326 | |
| 327 | if (this->currentFrame == nullptr) |
| 328 | { |
| 329 | DEBUG_vvdec("decoderVVDec::decodeNextFrame No more frames to flush. EOF."); |
| 330 | this->decoderState = DecoderState::EndOfBitstream; |
| 331 | return false; |
| 332 | } |
| 333 | |
| 334 | this->currentOutputBuffer.clear(); |
| 335 | DEBUG_vvdec("decoderVVDec::decodeNextFrame Flushing - Invalidate buffer"); |
| 336 | } |
| 337 | else |
| 338 | { |
| 339 | if (this->currentFrameReadyForRetrieval) |
| 340 | { |
| 341 | DEBUG_vvdec("decoderVVDec::decodeNextFrame Switch back to NeedsMoreData"); |
| 342 | this->decoderState = DecoderState::NeedsMoreData; |
| 343 | this->currentFrameReadyForRetrieval = false; |
| 344 | return false; |
| 345 | } |
| 346 | else |
| 347 | { |
| 348 | DEBUG_vvdec("decoderVVDec::decodeNextFrame Current frame ready to read out"); |
| 349 | this->currentFrameReadyForRetrieval = true; |
| 350 | return true; |
| 351 | } |
| 352 | } |
| 353 | |
| 354 | return this->getNextFrameFromDecoder(); |
| 355 | } |
| 356 | |
| 357 | bool decoderVVDec::getNextFrameFromDecoder() |
| 358 | { |
nothing calls this directly
no test coverage detected