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

{

    uint8_t *buf1;

    RMContext *rm = s->priv_data;

    ByteIOContext *pb = &s->pb;

    StreamInfo *stream = rm->audio_stream;

    int i;



    /* XXX: suppress this malloc */

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

    

    write_packet_header(s, stream, size, stream->enc->coded_frame->key_frame);

    

    /* for AC3, the words seems to be reversed */

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

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

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

    }

    put_buffer(pb, buf1, size);

    put_flush_packet(pb);

    stream->nb_frames++;

    av_free(buf1);

    return 0;

}

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

{

    uint8_t *buf1;

    RMContext *rm = s->priv_data;

    ByteIOContext *pb = &s->pb;

    StreamInfo *stream = rm->audio_stream;

    int i;



    

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

    

    write_packet_header(s, stream, size, stream->enc->coded_frame->key_frame);

    

    

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

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

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

    }

    put_buffer(pb, buf1, size);

    put_flush_packet(pb);

    stream->nb_frames++;

    av_free(buf1);

    return 0;

}

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

{

    uint8_t *buf1;

    RMContext *rm = VAR_0->priv_data;

    ByteIOContext *pb = &VAR_0->pb;

    StreamInfo *stream = rm->audio_stream;

    int VAR_3;



    

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

    

    write_packet_header(VAR_0, stream, VAR_2, stream->enc->coded_frame->key_frame);

    

    

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

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

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

    }

    put_buffer(pb, buf1, VAR_2);

    put_flush_packet(pb);

    stream->nb_frames++;

    av_free(buf1);

    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, const uint8_t *VAR_1, int VAR_2)
{ uint8_t *buf1; RMContext *rm = VAR_0->priv_data; ByteIOContext *pb = &VAR_0->pb; StreamInfo *stream = rm->audio_stream; int VAR_3; buf1= (uint8_t*) av_malloc( VAR_2 * sizeof(uint8_t) ); write_packet_header(VAR_0, stream, VAR_2, stream->enc->coded_frame->key_frame); for(VAR_3=0;VAR_3<VAR_2;VAR_3+=2) { buf1[VAR_3] = VAR_1[VAR_3+1]; buf1[VAR_3+1] = VAR_1[VAR_3]; } put_buffer(pb, buf1, VAR_2); put_flush_packet(pb); stream->nb_frames++; av_free(buf1); return 0; }