changeset 28105:3d8fe3f052be

Simplify: use AV_RL32/AV_RB32
author reimar
date Sat, 13 Dec 2008 09:53:08 +0000
parents 6ea280cd6b95
children 4932a522100e
files libmpdemux/demux_vqf.c
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_vqf.c	Sat Dec 13 09:44:51 2008 +0000
+++ b/libmpdemux/demux_vqf.c	Sat Dec 13 09:53:08 2008 +0000
@@ -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 @@
     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 @@
         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 @@
     {
         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 @@
     }
     }
     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;