Get the next packet (if any)
| 1467 | |
| 1468 | // Get the next packet (if any) |
| 1469 | int 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) |
| 1500 | bool FFmpegReader::GetAVFrame() { |
nothing calls this directly
no outgoing calls
no test coverage detected