vorbis 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #------------------------------------------------------------------------------
  2. # vorbis: file(1) magic for Ogg/Vorbis files
  3. #
  4. # From Felix von Leitner <leitner@fefe.de>
  5. # Extended by Beni Cherniavsky <cben@crosswinds.net>
  6. # Further extended by Greg Wooledge <greg@wooledge.org>
  7. #
  8. # Most (everything but the number of channels and bitrate) is commented
  9. # out with `##' as it's not interesting to the average user. The most
  10. # probable things advanced users would want to uncomment are probably
  11. # the number of comments and the encoder version.
  12. #
  13. # --- Ogg Framing ---
  14. 0 string OggS Ogg data
  15. >4 byte !0 UNKNOWN REVISION %u
  16. ##>4 byte 0 revision 0
  17. >4 byte 0
  18. ##>>14 lelong x (Serial %lX)
  19. # --- First vorbis packet - general header ---
  20. >>28 string \x01vorbis \b, Vorbis audio,
  21. >>>35 lelong !0 UNKNOWN VERSION %lu,
  22. ##>>>35 lelong 0 version 0,
  23. >>>35 lelong 0
  24. >>>>39 ubyte 1 mono,
  25. >>>>39 ubyte 2 stereo,
  26. >>>>39 ubyte >2 %u channels,
  27. >>>>40 lelong x %lu Hz
  28. # Minimal, nominal and maximal bitrates specified when encoding
  29. >>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff \b,
  30. # The above tests if at least one of these is specified:
  31. >>>>>44 lelong !-1
  32. # Vorbis RC2 has a bug which puts -1000 in the min/max bitrate fields
  33. # instead of -1.
  34. >>>>>>44 lelong !-1000
  35. >>>>>>>44 lelong x >%lu
  36. >>>>>48 lelong !-1
  37. >>>>>>48 lelong x ~%lu
  38. >>>>>52 lelong !-1
  39. >>>>>>52 lelong !-1000
  40. >>>>>>>52 lelong x <%lu
  41. >>>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff kbps
  42. # -- Second vorbis header packet - the comments
  43. # A kludge to read the vendor string. It's a counted string, not a
  44. # zero-terminated one, so file(1) can't read it in a generic way.
  45. # libVorbis is the only one existing currently, so I detect specifically
  46. # it. The interesting value is the cvs date (8 digits decimal).
  47. # Post-RC1 Ogg files have the second header packet (and thus the version)
  48. # in a different place, so we must use an indirect offset.
  49. >>>(84.b+85) string \x03vorbis
  50. >>>>(84.b+96) string/c Xiphophorus\ libVorbis\ I \b, created by: Xiphophorus libVorbis I
  51. >>>>>(84.b+120) string >00000000 %.8s
  52. # Map to beta version numbers:
  53. >>>>>>(84.b+120) string <20000508 (<beta1 - prepublic)
  54. # The string has not changed from beta1 to 2 - they are indistinguishable.
  55. >>>>>>(84.b+120) string 20000508 (beta1/2)
  56. >>>>>>(84.b+120) string >20000508
  57. >>>>>>>(84.b+120) string <20001031 (beta2-3)
  58. >>>>>>(84.b+120) string 20001031 (beta3)
  59. >>>>>>(84.b+120) string >20001031
  60. >>>>>>>(84.b+120) string <20010225 (beta3-4)
  61. >>>>>>(84.b+120) string 20010225 (beta4)
  62. >>>>>>(84.b+120) string >20010225
  63. >>>>>>>(84.b+120) string <20010615 (beta4-RC1)
  64. >>>>>>(84.b+120) string 20010615 (RC1)
  65. >>>>>>(84.b+120) string 20010813 (RC2)
  66. >>>>>>(84.b+120) string 20010816 (RC2 - Garf tuned v1)
  67. >>>>>>(84.b+120) string 20011014 (RC2 - Garf tuned v2)
  68. >>>>>>(84.b+120) string 20011217 (pre-RC3 CVS)
  69. >>>>>>(84.b+120) string 20011231 (RC3)
  70. # Then come the comments, again length-counted (and number-counted).
  71. # Some looping constructs and registers would allow reading them but now
  72. # it's impossible. However we can print the number of comments present
  73. # (skipping by the vendor string length):
  74. ##>>>>(109.l.113) lelong 0 \b, no comments
  75. ##>>>>(109.l+113) lelong >0 \b, %lu comments