00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef HAVE_RMFF_H
00027 #define HAVE_RMFF_H
00028
00029
00030 #define RMFF_HEADER_SIZE 0x12
00031
00032 #define RMFF_FILEHEADER_SIZE 18
00033 #define RMFF_PROPHEADER_SIZE 50
00034 #define RMFF_MDPRHEADER_SIZE 46
00035 #define RMFF_CONTHEADER_SIZE 18
00036 #define RMFF_DATAHEADER_SIZE 18
00037
00038 #define FOURCC_TAG( ch0, ch1, ch2, ch3 ) \
00039 (((long)(unsigned char)(ch3) ) | \
00040 ( (long)(unsigned char)(ch2) << 8 ) | \
00041 ( (long)(unsigned char)(ch1) << 16 ) | \
00042 ( (long)(unsigned char)(ch0) << 24 ) )
00043
00044
00045 #define RMF_TAG FOURCC_TAG('.', 'R', 'M', 'F')
00046 #define PROP_TAG FOURCC_TAG('P', 'R', 'O', 'P')
00047 #define MDPR_TAG FOURCC_TAG('M', 'D', 'P', 'R')
00048 #define CONT_TAG FOURCC_TAG('C', 'O', 'N', 'T')
00049 #define DATA_TAG FOURCC_TAG('D', 'A', 'T', 'A')
00050 #define INDX_TAG FOURCC_TAG('I', 'N', 'D', 'X')
00051 #define PNA_TAG FOURCC_TAG('P', 'N', 'A', 0 )
00052
00053 #define MLTI_TAG FOURCC_TAG('M', 'L', 'T', 'I')
00054
00055
00056 #define PN_SAVE_ENABLED 0x01
00057 #define PN_PERFECT_PLAY_ENABLED 0x02
00058 #define PN_LIVE_BROADCAST 0x04
00059
00060
00061
00062
00063
00064 typedef struct {
00065
00066 uint32_t object_id;
00067 uint32_t size;
00068 uint16_t object_version;
00069
00070 uint32_t file_version;
00071 uint32_t num_headers;
00072 } rmff_fileheader_t;
00073
00074 typedef struct {
00075
00076 uint32_t object_id;
00077 uint32_t size;
00078 uint16_t object_version;
00079
00080 uint32_t max_bit_rate;
00081 uint32_t avg_bit_rate;
00082 uint32_t max_packet_size;
00083 uint32_t avg_packet_size;
00084 uint32_t num_packets;
00085 uint32_t duration;
00086 uint32_t preroll;
00087 uint32_t index_offset;
00088 uint32_t data_offset;
00089 uint16_t num_streams;
00090 uint16_t flags;
00091 } rmff_prop_t;
00092
00093 typedef struct {
00094
00095 uint32_t object_id;
00096 uint32_t size;
00097 uint16_t object_version;
00098
00099 uint16_t stream_number;
00100 uint32_t max_bit_rate;
00101 uint32_t avg_bit_rate;
00102 uint32_t max_packet_size;
00103 uint32_t avg_packet_size;
00104 uint32_t start_time;
00105 uint32_t preroll;
00106 uint32_t duration;
00107 uint8_t stream_name_size;
00108 char *stream_name;
00109 uint8_t mime_type_size;
00110 char *mime_type;
00111 uint32_t type_specific_len;
00112 char *type_specific_data;
00113
00114 int mlti_data_size;
00115 char *mlti_data;
00116
00117 } rmff_mdpr_t;
00118
00119 typedef struct {
00120
00121 uint32_t object_id;
00122 uint32_t size;
00123 uint16_t object_version;
00124
00125 uint16_t title_len;
00126 char *title;
00127 uint16_t author_len;
00128 char *author;
00129 uint16_t copyright_len;
00130 char *copyright;
00131 uint16_t comment_len;
00132 char *comment;
00133
00134 } rmff_cont_t;
00135
00136 typedef struct {
00137
00138 uint32_t object_id;
00139 uint32_t size;
00140 uint16_t object_version;
00141
00142 uint32_t num_packets;
00143 uint32_t next_data_header;
00144 } rmff_data_t;
00145
00146 typedef struct {
00147
00148 rmff_fileheader_t *fileheader;
00149 rmff_prop_t *prop;
00150 rmff_mdpr_t **streams;
00151 rmff_cont_t *cont;
00152 rmff_data_t *data;
00153 } rmff_header_t;
00154
00155 typedef struct {
00156
00157 uint16_t object_version;
00158
00159 uint16_t length;
00160 uint16_t stream_number;
00161 uint32_t timestamp;
00162 uint8_t reserved;
00163 uint8_t flags;
00164
00165 } rmff_pheader_t;
00166
00167
00168
00169
00170
00171 rmff_fileheader_t *rmff_new_fileheader(uint32_t num_headers);
00172
00173 rmff_prop_t *rmff_new_prop (
00174 uint32_t max_bit_rate,
00175 uint32_t avg_bit_rate,
00176 uint32_t max_packet_size,
00177 uint32_t avg_packet_size,
00178 uint32_t num_packets,
00179 uint32_t duration,
00180 uint32_t preroll,
00181 uint32_t index_offset,
00182 uint32_t data_offset,
00183 uint16_t num_streams,
00184 uint16_t flags );
00185
00186 rmff_mdpr_t *rmff_new_mdpr(
00187 uint16_t stream_number,
00188 uint32_t max_bit_rate,
00189 uint32_t avg_bit_rate,
00190 uint32_t max_packet_size,
00191 uint32_t avg_packet_size,
00192 uint32_t start_time,
00193 uint32_t preroll,
00194 uint32_t duration,
00195 const char *stream_name,
00196 const char *mime_type,
00197 uint32_t type_specific_len,
00198 const char *type_specific_data );
00199
00200 rmff_cont_t *rmff_new_cont(
00201 const char *title,
00202 const char *author,
00203 const char *copyright,
00204 const char *comment);
00205
00206 rmff_data_t *rmff_new_dataheader(
00207 uint32_t num_packets, uint32_t next_data_header);
00208
00209
00210
00211
00212 rmff_header_t *rmff_scan_header(const char *data);
00213
00214
00215
00216
00217
00218 void rmff_scan_pheader(rmff_pheader_t *h, char *data);
00219
00220
00221
00222
00223 rmff_header_t *rmff_scan_header_stream(int fd);
00224
00225
00226
00227
00228 void rmff_print_header(rmff_header_t *h);
00229
00230
00231
00232
00233 void rmff_fix_header(rmff_header_t *h);
00234
00235
00236
00237
00238 int rmff_get_header_size(rmff_header_t *h);
00239
00240
00241
00242
00243 int rmff_dump_header(rmff_header_t *h, void *buffer, int max);
00244
00245
00246
00247
00248 void rmff_dump_pheader(rmff_pheader_t *h, char *data);
00249
00250
00251
00252
00253 void rmff_free_header(rmff_header_t *h);
00254
00255 #endif