| 686 | } |
| 687 | |
| 688 | static int vaapi_encode_get_coded_buffer_data(AVCodecContext *avctx, |
| 689 | VABufferID buf_id, uint8_t **dst) |
| 690 | { |
| 691 | VAAPIEncodeContext *ctx = avctx->priv_data; |
| 692 | VACodedBufferSegment *buf_list, *buf; |
| 693 | VAStatus vas; |
| 694 | int err; |
| 695 | |
| 696 | vas = vaMapBuffer(ctx->hwctx->display, buf_id, |
| 697 | (void**)&buf_list); |
| 698 | if (vas != VA_STATUS_SUCCESS) { |
| 699 | av_log(avctx, AV_LOG_ERROR, "Failed to map output buffers: " |
| 700 | "%d (%s).\n", vas, vaErrorStr(vas)); |
| 701 | err = AVERROR(EIO); |
| 702 | return err; |
| 703 | } |
| 704 | |
| 705 | for (buf = buf_list; buf; buf = buf->next) { |
| 706 | av_log(avctx, AV_LOG_DEBUG, "Output buffer: %u bytes " |
| 707 | "(status %08x).\n", buf->size, buf->status); |
| 708 | |
| 709 | memcpy(*dst, buf->buf, buf->size); |
| 710 | *dst += buf->size; |
| 711 | } |
| 712 | |
| 713 | vas = vaUnmapBuffer(ctx->hwctx->display, buf_id); |
| 714 | if (vas != VA_STATUS_SUCCESS) { |
| 715 | av_log(avctx, AV_LOG_ERROR, "Failed to unmap output buffers: " |
| 716 | "%d (%s).\n", vas, vaErrorStr(vas)); |
| 717 | err = AVERROR(EIO); |
| 718 | return err; |
| 719 | } |
| 720 | |
| 721 | return 0; |
| 722 | } |
| 723 | |
| 724 | static int vaapi_encode_get_coded_data(AVCodecContext *avctx, |
| 725 | VAAPIEncodePicture *pic, AVPacket *pkt) |
no test coverage detected