# EbmlProcessor

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/extractor/mkv/EbmlProcessor "View this page in Java")

<br />

```
@UnstableApi
interface EbmlProcessor
```

<br />

*** ** * ** ***

Defines EBML element IDs/types and processes events.

## Summary

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

|                                    ### Constants                                    |
|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [ELEMENT_TYPE_BINARY](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_BINARY())` = 4` Type for binary elements.                                         |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [ELEMENT_TYPE_FLOAT](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_FLOAT())` = 5` Type for IEEE floating point value elements of either 4 or 8 bytes. |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [ELEMENT_TYPE_MASTER](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_MASTER())` = 1` Type for elements that contain child elements.                    |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [ELEMENT_TYPE_STRING](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_STRING())` = 3` Type for string elements.                                         |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [ELEMENT_TYPE_UNKNOWN](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_UNKNOWN())` = 0` Type for unknown elements.                                      |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [ELEMENT_TYPE_UNSIGNED_INT](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_UNSIGNED_INT())` = 2` Type for integer value elements of up to 8 bytes.     |

|                                ### Public functions                                 |
|-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [binaryElement](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#binaryElement(int,int,androidx.media3.extractor.ExtractorInput))`(id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, contentsSize: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, input: `[ExtractorInput](https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput)`!)` Called when a binary element is encountered. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [endMasterElement](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#endMasterElement(int))`(id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called when the end of a master element is encountered.                                                                                                                                                                                                                                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [floatElement](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#floatElement(int,double))`(id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, value: `[Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)`)` Called when a float element is encountered.                                                                                                                                                                |
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)         | `@`[EbmlProcessor.ElementType](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor.ElementType) [getElementType](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#getElementType(int))`(id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Maps an element ID to a corresponding type.                                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [integerElement](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#integerElement(int,long))`(id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, value: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Called when an integer element is encountered.                                                                                                                                                               |
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isLevel1Element](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#isLevel1Element(int))`(id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Checks if the given id is that of a level 1 element.                                                                                                                                                                                                                                                    |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [startMasterElement](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#startMasterElement(int,long,long))`(id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, contentPosition: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`, contentSize: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Called when the start of a master element is encountered.                               |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [stringElement](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#stringElement(int,java.lang.String))`(id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, value: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!)` Called when a string element is encountered.                                                                                                                                                  |

## Constants

### ELEMENT_TYPE_BINARY

```
const val ELEMENT_TYPE_BINARY = 4: Int
```

Type for binary elements.  

### ELEMENT_TYPE_FLOAT

```
const val ELEMENT_TYPE_FLOAT = 5: Int
```

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

### ELEMENT_TYPE_MASTER

```
const val ELEMENT_TYPE_MASTER = 1: Int
```

Type for elements that contain child elements.  

### ELEMENT_TYPE_STRING

```
const val ELEMENT_TYPE_STRING = 3: Int
```

Type for string elements.  

### ELEMENT_TYPE_UNKNOWN

```
const val ELEMENT_TYPE_UNKNOWN = 0: Int
```

Type for unknown elements.  

### ELEMENT_TYPE_UNSIGNED_INT

```
const val ELEMENT_TYPE_UNSIGNED_INT = 2: Int
```

Type for integer value elements of up to 8 bytes.  

## Public functions

### binaryElement

```
fun binaryElement(id: Int, contentsSize: Int, input: ExtractorInput!): Unit
```

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                                                       |
|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                     | The element ID.                                                                                                                             |
| `contentsSize: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                           | The element's content size.                                                                                                                 |
| `input: `[ExtractorInput](https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput)`!` | The[ExtractorInput](https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput)from which data should be read. |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| [androidx.media3.common.ParserException](https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException) | If a parsing error occurs.                 |
| [java.io.IOException](https://developer.android.com/reference/java/io/IOException.html)                                         | If an error occurs reading from the input. |

### endMasterElement

```
fun endMasterElement(id: Int): Unit
```

Called when the end of a master element is encountered.  

|                                    Parameters                                     |
|-----------------------------------------------------------------------------------|-----------------|
| `id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The element ID. |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|----------------------------|
| [androidx.media3.common.ParserException](https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException) | If a parsing error occurs. |

### floatElement

```
fun floatElement(id: Int, value: Double): Unit
```

Called when a float element is encountered.  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|-------------------------------------------|
| `id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)          | The element ID.                           |
| `value: `[Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html) | The float value that the element contains |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|----------------------------|
| [androidx.media3.common.ParserException](https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException) | If a parsing error occurs. |

### getElementType

```
@EbmlProcessor.ElementType
fun getElementType(id: Int): Int
```

Maps an element ID to a corresponding type.

If[ELEMENT_TYPE_UNKNOWN](https://developer.android.com/reference/kotlin/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                                     |
|-----------------------------------------------------------------------------------|------------------------|
| `id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The element ID to map. |

|                                   Returns                                   |
|-----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | One of[ELEMENT_TYPE_UNKNOWN](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_UNKNOWN()),[ELEMENT_TYPE_MASTER](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_MASTER()),[ELEMENT_TYPE_UNSIGNED_INT](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_UNSIGNED_INT()),[ELEMENT_TYPE_STRING](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_STRING()),[ELEMENT_TYPE_BINARY](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_BINARY())and[ELEMENT_TYPE_FLOAT](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#ELEMENT_TYPE_FLOAT()). |

### integerElement

```
fun integerElement(id: Int, value: Long): Unit
```

Called when an integer element is encountered.  

|                                       Parameters                                       |
|----------------------------------------------------------------------------------------|----------------------------------------------|
| `id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)      | The element ID.                              |
| `value: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The integer value that the element contains. |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|----------------------------|
| [androidx.media3.common.ParserException](https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException) | If a parsing error occurs. |

### isLevel1Element

```
fun isLevel1Element(id: Int): Boolean
```

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

|                                    Parameters                                     |
|-----------------------------------------------------------------------------------|-----------------|
| `id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The element ID. |

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|----------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | Whether the given id is that of a level 1 element. |

### startMasterElement

```
fun startMasterElement(id: Int, contentPosition: Long, contentSize: Long): Unit
```

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](https://developer.android.com/reference/kotlin/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                                            |
|--------------------------------------------------------------------------------------------------|-------------------------------------------------------------------|
| `id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                | The element ID.                                                   |
| `contentPosition: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The position of the start of the element's content in the stream. |
| `contentSize: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)     | The size of the element's content in bytes.                       |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|----------------------------|
| [androidx.media3.common.ParserException](https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException) | If a parsing error occurs. |

### stringElement

```
fun stringElement(id: Int, value: String!): Unit
```

Called when a string element is encountered.  

|                                          Parameters                                           |
|-----------------------------------------------------------------------------------------------|---------------------------------------------|
| `id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)             | The element ID.                             |
| `value: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | The string value that the element contains. |

|                                                             Throws                                                              |
|---------------------------------------------------------------------------------------------------------------------------------|----------------------------|
| [androidx.media3.common.ParserException](https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException) | If a parsing error occurs. |