diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2007-11-08 15:52:53 +0000 |
---|---|---|
committer | Benoit Fouet <benoit.fouet@free.fr> | 2007-11-08 15:52:53 +0000 |
commit | 5c470b910e3b78e8a9b1aeb05ae4a40a3a3324a5 (patch) | |
tree | 49ef1887dd42fa75073785aaefd1a6e612ca6e71 /libavformat/rmdec.c | |
parent | d4d1b5fbde09593d56ee491f50eac6f29909ee4b (diff) | |
download | ffmpeg-streaming-5c470b910e3b78e8a9b1aeb05ae4a40a3a3324a5.zip ffmpeg-streaming-5c470b910e3b78e8a9b1aeb05ae4a40a3a3324a5.tar.gz |
Split ac3 byte swapping into a separate function.
Patch by Ronald S. Bultje: rsbultje gmail com
Original thread: Re: [FFmpeg-devel] [PATCH 4/6] rmdec.c: rm_ac3_swap_bytes()
Date: 11/05/2007 09:27 PM
Originally committed as revision 10964 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rmdec.c')
-rw-r--r-- | libavformat/rmdec.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 533a1a5..254620a 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -535,6 +535,21 @@ static int rm_assemble_video_frame(AVFormatContext *s, RMContext *rm, AVPacket * return 1; } +static inline void +rm_ac3_swap_bytes (AVStream *st, AVPacket *pkt) +{ + uint8_t *ptr; + int j; + + if (st->codec->codec_id == CODEC_ID_AC3) { + ptr = pkt->data; + for (j=0;j<pkt->size;j+=2) { + FFSWAP(int, ptr[0], ptr[1]); + ptr += 2; + } + } +} + static int ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len, AVPacket *pkt, int *seq, int *flags, int64_t *timestamp) @@ -658,9 +673,8 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt) RMContext *rm = s->priv_data; ByteIOContext *pb = &s->pb; AVStream *st; - int i, len, j; + int i, len; int64_t timestamp, pos; - uint8_t *ptr; int flags; if (rm->audio_pkt_cnt) { @@ -710,14 +724,7 @@ resync: } } - /* for AC3, needs to swap bytes */ - if (st->codec->codec_id == CODEC_ID_AC3) { - ptr = pkt->data; - for(j=0;j<pkt->size;j+=2) { - FFSWAP(int, ptr[0], ptr[1]); - ptr += 2; - } - } + rm_ac3_swap_bytes(st, pkt); return 0; } |