static int encode_init(AVCodecContext * avctx){

    WMACodecContext *s = avctx->priv_data;

    int i, flags1, flags2;

    uint8_t *extradata;



    s->avctx = avctx;



    if(avctx->channels > MAX_CHANNELS) {

        av_log(avctx, AV_LOG_ERROR, "too many channels: got %i, need %i or fewer",

               avctx->channels, MAX_CHANNELS);

        return AVERROR(EINVAL);

    }



    if(avctx->bit_rate < 24*1000) {

        av_log(avctx, AV_LOG_ERROR, "bitrate too low: got %i, need 24000 or higher\n",

               avctx->bit_rate);

        return AVERROR(EINVAL);

    }



    /* extract flag infos */

    flags1 = 0;

    flags2 = 1;

    if (avctx->codec->id == CODEC_ID_WMAV1) {

        extradata= av_malloc(4);

        avctx->extradata_size= 4;

        AV_WL16(extradata, flags1);

        AV_WL16(extradata+2, flags2);

    } else if (avctx->codec->id == CODEC_ID_WMAV2) {

        extradata= av_mallocz(10);

        avctx->extradata_size= 10;

        AV_WL32(extradata, flags1);

        AV_WL16(extradata+4, flags2);

    }else

        assert(0);

    avctx->extradata= extradata;

    s->use_exp_vlc = flags2 & 0x0001;

    s->use_bit_reservoir = flags2 & 0x0002;

    s->use_variable_block_len = flags2 & 0x0004;



    ff_wma_init(avctx, flags2);



    /* init MDCT */

    for(i = 0; i < s->nb_block_sizes; i++)

        ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0);



    avctx->block_align=

    s->block_align= avctx->bit_rate*(int64_t)s->frame_len / (avctx->sample_rate*8);

//av_log(NULL, AV_LOG_ERROR, "%d %d %d %d\n", s->block_align, avctx->bit_rate, s->frame_len, avctx->sample_rate);

    avctx->frame_size= s->frame_len;



    return 0;

}

static int encode_init(AVCodecContext * avctx){

    WMACodecContext *s = avctx->priv_data;

    int i, flags1, flags2;

    uint8_t *extradata;



    s->avctx = avctx;



    if(avctx->channels > MAX_CHANNELS) {

        av_log(avctx, AV_LOG_ERROR, "too many channels: got %i, need %i or fewer",

               avctx->channels, MAX_CHANNELS);

        return AVERROR(EINVAL);

    }



    if(avctx->bit_rate < 24*1000) {

        av_log(avctx, AV_LOG_ERROR, "bitrate too low: got %i, need 24000 or higher\n",

               avctx->bit_rate);

        return AVERROR(EINVAL);

    }



    

    flags1 = 0;

    flags2 = 1;

    if (avctx->codec->id == CODEC_ID_WMAV1) {

        extradata= av_malloc(4);

        avctx->extradata_size= 4;

        AV_WL16(extradata, flags1);

        AV_WL16(extradata+2, flags2);

    } else if (avctx->codec->id == CODEC_ID_WMAV2) {

        extradata= av_mallocz(10);

        avctx->extradata_size= 10;

        AV_WL32(extradata, flags1);

        AV_WL16(extradata+4, flags2);

    }else

        assert(0);

    avctx->extradata= extradata;

    s->use_exp_vlc = flags2 & 0x0001;

    s->use_bit_reservoir = flags2 & 0x0002;

    s->use_variable_block_len = flags2 & 0x0004;



    ff_wma_init(avctx, flags2);



    

    for(i = 0; i < s->nb_block_sizes; i++)

        ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0);



    avctx->block_align=

    s->block_align= avctx->bit_rate*(int64_t)s->frame_len / (avctx->sample_rate*8);



    avctx->frame_size= s->frame_len;



    return 0;

}

    avctx->block_align=     s->block_align= avctx->bit_rate*(int64_t)s->frame_len / (avctx->sample_rate*8);
