static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int flags)

{

    uint8_t *buf1;

    RMMuxContext *rm = s->priv_data;

    AVIOContext *pb = s->pb;

    StreamInfo *stream = rm->audio_stream;

    int i;



    /* XXX: suppress this malloc */

    buf1 = av_malloc(size * sizeof(uint8_t));





    write_packet_header(s, stream, size, !!(flags & AV_PKT_FLAG_KEY));



    if (stream->enc->codec_id == AV_CODEC_ID_AC3) {

        /* for AC-3, the words seem to be reversed */

        for(i=0;i<size;i+=2) {

            buf1[i] = buf[i+1];

            buf1[i+1] = buf[i];

        }

        avio_write(pb, buf1, size);

    } else {

        avio_write(pb, buf, size);

    }

    stream->nb_frames++;

    av_free(buf1);

    return 0;

}
static int rm_write_audio(AVFormatContext *s, const uint8_t *buf, int size, int flags)

{

    uint8_t *buf1;

    RMMuxContext *rm = s->priv_data;

    AVIOContext *pb = s->pb;

    StreamInfo *stream = rm->audio_stream;

    int i;



    

    buf1 = av_malloc(size * sizeof(uint8_t));





    write_packet_header(s, stream, size, !!(flags & AV_PKT_FLAG_KEY));



    if (stream->enc->codec_id == AV_CODEC_ID_AC3) {

        

        for(i=0;i<size;i+=2) {

            buf1[i] = buf[i+1];

            buf1[i+1] = buf[i];

        }

        avio_write(pb, buf1, size);

    } else {

        avio_write(pb, buf, size);

    }

    stream->nb_frames++;

    av_free(buf1);

    return 0;

}
static int FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3)

{

    uint8_t *buf1;

    RMMuxContext *rm = VAR_0->priv_data;

    AVIOContext *pb = VAR_0->pb;

    StreamInfo *stream = rm->audio_stream;

    int VAR_4;



    

    buf1 = av_malloc(VAR_2 * sizeof(uint8_t));





    write_packet_header(VAR_0, stream, VAR_2, !!(VAR_3 & AV_PKT_FLAG_KEY));



    if (stream->enc->codec_id == AV_CODEC_ID_AC3) {

        

        for(VAR_4=0;VAR_4<VAR_2;VAR_4+=2) {

            buf1[VAR_4] = VAR_1[VAR_4+1];

            buf1[VAR_4+1] = VAR_1[VAR_4];

        }

        avio_write(pb, buf1, VAR_2);

    } else {

        avio_write(pb, VAR_1, VAR_2);

    }

    stream->nb_frames++;

    av_free(buf1);

    return 0;

}
static int FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1, int VAR_2, int VAR_3)
{ uint8_t *buf1; RMMuxContext *rm = VAR_0->priv_data; AVIOContext *pb = VAR_0->pb; StreamInfo *stream = rm->audio_stream; int VAR_4; buf1 = av_malloc(VAR_2 * sizeof(uint8_t)); write_packet_header(VAR_0, stream, VAR_2, !!(VAR_3 & AV_PKT_FLAG_KEY)); if (stream->enc->codec_id == AV_CODEC_ID_AC3) { for(VAR_4=0;VAR_4<VAR_2;VAR_4+=2) { buf1[VAR_4] = VAR_1[VAR_4+1]; buf1[VAR_4+1] = VAR_1[VAR_4]; } avio_write(pb, buf1, VAR_2); } else { avio_write(pb, VAR_1, VAR_2); } stream->nb_frames++; av_free(buf1); return 0; }