Quantcast
Channel: Conrad Parker
Viewing all articles
Browse latest Browse all 25

How oggz-validate works

$
0
0

oggz-validate is a tool for checking the conformance of Ogg files against the Ogg logical bitstream framing specification and RFC3533. It is used by validator.xiph.org an online conformance-checking service.

oggz-validate builds on the correctness checks imposed by liboggz when writing Ogg packets. Whereas the low-level libogg simply allows an application to construct arbitrary Ogg packets and push them into a stream, liboggz checks each packet against the basic constraints:

  • Packet belongs to unknown serialno
  • Granulepos decreasing within track
  • Multiple bos pages
  • Multiple eos pages
oggz_write() fails if any of these constraints are violated.

oggz-validate works by reading the input file and attempting to reproduce its sequence of packets. It creates both a reader and a writer and feeds the output of the reader into the writer; any errors in stream creation are reported as validation errors.

File -> oggz_read() -> packets -> oggz_write() -> discard

Additionally, oggz_write() checks the following higher-level constraints:

  • File contains no Ogg packets
  • Packets out of order
  • eos marked but no bos
  • Missing eos pages
  • eos marked on page with no completed packets
  • Granulepos on page with no completed packets
  • Theora video bos page after audio bos page
  • Terminal header page has non-zero granulepos
  • Terminal header page contains non-header packet
  • Terminal header page contains non-header segment

For example, the check for "packets out of order" uses liboggz's parsing of codec granulepos to interpret timestamps of many free codecs including Ogg Dirac, FLAC, Speex, Theora and Vorbis. Also, there is a simple constraint in the specification for Ogg Theora that the BOS (Beginning Of Stream) header packet for Theora must come before that for Vorbis (or another audio codec).

What oggz-validate does not do is check that the contents of the codec streams are valid for that codec. Such checking is left up to codec-specific tools such as vorbose, and flac --test.


Viewing all articles
Browse latest Browse all 25

Trending Articles