Package com.google.android.exoplayer2.extractor.ts

## Class PesReader

- java.lang.Object
- - com.google.android.exoplayer2.extractor.ts.PesReader

- All Implemented Interfaces:
    `TsPayloadReader`

      public final class PesReader
      extends Object
      implements TsPayloadReader

  Parses PES packet data and extracts samples.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.google.android.exoplayer2.extractor.ts.TsPayloadReader

      `TsPayloadReader.DvbSubtitleInfo, TsPayloadReader.EsInfo, TsPayloadReader.Factory, TsPayloadReader.Flags, TsPayloadReader.TrackIdGenerator`

  - ### Field Summary

    - ### Fields inherited from interface com.google.android.exoplayer2.extractor.ts.TsPayloadReader

      `FLAG_DATA_ALIGNMENT_INDICATOR, FLAG_PAYLOAD_UNIT_START_INDICATOR, FLAG_RANDOM_ACCESS_INDICATOR`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PesReader​(ElementaryStreamReader reader)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `consume​(ParsableByteArray data, int flags)` | Consumes the payload of a TS packet.
    `void` | `init​(TimestampAdjuster timestampAdjuster, ExtractorOutput extractorOutput, TsPayloadReader.TrackIdGenerator idGenerator)` | Initializes the payload reader.
    `void` | `seek()` | Notifies the reader that a seek has occurred.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### PesReader

          public PesReader​(ElementaryStreamReader reader)

  - ### Method Detail

    - #### init

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

      Description copied from interface: `TsPayloadReader`
      Initializes the payload reader.
      Specified by:
        `init` in interface `TsPayloadReader`
      Parameters:
        `timestampAdjuster` - A timestamp adjuster for offsetting and scaling sample timestamps.
        `extractorOutput` - The `ExtractorOutput` that receives the extracted data.
        `idGenerator` - A `TsPayloadReader.TrackIdGenerator` that generates unique track ids for the `TrackOutput`s.

    - #### seek

          public final void seek()

      Description copied from interface: `TsPayloadReader`
      Notifies the reader that a seek has occurred.

      Following a call to this method, the data passed to the next invocation of `TsPayloadReader.consume(com.google.android.exoplayer2.util.ParsableByteArray, int)` will not be a continuation of the data that was previously passed. Hence the reader should reset any internal state.

      Specified by:
        `seek` in interface `TsPayloadReader`

    - #### consume

          public final void consume​(ParsableByteArray data,
                                    @Flags
                                    int flags)
                             throws ParserException

      Description copied from interface: `TsPayloadReader`
      Consumes the payload of a TS packet.
      Specified by:
        `consume` in interface `TsPayloadReader`
      Parameters:
        `data` - The TS packet. The position will be set to the start of the payload.
        `flags` - See `TsPayloadReader.Flags`.
      Throws:
        `ParserException` - If the payload could not be parsed.