MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / GetNextPacket

Method GetNextPacket

src/FFmpegReader.cpp:1469–1497  ·  view source on GitHub ↗

Get the next packet (if any)

Source from the content-addressed store, hash-verified

1467
1468// Get the next packet (if any)
1469int FFmpegReader::GetNextPacket() {
1470 int found_packet = 0;
1471 AVPacket *next_packet;
1472 next_packet = new AVPacket();
1473 found_packet = av_read_frame(pFormatCtx, next_packet);
1474
1475 if (packet) {
1476 // Remove previous packet before getting next one
1477 RemoveAVPacket(packet);
1478 packet = NULL;
1479 }
1480 if (found_packet >= 0) {
1481 // Update current packet pointer
1482 packet = next_packet;
1483
1484 // Keep track of packet stats
1485 if (packet->stream_index == videoStream) {
1486 packet_status.video_read++;
1487 } else if (packet->stream_index == audioStream) {
1488 packet_status.audio_read++;
1489 }
1490 } else {
1491 // No more packets found
1492 delete next_packet;
1493 packet = NULL;
1494 }
1495 // Return if packet was found (or error number)
1496 return found_packet;
1497}
1498
1499// Get an AVFrame (if any)
1500bool FFmpegReader::GetAVFrame() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected