[FFmpeg-devel] [PATCH 08/25] fftools/ffplay: support only limited color range

Marton Balint cus at passwd.hu
Sat Dec 16 13:24:55 EET 2017



On Sat, 16 Dec 2017, Paul B Mahol wrote:

> Signed-off-by: Paul B Mahol <onemda at gmail.com>
> ---
> fftools/ffplay.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fftools/ffplay.c b/fftools/ffplay.c
> index 10a917194d..f023c81575 100644
> --- a/fftools/ffplay.c
> +++ b/fftools/ffplay.c
> @@ -1822,6 +1822,7 @@ fail:
> static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters, AVFrame *frame)
> {
>     enum AVPixelFormat pix_fmts[FF_ARRAY_ELEMS(sdl_texture_format_map)];
> +    enum AVColorRange color_ranges[2] = { AVCOL_RANGE_MPEG, AVCOL_RANGE_UNSPECIFIED };
>     char sws_flags_str[512] = "";
>     char buffersrc_args[256];
>     int ret;
> @@ -1876,7 +1877,10 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
>     if ((ret = av_opt_set_int_list(filt_out, "pix_fmts", pix_fmts,  AV_PIX_FMT_NONE, AV_OPT_SEARCH_CHILDREN)) < 0)
>         goto fail;
> 
> -    last_filter = filt_out;
> +    if ((ret = av_opt_set_int_list(filt_out, "color_ranges", color_ranges, AVCOL_RANGE_UNSPECIFIED, AV_OPT_SEARCH_CHILDREN)) < 0)
> +        goto fail;
> +
> +     last_filter = filt_out;

I am afraid this wont work, because ffplay supports full range RGB as 
well. Unless there is a way to specify allowed pixel format / color range 
combinations (which is the only way to mimic existing behaviour as far as 
I see), you have to use hacks like configure the filter graph once without 
a range restriction, and if you get an invalid pixel format / color range 
combination, you have to configure the graph again with the supported 
color range list for that pixel format, hoping that the pixel format will 
remain the same.

Regards,
Marton


More information about the ffmpeg-devel mailing list