changeset 25488:74de12ad0c44

Replace LOAD_LE32 etc. by AV_RL32 etc.
author reimar
date Sun, 23 Dec 2007 16:46:24 +0000
parents 81a77832f5fc
children 52f6429a9ba7
files libmpdemux/demux_asf.c
diffstat 1 files changed, 8 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_asf.c	Sun Dec 23 16:42:54 2007 +0000
+++ b/libmpdemux/demux_asf.c	Sun Dec 23 16:46:24 2007 +0000
@@ -13,27 +13,7 @@
 #include "demuxer.h"
 
 #include "libvo/fastmemcpy.h"
-
-/*
- * Load 16/32-bit values in little endian byte order
- * from an unaligned address
- */
-#ifdef ARCH_X86
-#define	LOAD_LE32(p)	(*(unsigned int*)(p))
-#define	LOAD_LE16(p)	(*(unsigned short*)(p))
-#define	LOAD_BE32(p)	(((unsigned char*)(p))[3]     | \
- 			 ((unsigned char*)(p))[2]<< 8 | \
- 			 ((unsigned char*)(p))[1]<<16 | \
- 			 ((unsigned char*)(p))[0]<<24 )
-#else
-#define	LOAD_LE32(p)	(((unsigned char*)(p))[0]     | \
- 			 ((unsigned char*)(p))[1]<< 8 | \
- 			 ((unsigned char*)(p))[2]<<16 | \
- 			 ((unsigned char*)(p))[3]<<24 )
-#define	LOAD_LE16(p)	(((unsigned char*)(p))[0]     | \
-			 ((unsigned char*)(p))[1]<<8)
-#define	LOAD_BE32(p)	(*(unsigned int*)(p))
-#endif
+#include "libavutil/intreadwrite.h"
 
 // defined at asfheader.c:
 
@@ -53,8 +33,8 @@
     len &= 3;
     switch (len) {
       case 1: *ptr += 1; return *p;
-      case 2: *ptr += 2; return LOAD_LE16(p);
-      case 3: *ptr += 4; return LOAD_LE32(p);
+      case 2: *ptr += 2; return AV_RL16(p);
+      case 3: *ptr += 4; return AV_RL32(p);
     }
     return def;
 }
@@ -236,13 +216,13 @@
             payextsize = asf->aud_repdata_sizes[i];
 
         if (payextsize == 65535) {
-            payextsize = LOAD_LE16(pi);
+            payextsize = AV_RL16(pi);
             pi+=2;
         }
        
         // if this is the timing info extension then read the payload time
         if (i == ext_timing_index)
-            payload_time =  (uint64_t) LOAD_LE32(pi+8) | (uint64_t)LOAD_LE32(pi+8 + 4) << 32;
+            payload_time = AV_RL64(pi+8);
         
         // if this is the video frame info extension then 
         // set the keyframe indicator, the 'new frame segment' indicator
@@ -409,8 +389,8 @@
 	    }
 
 	    // Read time & duration:
-	    time = LOAD_LE32(p); p+=4;
-	    duration = LOAD_LE16(p); p+=2;
+	    time = AV_RL32(p); p+=4;
+	    duration = AV_RL16(p); p+=2;
 
 	    // Read payload flags:
             if(flags&1){
@@ -468,7 +448,7 @@
               default:
 	        if(rlen>=8){
             	    p+=4;	// skip object size
-            	    time2=LOAD_LE32(p); // read PTS
+            	    time2=AV_RL32(p); // read PTS
             	    if (asf->asf_is_dvr_ms)
             	        get_payload_extension_data(demux, &p, streamno, seq, &keyframe, &time2);
 		    p+=rlen-4;