Fix for compilation with C++. Use RMFF_OPEN_MODE_* instead of MB_OPEN_MODE_*. Set the track.id from the mdpr header.

This commit is contained in:
Moritz Bunkus 2004-03-17 21:47:28 +00:00
parent 83937d6979
commit 31f9fb29d8
2 changed files with 13 additions and 5 deletions

View File

@ -145,7 +145,7 @@ typedef struct __attribute__((__packed__)) real_audio_v5_props_t {
} real_audio_v5_props_t;
typedef struct rmff_frame_t {
void *data;
unsigned char *data;
uint32_t size;
int allocated_by_rmff;
@ -164,7 +164,7 @@ typedef struct rmff_frame_t {
struct rmff_file_t ;
typedef struct {
typedef struct rmff_track_t {
uint32_t id;
int type;
rmff_mdpr_t mdpr_header;
@ -173,7 +173,7 @@ typedef struct {
struct rmff_file_t *file;
} rmff_track_t;
typedef struct {
typedef struct rmff_file_t {
mb_file_io_t *io;
void *handle;
char *name;
@ -215,6 +215,9 @@ typedef struct {
(((unsigned char)c) << 8) + \
((unsigned char)d))
#define RMFF_OPEN_MODE_READING 0
#define RMFF_OPEN_MODE_WRITING 1
/** \brief Opens a RealMedia file for reading or writing.
* Can be used to open an existing file for reading or for creating a new
* file. The file headers will neither be read nor written automatically.

View File

@ -257,9 +257,13 @@ rmff_open_file_with_io(const char *path,
char buf[5];
if ((path == NULL) || (io == NULL) ||
((mode != MB_OPEN_MODE_READING) && (mode != MB_OPEN_MODE_WRITING)))
((mode != RMFF_OPEN_MODE_READING) && (mode != RMFF_OPEN_MODE_WRITING)))
return (rmff_file_t *)set_error(RMFF_ERR_PARAMETERS, NULL, 0);
if (mode == RMFF_OPEN_MODE_READING)
mode = MB_OPEN_MODE_READING;
else
mode = MB_OPEN_MODE_WRITING;
file_h = io->open(path, mode);
if (file_h == NULL)
return NULL;
@ -402,6 +406,7 @@ rmff_read_headers(rmff_file_t *file) {
track.file = (struct rmff_file_t *)file;
mdpr = &track.mdpr_header;
read_uint16_be_to(&mdpr->id);
track.id = get_uint16_be(&mdpr->id);
read_uint32_be_to(&mdpr->max_bit_rate);
read_uint32_be_to(&mdpr->avg_bit_rate);
read_uint32_be_to(&mdpr->max_packet_size);