static int set_format(void *obj, const char *name, int fmt, int search_flags,

                      enum AVOptionType type, const char *desc, int nb_fmts)

{

    void *target_obj;

    const AVOption *o = av_opt_find2(obj, name, NULL, 0,

                                     search_flags, &target_obj);

    int min, max;

    const AVClass *class = *(AVClass **)obj;



    if (!o || !target_obj)

        return AVERROR_OPTION_NOT_FOUND;

    if (o->type != type) {

        av_log(obj, AV_LOG_ERROR,

               "The value set by option '%s' is not a %s format", name, desc);

        return AVERROR(EINVAL);

    }



#if LIBAVUTIL_VERSION_MAJOR < 54

    if (class->version && class->version < AV_VERSION_INT(52, 11, 100)) {

        min = -1;

        max = nb_fmts-1;

    } else

#endif

    {

        min = FFMIN(o->min, -1);

        max = FFMAX(o->max, nb_fmts-1);

    }

    if (fmt < min || fmt > max) {

        av_log(obj, AV_LOG_ERROR,

               "Value %d for parameter '%s' out of %s format range [%d - %d]\n",

               fmt, name, desc, min, max);

        return AVERROR(ERANGE);

    }

    *(int *)(((uint8_t *)target_obj) + o->offset) = fmt;

    return 0;

}

static int set_format(void *obj, const char *name, int fmt, int search_flags,

                      enum AVOptionType type, const char *desc, int nb_fmts)

{

    void *target_obj;

    const AVOption *o = av_opt_find2(obj, name, NULL, 0,

                                     search_flags, &target_obj);

    int min, max;

    const AVClass *class = *(AVClass **)obj;



    if (!o || !target_obj)

        return AVERROR_OPTION_NOT_FOUND;

    if (o->type != type) {

        av_log(obj, AV_LOG_ERROR,

               "The value set by option '%s' is not a %s format", name, desc);

        return AVERROR(EINVAL);

    }



#if LIBAVUTIL_VERSION_MAJOR < 54

    if (class->version && class->version < AV_VERSION_INT(52, 11, 100)) {

        min = -1;

        max = nb_fmts-1;

    } else

#endif

    {

        min = FFMIN(o->min, -1);

        max = FFMAX(o->max, nb_fmts-1);

    }

    if (fmt < min || fmt > max) {

        av_log(obj, AV_LOG_ERROR,

               "Value %d for parameter '%s' out of %s format range [%d - %d]\n",

               fmt, name, desc, min, max);

        return AVERROR(ERANGE);

    }

    *(int *)(((uint8_t *)target_obj) + o->offset) = fmt;

    return 0;

}

static int FUNC_0(void *VAR_0, const char *VAR_1, int VAR_2, int VAR_3,

                      enum AVOptionType VAR_4, const char *VAR_5, int VAR_6)

{

    void *VAR_7;

    const AVOption *VAR_8 = av_opt_find2(VAR_0, VAR_1, NULL, 0,

                                     VAR_3, &VAR_7);

    int VAR_9, VAR_10;

    const AVClass *VAR_11 = *(AVClass **)VAR_0;



    if (!VAR_8 || !VAR_7)

        return AVERROR_OPTION_NOT_FOUND;

    if (VAR_8->VAR_4 != VAR_4) {

        av_log(VAR_0, AV_LOG_ERROR,

               "The value set by option '%s' is not a %s format", VAR_1, VAR_5);

        return AVERROR(EINVAL);

    }



#if LIBAVUTIL_VERSION_MAJOR < 54

    if (VAR_11->version && VAR_11->version < AV_VERSION_INT(52, 11, 100)) {

        VAR_9 = -1;

        VAR_10 = VAR_6-1;

    } else

#endif

    {

        VAR_9 = FFMIN(VAR_8->VAR_9, -1);

        VAR_10 = FFMAX(VAR_8->VAR_10, VAR_6-1);

    }

    if (VAR_2 < VAR_9 || VAR_2 > VAR_10) {

        av_log(VAR_0, AV_LOG_ERROR,

               "Value %d for parameter '%s' out of %s format range [%d - %d]\n",

               VAR_2, VAR_1, VAR_5, VAR_9, VAR_10);

        return AVERROR(ERANGE);

    }

    *(int *)(((uint8_t *)VAR_7) + VAR_8->offset) = VAR_2;

    return 0;

}

static int FUNC_0(void *VAR_0, const char *VAR_1, int VAR_2, int VAR_3,
enum AVOptionType VAR_4, const char *VAR_5, int VAR_6)
{ void *VAR_7; const AVOption *VAR_8 = av_opt_find2(VAR_0, VAR_1, NULL, 0,
VAR_3, &VAR_7); int VAR_9, VAR_10; const AVClass *VAR_11 = *(AVClass **)VAR_0; if (!VAR_8 || !VAR_7)
return AVERROR_OPTION_NOT_FOUND; if (VAR_8->VAR_4 != VAR_4) { av_log(VAR_0, AV_LOG_ERROR,
"The value set by option '%s' is not a %s format", VAR_1, VAR_5); return AVERROR(EINVAL); } #if LIBAVUTIL_VERSION_MAJOR < 54
if (VAR_11->version && VAR_11->version < AV_VERSION_INT(52, 11, 100)) { VAR_9 = -1; VAR_10 = VAR_6-1; } else #endif
{ VAR_9 = FFMIN(VAR_8->VAR_9, -1); VAR_10 = FFMAX(VAR_8->VAR_10, VAR_6-1); } if (VAR_2 < VAR_9 || VAR_2 > VAR_10) { av_log(VAR_0, AV_LOG_ERROR,
"Value %d for parameter '%s' out of %s format range [%d - %d]\n",
VAR_2, VAR_1, VAR_5, VAR_9, VAR_10); return AVERROR(ERANGE); } *(int *)(((uint8_t *)VAR_7) + VAR_8->offset) = VAR_2; return 0; }