public sealed class EbmlReaderThe primitive layer of EBML: variable-width integers, and the handful of scalar types Matroska stores its numbers as.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
EBML is two ideas. A number is written with its length in unary — the leading zero bits of the first byte say how many bytes it takes — and everything is an id, a length and either a payload or more elements. That is the whole format; the rest of Matroska is a very long list of which ids mean what.
Ids keep their marker bit and sizes lose theirs. This trips up every first implementation. 0xA3 is the id of a SimpleBlock and stays 0xA3; a size byte of 0xA3 means 35. The specification is written that way — ids are quoted with their markers — so reading them the same way is what lets a table of ids be compared against the specification by eye.
It reads a Stream, not a byte array. A video file is the one asset that will not be resident, and the demuxer above this is built to hold a few hundred kilobytes of it at a time regardless of whether the file is four megabytes or four gigabytes.
Fields and properties (4)
public Stream StreamThe stream being read.
public long PositionWhere the next read starts.
public long LengthHow long the stream is, or -1 if it will not say.
public bool AtEndWhether the stream has ended.
Methods (10)
public EbmlReader(Stream stream)Reads over a stream.
public bool TryReadElement(out EbmlElement element)Reads an element's id and size.
public long ReadSize(out int length)Reads a size, whose marker bit is stripped.
public ulong ReadUnsigned(long size)Reads a big-endian unsigned integer of a stated width.
public long ReadSigned(long size)Reads a big-endian signed integer of a stated width.
public double ReadFloat(long size)Reads an IEEE float of a stated width.
public string ReadString(long size)Reads an ASCII or UTF-8 string of a stated length.
public void ReadBytes(Span<byte> destination)Reads raw bytes.
public void Skip(long size)Moves past an element's payload.
public static int LengthOf(byte first)How many bytes a variable-width integer starting with a byte occupies.
Used by (2)
- EbmlReaderTestsVixen.Video.Tests
- MatroskaDemuxerVixen.Video