if (audio_qscale > QSCALE_NONE) { audio_enc->flags |= CODEC_FLAG_QSCALE; audio_enc->global_quality = st->quality = FF_QP2LAMBDA * audio_qscale; }
static void new_audio_stream(AVFormatContext *oc){    AVStream *st;    AVCodecContext *audio_enc;    int codec_id;                st = av_new_stream(oc, oc->nb_streams);    if (!st) {        fprintf(stderr, "Could not alloc stream\n");        exit(1);    }#if defined(HAVE_THREADS)    if(thread_count>1)        avcodec_thread_init(st->codec, thread_count);#endif        audio_enc = st->codec;    audio_enc->codec_type = CODEC_TYPE_AUDIO;        if(audio_codec_tag)        audio_enc->codec_tag= audio_codec_tag;        if (oc->oformat->flags & AVFMT_GLOBALHEADER)         audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;    if (audio_stream_copy) {        st->stream_copy = 1;        audio_enc->channels = audio_channels;    } else {        codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_AUDIO);        if (audio_codec_id != CODEC_ID_NONE)            codec_id = audio_codec_id;        audio_enc->codec_id = codec_id;                audio_enc->bit_rate = audio_bit_rate;        audio_enc->strict_std_compliance = strict;        audio_enc->thread_count = thread_count;        /* For audio codecs other than AC3 or DTS we limit */        /* the number of coded channels to stereo   */        if (audio_channels > 2 && codec_id != CODEC_ID_AC3            && codec_id != CODEC_ID_DTS) {            audio_enc->channels = 2;        } else            audio_enc->channels = audio_channels;    }    audio_enc->sample_rate = audio_sample_rate;    if (audio_language) {        pstrcpy(st->language, sizeof(st->language), audio_language);        av_free(audio_language);        audio_language = NULL;    }    /* reset some key parameters */    audio_disable = 0;    audio_codec_id = CODEC_ID_NONE;    audio_stream_copy = 0;}