aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-04-20 22:24:15 +0200
committerMichael Niedermayer <michaelni@gmx.at>2015-04-20 22:24:38 +0200
commitd108820c2e205b49871443eda5758680ec4783fa (patch)
tree553d194a4ab1f422071ef0f79532151e1f180b37
parent3cd6f4546ad9334c2f4b234ad370225e4ae717b1 (diff)
parentd34039b171bebe37bf723a1b03e5651267099739 (diff)
downloadffmpeg-d108820c2e205b49871443eda5758680ec4783fa.tar.gz
Merge commit 'd34039b171bebe37bf723a1b03e5651267099739'
* commit 'd34039b171bebe37bf723a1b03e5651267099739': rmenc: Drop the temporary buffer for ac3 byteswap Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/rmenc.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c
index cd32f271f1..73d175d6e7 100644
--- a/libavformat/rmenc.c
+++ b/libavformat/rmenc.c
@@ -360,31 +360,23 @@ static int rm_write_header(AVFormatContext *s)
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));
- if (!buf1)
- return AVERROR(ENOMEM);
-
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];
+ for (i = 0; i < size; i += 2) {
+ avio_w8(pb, buf[i + 1]);
+ avio_w8(pb, buf[i]);
}
- avio_write(pb, buf1, size);
} else {
avio_write(pb, buf, size);
}
stream->nb_frames++;
- av_free(buf1);
return 0;
}