Simplify: use AV_RL32/AV_RB32
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sat, 13 Dec 2008 09:53:08 +0000 (09:53 +0000)
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>
Sat, 13 Dec 2008 09:53:08 +0000 (09:53 +0000)
git-svn-id: svn://git.mplayerhq.hu/mplayer/trunk@28139 b3059339-0415-0410-9bf9-f77b7e298cf2

libmpdemux/demux_vqf.c

index adba688..3578803 100644 (file)
@@ -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_t* 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_t* 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_t* 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_t* 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;