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