DXHEAD.H 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*---- DXhead.h --------------------------------------------
  2. decoder MPEG Layer III
  3. handle Xing header
  4. Copyright 1998 Xing Technology Corp.
  5. -----------------------------------------------------------*/
  6. // A Xing header may be present in the ancillary
  7. // data field of the first frame of an mp3 bitstream
  8. // The Xing header (optionally) contains
  9. // frames total number of audio frames in the bitstream
  10. // bytes total number of bytes in the bitstream
  11. // toc table of contents
  12. // toc (table of contents) gives seek points
  13. // for random access
  14. // the ith entry determines the seek point for
  15. // i-percent duration
  16. // seek point in bytes = (toc[i]/256.0) * total_bitstream_bytes
  17. // e.g. half duration seek point = (toc[50]/256.0) * total_bitstream_bytes
  18. #define FRAMES_FLAG 0x0001
  19. #define BYTES_FLAG 0x0002
  20. #define TOC_FLAG 0x0004
  21. #define VBR_SCALE_FLAG 0x0008
  22. #define FRAMES_AND_BYTES (FRAMES_FLAG | BYTES_FLAG)
  23. int SeekPoint(unsigned char TOC[100], int file_bytes, float percent);
  24. // return seekpoint in bytes (may be at eof if percent=100.0)
  25. // TOC = table of contents from Xing header
  26. // file_bytes = number of bytes in mp3 file
  27. // percent = play time percentage of total playtime. May be
  28. // fractional (e.g. 87.245)