# MatroskaExtractor

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/MatroskaExtractor.java+class:androidx.media3.extractor.mkv.MatroskaExtractor)

*** ** * ** ***


```
@UnstableApi
class MatroskaExtractor : Extractor
```

<br />

*** ** * ** ***

Extracts data from the Matroska and WebM container formats.

## Summary

| ### Nested types |
|---|
| `protected class https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor.ChapterEntry` Holds data corresponding to a single chapter. |
| `@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/kotlin/androidx/annotation/IntDef(flag = true, value = ) annotation https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor.Flags` Flags controlling the behavior of the extractor. |
| `protected class https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor.Track` Holds data corresponding to a single track. |

| ### Constants |
|---|---|
| `const https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#FACTORY()` **This property is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#newFactory(androidx.media3.extractor.text.SubtitleParser.Factory)` instead. <br /> |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#FLAG_DISABLE_HAGC_METADATA() = 4` Flag to disable parsing of HAGC (ST 2094-50) metadata. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#FLAG_DISABLE_SEEK_FOR_CUES() = 1` Flag to disable seeking for cues. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#FLAG_EMIT_RAW_SUBTITLE_DATA() = 2` Flag to use the source subtitle formats without modification. |

| ### Public constructors |
|---|
| `[MatroskaExtractor](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#MatroskaExtractor())()` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#MatroskaExtractor(androidx.media3.extractor.text.SubtitleParser.Factory)` instead. <br /> |
| `[MatroskaExtractor](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#MatroskaExtractor(int))(@https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor.Flags flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#MatroskaExtractor(androidx.media3.extractor.text.SubtitleParser.Factory,int)` instead. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#MatroskaExtractor(androidx.media3.extractor.text.SubtitleParser.Factory)(subtitleParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory!)` Constructs an instance. |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#MatroskaExtractor(androidx.media3.extractor.text.SubtitleParser.Factory,int)( subtitleParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory!, @https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor.Flags flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Constructs an instance. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#init(androidx.media3.extractor.ExtractorOutput)(output: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorOutput!)` Initializes the extractor with an `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorOutput`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorsFactory!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#newFactory(androidx.media3.extractor.text.SubtitleParser.Factory)(subtitleParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory!)` Creates a factory for `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor` instances with the provided `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#read(androidx.media3.extractor.ExtractorInput,androidx.media3.extractor.PositionHolder)(input: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput!, seekPosition: https://developer.android.com/reference/kotlin/androidx/media3/extractor/PositionHolder!)` Extracts data read from a provided `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#release()()` Releases all kept resources. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#seek(long,long)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Notifies the extractor that a seek has occurred. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#sniff(androidx.media3.extractor.ExtractorInput)(input: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput!)` Returns whether this extractor can extract samples from the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput`, which must provide data from the start of the stream. |

| ### Protected functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#binaryElement(int,int,androidx.media3.extractor.ExtractorInput)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, contentSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, input: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput!)` Called when a binary element is encountered. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#endMasterElement(int)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Called when the end of a master element is encountered. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#floatElement(int,double)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)` Called when a float element is encountered. |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor.ChapterEntry!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#getCurrentChapter(int)(currentElementId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the chapter corresponding to the current ChapterAtom element. |
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor.Track!` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#getCurrentTrack(int)(currentElementId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the track corresponding to the current TrackEntry element. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper @https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor.ElementType https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#getElementType(int)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Maps an element ID to a corresponding type. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#handleBlockAddIDExtraData(androidx.media3.extractor.mkv.MatroskaExtractor.Track,androidx.media3.extractor.ExtractorInput,int)( track: https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor.Track!, input: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput!, contentSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#handleBlockAdditionalData(androidx.media3.extractor.mkv.MatroskaExtractor.Track,int,androidx.media3.extractor.ExtractorInput,int)( track: https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor.Track!, blockAdditionalId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, input: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput!, contentSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#integerElement(int,long)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Called when an integer element is encountered. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#isLevel1Element(int)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Checks if the given id is that of a level 1 element. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#startMasterElement(int,long,long)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, contentPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, contentSize: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Called when the start of a master element is encountered. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/CallSuper https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#stringElement(int,java.lang.String)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Called when a string element is encountered. |

### Inherited Constants

From [androidx.media3.extractor.Extractor](https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#RESULT_CONTINUE() = 0`

