static av_cold int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext)

{

    OggVorbisContext *context = avccontext->priv_data;

    double cfreq;



    if (avccontext->flags & CODEC_FLAG_QSCALE) {

        /* variable bitrate */

        if (vorbis_encode_setup_vbr(vi, avccontext->channels,

                                    avccontext->sample_rate,

                                    avccontext->global_quality / (float)FF_QP2LAMBDA / 10.0))

            return -1;

    } else {

        int minrate = avccontext->rc_min_rate > 0 ? avccontext->rc_min_rate : -1;

        int maxrate = avccontext->rc_min_rate > 0 ? avccontext->rc_max_rate : -1;



        /* constant bitrate */

        if (vorbis_encode_setup_managed(vi, avccontext->channels,

                                        avccontext->sample_rate, minrate,

                                        avccontext->bit_rate, maxrate))

            return -1;



        /* variable bitrate by estimate, disable slow rate management */

        if (minrate == -1 && maxrate == -1)

            if (vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_SET, NULL))

                return -1;

    }



    /* cutoff frequency */

    if (avccontext->cutoff > 0) {

        cfreq = avccontext->cutoff / 1000.0;

        if (vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_SET, &cfreq))

            return -1;

    }



    if (context->iblock) {

        vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &context->iblock);

    }



    return vorbis_encode_setup_init(vi);

}

static av_cold int oggvorbis_init_encoder(vorbis_info *vi, AVCodecContext *avccontext)

{

    OggVorbisContext *context = avccontext->priv_data;

    double cfreq;



    if (avccontext->flags & CODEC_FLAG_QSCALE) {

        

        if (vorbis_encode_setup_vbr(vi, avccontext->channels,

                                    avccontext->sample_rate,

                                    avccontext->global_quality / (float)FF_QP2LAMBDA / 10.0))

            return -1;

    } else {

        int minrate = avccontext->rc_min_rate > 0 ? avccontext->rc_min_rate : -1;

        int maxrate = avccontext->rc_min_rate > 0 ? avccontext->rc_max_rate : -1;



        

        if (vorbis_encode_setup_managed(vi, avccontext->channels,

                                        avccontext->sample_rate, minrate,

                                        avccontext->bit_rate, maxrate))

            return -1;



        

        if (minrate == -1 && maxrate == -1)

            if (vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_SET, NULL))

                return -1;

    }



    

    if (avccontext->cutoff > 0) {

        cfreq = avccontext->cutoff / 1000.0;

        if (vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_SET, &cfreq))

            return -1;

    }



    if (context->iblock) {

        vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &context->iblock);

    }



    return vorbis_encode_setup_init(vi);

}

static av_cold int FUNC_0(vorbis_info *vi, AVCodecContext *avccontext)

{

    OggVorbisContext *context = avccontext->priv_data;

    double VAR_0;



    if (avccontext->flags & CODEC_FLAG_QSCALE) {

        

        if (vorbis_encode_setup_vbr(vi, avccontext->channels,

                                    avccontext->sample_rate,

                                    avccontext->global_quality / (float)FF_QP2LAMBDA / 10.0))

            return -1;

    } else {

        int VAR_1 = avccontext->rc_min_rate > 0 ? avccontext->rc_min_rate : -1;

        int VAR_2 = avccontext->rc_min_rate > 0 ? avccontext->rc_max_rate : -1;



        

        if (vorbis_encode_setup_managed(vi, avccontext->channels,

                                        avccontext->sample_rate, VAR_1,

                                        avccontext->bit_rate, VAR_2))

            return -1;



        

        if (VAR_1 == -1 && VAR_2 == -1)

            if (vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_SET, NULL))

                return -1;

    }



    

    if (avccontext->cutoff > 0) {

        VAR_0 = avccontext->cutoff / 1000.0;

        if (vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_SET, &VAR_0))

            return -1;

    }



    if (context->iblock) {

        vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &context->iblock);

    }



    return vorbis_encode_setup_init(vi);

}

static av_cold int FUNC_0(vorbis_info *vi, AVCodecContext *avccontext)
{ OggVorbisContext *context = avccontext->priv_data; double VAR_0; if (avccontext->flags & CODEC_FLAG_QSCALE) { if (vorbis_encode_setup_vbr(vi, avccontext->channels,
avccontext->sample_rate,
avccontext->global_quality / (float)FF_QP2LAMBDA / 10.0))
return -1; } else { int VAR_1 = avccontext->rc_min_rate > 0 ? avccontext->rc_min_rate : -1; int VAR_2 = avccontext->rc_min_rate > 0 ? avccontext->rc_max_rate : -1; if (vorbis_encode_setup_managed(vi, avccontext->channels,
avccontext->sample_rate, VAR_1,
avccontext->bit_rate, VAR_2))
return -1; if (VAR_1 == -1 && VAR_2 == -1)
if (vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_SET, NULL))
return -1; } if (avccontext->cutoff > 0) { VAR_0 = avccontext->cutoff / 1000.0; if (vorbis_encode_ctl(vi, OV_ECTL_LOWPASS_SET, &VAR_0))
return -1; } if (context->iblock) { vorbis_encode_ctl(vi, OV_ECTL_IBLOCK_SET, &context->iblock); } return vorbis_encode_setup_init(vi); }