MCPcopy Create free account
hub / github.com/dirkvdb/ffmpegthumbnailer / decodeVideoPacket

Method decodeVideoPacket

libffmpegthumbnailer/moviedecoder.cpp:456–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454}
455
456bool 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
486bool MovieDecoder::getVideoPacket()
487{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected