vorbis 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #
  7. # Most (everything but the number of channels and bitrate) is commented
  8. # out with `##' as it's not interesting to the average user. The most
  9. # probable things advanced users would want to uncomment are probably
  10. # the number of comments and the encoder version.
  11. #
  12. # --- Ogg Framing ---
  13. 0 string OggS Ogg data
  14. >4 byte !0 UNKNOWN REVISION %u
  15. ##>4 byte 0 revision 0
  16. >4 byte 0
  17. ##>>14 lelong x (Serial %lX)
  18. # --- First vorbis packet - general header ---
  19. >>28 string \x01vorbis \b, Vorbis audio,
  20. >>>35 lelong !0 UNKNOWN VERSION %lu,
  21. ##>>>35 lelong 0 version 0,
  22. >>>35 lelong 0
  23. >>>>39 ubyte 1 mono,
  24. >>>>39 ubyte 2 stereo,
  25. >>>>39 ubyte >2 %u channels,
  26. >>>>40 lelong x %lu Hz
  27. # Minimal, nominal and maximal bitrates specified when encoding
  28. >>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff \b,
  29. # The above tests if at least one of these is specified:
  30. >>>>>44 lelong !-1
  31. >>>>>>44 lelong x >%lu
  32. >>>>>48 lelong !-1
  33. >>>>>>48 lelong x ~%lu
  34. >>>>>52 lelong !-1
  35. >>>>>>52 lelong x <%lu
  36. >>>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff kbps
  37. # -- Second vorbis header packet - the comments
  38. >>>102 string \x03vorbis
  39. # A kludge to read the vendor string. It's a counted string, not a
  40. # zero-terminated one, so file(1) can't read it in a generic way.
  41. # libVorbis is the only one existing currently, so I detect specifically
  42. # it. The interesting value is the cvs date (8 digits decimal).
  43. ##>>>>113 string/c Xiphophorus\ libVorbis\ I \b, created by: Xiphophorus libVorbis I
  44. ##>>>>>137 string >00000000 %.8s
  45. # Map to beta version numbers:
  46. ##>>>>>>137 string <20000508 (<beta1 - prepublic)
  47. # The string has not changed from beta1 to 2 - they are indistinguishable.
  48. ##>>>>>>137 string 20000508 (beta1/2)
  49. ##>>>>>>137 string >20000508
  50. ##>>>>>>>137 string <20001031 (beta2-3)
  51. ##>>>>>>137 string 20001031 (beta3)
  52. ##>>>>>>137 string >20001031
  53. ##>>>>>>>137 string <20010225 (beta3-4)
  54. ##>>>>>>137 string 20010225 (beta4)
  55. ##>>>>>>137 string >20010225
  56. ##>>>>>>>137 string <20010615 (beta4-RC1)
  57. ##>>>>>>137 string 20010615 (RC1)
  58. ##>>>>>>137 string >20010615 (>RC1)
  59. # Then come the comments, again length-counted (and number-counted).
  60. # Some looping constructs and registers would allow reading them but now
  61. # it's impossible. However we can print the number of comments present
  62. # (skipping by the vendor string length):
  63. ##>>>>(109.l.113) lelong 0 \b, no comments
  64. ##>>>>(109.l+113) lelong >0 \b, %lu comments