[FFmpeg-devel] [PATCH 02/27] avfilter/avfilter: add color_range to AVFilterLink struct

Nicolas George george at nsup.org
Sun Dec 10 12:48:56 EET 2017


Paul B Mahol (2017-12-09):
> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
>  libavfilter/avfilter.c | 2 ++
>  libavfilter/avfilter.h | 2 ++
>  libavfilter/video.c    | 8 +++++++-
>  3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
> index b98b32bacb..4a579bb49d 100644
> --- a/libavfilter/avfilter.c
> +++ b/libavfilter/avfilter.c
> @@ -336,6 +336,8 @@ int avfilter_config_links(AVFilterContext *filter)
>                          link->w = inlink->w;
>                      if (!link->h)
>                          link->h = inlink->h;
> +                    if (!link->color_range)
> +                        link->color_range = inlink->color_range;
>                  } else if (!link->w || !link->h) {
>                      av_log(link->src, AV_LOG_ERROR,
>                             "Video source filters must set their output link's "
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index 47546c15e5..a5f4df74de 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -448,6 +448,8 @@ struct AVFilterLink {
>       */
>      AVRational time_base;
>  

> +    int color_range;
> +

Missing documentation. And I would rather have it not part of the public
API, i.e. somewhat lower in the structure.

>      /*****************************************************************
>       * All fields below this line are not part of the public API. They
>       * may not be used outside of libavfilter and can be changed and
> diff --git a/libavfilter/video.c b/libavfilter/video.c
> index 6f9020b9fe..8f12cb7080 100644
> --- a/libavfilter/video.c
> +++ b/libavfilter/video.c
> @@ -43,6 +43,7 @@ AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
>  
>  AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
>  {
> +    AVFrame *frame = NULL;
>      int pool_width = 0;
>      int pool_height = 0;
>      int pool_align = 0;
> @@ -86,7 +87,12 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
>          }
>      }
>  
> -    return ff_frame_pool_get(link->frame_pool);
> +    frame = ff_frame_pool_get(link->frame_pool);
> +    if (!frame)
> +        return NULL;
> +    frame->color_range = link->color_range;
> +
> +    return frame;
>  }
>  
>  AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)

Regards,

-- 
  Nicolas George


More information about the ffmpeg-devel mailing list