| 385 | } |
| 386 | |
| 387 | bool decoderFFmpeg::decodeFrame() |
| 388 | { |
| 389 | // Try to retrive a next frame from the decoder (don't copy it yet). |
| 390 | auto retRecieve = this->ff.getFrameFromDecoder(decCtx, this->frame); |
| 391 | if (retRecieve == 0) |
| 392 | { |
| 393 | // We recieved a frame. |
| 394 | DEBUG_FFMPEG("decoderFFmpeg::decodeFrame: Received frame Size(" |
| 395 | << this->frame.getWidth() << "x" << this->frame.getHeight() << ") PTS" |
| 396 | << this->frame.getPTS() << "type" << this->frame.getPictType() |
| 397 | << (this->frame.getKeyFrame() ? "key frame" : "")); |
| 398 | // Checkt the size of the retrieved image |
| 399 | if (this->frameSize != this->frame.getSize()) |
| 400 | return this->setErrorB("Received a frame of different size"); |
| 401 | this->currentOutputBuffer.clear(); |
| 402 | return true; |
| 403 | } |
| 404 | else if (retRecieve < 0 && retRecieve != AVERROR(EAGAIN) && retRecieve != -35) |
| 405 | { |
| 406 | // An error occurred |
| 407 | DEBUG_FFMPEG("decoderFFmpeg::decodeFrame Error reading frame."); |
| 408 | return this->setErrorB(QStringLiteral("Error recieving frame (avcodec_receive_frame)")); |
| 409 | } |
| 410 | else if (retRecieve == AVERROR(EAGAIN)) |
| 411 | { |
| 412 | if (this->flushing) |
| 413 | { |
| 414 | // There is no more data |
| 415 | this->decoderState = DecoderState::EndOfBitstream; |
| 416 | DEBUG_FFMPEG("decoderFFmpeg::decodeFrame End of bitstream."); |
| 417 | } |
| 418 | else |
| 419 | { |
| 420 | this->decoderState = DecoderState::NeedsMoreData; |
| 421 | DEBUG_FFMPEG("decoderFFmpeg::decodeFrame Need more data."); |
| 422 | } |
| 423 | } |
| 424 | return false; |
| 425 | } |
| 426 | |
| 427 | void decoderFFmpeg::fillStatisticList(stats::StatisticsData &statisticsData) const |
| 428 | { |
no test coverage detected