aboutsummaryrefslogtreecommitdiffhomepage
path: root/stream
diff options
context:
space:
mode:
authorGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-13 12:57:44 +0000
committerGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-13 12:57:44 +0000
commit0a2a62634282bd7f9400bfaa16e0a75873e0cc3d (patch)
tree6cccd6cb1f1e897dad50bbcbff5419c0655de506 /stream
parent7ce9faabbed7f31cec54324c387283bbfd5e65d3 (diff)
Use AV_RB* instead of custom variants.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25725 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r--stream/pnm.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/stream/pnm.c b/stream/pnm.c
index 911001afd1..f8136e0e5c 100644
--- a/stream/pnm.c
+++ b/stream/pnm.c
@@ -44,6 +44,8 @@
#include <winsock2.h>
#endif
+#include "libavutil/intreadwrite.h"
+
#include "stream.h"
#include "libmpdemux/demuxer.h"
#include "help_mp.h"
@@ -103,16 +105,6 @@ struct pnm_s {
unsigned int packet; /* number of last recieved packet */
};
-/*
- * utility macros
- */
-
-#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
-#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
- (((uint8_t*)(x))[1] << 16) | \
- (((uint8_t*)(x))[2] << 8) | \
- ((uint8_t*)(x))[3])
-
/* D means direct (no pointer) */
#define BE_16D(x) ((x & 0xff00) >> 8)|((x & 0x00ff) << 8)
@@ -324,8 +316,8 @@ static int pnm_get_chunk(pnm_t *p,
max -= PREAMBLE_SIZE;
- *chunk_type = BE_32(data);
- chunk_size = BE_32(data+4);
+ *chunk_type = AV_RB32(data);
+ chunk_size = AV_RB32(data+4);
switch (*chunk_type) {
case PNA_TAG:
@@ -350,7 +342,7 @@ static int pnm_get_chunk(pnm_t *p,
return -1;
rm_read (p->s, ptr+2, 1);
max = -1;
- n=BE_16(ptr+1);
+ n=AV_RB16(ptr+1);
if (max < n)
return -1;
rm_read (p->s, ptr+3, n);
@@ -686,7 +678,7 @@ static int pnm_get_stream_chunk(pnm_t *p) {
/* a server message */
if (p->buffer[0] == 'X')
{
- int size=BE_16(&p->buffer[1]);
+ int size=AV_RB16(&p->buffer[1]);
rm_read (p->s, &p->buffer[8], size-5);
p->buffer[size+3]=0;
@@ -726,8 +718,8 @@ static int pnm_get_stream_chunk(pnm_t *p) {
}
/* check offsets */
- fof1=BE_16(&p->buffer[1]);
- fof2=BE_16(&p->buffer[3]);
+ fof1=AV_RB16(&p->buffer[1]);
+ fof2=AV_RB16(&p->buffer[3]);
if (fof1 != fof2)
{
mp_msg(MSGT_OPEN, MSGL_ERR, "input_pnm: frame offsets are different: 0x%04x 0x%04x\n",fof1,fof2);
@@ -735,7 +727,7 @@ static int pnm_get_stream_chunk(pnm_t *p) {
}
/* get first index */
- p->seq_current[0]=BE_16(&p->buffer[5]);
+ p->seq_current[0]=AV_RB16(&p->buffer[5]);
/* now read the rest of stream chunk */
n = rm_read (p->s, &p->recv[5], fof1-5);
@@ -745,7 +737,7 @@ static int pnm_get_stream_chunk(pnm_t *p) {
p->seq_current[1]=p->recv[5];
/* get timestamp */
- p->ts_current=BE_32(&p->recv[6]);
+ p->ts_current=AV_RB32(&p->recv[6]);
/* get stream number */
stream=pnm_calc_stream(p);
@@ -758,7 +750,7 @@ static int pnm_get_stream_chunk(pnm_t *p) {
p->recv[0]=0; /* object version */
p->recv[1]=0;
- fof2=BE_16(&fof2);
+ fof2=AV_RB16(&fof2);
memcpy(&p->recv[2], &fof2, 2);
/*p->recv[2]=(fof2>>8)%0xff;*/ /* length */
/*p->recv[3]=(fof2)%0xff;*/