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

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

{

    void *target_obj;

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

                                     search_flags, &target_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 (fmt < -1 || fmt > max) {

        av_log(obj, AV_LOG_ERROR,

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

               fmt, name, desc, 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 max)

{

    void *target_obj;

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

                                     search_flags, &target_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 (fmt < -1 || fmt > max) {

        av_log(obj, AV_LOG_ERROR,

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

               fmt, name, desc, 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);

    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 (VAR_2 < -1 || VAR_2 > VAR_6) {

        av_log(VAR_0, AV_LOG_ERROR,

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

               VAR_2, VAR_1, VAR_5, VAR_6);

        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); 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 (VAR_2 < -1 || VAR_2 > VAR_6) { av_log(VAR_0, AV_LOG_ERROR,
"Value %d for parameter '%s' out of %s format range [-1 - %d]\n",
VAR_2, VAR_1, VAR_5, VAR_6); return AVERROR(ERANGE); } *(int *)(((uint8_t *)VAR_7) + VAR_8->offset) = VAR_2; return 0; }