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

## Class H264Reader

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

- All Implemented Interfaces:
    `ElementaryStreamReader`

      public final class H264Reader
      extends Object
      implements ElementaryStreamReader

  Parses a continuous H264 byte stream and extracts individual frames.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `H264Reader​(SeiReader seiReader, boolean allowNonIdrKeyframes, boolean detectAccessUnits)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `consume​(ParsableByteArray data)` | Consumes (possibly partial) data from the current packet.
    `void` | `createTracks​(ExtractorOutput extractorOutput, TsPayloadReader.TrackIdGenerator idGenerator)` | Initializes the reader by providing outputs and ids for the tracks.
    `void` | `packetFinished()` | Called when a packet ends.
    `void` | `packetStarted​(long pesTimeUs, @com.google.android.exoplayer2.extractor.ts.TsPayloadReader.Flags int flags)` | Called when a packet starts.
    `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

    - #### H264Reader

          public H264Reader​(SeiReader seiReader,
                            boolean allowNonIdrKeyframes,
                            boolean detectAccessUnits)

      Parameters:
        `seiReader` - An SEI reader for consuming closed caption channels.
        `allowNonIdrKeyframes` - Whether to treat samples consisting of non-IDR I slices as synchronization samples (key-frames).
        `detectAccessUnits` - Whether to split the input stream into access units (samples) based on slice headers. Pass `false` if the stream contains access unit delimiters (AUDs).

  - ### Method Detail

    - #### seek

          public void seek()

      Description copied from interface: `ElementaryStreamReader`
      Notifies the reader that a seek has occurred.
      Specified by:
        `seek` in interface `ElementaryStreamReader`

    - #### createTracks

          public void createTracks​(ExtractorOutput extractorOutput,
                                   TsPayloadReader.TrackIdGenerator idGenerator)

      Description copied from interface: `ElementaryStreamReader`
      Initializes the reader by providing outputs and ids for the tracks.
      Specified by:
        `createTracks` in interface `ElementaryStreamReader`
      Parameters:
        `extractorOutput` - The `ExtractorOutput` that receives the extracted data.
        `idGenerator` - A `TsPayloadReader.TrackIdGenerator` that generates unique track ids for the `TrackOutput`s.

    - #### packetStarted

          public void packetStarted​(long pesTimeUs,
                                    @com.google.android.exoplayer2.extractor.ts.TsPayloadReader.Flags int flags)

      Description copied from interface: `ElementaryStreamReader`
      Called when a packet starts.
      Specified by:
        `packetStarted` in interface `ElementaryStreamReader`
      Parameters:
        `pesTimeUs` - The timestamp associated with the packet.
        `flags` - See `TsPayloadReader.Flags`.

    - #### consume

          public void consume​(ParsableByteArray data)

      Description copied from interface: `ElementaryStreamReader`
      Consumes (possibly partial) data from the current packet.
      Specified by:
        `consume` in interface `ElementaryStreamReader`
      Parameters:
        `data` - The data to consume.

    - #### packetFinished

          public void packetFinished()

      Description copied from interface: `ElementaryStreamReader`
      Called when a packet ends.
      Specified by:
        `packetFinished` in interface `ElementaryStreamReader`