[MPlayer-dev-eng] [PATCH] Switch libavutil macros instead of defining our own
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Feb 24 18:35:10 CET 2007
Hello,
attached patch replaces MIN, MAX, BE_32 and BE_16 in some places with
the libavutil equivalent.
Do you think this is okay despite it's size?
I assume it would also fix
http://bugzilla.mplayerhq.hu/show_bug.cgi?id=767 along the way, though
that is not really the main intention (and could be done by copying the
definitions from rmff.c instead).
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: vobsub.c
===================================================================
--- vobsub.c (revision 22335)
+++ vobsub.c (working copy)
@@ -23,10 +23,8 @@
#ifdef USE_UNRARLIB
#include "unrarlib.h"
#endif
+#include "libavutil/common.h"
-#define MIN(a, b) ((a)<(b)?(a):(b))
-#define MAX(a, b) ((a)>(b)?(a):(b))
-
extern int vobsub_id;
/**********************************************************************
@@ -820,9 +818,9 @@
r = tmp >> 16 & 0xff;
g = tmp >> 8 & 0xff;
b = tmp & 0xff;
- y = MIN(MAX((int)(0.1494 * r + 0.6061 * g + 0.2445 * b), 0), 0xff);
- u = MIN(MAX((int)(0.6066 * r - 0.4322 * g - 0.1744 * b) + 128, 0), 0xff);
- v = MIN(MAX((int)(-0.08435 * r - 0.3422 * g + 0.4266 * b) + 128, 0), 0xff);
+ y = FFMIN(FFMAX((int)(0.1494 * r + 0.6061 * g + 0.2445 * b), 0), 0xff);
+ u = FFMIN(FFMAX((int)(0.6066 * r - 0.4322 * g - 0.1744 * b) + 128, 0), 0xff);
+ v = FFMIN(FFMAX((int)(-0.08435 * r - 0.3422 * g + 0.4266 * b) + 128, 0), 0xff);
vob->palette[n++] = y << 16 | u << 8 | v;
if (n == 16)
break;
@@ -1332,9 +1330,9 @@
if (i)
putc(',', me->fidx);
fprintf(me->fidx, " %02x%02x%02x",
- MIN(MAX((int)(y + 1.4022 * u), 0), 0xff),
- MIN(MAX((int)(y - 0.3456 * u - 0.7145 * v), 0), 0xff),
- MIN(MAX((int)(y + 1.7710 * v), 0), 0xff));
+ FFMIN(FFMAX((int)(y + 1.4022 * u), 0), 0xff),
+ FFMIN(FFMAX((int)(y - 0.3456 * u - 0.7145 * v), 0), 0xff),
+ FFMIN(FFMAX((int)(y + 1.7710 * v), 0), 0xff));
}
putc('\n', me->fidx);
}
Index: stream/realrtsp/real.c
===================================================================
--- stream/realrtsp/real.c (revision 22335)
+++ stream/realrtsp/real.c (working copy)
@@ -42,6 +42,7 @@
#else
#include "libavutil/md5.h"
#endif
+#include "libavutil/intreadwrite.h"
#include "../http.h"
#include "mp_msg.h"
@@ -57,16 +58,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 +116,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 +184,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 +192,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 +210,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 +300,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 +383,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",
Index: stream/realrtsp/rmff.c
===================================================================
--- stream/realrtsp/rmff.c (revision 22335)
+++ stream/realrtsp/rmff.c (working copy)
@@ -29,17 +29,12 @@
#include "rmff.h"
#include "xbuffer.h"
#include "mp_msg.h"
+#include "libavutil/intreadwrite.h"
/*
#define LOG
*/
-#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])
-
static void hexdump (const char *buf, int length) {
int i;
@@ -78,40 +73,40 @@
static void rmff_dump_fileheader(rmff_fileheader_t *fileheader, char *buffer) {
if (!fileheader) return;
- fileheader->object_id=BE_32(&fileheader->object_id);
- fileheader->size=BE_32(&fileheader->size);
- fileheader->object_version=BE_16(&fileheader->object_version);
- fileheader->file_version=BE_32(&fileheader->file_version);
- fileheader->num_headers=BE_32(&fileheader->num_headers);
+ fileheader->object_id=AV_RB32(&fileheader->object_id);
+ fileheader->size=AV_RB32(&fileheader->size);
+ fileheader->object_version=AV_RB16(&fileheader->object_version);
+ fileheader->file_version=AV_RB32(&fileheader->file_version);
+ fileheader->num_headers=AV_RB32(&fileheader->num_headers);
memcpy(buffer, fileheader, 8);
memcpy(&buffer[8], &fileheader->object_version, 2);
memcpy(&buffer[10], &fileheader->file_version, 8);
- fileheader->size=BE_32(&fileheader->size);
- fileheader->object_version=BE_16(&fileheader->object_version);
- fileheader->file_version=BE_32(&fileheader->file_version);
- fileheader->num_headers=BE_32(&fileheader->num_headers);
- fileheader->object_id=BE_32(&fileheader->object_id);
+ fileheader->size=AV_RB32(&fileheader->size);
+ fileheader->object_version=AV_RB16(&fileheader->object_version);
+ fileheader->file_version=AV_RB32(&fileheader->file_version);
+ fileheader->num_headers=AV_RB32(&fileheader->num_headers);
+ fileheader->object_id=AV_RB32(&fileheader->object_id);
}
static void rmff_dump_prop(rmff_prop_t *prop, char *buffer) {
if (!prop) return;
- prop->object_id=BE_32(&prop->object_id);
- prop->size=BE_32(&prop->size);
- prop->object_version=BE_16(&prop->object_version);
- prop->max_bit_rate=BE_32(&prop->max_bit_rate);
- prop->avg_bit_rate=BE_32(&prop->avg_bit_rate);
- prop->max_packet_size=BE_32(&prop->max_packet_size);
- prop->avg_packet_size=BE_32(&prop->avg_packet_size);
- prop->num_packets=BE_32(&prop->num_packets);
- prop->duration=BE_32(&prop->duration);
- prop->preroll=BE_32(&prop->preroll);
- prop->index_offset=BE_32(&prop->index_offset);
- prop->data_offset=BE_32(&prop->data_offset);
- prop->num_streams=BE_16(&prop->num_streams);
- prop->flags=BE_16(&prop->flags);
+ prop->object_id=AV_RB32(&prop->object_id);
+ prop->size=AV_RB32(&prop->size);
+ prop->object_version=AV_RB16(&prop->object_version);
+ prop->max_bit_rate=AV_RB32(&prop->max_bit_rate);
+ prop->avg_bit_rate=AV_RB32(&prop->avg_bit_rate);
+ prop->max_packet_size=AV_RB32(&prop->max_packet_size);
+ prop->avg_packet_size=AV_RB32(&prop->avg_packet_size);
+ prop->num_packets=AV_RB32(&prop->num_packets);
+ prop->duration=AV_RB32(&prop->duration);
+ prop->preroll=AV_RB32(&prop->preroll);
+ prop->index_offset=AV_RB32(&prop->index_offset);
+ prop->data_offset=AV_RB32(&prop->data_offset);
+ prop->num_streams=AV_RB16(&prop->num_streams);
+ prop->flags=AV_RB16(&prop->flags);
memcpy(buffer, prop, 8);
memcpy(&buffer[8], &prop->object_version, 2);
@@ -119,20 +114,20 @@
memcpy(&buffer[46], &prop->num_streams, 2);
memcpy(&buffer[48], &prop->flags, 2);
- prop->size=BE_32(&prop->size);
- prop->object_version=BE_16(&prop->object_version);
- prop->max_bit_rate=BE_32(&prop->max_bit_rate);
- prop->avg_bit_rate=BE_32(&prop->avg_bit_rate);
- prop->max_packet_size=BE_32(&prop->max_packet_size);
- prop->avg_packet_size=BE_32(&prop->avg_packet_size);
- prop->num_packets=BE_32(&prop->num_packets);
- prop->duration=BE_32(&prop->duration);
- prop->preroll=BE_32(&prop->preroll);
- prop->index_offset=BE_32(&prop->index_offset);
- prop->data_offset=BE_32(&prop->data_offset);
- prop->num_streams=BE_16(&prop->num_streams);
- prop->flags=BE_16(&prop->flags);
- prop->object_id=BE_32(&prop->object_id);
+ prop->size=AV_RB32(&prop->size);
+ prop->object_version=AV_RB16(&prop->object_version);
+ prop->max_bit_rate=AV_RB32(&prop->max_bit_rate);
+ prop->avg_bit_rate=AV_RB32(&prop->avg_bit_rate);
+ prop->max_packet_size=AV_RB32(&prop->max_packet_size);
+ prop->avg_packet_size=AV_RB32(&prop->avg_packet_size);
+ prop->num_packets=AV_RB32(&prop->num_packets);
+ prop->duration=AV_RB32(&prop->duration);
+ prop->preroll=AV_RB32(&prop->preroll);
+ prop->index_offset=AV_RB32(&prop->index_offset);
+ prop->data_offset=AV_RB32(&prop->data_offset);
+ prop->num_streams=AV_RB16(&prop->num_streams);
+ prop->flags=AV_RB16(&prop->flags);
+ prop->object_id=AV_RB32(&prop->object_id);
}
static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) {
@@ -140,17 +135,17 @@
int s1, s2, s3;
if (!mdpr) return;
- mdpr->object_id=BE_32(&mdpr->object_id);
- mdpr->size=BE_32(&mdpr->size);
- mdpr->object_version=BE_16(&mdpr->object_version);
- mdpr->stream_number=BE_16(&mdpr->stream_number);
- mdpr->max_bit_rate=BE_32(&mdpr->max_bit_rate);
- mdpr->avg_bit_rate=BE_32(&mdpr->avg_bit_rate);
- mdpr->max_packet_size=BE_32(&mdpr->max_packet_size);
- mdpr->avg_packet_size=BE_32(&mdpr->avg_packet_size);
- mdpr->start_time=BE_32(&mdpr->start_time);
- mdpr->preroll=BE_32(&mdpr->preroll);
- mdpr->duration=BE_32(&mdpr->duration);
+ mdpr->object_id=AV_RB32(&mdpr->object_id);
+ mdpr->size=AV_RB32(&mdpr->size);
+ mdpr->object_version=AV_RB16(&mdpr->object_version);
+ mdpr->stream_number=AV_RB16(&mdpr->stream_number);
+ mdpr->max_bit_rate=AV_RB32(&mdpr->max_bit_rate);
+ mdpr->avg_bit_rate=AV_RB32(&mdpr->avg_bit_rate);
+ mdpr->max_packet_size=AV_RB32(&mdpr->max_packet_size);
+ mdpr->avg_packet_size=AV_RB32(&mdpr->avg_packet_size);
+ mdpr->start_time=AV_RB32(&mdpr->start_time);
+ mdpr->preroll=AV_RB32(&mdpr->preroll);
+ mdpr->duration=AV_RB32(&mdpr->duration);
memcpy(buffer, mdpr, 8);
memcpy(&buffer[8], &mdpr->object_version, 2);
@@ -164,22 +159,22 @@
s2=mdpr->mime_type_size;
memcpy(&buffer[42+s1], mdpr->mime_type, s2);
- mdpr->type_specific_len=BE_32(&mdpr->type_specific_len);
+ mdpr->type_specific_len=AV_RB32(&mdpr->type_specific_len);
memcpy(&buffer[42+s1+s2], &mdpr->type_specific_len, 4);
- mdpr->type_specific_len=BE_32(&mdpr->type_specific_len);
+ mdpr->type_specific_len=AV_RB32(&mdpr->type_specific_len);
s3=mdpr->type_specific_len;
memcpy(&buffer[46+s1+s2], mdpr->type_specific_data, s3);
- mdpr->size=BE_32(&mdpr->size);
- mdpr->stream_number=BE_16(&mdpr->stream_number);
- mdpr->max_bit_rate=BE_32(&mdpr->max_bit_rate);
- mdpr->avg_bit_rate=BE_32(&mdpr->avg_bit_rate);
- mdpr->max_packet_size=BE_32(&mdpr->max_packet_size);
- mdpr->avg_packet_size=BE_32(&mdpr->avg_packet_size);
- mdpr->start_time=BE_32(&mdpr->start_time);
- mdpr->preroll=BE_32(&mdpr->preroll);
- mdpr->duration=BE_32(&mdpr->duration);
- mdpr->object_id=BE_32(&mdpr->object_id);
+ mdpr->size=AV_RB32(&mdpr->size);
+ mdpr->stream_number=AV_RB16(&mdpr->stream_number);
+ mdpr->max_bit_rate=AV_RB32(&mdpr->max_bit_rate);
+ mdpr->avg_bit_rate=AV_RB32(&mdpr->avg_bit_rate);
+ mdpr->max_packet_size=AV_RB32(&mdpr->max_packet_size);
+ mdpr->avg_packet_size=AV_RB32(&mdpr->avg_packet_size);
+ mdpr->start_time=AV_RB32(&mdpr->start_time);
+ mdpr->preroll=AV_RB32(&mdpr->preroll);
+ mdpr->duration=AV_RB32(&mdpr->duration);
+ mdpr->object_id=AV_RB32(&mdpr->object_id);
}
@@ -188,59 +183,59 @@
int p;
if (!cont) return;
- cont->object_id=BE_32(&cont->object_id);
- cont->size=BE_32(&cont->size);
- cont->object_version=BE_16(&cont->object_version);
+ cont->object_id=AV_RB32(&cont->object_id);
+ cont->size=AV_RB32(&cont->size);
+ cont->object_version=AV_RB16(&cont->object_version);
memcpy(buffer, cont, 8);
memcpy(&buffer[8], &cont->object_version, 2);
- cont->title_len=BE_16(&cont->title_len);
+ cont->title_len=AV_RB16(&cont->title_len);
memcpy(&buffer[10], &cont->title_len, 2);
- cont->title_len=BE_16(&cont->title_len);
+ cont->title_len=AV_RB16(&cont->title_len);
memcpy(&buffer[12], cont->title, cont->title_len);
p=12+cont->title_len;
- cont->author_len=BE_16(&cont->author_len);
+ cont->author_len=AV_RB16(&cont->author_len);
memcpy(&buffer[p], &cont->author_len, 2);
- cont->author_len=BE_16(&cont->author_len);
+ cont->author_len=AV_RB16(&cont->author_len);
memcpy(&buffer[p+2], cont->author, cont->author_len);
p+=2+cont->author_len;
- cont->copyright_len=BE_16(&cont->copyright_len);
+ cont->copyright_len=AV_RB16(&cont->copyright_len);
memcpy(&buffer[p], &cont->copyright_len, 2);
- cont->copyright_len=BE_16(&cont->copyright_len);
+ cont->copyright_len=AV_RB16(&cont->copyright_len);
memcpy(&buffer[p+2], cont->copyright, cont->copyright_len);
p+=2+cont->copyright_len;
- cont->comment_len=BE_16(&cont->comment_len);
+ cont->comment_len=AV_RB16(&cont->comment_len);
memcpy(&buffer[p], &cont->comment_len, 2);
- cont->comment_len=BE_16(&cont->comment_len);
+ cont->comment_len=AV_RB16(&cont->comment_len);
memcpy(&buffer[p+2], cont->comment, cont->comment_len);
- cont->size=BE_32(&cont->size);
- cont->object_version=BE_16(&cont->object_version);
- cont->object_id=BE_32(&cont->object_id);
+ cont->size=AV_RB32(&cont->size);
+ cont->object_version=AV_RB16(&cont->object_version);
+ cont->object_id=AV_RB32(&cont->object_id);
}
static void rmff_dump_dataheader(rmff_data_t *data, char *buffer) {
if (!data) return;
- data->object_id=BE_32(&data->object_id);
- data->size=BE_32(&data->size);
- data->object_version=BE_16(&data->object_version);
- data->num_packets=BE_32(&data->num_packets);
- data->next_data_header=BE_32(&data->next_data_header);
+ data->object_id=AV_RB32(&data->object_id);
+ data->size=AV_RB32(&data->size);
+ data->object_version=AV_RB16(&data->object_version);
+ data->num_packets=AV_RB32(&data->num_packets);
+ data->next_data_header=AV_RB32(&data->next_data_header);
memcpy(buffer, data, 8);
memcpy(&buffer[8], &data->object_version, 2);
memcpy(&buffer[10], &data->num_packets, 8);
- data->num_packets=BE_32(&data->num_packets);
- data->next_data_header=BE_32(&data->next_data_header);
- data->size=BE_32(&data->size);
- data->object_version=BE_16(&data->object_version);
- data->object_id=BE_32(&data->object_id);
+ data->num_packets=AV_RB32(&data->num_packets);
+ data->next_data_header=AV_RB32(&data->next_data_header);
+ data->size=AV_RB32(&data->size);
+ data->object_version=AV_RB16(&data->object_version);
+ data->object_id=AV_RB32(&data->object_id);
}
int rmff_dump_header(rmff_header_t *h, char *buffer, int max) {
@@ -290,16 +285,16 @@
rmff_fileheader_t *fileheader=malloc(sizeof(rmff_fileheader_t));
- fileheader->object_id=BE_32(data);
- fileheader->size=BE_32(&data[4]);
- fileheader->object_version=BE_16(&data[8]);
+ fileheader->object_id=AV_RB32(data);
+ fileheader->size=AV_RB32(&data[4]);
+ fileheader->object_version=AV_RB16(&data[8]);
if (fileheader->object_version != 0)
{
mp_msg(MSGT_STREAM, MSGL_WARN, "warning: unknown object version in .RMF: 0x%04x\n",
fileheader->object_version);
}
- fileheader->file_version=BE_32(&data[10]);
- fileheader->num_headers=BE_32(&data[14]);
+ fileheader->file_version=AV_RB32(&data[10]);
+ fileheader->num_headers=AV_RB32(&data[14]);
return fileheader;
}
@@ -308,25 +303,25 @@
rmff_prop_t *prop=malloc(sizeof(rmff_prop_t));
- prop->object_id=BE_32(data);
- prop->size=BE_32(&data[4]);
- prop->object_version=BE_16(&data[8]);
+ prop->object_id=AV_RB32(data);
+ prop->size=AV_RB32(&data[4]);
+ prop->object_version=AV_RB16(&data[8]);
if (prop->object_version != 0)
{
mp_msg(MSGT_STREAM, MSGL_WARN, "warning: unknown object version in PROP: 0x%04x\n",
prop->object_version);
}
- prop->max_bit_rate=BE_32(&data[10]);
- prop->avg_bit_rate=BE_32(&data[14]);
- prop->max_packet_size=BE_32(&data[18]);
- prop->avg_packet_size=BE_32(&data[22]);
- prop->num_packets=BE_32(&data[26]);
- prop->duration=BE_32(&data[30]);
- prop->preroll=BE_32(&data[34]);
- prop->index_offset=BE_32(&data[38]);
- prop->data_offset=BE_32(&data[42]);
- prop->num_streams=BE_16(&data[46]);
- prop->flags=BE_16(&data[48]);
+ prop->max_bit_rate=AV_RB32(&data[10]);
+ prop->avg_bit_rate=AV_RB32(&data[14]);
+ prop->max_packet_size=AV_RB32(&data[18]);
+ prop->avg_packet_size=AV_RB32(&data[22]);
+ prop->num_packets=AV_RB32(&data[26]);
+ prop->duration=AV_RB32(&data[30]);
+ prop->preroll=AV_RB32(&data[34]);
+ prop->index_offset=AV_RB32(&data[38]);
+ prop->data_offset=AV_RB32(&data[42]);
+ prop->num_streams=AV_RB16(&data[46]);
+ prop->flags=AV_RB16(&data[48]);
return prop;
}
@@ -335,22 +330,22 @@
rmff_mdpr_t *mdpr=malloc(sizeof(rmff_mdpr_t));
- mdpr->object_id=BE_32(data);
- mdpr->size=BE_32(&data[4]);
- mdpr->object_version=BE_16(&data[8]);
+ mdpr->object_id=AV_RB32(data);
+ mdpr->size=AV_RB32(&data[4]);
+ mdpr->object_version=AV_RB16(&data[8]);
if (mdpr->object_version != 0)
{
mp_msg(MSGT_STREAM, MSGL_WARN, "warning: unknown object version in MDPR: 0x%04x\n",
mdpr->object_version);
}
- mdpr->stream_number=BE_16(&data[10]);
- mdpr->max_bit_rate=BE_32(&data[12]);
- mdpr->avg_bit_rate=BE_32(&data[16]);
- mdpr->max_packet_size=BE_32(&data[20]);
- mdpr->avg_packet_size=BE_32(&data[24]);
- mdpr->start_time=BE_32(&data[28]);
- mdpr->preroll=BE_32(&data[32]);
- mdpr->duration=BE_32(&data[36]);
+ mdpr->stream_number=AV_RB16(&data[10]);
+ mdpr->max_bit_rate=AV_RB32(&data[12]);
+ mdpr->avg_bit_rate=AV_RB32(&data[16]);
+ mdpr->max_packet_size=AV_RB32(&data[20]);
+ mdpr->avg_packet_size=AV_RB32(&data[24]);
+ mdpr->start_time=AV_RB32(&data[28]);
+ mdpr->preroll=AV_RB32(&data[32]);
+ mdpr->duration=AV_RB32(&data[36]);
mdpr->stream_name_size=data[40];
mdpr->stream_name=malloc(mdpr->stream_name_size+1);
@@ -362,7 +357,7 @@
memcpy(mdpr->mime_type, &data[42+mdpr->stream_name_size], mdpr->mime_type_size);
mdpr->mime_type[mdpr->mime_type_size]=0;
- mdpr->type_specific_len=BE_32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]);
+ mdpr->type_specific_len=AV_RB32(&data[42+mdpr->stream_name_size+mdpr->mime_type_size]);
mdpr->type_specific_data=malloc(mdpr->type_specific_len);
memcpy(mdpr->type_specific_data,
&data[46+mdpr->stream_name_size+mdpr->mime_type_size], mdpr->type_specific_len);
@@ -375,30 +370,30 @@
rmff_cont_t *cont=malloc(sizeof(rmff_cont_t));
int pos;
- cont->object_id=BE_32(data);
- cont->size=BE_32(&data[4]);
- cont->object_version=BE_16(&data[8]);
+ cont->object_id=AV_RB32(data);
+ cont->size=AV_RB32(&data[4]);
+ cont->object_version=AV_RB16(&data[8]);
if (cont->object_version != 0)
{
mp_msg(MSGT_STREAM, MSGL_WARN, "warning: unknown object version in CONT: 0x%04x\n",
cont->object_version);
}
- cont->title_len=BE_16(&data[10]);
+ cont->title_len=AV_RB16(&data[10]);
cont->title=malloc(cont->title_len+1);
memcpy(cont->title, &data[12], cont->title_len);
cont->title[cont->title_len]=0;
pos=cont->title_len+12;
- cont->author_len=BE_16(&data[pos]);
+ cont->author_len=AV_RB16(&data[pos]);
cont->author=malloc(cont->author_len+1);
memcpy(cont->author, &data[pos+2], cont->author_len);
cont->author[cont->author_len]=0;
pos=pos+2+cont->author_len;
- cont->copyright_len=BE_16(&data[pos]);
+ cont->copyright_len=AV_RB16(&data[pos]);
cont->copyright=malloc(cont->copyright_len+1);
memcpy(cont->copyright, &data[pos+2], cont->copyright_len);
cont->copyright[cont->copyright_len]=0;
pos=pos+2+cont->copyright_len;
- cont->comment_len=BE_16(&data[pos]);
+ cont->comment_len=AV_RB16(&data[pos]);
cont->comment=malloc(cont->comment_len+1);
memcpy(cont->comment, &data[pos+2], cont->comment_len);
cont->comment[cont->comment_len]=0;
@@ -410,16 +405,16 @@
rmff_data_t *dh=malloc(sizeof(rmff_data_t));
- dh->object_id=BE_32(data);
- dh->size=BE_32(&data[4]);
- dh->object_version=BE_16(&data[8]);
+ dh->object_id=AV_RB32(data);
+ dh->size=AV_RB32(&data[4]);
+ dh->object_version=AV_RB16(&data[8]);
if (dh->object_version != 0)
{
mp_msg(MSGT_STREAM, MSGL_WARN, "warning: unknown object version in DATA: 0x%04x\n",
dh->object_version);
}
- dh->num_packets=BE_32(&data[10]);
- dh->next_data_header=BE_32(&data[14]);
+ dh->num_packets=AV_RB32(&data[10]);
+ dh->next_data_header=AV_RB32(&data[14]);
return dh;
}
@@ -438,7 +433,7 @@
header->cont=NULL;
header->data=NULL;
- chunk_type = BE_32(ptr);
+ chunk_type = AV_RB32(ptr);
if (chunk_type != RMF_TAG)
{
mp_msg(MSGT_STREAM, MSGL_ERR, "rmff: not an real media file header (.RMF tag not found).\n");
@@ -454,7 +449,7 @@
}
for (i=1; i<header->fileheader->num_headers; i++) {
- chunk_type = BE_32(ptr);
+ chunk_type = AV_RB32(ptr);
if (ptr[0] == 0)
{
@@ -504,8 +499,8 @@
do {
buf = xbuffer_ensure_size(buf, index+8);
recv(fd, buf+index, 8, 0);
- chunk_type=BE_32(buf+index); index+=4;
- chunk_size=BE_32(buf+index); index+=4;
+ chunk_type=AV_RB32(buf+index); index+=4;
+ chunk_size=AV_RB32(buf+index); index+=4;
switch (chunk_type) {
case DATA_TAG:
@@ -534,10 +529,10 @@
void rmff_scan_pheader(rmff_pheader_t *h, char *data) {
- h->object_version=BE_16(data);
- h->length=BE_16(data+2);
- h->stream_number=BE_16(data+4);
- h->timestamp=BE_32(data+6);
+ h->object_version=AV_RB16(data);
+ h->length=AV_RB16(data+2);
+ h->stream_number=AV_RB16(data+4);
+ h->timestamp=AV_RB32(data+6);
h->reserved=(uint8_t)data[10];
h->flags=(uint8_t)data[11];
}
More information about the MPlayer-dev-eng
mailing list