[Matroska-devel] Unknown size

Moritz Bunkus moritz at bunkus.org
Wed Sep 12 13:25:27 CEST 2012


Hey,

On Mon, Sep 10, 2012 at 11:21 PM, Dan Hinsley <danhi at cox.net> wrote:

> So I'm working my way through the sample files, and get to test4 which has
> the unknown length (0xFF) for the segment.  Now it appears that what mkvinfo
> does is just scan forward until it find the segment info element and then
> goes from there.  What should be the behavior when you encounter an unknown
> length, and can they show up in any element?

If an element's size is unknown then it covers all the space from
where it starts to where its parent element ends. For example, if a
cluster had an unknown size then it would extend to the end of the
segment. If a segment has an unknown size then it extends to the end
of the file as a segment does not have a parent element.

In pseudo code:

if (current_element.size_is_known)
  element_size = current_element.size
else {
  if (parent)
    element_end_pos = parent.position + parent.size
  else
    element_end_pos = file.size
  element_size = element_end_pos - element.position - element.head_size
}


More information about the Matroska-devel mailing list