aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rmdec.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2008-12-14 22:26:28 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2008-12-14 22:26:28 +0000
commitb9b2b8c93b40a2d96f25362e9c8d7611d0adc3c7 (patch)
tree092bac4b71ce7833d0a11cd7dce5eb47810b96ca /libavformat/rmdec.c
parent127ed7b07bcbc91bbb21d39f77fb906a88733e19 (diff)
downloadffmpeg-b9b2b8c93b40a2d96f25362e9c8d7611d0adc3c7.tar.gz
Use get_buffer() and url_fskip() for some loops of get_byte()s. See discussion in ML thread
"[PATCH] rmdec.c: use get_buffer and skip_bytes instead of loops of get_byte". Originally committed as revision 16139 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/rmdec.c')
-rw-r--r--libavformat/rmdec.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 74199db4eb..1eb509d4fb 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -74,15 +74,12 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
RMDemuxContext *rm = s->priv_data;
char buf[256];
uint32_t version;
- int i;
/* ra type header */
version = get_be32(pb); /* version */
if (((version >> 16) & 0xff) == 3) {
int64_t startpos = url_ftell(pb);
- /* very old version */
- for(i = 0; i < 14; i++)
- get_byte(pb);
+ url_fskip(pb, 14);
get_str8(pb, s->title, sizeof(s->title));
get_str8(pb, s->author, sizeof(s->author));
get_str8(pb, s->copyright, sizeof(s->copyright));
@@ -123,10 +120,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
st->codec->channels = get_be16(pb);
if (((version >> 16) & 0xff) == 5) {
get_be32(pb);
- buf[0] = get_byte(pb);
- buf[1] = get_byte(pb);
- buf[2] = get_byte(pb);
- buf[3] = get_byte(pb);
+ get_buffer(pb, buf, 4);
buf[4] = 0;
} else {
get_str8(pb, buf, sizeof(buf)); /* desc */
@@ -149,7 +143,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h);
} else if ((!strcmp(buf, "cook")) || (!strcmp(buf, "atrc")) || (!strcmp(buf, "sipr"))) {
- int codecdata_length, i;
+ int codecdata_length;
get_be16(pb); get_byte(pb);
if (((version >> 16) & 0xff) == 5)
get_byte(pb);
@@ -169,8 +163,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
else st->codec->codec_id = CODEC_ID_ATRAC3;
st->codec->extradata_size= codecdata_length;
st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
- for(i = 0; i < codecdata_length; i++)
- ((uint8_t*)st->codec->extradata)[i] = get_byte(pb);
+ get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
rm->audio_framesize = st->codec->block_align;
st->codec->block_align = rm->sub_packet_size;
@@ -181,7 +174,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h);
} else if (!strcmp(buf, "raac") || !strcmp(buf, "racp")) {
- int codecdata_length, i;
+ int codecdata_length;
get_be16(pb); get_byte(pb);
if (((version >> 16) & 0xff) == 5)
get_byte(pb);
@@ -195,8 +188,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, ByteIOContext *pb,
st->codec->extradata_size = codecdata_length - 1;
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_byte(pb);
- for(i = 0; i < st->codec->extradata_size; i++)
- ((uint8_t*)st->codec->extradata)[i] = get_byte(pb);
+ get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
}
} else {
st->codec->codec_id = CODEC_ID_NONE;