Returned by `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#read(androidx.media3.extractor.ExtractorInput,androidx.media3.extractor.PositionHolder)` if the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput` passed to the next `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#read(androidx.media3.extractor.ExtractorInput,androidx.media3.extractor.PositionHolder)` is required to provide data continuing from the position in the stream reached by the returning call.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#RESULT_END_OF_INPUT() = -1`

Returned by `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#read(androidx.media3.extractor.ExtractorInput,androidx.media3.extractor.PositionHolder)` if the end of the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput` was reached.
`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#RESULT_SEEK() = 1`

Returned by `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#read(androidx.media3.extractor.ExtractorInput,androidx.media3.extractor.PositionHolder)` if the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput` passed to the next `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#read(androidx.media3.extractor.ExtractorInput,androidx.media3.extractor.PositionHolder)` is required to provide data starting from a specified position in the stream.

### Inherited functions

From [androidx.media3.extractor.Extractor](https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor) `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/media3/extractor/SniffFailure!>!` `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#getSniffFailureDetails()()`

Returns additional details about the last call to `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#sniff(androidx.media3.extractor.ExtractorInput)`.
`https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor!` `@https://checkerframework.org/api/org/checkerframework/dataflow/qual/SideEffectFree.html
https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#getUnderlyingImplementation()()`

Returns the 'real' `Extractor` implementation if this is a delegating instance, or `
this` if this instance does the extraction directly without delegating (the default behaviour).

## Constants

### FACTORY

```
const val FACTORY: ExtractorsFactory!
```

> [!CAUTION]
> **This property is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#newFactory(androidx.media3.extractor.text.SubtitleParser.Factory)` instead.

### FLAG_DISABLE_HAGC_METADATA

```
const val FLAG_DISABLE_HAGC_METADATA = 4: Int
```

Flag to disable parsing of HAGC (ST 2094-50) metadata.

### FLAG_DISABLE_SEEK_FOR_CUES

```
const val FLAG_DISABLE_SEEK_FOR_CUES = 1: Int
```

Flag to disable seeking for cues.

Normally (i.e. when this flag is not set) the extractor will seek to the cues element if its position is specified in the seek head and if it's after the first cluster. Setting this flag disables seeking to the cues element. If the cues element is after the first cluster then the media is treated as being unseekable.

### FLAG_EMIT_RAW_SUBTITLE_DATA

```
const val FLAG_EMIT_RAW_SUBTITLE_DATA = 2: Int
```

Flag to use the source subtitle formats without modification. If unset, subtitles will be transcoded to `https://developer.android.com/reference/kotlin/androidx/media3/common/MimeTypes#APPLICATION_MEDIA3_CUES()` during extraction.

## Public constructors

### MatroskaExtractor

```
[MatroskaExtractor](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#MatroskaExtractor())()
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#MatroskaExtractor(androidx.media3.extractor.text.SubtitleParser.Factory)` instead.

### MatroskaExtractor

```
[MatroskaExtractor](https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#MatroskaExtractor(int))(@MatroskaExtractor.Flags flags: Int)
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor#MatroskaExtractor(androidx.media3.extractor.text.SubtitleParser.Factory,int)` instead.

### MatroskaExtractor

```
MatroskaExtractor(subtitleParserFactory: SubtitleParser.Factory!)
```

Constructs an instance.

| Parameters |
|---|---|
| `subtitleParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory!` | The `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory` for parsing subtitles during extraction. |

### MatroskaExtractor

```
MatroskaExtractor(
    subtitleParserFactory: SubtitleParser.Factory!,
    @MatroskaExtractor.Flags flags: Int
)
```

Constructs an instance.

| Parameters |
|---|---|
| `subtitleParserFactory: https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory!` | The `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory` for parsing subtitles during extraction. |
| `@https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor.Flags flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Flags that control the extractor's behavior. |

## Public functions

### init

```
fun init(output: ExtractorOutput!): Unit
```

Initializes the extractor with an `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorOutput`. Called at most once.

| Parameters |
|---|---|
| `output: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorOutput!` | An `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorOutput` to receive extracted data. |

### newFactory

```
java-static fun newFactory(subtitleParserFactory: SubtitleParser.Factory!): ExtractorsFactory!
```

Creates a factory for `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/MatroskaExtractor` instances with the provided `https://developer.android.com/reference/kotlin/androidx/media3/extractor/text/SubtitleParser.Factory`.

### read

```
fun read(input: ExtractorInput!, seekPosition: PositionHolder!): Int
```

Extracts data read from a provided `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput`. Must not be called before `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#init(androidx.media3.extractor.ExtractorOutput)`.

A single call to this method will block until some progress has been made, but will not block for longer than this. Hence each call will consume only a small amount of input data.

