vorbis 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. # FIXME: The first match has been made a search, so that it can skip
  14. # over prepended ID3 tags. This will work for MIME type detection, but
  15. # won't work for detecting other properties of the file (they all need
  16. # to be made relative to the search). In any case, if the file has ID3
  17. # tags, the ID3 information will be printed, not the Ogg information,
  18. # so until that's fixed, this doesn't matter.
  19. #
  20. # --- Ogg Framing ---
  21. 0 search/1000 OggS Ogg data
  22. !:mime application/ogg
  23. >4 byte !0 UNKNOWN REVISION %u
  24. ##>4 byte 0 revision 0
  25. >4 byte 0
  26. ##>>14 lelong x (Serial %lX)
  27. # non-Vorbis content: FLAC (Free Lossless Audio Codec, http://flac.sourceforge.net)
  28. >>28 string \x7fFLAC \b, FLAC audio
  29. # non-Vorbis content: Theora
  30. >>28 string \x80theora \b, Theora video
  31. # non-Vorbis content: Kate
  32. >>28 string \x80kate\0\0\0\0 \b, Kate
  33. >>>37 ubyte x v%u
  34. >>>38 ubyte x \b.%u,
  35. >>>40 byte 0 utf8 encoding,
  36. >>>40 byte !0 unknown character encoding,
  37. >>>60 string >\0 language %s,
  38. >>>60 string \0 no language set,
  39. >>>76 string >\0 category %s
  40. >>>76 string \0 no category set
  41. # non-Vorbis content: Skeleton
  42. >>28 string fishead\0 \b, Skeleton
  43. >>>36 short x v%u
  44. >>>40 short x \b.%u
  45. # non-Vorbis content: Speex
  46. >>28 string Speex\ \ \ \b, Speex audio
  47. # non-Vorbis content: OGM
  48. >>28 string \x01video\0\0\0 \b, OGM video
  49. >>>37 string/c div3 (DivX 3)
  50. >>>37 string/c divx (DivX 4)
  51. >>>37 string/c dx50 (DivX 5)
  52. >>>37 string/c xvid (XviD)
  53. # --- First vorbis packet - general header ---
  54. >>28 string \x01vorbis \b, Vorbis audio,
  55. >>>35 lelong !0 UNKNOWN VERSION %lu,
  56. ##>>>35 lelong 0 version 0,
  57. >>>35 lelong 0
  58. >>>>39 ubyte 1 mono,
  59. >>>>39 ubyte 2 stereo,
  60. >>>>39 ubyte >2 %u channels,
  61. >>>>40 lelong x %lu Hz
  62. # Minimal, nominal and maximal bitrates specified when encoding
  63. >>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff \b,
  64. # The above tests if at least one of these is specified:
  65. >>>>>52 lelong !-1
  66. # Vorbis RC2 has a bug which puts -1000 in the min/max bitrate fields
  67. # instead of -1.
  68. # Vorbis 1.0 uses 0 instead of -1.
  69. >>>>>>52 lelong !0
  70. >>>>>>>52 lelong !-1000
  71. >>>>>>>>52 lelong x <%lu
  72. >>>>>48 lelong !-1
  73. >>>>>>48 lelong x ~%lu
  74. >>>>>44 lelong !-1
  75. >>>>>>44 lelong !-1000
  76. >>>>>>>44 lelong !0
  77. >>>>>>>>44 lelong x >%lu
  78. >>>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff bps
  79. # -- Second vorbis header packet - the comments
  80. # A kludge to read the vendor string. It's a counted string, not a
  81. # zero-terminated one, so file(1) can't read it in a generic way.
  82. # libVorbis is the only one existing currently, so I detect specifically
  83. # it. The interesting value is the cvs date (8 digits decimal).
  84. # Post-RC1 Ogg files have the second header packet (and thus the version)
  85. # in a different place, so we must use an indirect offset.
  86. >>>(84.b+85) string \x03vorbis
  87. >>>>(84.b+96) string/c Xiphophorus\ libVorbis\ I \b, created by: Xiphophorus libVorbis I
  88. >>>>>(84.b+120) string >00000000
  89. # Map to beta version numbers:
  90. >>>>>>(84.b+120) string <20000508 (<beta1, prepublic)
  91. >>>>>>(84.b+120) string 20000508 (1.0 beta 1 or beta 2)
  92. >>>>>>(84.b+120) string >20000508
  93. >>>>>>>(84.b+120) string <20001031 (beta2-3)
  94. >>>>>>(84.b+120) string 20001031 (1.0 beta 3)
  95. >>>>>>(84.b+120) string >20001031
  96. >>>>>>>(84.b+120) string <20010225 (beta3-4)
  97. >>>>>>(84.b+120) string 20010225 (1.0 beta 4)
  98. >>>>>>(84.b+120) string >20010225
  99. >>>>>>>(84.b+120) string <20010615 (beta4-RC1)
  100. >>>>>>(84.b+120) string 20010615 (1.0 RC1)
  101. >>>>>>(84.b+120) string 20010813 (1.0 RC2)
  102. >>>>>>(84.b+120) string 20010816 (RC2 - Garf tuned v1)
  103. >>>>>>(84.b+120) string 20011014 (RC2 - Garf tuned v2)
  104. >>>>>>(84.b+120) string 20011217 (1.0 RC3)
  105. >>>>>>(84.b+120) string 20011231 (1.0 RC3)
  106. # Some pre-1.0 CVS snapshots still had "Xiphphorus"...
  107. >>>>>>(84.b+120) string >20011231 (pre-1.0 CVS)
  108. # For the 1.0 release, Xiphophorus is replaced by Xiph.Org
  109. >>>>(84.b+96) string/c Xiph.Org\ libVorbis\ I \b, created by: Xiph.Org libVorbis I
  110. >>>>>(84.b+117) string >00000000
  111. >>>>>>(84.b+117) string <20020717 (pre-1.0 CVS)
  112. >>>>>>(84.b+117) string 20020717 (1.0)
  113. >>>>>>(84.b+117) string 20030909 (1.0.1)
  114. >>>>>>(84.b+117) string 20040629 (1.1.0 RC1)