illiminable
2004-Oct-09 23:53 UTC
[Flac-dev] liboggflac bug (flac.exe) : wrong header field
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.
Josh Coalson
2004-Oct-13 10:02 UTC
[Flac-dev] liboggflac bug (flac.exe) : wrong header field
--- illiminable <ogg@illiminable.com> wrote:> 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. "the spec is wrong in this case (if you look in the old html there is a little note to myself in comments but it got overlooked for the release). I updated the page to say 'not including this one'. the 'unknown' value is still OK to be zero since legal streams must have at least one more header packet (the vorbis comment). I put this packet count in because I wasn't sure if it would be required to know this info in advance, since the number of vorbis header packets is always known in advance. it may never actually be used. Josh __________________________________ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail
illiminable
2004-Oct-16 02:26 UTC
[Flac-dev] liboggflac bug (flac.exe) : wrong header field
----- Original Message ----- From: "Josh Coalson" <xflac@yahoo.com> To: "illiminable" <ogg@illiminable.com>; <flac-dev@xiph.org> Sent: Thursday, October 14, 2004 1:01 AM Subject: Re: [Flac-dev] liboggflac bug (flac.exe) : wrong header field>> The spec doc says... >> >> " A two-byte, big-endian binary number signifying the number of >> header >> (non-audio) packets, including this one. " > > the spec is wrong in this case (if you look in the old html > there is a little note to myself in comments but it got > overlooked for the release). >I thought it was probably something like that...> I updated the page to say 'not including this one'. > > the 'unknown' value is still OK to be zero since legal > streams must have at least one more header packet (the > vorbis comment). >Yeah... i know the zero value is ok... but i wanted to fill it in to make sure it's ok for all players. And also when it converts the old flac to the new flac, it fills in that field. All working now... can handle both formats... original ogg flac and the new ogg flac. Thanks, Zen.