funcprotos.h
上传用户:luping1608
上传日期:2007-01-06
资源大小:38k
文件大小:17k
源码类别:

多媒体

开发平台:

Unix_Linux

  1. #ifndef FUNCPROTOS_H
  2. #define FUNCPROTOS_H
  3. // atom handling routines
  4. int quicktime_atom_reset(quicktime_atom_t *atom);
  5. int quicktime_atom_read_header(FILE *stream, quicktime_atom_t *atom);
  6. int quicktime_atom_is(quicktime_atom_t *atom, char *type);
  7. long quicktime_atom_read_size(char *data);
  8. int quicktime_atom_read_type(char *data, char *output);
  9. int quicktime_atom_skip(quicktime_t *file, quicktime_atom_t *atom);
  10. int quicktime_atom_write_header(quicktime_t *file, quicktime_atom_t *atom, char *text);
  11. int quicktime_atom_write_footer(quicktime_t *file, quicktime_atom_t *atom);
  12. // utilities for reading data types
  13. int quicktime_read_data(quicktime_t *file, char *data, int size);
  14. int quicktime_write_data(quicktime_t *file, char *data, int size);
  15. int quicktime_read_pascal(quicktime_t *file, char *data);
  16. int quicktime_write_pascal(quicktime_t *file, char *data);
  17. float quicktime_read_fixed32(quicktime_t *file);
  18. int quicktime_write_fixed32(quicktime_t *file, float number);
  19. float quicktime_read_fixed16(quicktime_t *file);
  20. int quicktime_write_fixed16(quicktime_t *file, float number);
  21. long quicktime_read_int32(quicktime_t *file);
  22. int quicktime_write_int32(quicktime_t *file, long number);
  23. long quicktime_read_int24(quicktime_t *file);
  24. int quicktime_write_int24(quicktime_t *file, long number);
  25. int quicktime_read_int16(quicktime_t *file);
  26. int quicktime_write_int16(quicktime_t *file, int number);
  27. int quicktime_read_char(quicktime_t *file);
  28. int quicktime_write_char(quicktime_t *file, char x);
  29. int quicktime_read_char32(quicktime_t *file, char *string);
  30. int quicktime_write_char32(quicktime_t *file, char *string);
  31. int quicktime_copy_char32(char *output, char *input);
  32. long quicktime_position(quicktime_t *file);
  33. int quicktime_set_position(quicktime_t *file, long position);
  34. int quicktime_print_chars(char *desc, char *input, int len);
  35. int quicktime_match_32(char *input, char *output);
  36. // initializers for every atom
  37. int quicktime_matrix_init(quicktime_matrix_t *matrix);
  38. int quicktime_edts_init_table(quicktime_edts_t *edts);
  39. int quicktime_edts_init(quicktime_edts_t *edts);
  40. int quicktime_elst_init(quicktime_elst_t *elst);
  41. int quicktime_elst_init_all(quicktime_elst_t *elst);
  42. int quicktime_elst_table_init(quicktime_elst_table_t *table); // initialize a table
  43. int quicktime_tkhd_init(quicktime_tkhd_t *tkhd);
  44. int quicktime_tkhd_init_video(quicktime_t *file, quicktime_tkhd_t *tkhd, int frame_w, int frame_h);
  45. int quicktime_ctab_init(quicktime_ctab_t *ctab);
  46. int quicktime_mjqt_init(quicktime_mjqt_t *mjqt);
  47. int quicktime_mjht_init(quicktime_mjht_t *mjht);
  48. int quicktime_stsd_table_init(quicktime_stsd_table_t *table);
  49. int quicktime_stsd_init(quicktime_stsd_t *stsd);
  50. int quicktime_stsd_init_table(quicktime_stsd_t *stsd);
  51. int quicktime_stsd_init_video(quicktime_t *file, quicktime_stsd_t *stsd, int frame_w, int frame_h, float frame_rate, char *compression);
  52. int quicktime_stsd_init_audio(quicktime_t *file, quicktime_stsd_t *stsd, int channels, int sample_rate, int bits, char *compressor);
  53. int quicktime_stts_init(quicktime_stts_t *stts);
  54. int quicktime_stts_init_table(quicktime_stts_t *stts);
  55. int quicktime_stts_init_video(quicktime_t *file, quicktime_stts_t *stts, float frame_rate);
  56. int quicktime_stts_init_audio(quicktime_t *file, quicktime_stts_t *stts, int sample_rate);
  57. int quicktime_stss_init(quicktime_stss_t *stss);
  58. int quicktime_stsc_init(quicktime_stsc_t *stsc);
  59. int quicktime_stsc_init_video(quicktime_t *file, quicktime_stsc_t *stsc);
  60. int quicktime_stsc_init_audio(quicktime_t *file, quicktime_stsc_t *stsc, int sample_rate);
  61. int quicktime_stsz_init(quicktime_stsz_t *stsz);
  62. int quicktime_stsz_init_video(quicktime_t *file, quicktime_stsz_t *stsz);
  63. int quicktime_stsz_init_audio(quicktime_t *file, quicktime_stsz_t *stsz, int channels, int bits);
  64. int quicktime_stco_init(quicktime_stco_t *stco);
  65. int quicktime_stco_init_common(quicktime_t *file, quicktime_stco_t *stco);
  66. int quicktime_stbl_init(quicktime_stbl_t *tkhd);
  67. int quicktime_stbl_init_video(quicktime_t *file, quicktime_stbl_t *stbl, int frame_w, int frame_h, float frame_rate, char *compressor);
  68. int quicktime_stbl_init_audio(quicktime_t *file, quicktime_stbl_t *stbl, int channels, int sample_rate, int bits, char *compressor);
  69. int quicktime_vmhd_init(quicktime_vmhd_t *vmhd);
  70. int quicktime_vmhd_init_video(quicktime_t *file, quicktime_vmhd_t *vmhd, int frame_w, int frame_h, float frame_rate);
  71. int quicktime_smhd_init(quicktime_smhd_t *smhd);
  72. int quicktime_dref_table_init(quicktime_dref_table_t *table);
  73. int quicktime_dref_init_all(quicktime_dref_t *dref);
  74. int quicktime_dref_init(quicktime_dref_t *dref);
  75. int quicktime_dinf_init_all(quicktime_dinf_t *dinf);
  76. int quicktime_dinf_init(quicktime_dinf_t *dinf);
  77. int quicktime_minf_init(quicktime_minf_t *minf);
  78. int quicktime_minf_init_video(quicktime_t *file, quicktime_minf_t *minf, int frame_w, int frame_h, float frame_rate, char *compressor);
  79. int quicktime_minf_init_audio(quicktime_t *file, quicktime_minf_t *minf, int channels, int sample_rate, int bits, char *compressor);
  80. int quicktime_mdhd_init(quicktime_mdhd_t *mdhd);
  81. int quicktime_mdhd_init_video(quicktime_t *file, quicktime_mdhd_t *mdhd, int frame_w, int frame_h, float frame_rate);
  82. int quicktime_mdhd_init_audio(quicktime_t *file, quicktime_mdhd_t *mdhd, int channels, int sample_rate, int bits, char *compressor);
  83. int quicktime_mdia_init(quicktime_mdia_t *mdia);
  84. int quicktime_mdia_init_video(quicktime_t *file, quicktime_mdia_t *mdia, int frame_w, int frame_h, float frame_rate, char *compressor);
  85. int quicktime_mdia_init_audio(quicktime_t *file, quicktime_mdia_t *mdia, int channels, int sample_rate, int bits, char *compressor);
  86. int quicktime_trak_init(quicktime_trak_t *trak);
  87. int quicktime_trak_init_video(quicktime_t *file, quicktime_trak_t *trak, int frame_w, int frame_h, float frame_rate, char *compressor);
  88. int quicktime_trak_init_audio(quicktime_t *file, quicktime_trak_t *trak, int channels, int sample_rate, int bits, char *compressor);
  89. int quicktime_mvhd_init(quicktime_mvhd_t *mvhd);
  90. int quicktime_mhvd_init_video(quicktime_t *file, quicktime_mvhd_t *mvhd, float frame_rate);
  91. int quicktime_moov_init(quicktime_moov_t *moov);
  92. int quicktime_mdat_init(quicktime_mdat_t *mdat);
  93. int quicktime_init(quicktime_t *file);
  94. int quicktime_hdlr_init(quicktime_hdlr_t *hdlr);
  95. int quicktime_hdlr_init_video(quicktime_hdlr_t *hdlr);
  96. int quicktime_hdlr_init_audio(quicktime_hdlr_t *hdlr);
  97. int quicktime_hdlr_init_data(quicktime_hdlr_t *hdlr);
  98. // deleters for every atom
  99. int quicktime_matrix_delete(quicktime_matrix_t *matrix);
  100. int quicktime_edts_delete(quicktime_edts_t *edts);
  101. int quicktime_elst_delete(quicktime_elst_t *elst);
  102. int quicktime_elst_table_delete(quicktime_elst_table_t *table);
  103. int quicktime_tkhd_delete(quicktime_tkhd_t *tkhd);
  104. int quicktime_ctab_delete(quicktime_ctab_t *ctab);
  105. int quicktime_mjqt_delete(quicktime_mjqt_t *mjqt);
  106. int quicktime_mjht_delete(quicktime_mjht_t *mjht);
  107. int quicktime_stsd_table_delete(quicktime_stsd_table_t *table);
  108. int quicktime_stsd_delete(quicktime_stsd_t *stsd);
  109. int quicktime_stts_delete(quicktime_stts_t *stts);
  110. int quicktime_stss_delete(quicktime_stss_t *stss);
  111. int quicktime_stsc_delete(quicktime_stsc_t *stsc);
  112. int quicktime_stsz_delete(quicktime_stsz_t *stsz);
  113. int quicktime_stco_delete(quicktime_stco_t *stco);
  114. int quicktime_stbl_delete(quicktime_stbl_t *stbl);
  115. int quicktime_vmhd_delete(quicktime_vmhd_t *vmhd);
  116. int quicktime_smhd_delete(quicktime_smhd_t *smhd);
  117. int quicktime_dref_table_delete(quicktime_dref_table_t *table);
  118. int quicktime_dref_delete(quicktime_dref_t *dref);
  119. int quicktime_dinf_delete(quicktime_dinf_t *dinf);
  120. int quicktime_minf_delete(quicktime_minf_t *minf);
  121. int quicktime_mdhd_delete(quicktime_mdhd_t *mdhd);
  122. int quicktime_mdia_delete(quicktime_mdia_t *mdia);
  123. int quicktime_trak_delete(quicktime_trak_t *trak);
  124. quicktime_trak_t* quicktime_add_track(quicktime_moov_t *moov);
  125. int quicktime_mvhd_delete(quicktime_mvhd_t *mvhd);
  126. int quicktime_moov_delete(quicktime_moov_t *moov);
  127. int quicktime_mdat_delete(quicktime_mdat_t *moov);
  128. int quicktime_delete(quicktime_t *file);
  129. int quicktime_hdlr_delete(quicktime_hdlr_t *hdlr);
  130. // dumpers for every atom
  131. int quicktime_matrix_dump(quicktime_matrix_t *matrix);
  132. int quicktime_edts_dump(quicktime_edts_t *edts);
  133. int quicktime_elst_dump(quicktime_elst_t *elst);
  134. int quicktime_elst_table_dump(quicktime_elst_table_t *table);
  135. int quicktime_tkhd_dump(quicktime_tkhd_t *tkhd);
  136. int quicktime_ctab_dump(quicktime_ctab_t *ctab);
  137. int quicktime_mjqt_dump(quicktime_mjqt_t *mjqt);
  138. int quicktime_mjht_dump(quicktime_mjht_t *mjht);
  139. int quicktime_stsd_table_dump(void *minf_ptr, quicktime_stsd_table_t *table);
  140. int quicktime_stsd_audio_dump(quicktime_stsd_table_t *table);
  141. int quicktime_stsd_video_dump(quicktime_stsd_table_t *table);
  142. int quicktime_stsd_dump(void *minf_ptr, quicktime_stsd_t *stsd);
  143. int quicktime_stts_dump(quicktime_stts_t *stts);
  144. int quicktime_stss_dump(quicktime_stss_t *stss);
  145. int quicktime_stsc_dump(quicktime_stsc_t *stsc);
  146. int quicktime_stsz_dump(quicktime_stsz_t *stsz);
  147. int quicktime_stco_dump(quicktime_stco_t *stco);
  148. int quicktime_stbl_dump(void *minf_ptr, quicktime_stbl_t *stbl);
  149. int quicktime_vmhd_dump(quicktime_vmhd_t *vmhd);
  150. int quicktime_smhd_dump(quicktime_smhd_t *smhd);
  151. int quicktime_dref_table_dump(quicktime_dref_table_t *table);
  152. int quicktime_dref_dump(quicktime_dref_t *dref);
  153. int quicktime_dinf_dump(quicktime_dinf_t *dinf);
  154. int quicktime_minf_dump(quicktime_minf_t *minf);
  155. int quicktime_mdhd_dump(quicktime_mdhd_t *mdhd);
  156. int quicktime_mdia_dump(quicktime_mdia_t *mdia);
  157. int quicktime_trak_dump(quicktime_trak_t *trak);
  158. int quicktime_dump_mvhd(quicktime_mvhd_t *mvhd);
  159. int quicktime_moov_dump(quicktime_moov_t *moov);
  160. int quicktime_hdlr_dump(quicktime_hdlr_t *hdlr);
  161. // storage for every type of atom
  162. int quicktime_read_moov(quicktime_t *file, quicktime_moov_t *moov, quicktime_atom_t *parent_atom);
  163. int quicktime_write_moov(quicktime_t *file, quicktime_moov_t *moov);
  164. int quicktime_read_mdat(quicktime_t *file, quicktime_mdat_t *mdat, quicktime_atom_t *parent_atom);
  165. int quicktime_write_mdat(quicktime_t *file, quicktime_mdat_t *mdat);
  166. int quicktime_read_matrix(quicktime_t *file, quicktime_matrix_t *matrix);
  167. int quicktime_write_matrix(quicktime_t *file, quicktime_matrix_t *matrix);
  168. int quicktime_read_ctab(quicktime_t *file, quicktime_ctab_t *ctab);
  169. int quicktime_read_trak(quicktime_t *file, quicktime_trak_t *trak, quicktime_atom_t *parent_atom);
  170. int quicktime_write_trak(quicktime_t *file, quicktime_trak_t *trak, long moov_time_scale);
  171. int quicktime_read_edts(quicktime_t *file, quicktime_edts_t *edts, quicktime_atom_t *edts_atom);
  172. int quicktime_write_edts(quicktime_t *file, quicktime_edts_t *edts, long duration);
  173. int quicktime_read_elst(quicktime_t *file, quicktime_elst_t *elst);
  174. int quicktime_write_elst(quicktime_t *file, quicktime_elst_t *elst, long duration);
  175. int quicktime_read_elst_table(quicktime_t *file, quicktime_elst_table_t *table);
  176. int quicktime_write_elst_table(quicktime_t *file, quicktime_elst_table_t *table, long duration);
  177. int quicktime_read_tkhd(quicktime_t *file, quicktime_tkhd_t *tkhd);
  178. int quicktime_write_tkhd(quicktime_t *file, quicktime_tkhd_t *tkhd);
  179. int quicktime_read_mvhd(quicktime_t *file, quicktime_mvhd_t *mvhd);
  180. int quicktime_write_mvhd(quicktime_t *file, quicktime_mvhd_t *mvhd);
  181. int quicktime_read_mdhd(quicktime_t *file, quicktime_mdhd_t *mdhd);
  182. int quicktime_read_mdia(quicktime_t *file, quicktime_mdia_t *mdia, quicktime_atom_t *parent_atom);
  183. int quicktime_write_mdia(quicktime_t *file, quicktime_mdia_t *mdia);
  184. int quicktime_read_dref_table(quicktime_t *file, quicktime_dref_table_t *table);
  185. int quicktime_write_dref_table(quicktime_t *file, quicktime_dref_table_t *table);
  186. int quicktime_read_dref(quicktime_t *file, quicktime_dref_t *dref);
  187. int quicktime_write_dref(quicktime_t *file, quicktime_dref_t *dref);
  188. int quicktime_read_dinf(quicktime_t *file, quicktime_dinf_t *dinf, quicktime_atom_t *dinf_atom);
  189. int quicktime_write_dinf(quicktime_t *file, quicktime_dinf_t *dinf);
  190. int quicktime_read_minf(quicktime_t *file, quicktime_minf_t *minf, quicktime_atom_t *parent_atom);
  191. int quicktime_read_vmhd(quicktime_t *file, quicktime_vmhd_t *vmhd);
  192. int quicktime_write_vmhd(quicktime_t *file, quicktime_vmhd_t *vmhd);
  193. int quicktime_read_smhd(quicktime_t *file, quicktime_smhd_t *smhd);
  194. int quicktime_write_smhd(quicktime_t *file, quicktime_smhd_t *smhd);
  195. int quicktime_read_stbl(quicktime_t *file, quicktime_minf_t *minf, quicktime_stbl_t *stbl, quicktime_atom_t *parent_atom);
  196. int quicktime_write_stbl(quicktime_t *file, quicktime_minf_t *minf, quicktime_stbl_t *stbl);
  197. int quicktime_read_stsd(quicktime_t *file, quicktime_minf_t *minf, quicktime_stsd_t *stsd);
  198. int quicktime_read_stsd_table(quicktime_t *file, quicktime_minf_t *minf, quicktime_stsd_table_t *table);
  199. int quicktime_write_stsd_table(quicktime_t *file, quicktime_minf_t *minf, quicktime_stsd_table_t *table);
  200. int quicktime_read_stsd_audio(quicktime_t *file, quicktime_stsd_table_t *table, quicktime_atom_t *parent_atom);
  201. int quicktime_write_stsd_audio(quicktime_t *file, quicktime_stsd_table_t *table);
  202. int quicktime_read_stsd_video(quicktime_t *file, quicktime_stsd_table_t *table, quicktime_atom_t *parent_atom);
  203. int quicktime_write_stsd_video(quicktime_t *file, quicktime_stsd_table_t *table);
  204. int quicktime_read_stts(quicktime_t *file, quicktime_stts_t *stts);
  205. int quicktime_write_stts(quicktime_t *file, quicktime_stts_t *stts);
  206. int quicktime_read_stss(quicktime_t *file, quicktime_stss_t *stss);
  207. int quicktime_write_stss(quicktime_t *file, quicktime_stss_t *stss);
  208. int quicktime_read_stsc(quicktime_t *file, quicktime_stsc_t *stsc);
  209. int quicktime_write_stsc(quicktime_t *file, quicktime_stsc_t *stsc);
  210. int quicktime_read_stsz(quicktime_t *file, quicktime_stsz_t *stsz);
  211. int quicktime_write_stsz(quicktime_t *file, quicktime_stsz_t *stsz);
  212. int quicktime_read_stco(quicktime_t *file, quicktime_stco_t *stco);
  213. int quicktime_write_stco(quicktime_t *file, quicktime_stco_t *stco);
  214. int quicktime_read_hdlr(quicktime_t *file, quicktime_hdlr_t *hdlr);
  215. int quicktime_write_hdlr(quicktime_t *file, quicktime_hdlr_t *hdlr);
  216. // routines for codecs
  217. int quicktime_init_vcodecs(quicktime_video_map_t *vtrack);
  218. int quicktime_init_acodecs(quicktime_audio_map_t *atrack);
  219. int quicktime_delete_vcodecs(quicktime_video_map_t *vtrack);
  220. int quicktime_delete_acodecs(quicktime_audio_map_t *atrack);
  221. // Most codecs don't specify the actual number of bits on disk in the stbl.
  222. // Convert the samples to the number of bytes for reading depending on the codec.
  223. long quicktime_samples_to_bytes(quicktime_trak_t *track, long samples);
  224. // chunks always start on 1
  225. // samples start on 0
  226. // queries for every atom
  227. // the starting sample in the given chunk
  228. long quicktime_sample_of_chunk(quicktime_trak_t *trak, long chunk);
  229. // number of samples in the chunk
  230. long quicktime_chunk_samples(quicktime_trak_t *trak, long chunk);
  231. // the chunk containing the sample
  232. int quicktime_chunk_of_sample(long *chunk_sample, long *chunk, quicktime_trak_t *trak, long sample);
  233. // the byte offset from mdat start of the chunk
  234. long quicktime_chunk_to_offset(quicktime_trak_t *trak, long chunk);
  235. // the chunk of any offset from mdat start
  236. long quicktime_offset_to_chunk(long *chunk_offset, quicktime_trak_t *trak, long offset);
  237. // the total number of samples in the track depending on the access mode
  238. long quicktime_track_samples(quicktime_t *file, quicktime_trak_t *trak);
  239. // length of track in timescale
  240. int quicktime_trak_duration(quicktime_trak_t *trak, long *duration, long *timescale);
  241. // total bytes between the two samples
  242. long quicktime_sample_range_size(quicktime_trak_t *trak, long chunk_sample, long sample);
  243. // update the position pointers in all the tracks after a set_position
  244. int quicktime_update_positions(quicktime_t *file);
  245. // converting between mdat offsets to samples
  246. long quicktime_sample_to_offset(quicktime_trak_t *trak, long sample);
  247. long quicktime_offset_to_sample(quicktime_trak_t *trak, long offset);
  248. quicktime_trak_t* quicktime_add_trak(quicktime_moov_t *moov);
  249. int quicktime_delete_trak(quicktime_moov_t *moov);
  250. int quicktime_get_timescale(float frame_rate);
  251. // update all the tables after writing a buffer
  252. // set sample_size to 0 if no sample size should be set
  253. int quicktime_update_tables(quicktime_trak_t *trak, 
  254. long offset, 
  255. long chunk, 
  256. long sample, 
  257. long samples, 
  258. long sample_size);
  259. int quicktime_init_video_map(quicktime_video_map_t *vtrack, quicktime_trak_t *trak);
  260. int quicktime_delete_video_map(quicktime_video_map_t *vtrack);
  261. int quicktime_init_audio_map(quicktime_audio_map_t *atrack, quicktime_trak_t *trak);
  262. int quicktime_delete_audio_map(quicktime_audio_map_t *atrack);
  263. int quicktime_update_stco(quicktime_stco_t *stco, long chunk, long offset);
  264. int quicktime_update_stsc(quicktime_stsc_t *stsc, long chunk, long samples);
  265. int quicktime_update_stsz(quicktime_stsz_t *stsz, long sample, long sample_size);
  266. int quicktime_trak_fix_counts(quicktime_t *file, quicktime_trak_t *trak);
  267. int quicktime_update_durations(quicktime_moov_t *moov);
  268. unsigned long quicktime_current_time();
  269. // for making streamable
  270. int quicktime_shift_offsets(quicktime_moov_t *moov, long offset);
  271. #endif