static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track)

{

    int64_t pos = avio_tell(pb);



    avio_wb32(pb, 0);     /* size */

    ffio_wfourcc(pb, "wave");



    if (track->enc->codec_id != AV_CODEC_ID_QDM2) {

    avio_wb32(pb, 12);    /* size */

    ffio_wfourcc(pb, "frma");

    avio_wl32(pb, track->tag);

    }



    if (track->enc->codec_id == AV_CODEC_ID_AAC) {

        /* useless atom needed by mplayer, ipod, not needed by quicktime */

        avio_wb32(pb, 12); /* size */

        ffio_wfourcc(pb, "mp4a");

        avio_wb32(pb, 0);

        mov_write_esds_tag(pb, track);

    } else if (mov_pcm_le_gt16(track->enc->codec_id)) {

        mov_write_enda_tag(pb);

    } else if (track->enc->codec_id == AV_CODEC_ID_AMR_NB) {

        mov_write_amr_tag(pb, track);

    } else if (track->enc->codec_id == AV_CODEC_ID_AC3) {

        mov_write_ac3_tag(pb, track);

    } else if (track->enc->codec_id == AV_CODEC_ID_ALAC ||

               track->enc->codec_id == AV_CODEC_ID_QDM2) {

        mov_write_extradata_tag(pb, track);

    } else if (track->enc->codec_id == AV_CODEC_ID_ADPCM_MS ||

               track->enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) {

        mov_write_ms_tag(pb, track);

    }



    avio_wb32(pb, 8);     /* size */

    avio_wb32(pb, 0);     /* null tag */



    return update_size(pb, pos);

}

static int mov_write_wave_tag(AVIOContext *pb, MOVTrack *track)

{

    int64_t pos = avio_tell(pb);



    avio_wb32(pb, 0);     

    ffio_wfourcc(pb, "wave");



    if (track->enc->codec_id != AV_CODEC_ID_QDM2) {

    avio_wb32(pb, 12);    

    ffio_wfourcc(pb, "frma");

    avio_wl32(pb, track->tag);

    }



    if (track->enc->codec_id == AV_CODEC_ID_AAC) {

        

        avio_wb32(pb, 12); 

        ffio_wfourcc(pb, "mp4a");

        avio_wb32(pb, 0);

        mov_write_esds_tag(pb, track);

    } else if (mov_pcm_le_gt16(track->enc->codec_id)) {

        mov_write_enda_tag(pb);

    } else if (track->enc->codec_id == AV_CODEC_ID_AMR_NB) {

        mov_write_amr_tag(pb, track);

    } else if (track->enc->codec_id == AV_CODEC_ID_AC3) {

        mov_write_ac3_tag(pb, track);

    } else if (track->enc->codec_id == AV_CODEC_ID_ALAC ||

               track->enc->codec_id == AV_CODEC_ID_QDM2) {

        mov_write_extradata_tag(pb, track);

    } else if (track->enc->codec_id == AV_CODEC_ID_ADPCM_MS ||

               track->enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) {

        mov_write_ms_tag(pb, track);

    }



    avio_wb32(pb, 8);     

    avio_wb32(pb, 0);     



    return update_size(pb, pos);

}

static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1)

{

    int64_t pos = avio_tell(VAR_0);



    avio_wb32(VAR_0, 0);     

    ffio_wfourcc(VAR_0, "wave");



    if (VAR_1->enc->codec_id != AV_CODEC_ID_QDM2) {

    avio_wb32(VAR_0, 12);    

    ffio_wfourcc(VAR_0, "frma");

    avio_wl32(VAR_0, VAR_1->tag);

    }



    if (VAR_1->enc->codec_id == AV_CODEC_ID_AAC) {

        

        avio_wb32(VAR_0, 12); 

        ffio_wfourcc(VAR_0, "mp4a");

        avio_wb32(VAR_0, 0);

        mov_write_esds_tag(VAR_0, VAR_1);

    } else if (mov_pcm_le_gt16(VAR_1->enc->codec_id)) {

        mov_write_enda_tag(VAR_0);

    } else if (VAR_1->enc->codec_id == AV_CODEC_ID_AMR_NB) {

        mov_write_amr_tag(VAR_0, VAR_1);

    } else if (VAR_1->enc->codec_id == AV_CODEC_ID_AC3) {

        mov_write_ac3_tag(VAR_0, VAR_1);

    } else if (VAR_1->enc->codec_id == AV_CODEC_ID_ALAC ||

               VAR_1->enc->codec_id == AV_CODEC_ID_QDM2) {

        mov_write_extradata_tag(VAR_0, VAR_1);

    } else if (VAR_1->enc->codec_id == AV_CODEC_ID_ADPCM_MS ||

               VAR_1->enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) {

        mov_write_ms_tag(VAR_0, VAR_1);

    }



    avio_wb32(VAR_0, 8);     

    avio_wb32(VAR_0, 0);     



    return update_size(VAR_0, pos);

}

static int FUNC_0(AVIOContext *VAR_0, MOVTrack *VAR_1)
{ int64_t pos = avio_tell(VAR_0); avio_wb32(VAR_0, 0); ffio_wfourcc(VAR_0, "wave"); if (VAR_1->enc->codec_id != AV_CODEC_ID_QDM2) { avio_wb32(VAR_0, 12); ffio_wfourcc(VAR_0, "frma"); avio_wl32(VAR_0, VAR_1->tag); } if (VAR_1->enc->codec_id == AV_CODEC_ID_AAC) { avio_wb32(VAR_0, 12); ffio_wfourcc(VAR_0, "mp4a"); avio_wb32(VAR_0, 0); mov_write_esds_tag(VAR_0, VAR_1); } else if (mov_pcm_le_gt16(VAR_1->enc->codec_id)) { mov_write_enda_tag(VAR_0); } else if (VAR_1->enc->codec_id == AV_CODEC_ID_AMR_NB) { mov_write_amr_tag(VAR_0, VAR_1); } else if (VAR_1->enc->codec_id == AV_CODEC_ID_AC3) { mov_write_ac3_tag(VAR_0, VAR_1); } else if (VAR_1->enc->codec_id == AV_CODEC_ID_ALAC || VAR_1->enc->codec_id == AV_CODEC_ID_QDM2) { mov_write_extradata_tag(VAR_0, VAR_1); } else if (VAR_1->enc->codec_id == AV_CODEC_ID_ADPCM_MS || VAR_1->enc->codec_id == AV_CODEC_ID_ADPCM_IMA_WAV) { mov_write_ms_tag(VAR_0, VAR_1); } avio_wb32(VAR_0, 8); avio_wb32(VAR_0, 0); return update_size(VAR_0, pos); }