| 454 | } |
| 455 | |
| 456 | bool MovieDecoder::decodeVideoPacket() |
| 457 | { |
| 458 | if (m_pPacket->stream_index != m_VideoStream) { |
| 459 | return false; |
| 460 | } |
| 461 | |
| 462 | int rc = avcodec_send_packet(m_pVideoCodecContext, m_pPacket); |
| 463 | if (rc == AVERROR(EAGAIN)) { |
| 464 | rc = 0; |
| 465 | } |
| 466 | |
| 467 | if (rc == AVERROR_EOF) { |
| 468 | return false; |
| 469 | } else if (rc < 0) { |
| 470 | throw logic_error("Failed to decode video frame: avcodec_send_packet() < 0"); |
| 471 | } |
| 472 | |
| 473 | rc = avcodec_receive_frame(m_pVideoCodecContext, m_pFrame); |
| 474 | switch (rc) { |
| 475 | case 0: |
| 476 | return true; |
| 477 | |
| 478 | case AVERROR(EAGAIN): |
| 479 | return false; |
| 480 | |
| 481 | default: |
| 482 | throw logic_error("Failed to decode video frame: avcodec_receive_frame() < 0"); |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | bool MovieDecoder::getVideoPacket() |
| 487 | { |
nothing calls this directly
no outgoing calls
no test coverage detected