static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)

{

    int pos = url_ftell(pb);

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



    if(track->enc->codec_id == CODEC_ID_PCM_MULAW)

      put_tag(pb, "ulaw");

    else if(track->enc->codec_id == CODEC_ID_PCM_ALAW)

      put_tag(pb, "alaw");

    else if(track->enc->codec_id == CODEC_ID_ADPCM_IMA_QT)

      put_tag(pb, "ima4");

    else if(track->enc->codec_id == CODEC_ID_MACE3)

      put_tag(pb, "MAC3");

    else if(track->enc->codec_id == CODEC_ID_MACE6)

      put_tag(pb, "MAC6");

    else if(track->enc->codec_id == CODEC_ID_AAC)

      put_tag(pb, "mp4a");

    else if(track->enc->codec_id == CODEC_ID_AMR_NB)

      put_tag(pb, "samr");

    else

      put_tag(pb, "    ");



    put_be32(pb, 0); /* Reserved */

    put_be16(pb, 0); /* Reserved */

    put_be16(pb, 1); /* Data-reference index, XXX  == 1 */

    /* SoundDescription */

    put_be16(pb, 0); /* Version */

    put_be16(pb, 0); /* Revision level */

    put_be32(pb, 0); /* Reserved */



    put_be16(pb, track->enc->channels); /* Number of channels */

    /* TODO: Currently hard-coded to 16-bit, there doesn't seem

                 to be a good way to get number of bits of audio */

    put_be16(pb, 0x10); /* Reserved */

    put_be16(pb, 0); /* compression ID (= 0) */

    put_be16(pb, 0); /* packet size (= 0) */

    put_be16(pb, track->timescale); /* Time scale */

    put_be16(pb, 0); /* Reserved */



    if(track->enc->codec_id == CODEC_ID_AAC)

        mov_write_esds_tag(pb, track);

    if(track->enc->codec_id == CODEC_ID_AMR_NB)

        mov_write_damr_tag(pb);

    return updateSize (pb, pos);

}

static int mov_write_audio_tag(ByteIOContext *pb, MOVTrack* track)

{

    int pos = url_ftell(pb);

    put_be32(pb, 0); 



    if(track->enc->codec_id == CODEC_ID_PCM_MULAW)

      put_tag(pb, "ulaw");

    else if(track->enc->codec_id == CODEC_ID_PCM_ALAW)

      put_tag(pb, "alaw");

    else if(track->enc->codec_id == CODEC_ID_ADPCM_IMA_QT)

      put_tag(pb, "ima4");

    else if(track->enc->codec_id == CODEC_ID_MACE3)

      put_tag(pb, "MAC3");

    else if(track->enc->codec_id == CODEC_ID_MACE6)

      put_tag(pb, "MAC6");

    else if(track->enc->codec_id == CODEC_ID_AAC)

      put_tag(pb, "mp4a");

    else if(track->enc->codec_id == CODEC_ID_AMR_NB)

      put_tag(pb, "samr");

    else

      put_tag(pb, "    ");



    put_be32(pb, 0); 

    put_be16(pb, 0); 

    put_be16(pb, 1); 

    

    put_be16(pb, 0); 

    put_be16(pb, 0); 

    put_be32(pb, 0); 



    put_be16(pb, track->enc->channels); 

    



    put_be16(pb, 0x10); 

    put_be16(pb, 0); 

    put_be16(pb, 0); 

    put_be16(pb, track->timescale); 

    put_be16(pb, 0); 



    if(track->enc->codec_id == CODEC_ID_AAC)

        mov_write_esds_tag(pb, track);

    if(track->enc->codec_id == CODEC_ID_AMR_NB)

        mov_write_damr_tag(pb);

    return updateSize (pb, pos);

}

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

{

    int VAR_2 = url_ftell(VAR_0);

    put_be32(VAR_0, 0); 



    if(VAR_1->enc->codec_id == CODEC_ID_PCM_MULAW)

      put_tag(VAR_0, "ulaw");

    else if(VAR_1->enc->codec_id == CODEC_ID_PCM_ALAW)

      put_tag(VAR_0, "alaw");

    else if(VAR_1->enc->codec_id == CODEC_ID_ADPCM_IMA_QT)

      put_tag(VAR_0, "ima4");

    else if(VAR_1->enc->codec_id == CODEC_ID_MACE3)

      put_tag(VAR_0, "MAC3");

    else if(VAR_1->enc->codec_id == CODEC_ID_MACE6)

      put_tag(VAR_0, "MAC6");

    else if(VAR_1->enc->codec_id == CODEC_ID_AAC)

      put_tag(VAR_0, "mp4a");

    else if(VAR_1->enc->codec_id == CODEC_ID_AMR_NB)

      put_tag(VAR_0, "samr");

    else

      put_tag(VAR_0, "    ");



    put_be32(VAR_0, 0); 

    put_be16(VAR_0, 0); 

    put_be16(VAR_0, 1); 

    

    put_be16(VAR_0, 0); 

    put_be16(VAR_0, 0); 

    put_be32(VAR_0, 0); 



    put_be16(VAR_0, VAR_1->enc->channels); 

    



    put_be16(VAR_0, 0x10); 

    put_be16(VAR_0, 0); 

    put_be16(VAR_0, 0); 

    put_be16(VAR_0, VAR_1->timescale); 

    put_be16(VAR_0, 0); 



    if(VAR_1->enc->codec_id == CODEC_ID_AAC)

        mov_write_esds_tag(VAR_0, VAR_1);

    if(VAR_1->enc->codec_id == CODEC_ID_AMR_NB)

        mov_write_damr_tag(VAR_0);

    return updateSize (VAR_0, VAR_2);

}

static int FUNC_0(ByteIOContext *VAR_0, MOVTrack* VAR_1)
{ int VAR_2 = url_ftell(VAR_0); put_be32(VAR_0, 0); if(VAR_1->enc->codec_id == CODEC_ID_PCM_MULAW)
put_tag(VAR_0, "ulaw"); else if(VAR_1->enc->codec_id == CODEC_ID_PCM_ALAW)
put_tag(VAR_0, "alaw"); else if(VAR_1->enc->codec_id == CODEC_ID_ADPCM_IMA_QT)
put_tag(VAR_0, "ima4"); else if(VAR_1->enc->codec_id == CODEC_ID_MACE3)
put_tag(VAR_0, "MAC3"); else if(VAR_1->enc->codec_id == CODEC_ID_MACE6)
put_tag(VAR_0, "MAC6"); else if(VAR_1->enc->codec_id == CODEC_ID_AAC)
put_tag(VAR_0, "mp4a"); else if(VAR_1->enc->codec_id == CODEC_ID_AMR_NB)
put_tag(VAR_0, "samr"); else
put_tag(VAR_0, "    "); put_be32(VAR_0, 0); put_be16(VAR_0, 0); put_be16(VAR_0, 1); put_be16(VAR_0, 0); put_be16(VAR_0, 0); put_be32(VAR_0, 0); put_be16(VAR_0, VAR_1->enc->channels); put_be16(VAR_0, 0x10); put_be16(VAR_0, 0); put_be16(VAR_0, 0); put_be16(VAR_0, VAR_1->timescale); put_be16(VAR_0, 0); if(VAR_1->enc->codec_id == CODEC_ID_AAC)
mov_write_esds_tag(VAR_0, VAR_1); if(VAR_1->enc->codec_id == CODEC_ID_AMR_NB)
mov_write_damr_tag(VAR_0); return updateSize (VAR_0, VAR_2); }