[Flac-dev] liboggflac bug (flac.exe) : wrong header field

illiminable ogg at illiminable.com
Sat Oct 9 23:51:58 PDT 2004


Just playing around with my new flac code, and did some tests with stuff 
from the reference tools, and i noticed that one of the fields in the first 
header is wrong. (The number of headers field is 1 less than it should be)

The spec doc says...

" A two-byte, big-endian binary number signifying the number of header 
(non-audio) packets, including this one. "

Here's a partial dump from a file created by flac.exe

Page Location : 0 to 79
Ver No      : 0
Head Flags  : 2
Granule Pos : 0
Serial No   : 7660
Seq No      : 0
Checksum    : 1670249472
Num Segs    : 1
------------------------
Head Size   : 28
Data Size   : 51
Page Size   : 79
Num Packets : 1
------ Packet  0 (51 bytes) -------
00000000: 7F 46 4C 41 43 01 00 00 03 66 4C 61 43 00 00 00
........

The 9th byte in says there are 3 headers (including this one...)
==================================
Page Location : 79 to 151
Ver No      : 0
Head Flags  : 0
Granule Pos : 0
Serial No   : 7660
Seq No      : 1
Checksum    : 12445430
Num Segs    : 1
------------------------
Head Size   : 28
Data Size   : 44
Page Size   : 72
Num Packets : 1
------ Packet  0 (44 bytes) -------
00000000: 04 00 00 28 20 00 00 00 72 65 66 65 72 65 6E 63
.....
This is the comment header packet (number 2)
===================================
Page Location : 151 to 580
Ver No      : 0
Head Flags  : 0
Granule Pos : 0
Serial No   : 7660
Seq No      : 2
Checksum    : 3279053945
Num Segs    : 2
------------------------
Head Size   : 29
Data Size   : 400
Page Size   : 429
Num Packets : 1
------ Packet  0 (400 bytes) -------
00000000: 03 00 01 8C 00 00 00 00 00 00 00 00 00 00 00 00
......

This is a seek table header packet (number 3) and notice the last header 
flag is not set.
=======================================

Page Location : 580 to 4724
Ver No      : 0
Head Flags  : 0
Granule Pos : 0
Serial No   : 7660
Seq No      : 3
Checksum    : 1559455392
Num Segs    : 17
------------------------
Head Size   : 44
Data Size   : 4100
Page Size   : 4144
Num Packets : 1
------ Packet  0 (4100 bytes) -------
00000000: 81 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00

This is a padding header (number 4) and the last header flag is set on this 
one.

Just thought you should know as it may mean that a decoder needs to detect 
the vendor string to identify this version and add one to the field, 
assuming people have created files with this already.

Or you could take the microsoft route... and just change the spec to say 
"The number of header *not including this one*" :)

Zen.






More information about the Flac-dev mailing list