static av_cold int init(AVFilterContext *ctx)

{

    FormatContext *s = ctx->priv;

    char *cur, *sep;

    int nb_formats = 1;

    int i;

    int ret;



    /* count the formats */

    cur = s->pix_fmts;

    while ((cur = strchr(cur, '|'))) {

        nb_formats++;

        if (*cur)

            cur++;

    }



    s->formats = av_malloc_array(nb_formats + 1, sizeof(*s->formats));

    if (!s->formats)

        return AVERROR(ENOMEM);



    if (!s->pix_fmts)

        return AVERROR(EINVAL);



    /* parse the list of formats */

    cur = s->pix_fmts;

    for (i = 0; i < nb_formats; i++) {

        sep = strchr(cur, '|');

        if (sep)

            *sep++ = 0;



        if ((ret = ff_parse_pixel_format(&s->formats[i], cur, ctx)) < 0)

            return ret;



        cur = sep;

    }

    s->formats[nb_formats] = AV_PIX_FMT_NONE;



    if (!strcmp(ctx->filter->name, "noformat")) {

        const AVPixFmtDescriptor *desc = NULL;

        enum AVPixelFormat *formats_allowed;

        int nb_formats_lavu = 0, nb_formats_allowed = 0;



        /* count the formats known to lavu */

        while ((desc = av_pix_fmt_desc_next(desc)))

            nb_formats_lavu++;



        formats_allowed = av_malloc_array(nb_formats_lavu + 1, sizeof(*formats_allowed));

        if (!formats_allowed)

            return AVERROR(ENOMEM);



        /* for each format known to lavu, check if it's in the list of

         * forbidden formats */

        while ((desc = av_pix_fmt_desc_next(desc))) {

            enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(desc);



            for (i = 0; i < nb_formats; i++) {

                if (s->formats[i] == pix_fmt)

                    break;

            }

            if (i < nb_formats)

                continue;



            formats_allowed[nb_formats_allowed++] = pix_fmt;

        }

        formats_allowed[nb_formats_allowed] = AV_PIX_FMT_NONE;

        av_freep(&s->formats);

        s->formats = formats_allowed;

    }



    return 0;

}

static av_cold int init(AVFilterContext *ctx)

{

    FormatContext *s = ctx->priv;

    char *cur, *sep;

    int nb_formats = 1;

    int i;

    int ret;



    

    cur = s->pix_fmts;

    while ((cur = strchr(cur, '|'))) {

        nb_formats++;

        if (*cur)

            cur++;

    }



    s->formats = av_malloc_array(nb_formats + 1, sizeof(*s->formats));

    if (!s->formats)

        return AVERROR(ENOMEM);



    if (!s->pix_fmts)

        return AVERROR(EINVAL);



    

    cur = s->pix_fmts;

    for (i = 0; i < nb_formats; i++) {

        sep = strchr(cur, '|');

        if (sep)

            *sep++ = 0;



        if ((ret = ff_parse_pixel_format(&s->formats[i], cur, ctx)) < 0)

            return ret;



        cur = sep;

    }

    s->formats[nb_formats] = AV_PIX_FMT_NONE;



    if (!strcmp(ctx->filter->name, "noformat")) {

        const AVPixFmtDescriptor *desc = NULL;

        enum AVPixelFormat *formats_allowed;

        int nb_formats_lavu = 0, nb_formats_allowed = 0;



        

        while ((desc = av_pix_fmt_desc_next(desc)))

            nb_formats_lavu++;



        formats_allowed = av_malloc_array(nb_formats_lavu + 1, sizeof(*formats_allowed));

        if (!formats_allowed)

            return AVERROR(ENOMEM);



        



        while ((desc = av_pix_fmt_desc_next(desc))) {

            enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(desc);



            for (i = 0; i < nb_formats; i++) {

                if (s->formats[i] == pix_fmt)

                    break;

            }

            if (i < nb_formats)

                continue;



            formats_allowed[nb_formats_allowed++] = pix_fmt;

        }

        formats_allowed[nb_formats_allowed] = AV_PIX_FMT_NONE;

        av_freep(&s->formats);

        s->formats = formats_allowed;

    }



    return 0;

}

