aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMåns Rullgård <mans@mansr.com>2007-07-07 20:50:31 +0000
committerMåns Rullgård <mans@mansr.com>2007-07-07 20:50:31 +0000
commit78c3c1881f6cb9e27404333de04eecabd49a292b (patch)
tree157bcba4033447c66973df5218dd3e929b6296aa /libavformat
parent3c3f7ce15ac18fd7f9bbee12100b8d92f21dc896 (diff)
downloadffmpeg-78c3c1881f6cb9e27404333de04eecabd49a292b.tar.gz
use bytestream_get_* and AV_RLxx
Originally committed as revision 9525 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/oggparseogm.c49
1 files changed, 23 insertions, 26 deletions
diff --git a/libavformat/oggparseogm.c b/libavformat/oggparseogm.c
index 8788e5d410..e263e34c0b 100644
--- a/libavformat/oggparseogm.c
+++ b/libavformat/oggparseogm.c
@@ -25,7 +25,8 @@
#include <stdlib.h>
#include "avformat.h"
#include "bitstream.h"
-#include "bswap.h"
+#include "bytestream.h"
+#include "intreadwrite.h"
#include "ogg2.h"
#include "riff.h"
@@ -51,42 +52,38 @@ ogm_header(AVFormatContext *s, int idx)
int tag;
st->codec->codec_type = CODEC_TYPE_VIDEO;
p += 8;
- tag = le2me_32(unaligned32(p));
+ tag = bytestream_get_le32(&p);
st->codec->codec_id = codec_get_bmp_id(tag);
st->codec->codec_tag = tag;
} else {
+ uint8_t acid[5];
int cid;
st->codec->codec_type = CODEC_TYPE_AUDIO;
p += 8;
- p[4] = 0;
- cid = strtol(p, NULL, 16);
+ bytestream_get_buffer(&p, acid, 4);
+ acid[4] = 0;
+ cid = strtol(acid, NULL, 16);
st->codec->codec_id = codec_get_wav_id(cid);
}
- p += 4;
p += 4; /* useless size field */
- time_unit = le2me_64(unaligned64(p));
- p += 8;
- spu = le2me_64(unaligned64(p));
- p += 8;
- default_len = le2me_32(unaligned32(p));
- p += 4;
+ time_unit = bytestream_get_le64(&p);
+ spu = bytestream_get_le64(&p);
+ default_len = bytestream_get_le32(&p);
p += 8; /* buffersize + bits_per_sample */
if(st->codec->codec_type == CODEC_TYPE_VIDEO){
- st->codec->width = le2me_32(unaligned32(p));
- p += 4;
- st->codec->height = le2me_32(unaligned32(p));
+ st->codec->width = bytestream_get_le32(&p);
+ st->codec->height = bytestream_get_le32(&p);
st->codec->time_base.den = spu * 10000000;
st->codec->time_base.num = time_unit;
st->time_base = st->codec->time_base;
} else {
- st->codec->channels = le2me_16(unaligned16(p));
- p += 2;
+ st->codec->channels = bytestream_get_le16(&p);
p += 2; /* block_align */
- st->codec->bit_rate = le2me_32(unaligned32(p)) * 8;
+ st->codec->bit_rate = bytestream_get_le32(&p) * 8;
st->codec->sample_rate = spu * 10000000 / time_unit;
st->time_base.num = 1;
st->time_base.den = st->codec->sample_rate;
@@ -109,21 +106,21 @@ ogm_dshow_header(AVFormatContext *s, int idx)
if(*p != 1)
return 1;
- t = le2me_32(unaligned32(p + 96));
+ t = AV_RL32(p + 96);
if(t == 0x05589f80){
st->codec->codec_type = CODEC_TYPE_VIDEO;
- st->codec->codec_id = codec_get_bmp_id(le2me_32(unaligned32(p + 68)));
+ st->codec->codec_id = codec_get_bmp_id(AV_RL32(p + 68));
st->codec->time_base.den = 10000000;
- st->codec->time_base.num = le2me_64(unaligned64(p + 164));
- st->codec->width = le2me_32(unaligned32(p + 176));
- st->codec->height = le2me_32(unaligned32(p + 180));
+ st->codec->time_base.num = AV_RL64(p + 164);
+ st->codec->width = AV_RL32(p + 176);
+ st->codec->height = AV_RL32(p + 180);
} else if(t == 0x05589f81){
st->codec->codec_type = CODEC_TYPE_AUDIO;
- st->codec->codec_id = codec_get_wav_id(le2me_16(unaligned16(p+124)));
- st->codec->channels = le2me_16(unaligned16(p + 126));
- st->codec->sample_rate = le2me_32(unaligned32(p + 128));
- st->codec->bit_rate = le2me_32(unaligned32(p + 132)) * 8;
+ st->codec->codec_id = codec_get_wav_id(AV_RL16(p + 124));
+ st->codec->channels = AV_RL16(p + 126);
+ st->codec->sample_rate = AV_RL32(p + 128);
+ st->codec->bit_rate = AV_RL32(p + 132) * 8;
}
return 1;