Mercurial > mplayer.hg
diff stream/realrtsp/real.c @ 22376:6c1fe779b704
Use libavutil AV_RB/AV_WB macros instead of defining out own variants.
Probably fixes http://bugzilla.mplayerhq.hu/show_bug.cgi?id=767 as a side-effect
author | reimar |
---|---|
date | Thu, 01 Mar 2007 12:51:33 +0000 |
parents | 4cabf7499fef |
children | f088d69b1667 |
line wrap: on
line diff
--- a/stream/realrtsp/real.c Thu Mar 01 12:45:00 2007 +0000 +++ b/stream/realrtsp/real.c Thu Mar 01 12:51:33 2007 +0000 @@ -32,7 +32,6 @@ #include "../config.h" #include "libavutil/common.h" -#include "mpbswap.h" #include "real.h" #include "asmrp.h" #include "sdpplin.h" @@ -42,6 +41,7 @@ #else #include "libavutil/md5.h" #endif +#include "libavutil/intreadwrite.h" #include "../http.h" #include "mp_msg.h" @@ -57,16 +57,6 @@ 0x10, 0x57, 0x05, 0x18, 0x54, 0x00, 0x00, 0x00 }; -#define BE_32C(x,y) (*((uint32_t*)(x))=be2me_32(y)) - -#define BE_16(x) be2me_16(*(uint16_t*)(x)) - -#define BE_32(x) be2me_32(*(uint32_t*)(x)) - -#ifndef MAX -#define MAX(x,y) ((x>y) ? x : y) -#endif - #define BUF_SIZE 4096 #ifdef LOG @@ -125,9 +115,9 @@ /* initialize buffer */ memset(buf, 0, 128); ptr=buf; - BE_32C(ptr, 0xa1e9149d); + AV_WB32(ptr, 0xa1e9149d); ptr+=4; - BE_32C(ptr, 0x0e6b3b59); + AV_WB32(ptr, 0x0e6b3b59); ptr+=4; /* some (length) checks */ @@ -193,7 +183,7 @@ mlti_chunk+=4; /* next 16 bits are the number of rules */ - numrules=BE_16(mlti_chunk); + numrules=AV_RB16(mlti_chunk); if (selection >= numrules) return 0; /* now <numrules> indices of codecs follows */ @@ -201,13 +191,13 @@ mlti_chunk+=(selection+1)*2; /* get our index */ - codec=BE_16(mlti_chunk); + codec=AV_RB16(mlti_chunk); /* skip to number of codecs */ mlti_chunk+=(numrules-selection)*2; /* get number of codecs */ - numrules=BE_16(mlti_chunk); + numrules=AV_RB16(mlti_chunk); if (codec >= numrules) { mp_msg(MSGT_STREAM, MSGL_WARN, "realrtsp: codec index >= number of codecs. %i %i\n", @@ -219,11 +209,11 @@ /* now seek to selected codec */ for (i=0; i<codec; i++) { - size=BE_32(mlti_chunk); + size=AV_RB32(mlti_chunk); mlti_chunk+=size+4; } - size=BE_32(mlti_chunk); + size=AV_RB32(mlti_chunk); #ifdef LOG hexdump(mlti_chunk+4, size); @@ -309,10 +299,10 @@ len, buf); - duration=MAX(duration,desc->stream[i]->duration); + duration=FFMAX(duration,desc->stream[i]->duration); max_bit_rate+=desc->stream[i]->max_bit_rate; avg_bit_rate+=desc->stream[i]->avg_bit_rate; - max_packet_size=MAX(max_packet_size, desc->stream[i]->max_packet_size); + max_packet_size=FFMAX(max_packet_size, desc->stream[i]->max_packet_size); if (avg_packet_size) avg_packet_size=(avg_packet_size + desc->stream[i]->avg_packet_size) / 2; else @@ -392,7 +382,7 @@ unknown1=(header[5]<<16)+(header[6]<<8)+(header[7]); n=rtsp_read_data(rtsp_session, header, 6); if (n<6) return 0; - ts=BE_32(header); + ts=AV_RB32(header); #ifdef LOG printf("ts: %u, size: %u, flags: 0x%02x, unknown values: 0x%06x 0x%02x 0x%02x\n",