static int av_set_number2(void *obj, const char *name, double num, int den, int64_t intnum, const AVOption **o_out)

{

    const AVOption *o = av_opt_find(obj, name, NULL, 0, 0);

    void *dst;

    if (o_out)

        *o_out= o;

    if (!o || o->offset<=0)

        return AVERROR_OPTION_NOT_FOUND;



    if (o->max*den < num*intnum || o->min*den > num*intnum) {

        av_log(obj, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name);

        return AVERROR(ERANGE);

    }



    dst= ((uint8_t*)obj) + o->offset;



    switch (o->type) {

    case FF_OPT_TYPE_FLAGS:

    case FF_OPT_TYPE_INT:   *(int       *)dst= llrint(num/den)*intnum; break;

    case FF_OPT_TYPE_INT64: *(int64_t   *)dst= llrint(num/den)*intnum; break;

    case FF_OPT_TYPE_FLOAT: *(float     *)dst= num*intnum/den;         break;

    case FF_OPT_TYPE_DOUBLE:*(double    *)dst= num*intnum/den;         break;

    case FF_OPT_TYPE_RATIONAL:

        if ((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den};

        else                 *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24);

        break;

    default:

        return AVERROR(EINVAL);

    }

    return 0;

}

static int av_set_number2(void *obj, const char *name, double num, int den, int64_t intnum, const AVOption **o_out)

{

    const AVOption *o = av_opt_find(obj, name, NULL, 0, 0);

    void *dst;

    if (o_out)

        *o_out= o;

    if (!o || o->offset<=0)

        return AVERROR_OPTION_NOT_FOUND;



    if (o->max*den < num*intnum || o->min*den > num*intnum) {

        av_log(obj, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name);

        return AVERROR(ERANGE);

    }



    dst= ((uint8_t*)obj) + o->offset;



    switch (o->type) {

    case FF_OPT_TYPE_FLAGS:

    case FF_OPT_TYPE_INT:   *(int       *)dst= llrint(num/den)*intnum; break;

    case FF_OPT_TYPE_INT64: *(int64_t   *)dst= llrint(num/den)*intnum; break;

    case FF_OPT_TYPE_FLOAT: *(float     *)dst= num*intnum/den;         break;

    case FF_OPT_TYPE_DOUBLE:*(double    *)dst= num*intnum/den;         break;

    case FF_OPT_TYPE_RATIONAL:

        if ((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den};

        else                 *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24);

        break;

    default:

        return AVERROR(EINVAL);

    }

    return 0;

}

static int FUNC_0(void *VAR_0, const char *VAR_1, double VAR_2, int VAR_3, int64_t VAR_4, const AVOption **VAR_5)

{

    const AVOption *VAR_6 = av_opt_find(VAR_0, VAR_1, NULL, 0, 0);

    void *VAR_7;

    if (VAR_5)

        *VAR_5= VAR_6;

    if (!VAR_6 || VAR_6->offset<=0)

        return AVERROR_OPTION_NOT_FOUND;



    if (VAR_6->max*VAR_3 < VAR_2*VAR_4 || VAR_6->min*VAR_3 > VAR_2*VAR_4) {

        av_log(VAR_0, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", VAR_2, VAR_1);

        return AVERROR(ERANGE);

    }



    VAR_7= ((uint8_t*)VAR_0) + VAR_6->offset;



    switch (VAR_6->type) {

    case FF_OPT_TYPE_FLAGS:

    case FF_OPT_TYPE_INT:   *(int       *)VAR_7= llrint(VAR_2/VAR_3)*VAR_4; break;

    case FF_OPT_TYPE_INT64: *(int64_t   *)VAR_7= llrint(VAR_2/VAR_3)*VAR_4; break;

    case FF_OPT_TYPE_FLOAT: *(float     *)VAR_7= VAR_2*VAR_4/VAR_3;         break;

    case FF_OPT_TYPE_DOUBLE:*(double    *)VAR_7= VAR_2*VAR_4/VAR_3;         break;

    case FF_OPT_TYPE_RATIONAL:

        if ((int)VAR_2 == VAR_2) *(AVRational*)VAR_7= (AVRational){VAR_2*VAR_4, VAR_3};

        else                 *(AVRational*)VAR_7= av_d2q(VAR_2*VAR_4/VAR_3, 1<<24);

        break;

    default:

        return AVERROR(EINVAL);

    }

    return 0;

}

static int FUNC_0(void *VAR_0, const char *VAR_1, double VAR_2, int VAR_3, int64_t VAR_4, const AVOption **VAR_5)
{ const AVOption *VAR_6 = av_opt_find(VAR_0, VAR_1, NULL, 0, 0); void *VAR_7; if (VAR_5)
*VAR_5= VAR_6; if (!VAR_6 || VAR_6->offset<=0)
return AVERROR_OPTION_NOT_FOUND; if (VAR_6->max*VAR_3 < VAR_2*VAR_4 || VAR_6->min*VAR_3 > VAR_2*VAR_4) { av_log(VAR_0, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", VAR_2, VAR_1); return AVERROR(ERANGE); } VAR_7= ((uint8_t*)VAR_0) + VAR_6->offset; switch (VAR_6->type) { case FF_OPT_TYPE_FLAGS:
case FF_OPT_TYPE_INT:   *(int       *)VAR_7= llrint(VAR_2/VAR_3)*VAR_4; break; case FF_OPT_TYPE_INT64: *(int64_t   *)VAR_7= llrint(VAR_2/VAR_3)*VAR_4; break; case FF_OPT_TYPE_FLOAT: *(float     *)VAR_7= VAR_2*VAR_4/VAR_3;         break; case FF_OPT_TYPE_DOUBLE:*(double    *)VAR_7= VAR_2*VAR_4/VAR_3;         break; case FF_OPT_TYPE_RATIONAL:
if ((int)VAR_2 == VAR_2) *(AVRational*)VAR_7= (AVRational){VAR_2*VAR_4, VAR_3}; else                 *(AVRational*)VAR_7= av_d2q(VAR_2*VAR_4/VAR_3, 1<<24); break; default:
return AVERROR(EINVAL); } return 0; }