In the common case, `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#RESULT_CONTINUE()` is returned to indicate that the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput` passed to the next read is required to provide data continuing from the position in the stream reached by the returning call. If the extractor requires data to be provided from a different position, then that position is set in `seekPosition` and `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#RESULT_SEEK()` is returned. If the extractor reached the end of the data provided by the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput`, then `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#RESULT_END_OF_INPUT()` is returned.

When this method throws an `https://developer.android.com/reference/java/io/IOException.html`, extraction may continue by providing an `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput` with an unchanged `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput#getPosition()` to a subsequent call to this method.

| Parameters |
|---|---|
| `input: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput!` | The `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput` from which data should be read. |
| `seekPosition: https://developer.android.com/reference/kotlin/androidx/media3/extractor/PositionHolder!` | If `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#RESULT_SEEK()` is returned, this holder is updated to hold the position of the required data. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | One of the `RESULT_` values defined in this interface. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an error occurred reading from or parsing the input. |

### release

```
fun release(): Unit
```

Releases all kept resources.

### seek

```
@CallSuper
fun seek(position: Long, timeUs: Long): Unit
```

Notifies the extractor that a seek has occurred.

Following a call to this method, the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput` passed to the next invocation of `https://developer.android.com/reference/kotlin/androidx/media3/extractor/Extractor#read(androidx.media3.extractor.ExtractorInput,androidx.media3.extractor.PositionHolder)` is required to provide data starting from `
position` in the stream. Valid random access positions are the start of the stream and positions that can be obtained from any `https://developer.android.com/reference/kotlin/androidx/media3/extractor/SeekMap` passed to the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorOutput`.

| Parameters |
|---|---|
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The byte offset in the stream from which data will be provided. |
| `timeUs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The seek time in microseconds. |

### sniff

```
fun sniff(input: ExtractorInput!): Boolean
```

Returns whether this extractor can extract samples from the `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput`, which must provide data from the start of the stream.

If `true` is returned, the `input`'s reading position may have been modified. Otherwise, only its peek position may have been modified.

| Parameters |
|---|---|
| `input: https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput!` | The `https://developer.android.com/reference/kotlin/androidx/media3/extractor/ExtractorInput` from which data should be peeked/read. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether this extractor can read the provided input. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an error occurred reading from the input. |

## Protected functions

### binaryElement

```
@CallSuper
protected fun binaryElement(id: Int, contentSize: Int, input: ExtractorInput!): Unit
```

Called when a binary element is encountered.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` |   |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#binaryElement(int,int,androidx.media3.extractor.ExtractorInput)` |   |

### endMasterElement

```
@CallSuper
protected fun endMasterElement(id: Int): Unit
```

Called when the end of a master element is encountered.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException` |   |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#endMasterElement(int)` |   |

### floatElement

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

Called when a float element is encountered.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException` |   |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#floatElement(int,double)` |   |

### getCurrentChapter

```
protected fun getCurrentChapter(currentElementId: Int): MatroskaExtractor.ChapterEntry!
```

Returns the chapter corresponding to the current ChapterAtom element.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException` | if the element id is not in a ChapterAtom. |

### getCurrentTrack

```
protected fun getCurrentTrack(currentElementId: Int): MatroskaExtractor.Track!
```

Returns the track corresponding to the current TrackEntry element.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException` | if the element id is not in a TrackEntry. |

### getElementType

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

Maps an element ID to a corresponding type.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#getElementType(int)` |   |

### handleBlockAddIDExtraData

```
protected fun handleBlockAddIDExtraData(
    track: MatroskaExtractor.Track!,
    input: ExtractorInput!,
    contentSize: Int
): Unit
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` |   |

### handleBlockAdditionalData

```
protected fun handleBlockAdditionalData(
    track: MatroskaExtractor.Track!,
    blockAdditionalId: Int,
    input: ExtractorInput!,
    contentSize: Int
): Unit
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` |   |

### integerElement

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

Called when an integer element is encountered.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException` |   |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#integerElement(int,long)` |   |

### isLevel1Element

```
@CallSuper
protected fun isLevel1Element(id: Int): Boolean
```

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#isLevel1Element(int)` |   |

### startMasterElement

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

Called when the start of a master element is encountered.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException` |   |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#startMasterElement(int,long,long)` |   |

### stringElement

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

Called when a string element is encountered.

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/common/ParserException` |   |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/extractor/mkv/EbmlProcessor#stringElement(int,java.lang.String)` |   |