MatroskaSegment

data class MatroskaSegment(val uid: String?, val filename: String?, val previousUid: String?, val previousFilename: String?, val nextUid: String?, val nextFilename: String?, val families: List<String>, val editions: List<MatroskaEdition>)

What a Matroska file says about its own segment, its editions and their chapters, read as RFC 9559 defines them (#173).

A Matroska file can describe a timeline rather than a plain run of media. An ordered edition plays a list of chapters in its own order, a chapter can play a range or a whole edition of another file named by that file's uid, and segments can be chained through previousUid and nextUid. Anime releases share one opening and one ending file across a season this way, and a film can carry a theatrical and an extended cut as two editions of one file.

FFmpeg plays every such file as a plain file, and MediaSource.chapters is the plain reading of defaultEdition. This is what the file says, so that a player can build the timeline itself, as mpv and VLC do. Finding the files a segment links to, and playing them, is the player's work.

Segment UIDs are 32 lowercase hexadecimal digits, the 16 bytes of the UID in the order the file stores them, so two of them compare with ==. Edition and chapter UIDs are the file's unsigned 64-bit values carried in a Long, as Chapter.id carries them.

Constructors

Link copied to clipboard
constructor(uid: String?, filename: String?, previousUid: String?, previousFilename: String?, nextUid: String?, nextFilename: String?, families: List<String>, editions: List<MatroskaEdition>)

Properties

Link copied to clipboard

The edition a player uses unless told otherwise: the first one flagged default, or the first one when none is (RFC 9559, section 20.1.2). Null when the file has no editions.

Link copied to clipboard

The editions of the file's Chapters element, in stored order. Empty when it has none.

Link copied to clipboard

Each SegmentFamily this segment belongs to, in the order the file lists them.

Link copied to clipboard

The SegmentFilename the file states for itself, or null.

Link copied to clipboard

The NextFilename of that segment, or null.

Link copied to clipboard

The NextUUID of the segment that follows this one when segments are chained, or null.

Link copied to clipboard

The PrevFilename of that segment, or null.

Link copied to clipboard

The PrevUUID of the segment this one follows when segments are chained, or null.

Link copied to clipboard
val uid: String?

This segment's SegmentUUID, or null when the file states none.