# EbmlProcessor

Artifact: [androidx.media3:media3-extractor](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/extractor/mkv/EbmlProcessor.java+class:androidx.media3.extractor.mkv.EbmlProcessor)

*** ** * ** ***


```
@UnstableApi
public interface EbmlProcessor
```

<br />

*** ** * ** ***

Defines EBML element IDs/types and processes events.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/java/lang/annotation/Documented.html @https://developer.android.com/reference/java/lang/annotation/Retention.html(value = https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE) @https://developer.android.com/reference/java/lang/annotation/Target.html(value = https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE) @https://developer.android.com/reference/androidx/annotation/IntDef(value = ) public annotation https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor.ElementType` EBML element types. |

| ### Constants |
|---|---|
| `default static final int` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_BINARY() = 4` Type for binary elements. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_FLOAT() = 5` Type for IEEE floating point value elements of either 4 or 8 bytes. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_MASTER() = 1` Type for elements that contain child elements. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_STRING() = 3` Type for string elements. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_UNKNOWN() = 0` Type for unknown elements. |
| `default static final int` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_UNSIGNED_INT() = 2` Type for integer value elements of up to 8 bytes. |

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#binaryElement(int,int,androidx.media3.extractor.ExtractorInput)(int id, int contentsSize, https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput input)` Called when a binary element is encountered. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#endMasterElement(int)(int id)` Called when the end of a master element is encountered. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#floatElement(int,double)(int id, double value)` Called when a float element is encountered. |
| `abstract int` | `@https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor.ElementType https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#getElementType(int)(int id)` Maps an element ID to a corresponding type. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#integerElement(int,long)(int id, long value)` Called when an integer element is encountered. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#isLevel1Element(int)(int id)` Checks if the given id is that of a level 1 element. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#startMasterElement(int,long,long)(int id, long contentPosition, long contentSize)` Called when the start of a master element is encountered. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#stringElement(int,java.lang.String)(int id, https://developer.android.com/reference/java/lang/String.html 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. |
| `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput input` | The `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput` from which data should be read. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ParserException` | If a parsing error occurs. |
| `https://developer.android.com/reference/java/io/IOException.html` | 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 |
|---|---|
| `https://developer.android.com/reference/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 |
|---|---|
| `https://developer.android.com/reference/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 `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#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. |

| Returns |
|---|---|
| `int` | One of `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_UNKNOWN()`, `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_MASTER()`, `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_UNSIGNED_INT()`, `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_STRING()`, `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_BINARY()` and `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_FLOAT()`. |

### 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 |
|---|---|
| `https://developer.android.com/reference/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 `https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor#endMasterElement(int)` 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 |
|---|---|
| `https://developer.android.com/reference/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. |
| `https://developer.android.com/reference/java/lang/String.html value` | The string value that the element contains. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/common/ParserException` | If a parsing error occurs. |