| 522 | } |
| 523 | |
| 524 | int attribute_align_arg avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt) |
| 525 | { |
| 526 | AVCodecInternal *avci = avctx->internal; |
| 527 | int ret; |
| 528 | |
| 529 | av_packet_unref(avpkt); |
| 530 | |
| 531 | if (!avcodec_is_open(avctx) || !av_codec_is_encoder(avctx->codec)) |
| 532 | return AVERROR(EINVAL); |
| 533 | |
| 534 | if (avci->buffer_pkt->data || avci->buffer_pkt->side_data) { |
| 535 | av_packet_move_ref(avpkt, avci->buffer_pkt); |
| 536 | } else { |
| 537 | ret = encode_receive_packet_internal(avctx, avpkt); |
| 538 | if (ret < 0) |
| 539 | return ret; |
| 540 | } |
| 541 | |
| 542 | return 0; |
| 543 | } |
| 544 | |
| 545 | static int encode_preinit_video(AVCodecContext *avctx) |
| 546 | { |