[libav-devel] [PATCH 2/2] libx264: Pass the reordered_opaque field through the encoder

Martin Storsjö martin at martin.st
Thu Oct 25 14:52:16 CEST 2018


On Thu, 25 Oct 2018, Martin Storsjö wrote:

> libx264 does have a field for opaque data to pass along with frames
> through the encoder, but it is a pointer, while the libavcodec
> reordered_opaque field is an int64_t. Therefore, allocate an array
> within the libx264 wrapper, where reordered_opaque values in flight
> are stored, and pass a pointer to this array to libx264.
>
> Update the public libavcodec documentation for the AVCodecContext
> field to explain this usage, and add a codec capability that allows
> detecting whether an encoder handles this field.
> ---
> libavcodec/avcodec.h | 12 +++++++++++-
> libavcodec/libx264.c | 31 +++++++++++++++++++++++++++++--
> 2 files changed, 40 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index fb8e34e7d5..727e1c411d 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -899,6 +899,13 @@ typedef struct RcOverride{
>  */
> #define AV_CODEC_CAP_HYBRID              (1 << 18)
> 
> +/**
> + * This codec takes the reordered_opaque field from input AVFrames
> + * and returns it in the corresponding field in AVCodecContext after
> + * encoding.
> + */
> +#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 19)

This obviously needs a minor bump, I'll add one locally.

// Martin


More information about the libav-devel mailing list