diff --git a/librmff/librmff.h b/librmff/librmff.h index a5ce09bf3..ea16651f1 100644 --- a/librmff/librmff.h +++ b/librmff/librmff.h @@ -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; @@ -162,9 +162,9 @@ typedef struct rmff_frame_t { /** \brief The track contains video data. */ #define RMFF_TRACK_TYPE_VIDEO 2 -struct rmff_file_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. diff --git a/librmff/rmff.c b/librmff/rmff.c index 982bdf3b3..4e8e6ab10 100644 --- a/librmff/rmff.c +++ b/librmff/rmff.c @@ -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);