mdat.c
上传用户:sun1608
上传日期:2007-02-02
资源大小:6116k
文件大小:1k
源码类别:

流媒体/Mpeg4/MP4

开发平台:

Visual C++

  1. #include "quicktime.h"
  2. int quicktime_mdat_init(quicktime_mdat_t *mdat)
  3. {
  4. mdat->size = 8;
  5. mdat->start = 0;
  6. }
  7. int quicktime_mdat_delete(quicktime_mdat_t *mdat)
  8. {
  9. }
  10. int quicktime_read_mdat(quicktime_t *file, quicktime_mdat_t *mdat, quicktime_atom_t *parent_atom)
  11. {
  12. mdat->size = parent_atom->size;
  13. mdat->start = parent_atom->start;
  14. quicktime_atom_skip(file, parent_atom);
  15. }
  16. int quicktime_write_mdat(quicktime_t *file, quicktime_mdat_t *mdat)
  17. {
  18. long position, size = 0, new_size = 0;
  19. int i, j;
  20. for(i = 0; i < file->total_atracks; i++)
  21. {
  22. new_size = quicktime_track_end(file->atracks[i].track);
  23. if(new_size > size) 
  24. size = new_size;
  25. for(j = 0; j < file->atracks[i].totalHintTracks; j++) {
  26. new_size = quicktime_track_end(file->atracks[i].hintTracks[j]);
  27. if(new_size > size) 
  28. size = new_size;
  29. }
  30. }
  31. for(i = 0; i < file->total_vtracks; i++)
  32. {
  33. new_size = quicktime_track_end(file->vtracks[i].track);
  34. if(new_size > size) 
  35. size = new_size;
  36. for(j = 0; j < file->vtracks[i].totalHintTracks; j++) {
  37. new_size = quicktime_track_end(file->vtracks[i].hintTracks[j]);
  38. if(new_size > size) 
  39. size = new_size;
  40. }
  41. }
  42. mdat->size = size;
  43. quicktime_set_position(file, mdat->start);
  44. quicktime_write_int32(file, mdat->size);
  45. quicktime_set_position(file, mdat->start + mdat->size);
  46. }