| 1465 | } |
| 1466 | |
| 1467 | static int encode_frame(AVCodecContext *c, const AVFrame *frame, AVPacket *pkt) |
| 1468 | { |
| 1469 | int ret; |
| 1470 | int size = 0; |
| 1471 | |
| 1472 | ret = avcodec_send_frame(c, frame); |
| 1473 | if (ret < 0) |
| 1474 | return ret; |
| 1475 | |
| 1476 | do { |
| 1477 | ret = avcodec_receive_packet(c, pkt); |
| 1478 | if (ret >= 0) { |
| 1479 | size += pkt->size; |
| 1480 | av_packet_unref(pkt); |
| 1481 | } else if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) |
| 1482 | return ret; |
| 1483 | } while (ret >= 0); |
| 1484 | |
| 1485 | return size; |
| 1486 | } |
| 1487 | |
| 1488 | static int estimate_best_b_count(MPVMainEncContext *const m) |
| 1489 | { |
no test coverage detected