[FFmpeg-devel] [PATCH 1/2] avcodec/libdav1d: try to set decoder context parameters during init()

Anton Khirnov anton at khirnov.net
Mon May 18 17:43:10 EEST 2020


Quoting James Almer (2020-05-11 16:27:55)
> If extradata is available, use it to initialize the AVCodecContext before
> packet data is seen. Also, don't constantly overwrite it after it's set.
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> The main benefit from this is using ff_decode_frame_props() to fill frame
> props, which includes copying any relevant side data that may be present in
> packets, like for example container mastering metadata propagated by a demuxer.
> 
>  libavcodec/libdav1d.c | 102 +++++++++++++++++++++++++++++-------------
>  1 file changed, 71 insertions(+), 31 deletions(-)
> 
> diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
> index 5248e3f9f5..72f06c550e 100644
> --- a/libavcodec/libdav1d.c
> +++ b/libavcodec/libdav1d.c
> @@ -42,6 +42,8 @@ typedef struct Libdav1dContext {
>      int apply_grain;
>      int operating_point;
>      int all_layers;
> +
> +    int inited;
>  } Libdav1dContext;
>  
>  static const enum AVPixelFormat pix_fmt[][3] = {
> @@ -117,9 +119,59 @@ static void libdav1d_picture_release(Dav1dPicture *p, void *cookie)
>      av_buffer_unref(&buf);
>  }
>  
> +static int libdav1d_init_params(AVCodecContext *c, Dav1dSequenceHeader *seq)
> +{
> +    Libdav1dContext *dav1d = c->priv_data;
> +    int res;
> +
> +    if (dav1d->inited)
> +        return 0;

Changing parameters mid-stream is not supported?

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list