@UnstableApi
public interface EbmlProcessor


Defines EBML element IDs/types and processes events.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation EbmlProcessor.ElementType

EBML element types.

Constants

default static final int

Type for binary elements.

default static final int

Type for IEEE floating point value elements of either 4 or 8 bytes.

default static final int

Type for elements that contain child elements.

default static final int

Type for string elements.

default static final int

Type for unknown elements.

default static final int

Type for integer value elements of up to 8 bytes.

Public methods

abstract void
binaryElement(int id, int contentsSize, ExtractorInput input)

Called when a binary element is encountered.

abstract void

Called when the end of a master element is encountered.

abstract void
floatElement(int id, double value)

Called when a float element is encountered.

abstract int

Maps an element ID to a corresponding type.

abstract void
integerElement(int id, long value)

Called when an integer element is encountered.

abstract boolean

Checks if the given id is that of a level 1 element.

abstract void
startMasterElement(int id, long contentPosition, long contentSize)

Called when the start of a master element is encountered.

abstract void
stringElement(int id, String value)

Called when a string element is encountered.

Constants

ELEMENT_TYPE_BINARY

default static final int ELEMENT_TYPE_BINARY = 4

Type for binary elements.

ELEMENT_TYPE_FLOAT

default static final int ELEMENT_TYPE_FLOAT = 5

Type for IEEE floating point value elements of either 4 or 8 bytes.

ELEMENT_TYPE_MASTER

default static final int ELEMENT_TYPE_MASTER = 1

Type for elements that contain child elements.

ELEMENT_TYPE_STRING

default static final int ELEMENT_TYPE_STRING = 3

Type for string elements.

ELEMENT_TYPE_UNKNOWN

default static final int ELEMENT_TYPE_UNKNOWN = 0

Type for unknown elements.

ELEMENT_TYPE_UNSIGNED_INT

default static final int ELEMENT_TYPE_UNSIGNED_INT = 2

Type for integer value elements of up to 8 bytes.

Public methods

binaryElement

abstract void binaryElement(int id, int contentsSize, ExtractorInput input)

Called when a binary element is encountered.

The element header (containing the element ID and content size) will already have been read. Implementations are required to consume the whole remainder of the element, which is contentSize bytes in length, before returning. Implementations are permitted to fail (by throwing an exception) having partially consumed the data, however if they do this, they must consume the remainder of the content when called again.

Parameters
int id

The element ID.

int contentsSize

The element's content size.

ExtractorInput input

The ExtractorInput from which data should be read.

Throws
androidx.media3.common.ParserException

If a parsing error occurs.

java.io.IOException

If an error occurs reading from the input.

endMasterElement

abstract void endMasterElement(int id)

Called when the end of a master element is encountered.

Parameters
int id

The element ID.

Throws
androidx.media3.common.ParserException

If a parsing error occurs.

floatElement

abstract void floatElement(int id, double value)

Called when a float element is encountered.

Parameters
int id

The element ID.

double value

The float value that the element contains

Throws
androidx.media3.common.ParserException

If a parsing error occurs.

getElementType

@EbmlProcessor.ElementType
abstract int getElementType(int id)

Maps an element ID to a corresponding type.

If ELEMENT_TYPE_UNKNOWN is returned then the element is skipped. Note that all children of a skipped element are also skipped.

Parameters
int id

The element ID to map.

integerElement

abstract void integerElement(int id, long value)

Called when an integer element is encountered.

Parameters
int id

The element ID.

long value

The integer value that the element contains.

Throws
androidx.media3.common.ParserException

If a parsing error occurs.

isLevel1Element

abstract boolean isLevel1Element(int id)

Checks if the given id is that of a level 1 element.

Parameters
int id

The element ID.

Returns
boolean

Whether the given id is that of a level 1 element.

startMasterElement

abstract void startMasterElement(int id, long contentPosition, long contentSize)

Called when the start of a master element is encountered.

Following events should be considered as taking place within this element until a matching call to endMasterElement is made.

Note that it is possible for another master element of the same element ID to be nested within itself.

Parameters
int id

The element ID.

long contentPosition

The position of the start of the element's content in the stream.

long contentSize

The size of the element's content in bytes.

Throws
androidx.media3.common.ParserException

If a parsing error occurs.

stringElement

abstract void stringElement(int id, String value)

Called when a string element is encountered.

Parameters
int id

The element ID.

String value

The string value that the element contains.

Throws
androidx.media3.common.ParserException

If a parsing error occurs.