@UnstableApi
class PesReader : TsPayloadReader


Parses PES packet data and extracts samples.

Summary

Public constructors

Public functions

Boolean

Determines if the parser can consume a synthesized empty pusi.

Unit

Consumes the payload of a TS packet.

Unit
init(
    timestampAdjuster: TimestampAdjuster!,
    extractorOutput: ExtractorOutput!,
    idGenerator: TsPayloadReader.TrackIdGenerator!
)

Initializes the payload reader.

Unit

Notifies the reader that a seek has occurred.

Inherited Constants

From androidx.media3.extractor.ts.TsPayloadReader
const Int

Indicates the presence of the data_alignment_indicator in the PES header.

const Int

Indicates the presence of the payload_unit_start_indicator in the TS packet header.

const Int

Indicates the presence of the random_access_indicator in the TS packet header adaptation field.

Public constructors

PesReader

PesReader(reader: ElementaryStreamReader!)

Public functions

canConsumeSynthesizedEmptyPusi

fun canConsumeSynthesizedEmptyPusi(isModeHls: Boolean): Boolean

Determines if the parser can consume a synthesized empty pusi.

Parameters
isModeHls: Boolean

True if operating in HLS (HTTP Live Streaming) mode, false otherwise.

consume

fun consume(data: ParsableByteArray!, @TsPayloadReader.Flags flags: Int): Unit

Consumes the payload of a TS packet.

Parameters
data: ParsableByteArray!

The TS packet. The position will be set to the start of the payload.

@TsPayloadReader.Flags flags: Int

See Flags.

Throws
androidx.media3.common.ParserException

If the payload could not be parsed.

init

fun init(
    timestampAdjuster: TimestampAdjuster!,
    extractorOutput: ExtractorOutput!,
    idGenerator: TsPayloadReader.TrackIdGenerator!
): Unit

Initializes the payload reader.

Parameters
timestampAdjuster: TimestampAdjuster!

A timestamp adjuster for offsetting and scaling sample timestamps.

extractorOutput: ExtractorOutput!

The ExtractorOutput that receives the extracted data.

idGenerator: TsPayloadReader.TrackIdGenerator!

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

seek

fun seek(): Unit

Notifies the reader that a seek has occurred.

Following a call to this method, the data passed to the next invocation of consume will not be a continuation of the data that was previously passed. Hence the reader should reset any internal state.