| 722 | } |
| 723 | |
| 724 | static int vaapi_encode_get_coded_data(AVCodecContext *avctx, |
| 725 | VAAPIEncodePicture *pic, AVPacket *pkt) |
| 726 | { |
| 727 | VAAPIEncodeContext *ctx = avctx->priv_data; |
| 728 | VABufferID output_buffer_prev; |
| 729 | int total_size = 0; |
| 730 | uint8_t *ptr; |
| 731 | int ret; |
| 732 | |
| 733 | if (ctx->coded_buffer_ref) { |
| 734 | output_buffer_prev = *ctx->coded_buffer_ref; |
| 735 | ret = vaapi_encode_get_coded_buffer_size(avctx, output_buffer_prev); |
| 736 | if (ret < 0) |
| 737 | goto end; |
| 738 | total_size += ret; |
| 739 | } |
| 740 | |
| 741 | ret = vaapi_encode_get_coded_buffer_size(avctx, pic->output_buffer); |
| 742 | if (ret < 0) |
| 743 | goto end; |
| 744 | total_size += ret; |
| 745 | |
| 746 | ret = ff_get_encode_buffer(avctx, pkt, total_size, 0); |
| 747 | if (ret < 0) |
| 748 | goto end; |
| 749 | ptr = pkt->data; |
| 750 | |
| 751 | if (ctx->coded_buffer_ref) { |
| 752 | ret = vaapi_encode_get_coded_buffer_data(avctx, output_buffer_prev, &ptr); |
| 753 | if (ret < 0) |
| 754 | goto end; |
| 755 | } |
| 756 | |
| 757 | ret = vaapi_encode_get_coded_buffer_data(avctx, pic->output_buffer, &ptr); |
| 758 | if (ret < 0) |
| 759 | goto end; |
| 760 | |
| 761 | end: |
| 762 | av_refstruct_unref(&ctx->coded_buffer_ref); |
| 763 | av_refstruct_unref(&pic->output_buffer_ref); |
| 764 | pic->output_buffer = VA_INVALID_ID; |
| 765 | |
| 766 | return ret; |
| 767 | } |
| 768 | |
| 769 | static int vaapi_encode_output(AVCodecContext *avctx, |
| 770 | FFHWBaseEncodePicture *base_pic, AVPacket *pkt) |
no test coverage detected