2 #------------------------------------------------------------------------------
3 # vorbis: file(1) magic for Ogg/Vorbis files
5 # From Felix von Leitner <leitner@fefe.de>
6 # Extended by Beni Cherniavsky <cben@crosswinds.net>
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.
14 0 string OggS Ogg data
15 >4 byte !0 UNKNOWN REVISION %u
16 ##>4 byte 0 revision 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,
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:
32 >>>>>>44 lelong x >%lu
34 >>>>>>48 lelong x ~%lu
36 >>>>>>52 lelong x <%lu
37 >>>>>48 string <\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff kbps
38 # -- Second vorbis header packet - the comments
39 >>>102 string \x03vorbis
40 # A kludge to read the vendor string. It's a counted string, not a
41 # zero-terminated one, so file(1) can't read it in a generic way.
42 # libVorbis is the only one existing currently, so I detect specifically
43 # it. The interesting value is the cvs date (8 digits decimal).
44 ##>>>>113 string/c Xiphophorus\ libVorbis\ I \b, created by: Xiphophorus libVorbis I
45 ##>>>>>137 string >00000000 %.8s
46 # Map to beta version numbers:
47 ##>>>>>>137 string <20000508 (<beta1 - prepublic)
48 # The string has not changed from beta1 to 2 - they are indistinguishable.
49 ##>>>>>>137 string 20000508 (beta1/2)
50 ##>>>>>>137 string >20000508
51 ##>>>>>>>137 string <20001031 (beta2-3)
52 ##>>>>>>137 string 20001031 (beta3)
53 ##>>>>>>137 string >20001031
54 ##>>>>>>>137 string <20010225 (beta3-4)
55 ##>>>>>>137 string 20010225 (beta4)
56 ##>>>>>>137 string >20010225
57 ##>>>>>>>137 string <20010615 (beta4-RC1)
58 ##>>>>>>137 string 20010615 (RC1)
59 ##>>>>>>137 string >20010615 (>RC1)
60 # Then come the comments, again length-counted (and number-counted).
61 # Some looping constructs and registers would allow reading them but now
62 # it's impossible. However we can print the number of comments present
63 # (skipping by the vendor string length):
64 ##>>>>(109.l.113) lelong 0 \b, no comments
65 ##>>>>(109.l+113) lelong >0 \b, %lu comments