static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)

{

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

        av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range\n",

               num*intnum/den, o->name);

        return AVERROR(ERANGE);

    }



    switch (o->type) {

    case AV_OPT_TYPE_FLAGS:

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

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

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

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

    case AV_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 write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)

{

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

        av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range\n",

               num*intnum/den, o->name);

        return AVERROR(ERANGE);

    }



    switch (o->type) {

    case AV_OPT_TYPE_FLAGS:

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

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

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

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

    case AV_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 AVOption *VAR_1, void *VAR_2, double VAR_3, int VAR_4, int64_t VAR_5)

{

    if (VAR_1->max*VAR_4 < VAR_3*VAR_5 || VAR_1->min*VAR_4 > VAR_3*VAR_5) {

        av_log(VAR_0, AV_LOG_ERROR, "Value %f for parameter '%s' out of range\n",

               VAR_3*VAR_5/VAR_4, VAR_1->name);

        return AVERROR(ERANGE);

    }



    switch (VAR_1->type) {

    case AV_OPT_TYPE_FLAGS:

    case AV_OPT_TYPE_INT:   *(int       *)VAR_2= llrint(VAR_3/VAR_4)*VAR_5; break;

    case AV_OPT_TYPE_INT64: *(int64_t   *)VAR_2= llrint(VAR_3/VAR_4)*VAR_5; break;

    case AV_OPT_TYPE_FLOAT: *(float     *)VAR_2= VAR_3*VAR_5/VAR_4;         break;

    case AV_OPT_TYPE_DOUBLE:*(double    *)VAR_2= VAR_3*VAR_5/VAR_4;         break;

    case AV_OPT_TYPE_RATIONAL:

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

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

        break;

    default:

        return AVERROR(EINVAL);

    }

    return 0;

}

static int FUNC_0(void *VAR_0, const AVOption *VAR_1, void *VAR_2, double VAR_3, int VAR_4, int64_t VAR_5)
{ if (VAR_1->max*VAR_4 < VAR_3*VAR_5 || VAR_1->min*VAR_4 > VAR_3*VAR_5) { av_log(VAR_0, AV_LOG_ERROR, "Value %f for parameter '%s' out of range\n",
VAR_3*VAR_5/VAR_4, VAR_1->name); return AVERROR(ERANGE); } switch (VAR_1->type) { case AV_OPT_TYPE_FLAGS:
case AV_OPT_TYPE_INT:   *(int       *)VAR_2= llrint(VAR_3/VAR_4)*VAR_5; break; case AV_OPT_TYPE_INT64: *(int64_t   *)VAR_2= llrint(VAR_3/VAR_4)*VAR_5; break; case AV_OPT_TYPE_FLOAT: *(float     *)VAR_2= VAR_3*VAR_5/VAR_4;         break; case AV_OPT_TYPE_DOUBLE:*(double    *)VAR_2= VAR_3*VAR_5/VAR_4;         break; case AV_OPT_TYPE_RATIONAL:
if ((int)VAR_3 == VAR_3) *(AVRational*)VAR_2= (AVRational){VAR_3*VAR_5, VAR_4}; else                 *(AVRational*)VAR_2= av_d2q(VAR_3*VAR_5/VAR_4, 1<<24); break; default:
return AVERROR(EINVAL); } return 0; }