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