Quoting Mark Thompson (2016-10-10 21:54:35)
> Only works if packed headers are supported, where we can know the
> output before generating the first frame.
> ---
> Added padding; fail harder; informative comment in header.
> 
> Not sure how to do this in the non-packed-header case - we could just
> invoke this anyway, but the result is unlikely to precisely match what
> the encoder then produces.

I guess we shouldn't then -- creating corrupted files is evil. At least
in avconv we can now use the extract_extradata bitstream filter (once it
goes in) to get the extradata from the first packet.

> 
>  libavcodec/vaapi_encode.c | 22 ++++++++++++++++++++++
>  libavcodec/vaapi_encode.h |  2 ++
>  2 files changed, 24 insertions(+)
> 
> diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c
> index b600a00..4dc1f50 100644
> --- a/libavcodec/vaapi_encode.c
> +++ b/libavcodec/vaapi_encode.c
> @@ -1399,6 +1399,28 @@ av_cold int ff_vaapi_encode_init(AVCodecContext *avctx)
>      // where it actually overlaps properly, though.)
>      ctx->issue_mode = ISSUE_MODE_MAXIMISE_THROUGHPUT;
> 
> +    if (ctx->va_packed_headers & VA_ENC_PACKED_HEADER_SEQUENCE &&
> +        ctx->codec->write_sequence_header) {
> +        char data[MAX_PARAM_BUFFER_SIZE];
> +        size_t bit_len = 8 * sizeof(data);
> +
> +        err = ctx->codec->write_sequence_header(avctx, data, &bit_len);
> +        if (err < 0) {
> +            av_log(avctx, AV_LOG_ERROR, "Failed to write sequence header "
> +                   "for extradata: %d.\n", err);
> +            goto fail;
> +        } else {
> +            avctx->extradata_size = bit_len / 8;

Round up? Or is this guaranteed to be byte-aligned (in which case why is
it not in bytes in the first place)?

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to