static int FUNC_0(AVCodecContext * VAR_0){

    WMACodecContext *s = VAR_0->priv_data;

    int VAR_1, VAR_2, VAR_3;

    uint8_t *extradata;



    s->VAR_0 = VAR_0;



    if(VAR_0->channels > MAX_CHANNELS) {

        av_log(VAR_0, AV_LOG_ERROR, "too many channels: got %VAR_1, need %VAR_1 or fewer",

               VAR_0->channels, MAX_CHANNELS);

        return AVERROR(EINVAL);

    }



    if(VAR_0->bit_rate < 24*1000) {

        av_log(VAR_0, AV_LOG_ERROR, "bitrate too low: got %VAR_1, need 24000 or higher\n",

               VAR_0->bit_rate);

        return AVERROR(EINVAL);

    }



    

    VAR_2 = 0;

    VAR_3 = 1;

    if (VAR_0->codec->id == CODEC_ID_WMAV1) {

        extradata= av_malloc(4);

        VAR_0->extradata_size= 4;

        AV_WL16(extradata, VAR_2);

        AV_WL16(extradata+2, VAR_3);

    } else if (VAR_0->codec->id == CODEC_ID_WMAV2) {

        extradata= av_mallocz(10);

        VAR_0->extradata_size= 10;

        AV_WL32(extradata, VAR_2);

        AV_WL16(extradata+4, VAR_3);

    }else

        assert(0);

    VAR_0->extradata= extradata;

    s->use_exp_vlc = VAR_3 & 0x0001;

    s->use_bit_reservoir = VAR_3 & 0x0002;

    s->use_variable_block_len = VAR_3 & 0x0004;



    ff_wma_init(VAR_0, VAR_3);



    

    for(VAR_1 = 0; VAR_1 < s->nb_block_sizes; VAR_1++)

        ff_mdct_init(&s->mdct_ctx[VAR_1], s->frame_len_bits - VAR_1 + 1, 0, 1.0);



    VAR_0->block_align=

    s->block_align= VAR_0->bit_rate*(int64_t)s->frame_len / (VAR_0->sample_rate*8);



    VAR_0->frame_size= s->frame_len;



    return 0;

}

static int FUNC_0(AVCodecContext * VAR_0){ WMACodecContext *s = VAR_0->priv_data; int VAR_1, VAR_2, VAR_3; uint8_t *extradata; s->VAR_0 = VAR_0; if(VAR_0->channels > MAX_CHANNELS) { av_log(VAR_0, AV_LOG_ERROR, "too many channels: got %VAR_1, need %VAR_1 or fewer",
VAR_0->channels, MAX_CHANNELS); return AVERROR(EINVAL); } if(VAR_0->bit_rate < 24*1000) { av_log(VAR_0, AV_LOG_ERROR, "bitrate too low: got %VAR_1, need 24000 or higher\n",
VAR_0->bit_rate); return AVERROR(EINVAL); } VAR_2 = 0; VAR_3 = 1; if (VAR_0->codec->id == CODEC_ID_WMAV1) { extradata= av_malloc(4); VAR_0->extradata_size= 4; AV_WL16(extradata, VAR_2); AV_WL16(extradata+2, VAR_3); } else if (VAR_0->codec->id == CODEC_ID_WMAV2) { extradata= av_mallocz(10); VAR_0->extradata_size= 10; AV_WL32(extradata, VAR_2); AV_WL16(extradata+4, VAR_3); }else assert(0); VAR_0->extradata= extradata; s->use_exp_vlc = VAR_3 & 0x0001; s->use_bit_reservoir = VAR_3 & 0x0002; s->use_variable_block_len = VAR_3 & 0x0004; ff_wma_init(VAR_0, VAR_3); for(VAR_1 = 0; VAR_1 < s->nb_block_sizes; VAR_1++) ff_mdct_init(&s->mdct_ctx[VAR_1], s->frame_len_bits - VAR_1 + 1, 0, 1.0); VAR_0->block_align=
s->block_align= VAR_0->bit_rate*(int64_t)s->frame_len / (VAR_0->sample_rate*8); VAR_0->frame_size= s->frame_len; return 0; }