static av_cold int FUNC_0(AVFilterContext *ctx)

{

    FormatContext *s = ctx->priv;

    char *VAR_0, *VAR_1;

    int VAR_2 = 1;

    int VAR_3;

    int VAR_4;



    

    VAR_0 = s->pix_fmts;

    while ((VAR_0 = strchr(VAR_0, '|'))) {

        VAR_2++;

        if (*VAR_0)

            VAR_0++;

    }



    s->formats = av_malloc_array(VAR_2 + 1, sizeof(*s->formats));

    if (!s->formats)

        return AVERROR(ENOMEM);



    if (!s->pix_fmts)

        return AVERROR(EINVAL);



    

    VAR_0 = s->pix_fmts;

    for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) {

        VAR_1 = strchr(VAR_0, '|');

        if (VAR_1)

            *VAR_1++ = 0;



        if ((VAR_4 = ff_parse_pixel_format(&s->formats[VAR_3], VAR_0, ctx)) < 0)

            return VAR_4;



        VAR_0 = VAR_1;

    }

    s->formats[VAR_2] = AV_PIX_FMT_NONE;



    if (!strcmp(ctx->filter->name, "noformat")) {

        const AVPixFmtDescriptor *VAR_5 = NULL;

        enum AVPixelFormat *VAR_6;

        int VAR_7 = 0, VAR_8 = 0;



        

        while ((VAR_5 = av_pix_fmt_desc_next(VAR_5)))

            VAR_7++;



        VAR_6 = av_malloc_array(VAR_7 + 1, sizeof(*VAR_6));

        if (!VAR_6)

            return AVERROR(ENOMEM);



        



        while ((VAR_5 = av_pix_fmt_desc_next(VAR_5))) {

            enum AVPixelFormat VAR_9 = av_pix_fmt_desc_get_id(VAR_5);



            for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) {

                if (s->formats[VAR_3] == VAR_9)

                    break;

            }

            if (VAR_3 < VAR_2)

                continue;



            VAR_6[VAR_8++] = VAR_9;

        }

        VAR_6[VAR_8] = AV_PIX_FMT_NONE;

        av_freep(&s->formats);

        s->formats = VAR_6;

    }



    return 0;

}

static av_cold int FUNC_0(AVFilterContext *ctx)
{ FormatContext *s = ctx->priv; char *VAR_0, *VAR_1; int VAR_2 = 1; int VAR_3; int VAR_4; VAR_0 = s->pix_fmts; while ((VAR_0 = strchr(VAR_0, '|'))) { VAR_2++; if (*VAR_0)
VAR_0++; } s->formats = av_malloc_array(VAR_2 + 1, sizeof(*s->formats)); if (!s->formats)
return AVERROR(ENOMEM); if (!s->pix_fmts)
return AVERROR(EINVAL); VAR_0 = s->pix_fmts; for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) { VAR_1 = strchr(VAR_0, '|'); if (VAR_1)
*VAR_1++ = 0; if ((VAR_4 = ff_parse_pixel_format(&s->formats[VAR_3], VAR_0, ctx)) < 0)
return VAR_4; VAR_0 = VAR_1; } s->formats[VAR_2] = AV_PIX_FMT_NONE; if (!strcmp(ctx->filter->name, "noformat")) { const AVPixFmtDescriptor *VAR_5 = NULL; enum AVPixelFormat *VAR_6; int VAR_7 = 0, VAR_8 = 0; while ((VAR_5 = av_pix_fmt_desc_next(VAR_5)))
VAR_7++; VAR_6 = av_malloc_array(VAR_7 + 1, sizeof(*VAR_6)); if (!VAR_6)
return AVERROR(ENOMEM); while ((VAR_5 = av_pix_fmt_desc_next(VAR_5))) { enum AVPixelFormat VAR_9 = av_pix_fmt_desc_get_id(VAR_5); for (VAR_3 = 0; VAR_3 < VAR_2; VAR_3++) { if (s->formats[VAR_3] == VAR_9)
break; } if (VAR_3 < VAR_2)
continue; VAR_6[VAR_8++] = VAR_9; } VAR_6[VAR_8] = AV_PIX_FMT_NONE; av_freep(&s->formats); s->formats = VAR_6; } return 0; }