[MPlayer-cvslog] r28139 - trunk/libmpdemux/demux_vqf.c
reimar
subversion at mplayerhq.hu
Sat Dec 13 10:53:08 CET 2008
Author: reimar
Date: Sat Dec 13 10:53:08 2008
New Revision: 28139
Log:
Simplify: use AV_RL32/AV_RB32
Modified:
trunk/libmpdemux/demux_vqf.c
Modified: trunk/libmpdemux/demux_vqf.c
==============================================================================
--- trunk/libmpdemux/demux_vqf.c (original)
+++ trunk/libmpdemux/demux_vqf.c Sat Dec 13 10:53:08 2008
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "libavutil/common.h"
+#include "libavutil/intreadwrite.h"
#include "mpbswap.h"
#include "stream/stream.h"
@@ -50,19 +51,19 @@ static demuxer_t* demux_open_vqf(demuxer
unsigned chunk_size;
hi->size=chunk_size=stream_read_dword(s); /* include itself */
stream_read(s,chunk_id,4);
- if(*((uint32_t *)&chunk_id[0])==mmioFOURCC('C','O','M','M'))
+ if(AV_RL32(chunk_id)==mmioFOURCC('C','O','M','M'))
{
char buf[chunk_size-8];
unsigned i,subchunk_size;
if(stream_read(s,buf,chunk_size-8)!=chunk_size-8) return NULL;
i=0;
- subchunk_size=be2me_32(*((uint32_t *)&buf[0]));
- hi->channelMode=be2me_32(*((uint32_t *)&buf[4]));
+ subchunk_size = AV_RB32(buf);
+ hi->channelMode = AV_RB32(buf + 4);
w->nChannels=sh_audio->channels=hi->channelMode+1; /*0-mono;1-stereo*/
- hi->bitRate=be2me_32(*((uint32_t *)&buf[8]));
+ hi->bitRate = AV_RB32(buf + 8);
sh_audio->i_bps=hi->bitRate*1000/8; /* bitrate kbit/s */
w->nAvgBytesPerSec = sh_audio->i_bps;
- hi->samplingRate=be2me_32(*((uint32_t *)&buf[12]));
+ hi->samplingRate = AV_RB32(buf + 12);
switch(hi->samplingRate){
case 44:
w->nSamplesPerSec=44100;
@@ -78,7 +79,7 @@ static demuxer_t* demux_open_vqf(demuxer
break;
}
sh_audio->samplerate=w->nSamplesPerSec;
- hi->securityLevel=be2me_32(*((uint32_t *)&buf[16]));
+ hi->securityLevel = AV_RB32(buf + 16);
w->nBlockAlign = 0;
sh_audio->samplesize = 4;
w->wBitsPerSample = 8*sh_audio->samplesize;
@@ -88,11 +89,11 @@ static demuxer_t* demux_open_vqf(demuxer
{
unsigned slen,sid;
char sdata[chunk_size];
- sid=*((uint32_t *)&buf[i]); i+=4;
- slen=be2me_32(*((uint32_t *)&buf[i])); i+=4;
+ sid = AV_RL32(buf + i); i+=4;
+ slen = AV_RB32(buf + i); i+=4;
if(sid==mmioFOURCC('D','S','I','Z'))
{
- hi->Dsiz=be2me_32(*((uint32_t *)&buf[i]));
+ hi->Dsiz=AV_RB32(buf + i);
continue; /* describes the same info as size of DATA chunk */
}
memcpy(sdata,&buf[i],slen); sdata[slen]=0; i+=slen;
@@ -138,7 +139,7 @@ static demuxer_t* demux_open_vqf(demuxer
}
}
else
- if(*((uint32_t *)&chunk_id[0])==mmioFOURCC('D','A','T','A'))
+ if(AV_RL32(chunk_id)==mmioFOURCC('D','A','T','A'))
{
demuxer->movi_start=stream_tell(s);
demuxer->movi_end=demuxer->movi_start+chunk_size-8;
More information about the MPlayer-cvslog
mailing list