[Flac] What is the magic code for Ogg FLAC?

Martin Leese martin.leese at stanfordalumni.org
Mon Feb 11 11:44:23 PST 2008


Josh Coalson <xflac at yahoo.com> wrote:

> I think everything you need is here:
> http://flac.sourceforge.net/ogg_mapping.html

" Ivo Emanuel Gon?alves " <justivo at gmail.com> wrote:

> I'd say it had enough info, but too much for what I needed.  I ended
> up finding the answer in oggenc/flac.c: it's "\177FLAC" not "fLaC" as
> ogginfo claimed.
>
> Is this right, Josh?  While my patched ogginfo now detects Ogg FLAC
> properly, I'm not sure if this is the correct method.  ogginfo only
> checks for magic and packet size.

I am not Josh, but this looks straightforward.
>From http://flac.sourceforge.net/ogg_mapping.html:
    Version 1.0 of the FLAC-to-Ogg mapping
    then is a simple identifying header followed by
    pure native FLAC data, as follows:

    * The first packet of a stream consists of:
          o The one-byte packet type 0x7F
          o The four-byte ASCII signature "FLAC",
                i.e. 0x46, 0x4C, 0x41, 0x43

As 0x7F = \177, yes this is right.

Regards,
Martin
-- 
Martin J Leese
E-mail: martin.leese at stanfordalumni.org
Web: http://members.tripod.com/martin_leese/


More information about the Flac mailing list