You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
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
This commit is contained in:
committed by
Benoit Fouet
parent
d4d1b5fbde
commit
5c470b910e
@@ -535,6 +535,21 @@ static int rm_assemble_video_frame(AVFormatContext *s, RMContext *rm, AVPacket *
|
|||||||
return 1;
|
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
|
static int
|
||||||
ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len, AVPacket *pkt,
|
ff_rm_parse_packet (AVFormatContext *s, AVStream *st, int len, AVPacket *pkt,
|
||||||
int *seq, int *flags, int64_t *timestamp)
|
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;
|
RMContext *rm = s->priv_data;
|
||||||
ByteIOContext *pb = &s->pb;
|
ByteIOContext *pb = &s->pb;
|
||||||
AVStream *st;
|
AVStream *st;
|
||||||
int i, len, j;
|
int i, len;
|
||||||
int64_t timestamp, pos;
|
int64_t timestamp, pos;
|
||||||
uint8_t *ptr;
|
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
if (rm->audio_pkt_cnt) {
|
if (rm->audio_pkt_cnt) {
|
||||||
@@ -710,14 +724,7 @@ resync:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for AC3, needs to swap bytes */
|
rm_ac3_swap_bytes(st, pkt);
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user