@UnstableApi
class AdtsReader : ElementaryStreamReader


Parses a continuous ADTS byte stream and extracts individual frames.

Summary

Public constructors

AdtsReader(exposeId3: Boolean)
AdtsReader(exposeId3: Boolean, language: String?, @C.RoleFlags roleFlags: Int)

Public functions

Unit

Consumes (possibly partial) data from the current packet.

Unit
createTracks(
    extractorOutput: ExtractorOutput!,
    idGenerator: TsPayloadReader.TrackIdGenerator!
)

Initializes the reader by providing outputs and ids for the tracks.

java-static Boolean
isAdtsSyncWord(candidateSyncWord: Int)

Returns whether an integer matches an ADTS SYNC word.

Unit
packetFinished(isEndOfInput: Boolean)

Called when a packet ends.

Unit

Called when a packet starts.

Unit

Notifies the reader that a seek has occurred.

Public properties

Long

Public constructors

AdtsReader

AdtsReader(exposeId3: Boolean)
Parameters
exposeId3: Boolean

True if the reader should expose ID3 information.

AdtsReader

AdtsReader(exposeId3: Boolean, language: String?, @C.RoleFlags roleFlags: Int)
Parameters
exposeId3: Boolean

True if the reader should expose ID3 information.

language: String?

Track language.

@C.RoleFlags roleFlags: Int

Track role flags.

Public functions

consume

fun consume(data: ParsableByteArray!): Unit

Consumes (possibly partial) data from the current packet.

Parameters
data: ParsableByteArray!

The data to consume.

Throws
androidx.media3.common.ParserException

If the data could not be parsed.

createTracks

fun createTracks(
    extractorOutput: ExtractorOutput!,
    idGenerator: TsPayloadReader.TrackIdGenerator!
): Unit

Initializes the reader by providing outputs and ids for the tracks.

Parameters
extractorOutput: ExtractorOutput!

The ExtractorOutput that receives the extracted data.

idGenerator: TsPayloadReader.TrackIdGenerator!

A PesReader.TrackIdGenerator that generates unique track ids for the TrackOutputs.

isAdtsSyncWord

java-static fun isAdtsSyncWord(candidateSyncWord: Int): Boolean

Returns whether an integer matches an ADTS SYNC word.

packetFinished

fun packetFinished(isEndOfInput: Boolean): Unit

Called when a packet ends.

packetStarted

fun packetStarted(pesTimeUs: Long, @TsPayloadReader.Flags flags: Int): Unit

Called when a packet starts.

Parameters
pesTimeUs: Long

The timestamp associated with the packet.

@TsPayloadReader.Flags flags: Int

See TsPayloadReader.Flags.

seek

fun seek(): Unit

Notifies the reader that a seek has occurred.

Public properties

sampleDurationUs

val sampleDurationUsLong