mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 16:33:02 +00:00
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 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22394 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
2ad2fefc2b
commit
7e316c542e
@ -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 @@ static const unsigned char xor_table[] = {
|
||||
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 @@ static void real_calc_response_and_checksum (char *response, char *chksum, char
|
||||
/* 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 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection
|
||||
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 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection
|
||||
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 @@ static int select_mlti_data(const char *mlti_chunk, int mlti_size, int selection
|
||||
|
||||
/* 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 @@ static rmff_header_t *real_parse_sdp(char *data, char **stream_rules, uint32_t b
|
||||
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 @@ int real_get_rdt_chunk(rtsp_t *rtsp_session, char **buffer, int rdt_rawdata) {
|
||||
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",
|
||||
|
@ -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 hexdump (const char *buf, int length) {
|
||||
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 @@ static void rmff_dump_prop(rmff_prop_t *prop, char *buffer) {
|
||||
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 @@ static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) {
|
||||
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 @@ static void rmff_dump_mdpr(rmff_mdpr_t *mdpr, char *buffer) {
|
||||
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 @@ static void rmff_dump_cont(rmff_cont_t *cont, char *buffer) {
|
||||
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 @@ static rmff_fileheader_t *rmff_scan_fileheader(const char *data) {
|
||||
|
||||
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 @@ static rmff_prop_t *rmff_scan_prop(const char *data) {
|
||||
|
||||
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 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) {
|
||||
|
||||
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 @@ static rmff_mdpr_t *rmff_scan_mdpr(const char *data) {
|
||||
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 @@ static rmff_cont_t *rmff_scan_cont(const char *data) {
|
||||
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 @@ static rmff_data_t *rmff_scan_dataheader(const char *data) {
|
||||
|
||||
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 @@ rmff_header_t *rmff_scan_header(const char *data) {
|
||||
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 @@ rmff_header_t *rmff_scan_header(const char *data) {
|
||||
}
|
||||
|
||||
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 @@ rmff_header_t *rmff_scan_header_stream(int fd) {
|
||||
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 @@ rmff_header_t *rmff_scan_header_stream(int fd) {
|
||||
|
||||
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];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user