|
EBML Library
Extensible Binary Meta Language read/write/modify library for Python
|
view on
github
|
This is an Extensible Binary Meta Language library library for use with Python 2.x and 3.x. Its primary goal is to provide ease of use and minimal memory usage.
The following section documents the public API of the classes and functions which are useful under normal circumstances. Modifying objects using other methods may break the internal state of an EBML document.
The extended descriptions are minimized by default for ease of locating functions by name. Click the +/− or the function name to expand/shrink the description. (expand all | shrink all)
The following functions are available in the module and are used for encoding/decoding file-like streams.
ebml.(element, stream, pointers_temporary=True...)element : ebml.Elementstream : input_streampointers_temporary : booleanThe Schema object is used to define the semantic information for decoding and validating an EBML document.
Schema.(id, name, el_type, level="g", versions=0, validator=None, pointer=False...) : ebml.ElementDescriptorid : list | tuple | string | byteslist or tuple, each entry of the object will be treated as a byte.string, each set of 2 characters will be treated as a hexadecimal byte.bytes object, each character will be treated as a byte.name : stringel_type : TYPE_CONSTANTlevel : string | integer"g", then it can appear anywhere in the document."#+", then it can appear on level # and deeper. (it is recursive)versions : integer0, it can appear in any version.validator : functionTrue if it's valid, and False otherwisepointer : booleanTrue if this value should be loaded as a pointer (the reading of its value from the input stream will be deferred), or False otherwisereturn : ebml.ElementDescriptorSchema.(name, value=None...) : ebml.Elementname : string | ebml.ElementDescriptorebml.ElementDescriptor returned from a .define call, it creates an element of the descriptor's type.value : any.set functionreturn : ebml.ElementSchema.() : ebml.ElementContainerreturn : ebml.ElementContainerThe following functions are available on all Element instances.
However, certain functions may not be implemented for certain subclasses, so they may raise exceptions.
Element.(decode_depth=-1...) : anydecode_depth : integer0 indicates only the element itself should be decoded, all child elements will be pointers.1 indicates only element and its first level children should be decoded, all other elements will be pointers...return : anyElement.(element, before=None, after=None, prepend=False...)self object is not a container element, an exception will be raised.element : ebml.Elementbefore : ebml.ElementNone, the element will be inserted before this child element.after : ebml.Elementbefore is None, and the value is not None, the element will be inserted after this child element.prepend : booleanbefore and after are both None, this parameter specifies where the new element should be inserted.False, it's inserted after all of the children as the last element.True, it's inserted before all of the children as the first element.The following class is used to provide high-precision date objects for encoding/decoding dates.
ebml.ElementDate.(year, month, day, hour=0, minute=0, second=0, nanoseconds=0...) : ebml.ElementDate.Dateyear : integermonth : integerday : integerhour : integerminute : integersecond : integernanoseconds : integerreturn : ebml.ElementDate.DateEBML selectors are similar to CSS selectors, and are used to easily select elements out of a document. The exact syntax of a valid selector string will not be described, as it is mostly identical to the standard CSS selectors.
The following are the available selectors:
3n+1, n+4, n, 4
"int" represents ebml.INT elements
Selector.(element...) : ebml.Element | None