diff --git a/libmpdemux/asfheader.c b/libmpdemux/asfheader.c index bc4ab34e67..50a83b75d9 100644 --- a/libmpdemux/asfheader.c +++ b/libmpdemux/asfheader.c @@ -630,8 +630,7 @@ int read_asf_header(demuxer_t *demuxer,struct asf_priv* asf){ for( i=0 ; istream, (char *)&data_len, sizeof(data_len)); - data_len = le2me_64(data_len); + data_len = stream_read_qword_le(demuxer->stream); demuxer->movi_start = stream_tell(demuxer->stream) + 26; demuxer->movi_end = start + data_len; mp_msg(MSGT_HEADER, MSGL_V, "Found movie at 0x%X - 0x%X\n", diff --git a/libmpdemux/demux_audio.c b/libmpdemux/demux_audio.c index 35844a344f..38f1d2afd2 100644 --- a/libmpdemux/demux_audio.c +++ b/libmpdemux/demux_audio.c @@ -481,13 +481,12 @@ static int demux_audio_open(demuxer_t* demuxer) { if (demuxer->movi_end > demuxer->movi_start) { // try to find out approx. bitrate int64_t size = demuxer->movi_end - demuxer->movi_start; - int64_t num_samples = 0; - int32_t srate = 0; + int64_t num_samples; + int32_t srate; stream_skip(s, 14); - stream_read(s, (char *)&srate, 3); - srate = be2me_32(srate) >> 12; - stream_read(s, (char *)&num_samples, 5); - num_samples = (be2me_64(num_samples) >> 24) & 0xfffffffffULL; + srate = stream_read_int24(s) >> 4; + num_samples = stream_read_int24(s) << 16; + num_samples |= stream_read_word(s); if (num_samples && srate) sh_audio->i_bps = size * srate / num_samples; }