@UnstableApi
public final class PesReader implements TsPayloadReader


Parses PES packet data and extracts samples.

Summary

Public constructors

Public methods

final void

Consumes the payload of a TS packet.

void
init(
    TimestampAdjuster timestampAdjuster,
    ExtractorOutput extractorOutput,
    TsPayloadReader.TrackIdGenerator idGenerator
)

Initializes the payload reader.

final void

Notifies the reader that a seek has occurred.

Inherited Constants

From androidx.media3.extractor.ts.TsPayloadReader
static final int

Indicates the presence of the data_alignment_indicator in the PES header.

static final int

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

static final int

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

Public constructors

PesReader

public PesReader(ElementaryStreamReader reader)

Public methods

consume

public final void consume(ParsableByteArray data, @TsPayloadReader.Flags int flags)

Consumes the payload of a TS packet.

Parameters
ParsableByteArray data

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

@TsPayloadReader.Flags int flags

See Flags.

Throws
androidx.media3.common.ParserException

If the payload could not be parsed.

init

public void init(
    TimestampAdjuster timestampAdjuster,
    ExtractorOutput extractorOutput,
    TsPayloadReader.TrackIdGenerator idGenerator
)

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.

TsPayloadReader.TrackIdGenerator idGenerator

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

seek

public final void seek()

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.