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

流媒体/Mpeg4/MP4

开发平台:

Visual C++

  1. #include "quicktime.h"
  2. int quicktime_smhd_init(quicktime_smhd_t *smhd)
  3. {
  4. smhd->version = 0;
  5. smhd->flags = 0;
  6. smhd->balance = 0;
  7. smhd->reserved = 0;
  8. }
  9. int quicktime_smhd_delete(quicktime_smhd_t *smhd)
  10. {
  11. }
  12. int quicktime_smhd_dump(quicktime_smhd_t *smhd)
  13. {
  14. printf("    sound media headern");
  15. printf("     version %dn", smhd->version);
  16. printf("     flags %dn", smhd->flags);
  17. printf("     balance %dn", smhd->balance);
  18. printf("     reserved %dn", smhd->reserved);
  19. }
  20. int quicktime_read_smhd(quicktime_t *file, quicktime_smhd_t *smhd)
  21. {
  22. smhd->version = quicktime_read_char(file);
  23. smhd->flags = quicktime_read_int24(file);
  24. smhd->balance = quicktime_read_int16(file);
  25. smhd->reserved = quicktime_read_int16(file);
  26. }
  27. int quicktime_write_smhd(quicktime_t *file, quicktime_smhd_t *smhd)
  28. {
  29. quicktime_atom_t atom;
  30. quicktime_atom_write_header(file, &atom, "smhd");
  31. quicktime_write_char(file, smhd->version);
  32. quicktime_write_int24(file, smhd->flags);
  33. if (file->use_mp4) {
  34. quicktime_write_int32(file, 0x00000000);
  35. } else {
  36. quicktime_write_int16(file, smhd->balance);
  37. quicktime_write_int16(file, smhd->reserved);
  38. }
  39. quicktime_atom_write_footer(file, &atom);
  40. }