[Matroska-devel] Unknown size

Steve Lhomme slhomme at matroska.org
Sat Sep 15 15:49:18 CEST 2012

In general an unknown size element ends when an element of similar or
higher level is found. For ex for a Cluster any Cluster, SeekInfo,
Info, Chapters, etc but also another Segment.

On Wed, Sep 12, 2012 at 1:25 PM, Moritz Bunkus <moritz at bunkus.org> wrote:
> 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
> }
> _______________________________________________
> Matroska-devel mailing list
> Matroska-devel at lists.matroska.org
> http://lists.matroska.org/cgi-bin/mailman/listinfo/matroska-devel
> Read Matroska-Devel on GMane: http://dir.gmane.org/gmane.comp.multimedia.matroska.devel

Steve Lhomme
Matroska association Chairman

More information about the Matroska-devel mailing list