Back to Exoplayer

TrackOutput (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/extractor/TrackOutput.html

latest10.4 KB
Original Source

Package com.google.android.exoplayer2.extractor

Interface TrackOutput

  • All Known Implementing Classes:DummyTrackOutput, FakeTrackOutput, PlayerEmsgHandler.PlayerTrackEmsgHandler, SampleQueue

[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public interfaceTrackOutput

Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.

Receives track level data extracted by an Extractor.

Nested Class Summary

Nested Classes | Modifier and Type | Interface | Description | | --- | --- | --- | | static class | TrackOutput.CryptoData | Deprecated.

Holds data required to decrypt a sample. | | static interface | TrackOutput.SampleDataPart | Deprecated.

Defines the part of the sample data to which a call to sampleData(com.google.android.exoplayer2.upstream.DataReader, int, boolean) corresponds. |

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static int | SAMPLE_DATA_PART_ENCRYPTION | Deprecated.

Sample encryption data. | | static int | SAMPLE_DATA_PART_MAIN | Deprecated.

Main media sample data. | | static int | SAMPLE_DATA_PART_SUPPLEMENTAL | Deprecated.

Sample supplemental data. |

Method Summary

All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | format​(Format format) | Deprecated.

Called when the Format of the track has been extracted from the stream. | | default int | sampleData​(DataReader input, int length, boolean allowEndOfInput) | Deprecated.

Equivalent to sampleData(input, length, allowEndOfInput, SAMPLE_DATA_PART_MAIN). | | int | sampleData​(DataReader input, int length, boolean allowEndOfInput, @com.google.android.exoplayer2.extractor.TrackOutput.SampleDataPart int sampleDataPart) | Deprecated.

Called to write sample data to the output. | | default void | sampleData​(ParsableByteArray data, int length) | Deprecated.

Equivalent to sampleData(ParsableByteArray, int, int) sampleData(data, length, SAMPLE_DATA_PART_MAIN)}. | | void | sampleData​(ParsableByteArray data, int length, @com.google.android.exoplayer2.extractor.TrackOutput.SampleDataPart int sampleDataPart) | Deprecated.

Called to write sample data to the output. | | void | sampleMetadata​(long timeUs, @com.google.android.exoplayer2.C.BufferFlags int flags, int size, int offset, TrackOutput.CryptoData cryptoData) | Deprecated.

Called when metadata associated with a sample has been extracted from the stream. |

Field Detail

- 

SAMPLE_DATA_PART_MAIN

static final int SAMPLE_DATA_PART_MAIN

Deprecated.

Main media sample data. See Also:Constant Field Values

- 

SAMPLE_DATA_PART_ENCRYPTION

static final int SAMPLE_DATA_PART_ENCRYPTION

Deprecated.

Sample encryption data.

The format for encryption information is:

  - (1 byte) `encryption_signal_byte`: Most significant bit signals whether the encryption data contains subsample encryption data. The remaining bits contain `
   initialization_vector_size`. 
  - (`initialization_vector_size` bytes) Initialization vector. 
  - If subsample encryption data is present, as per `encryption_signal_byte`, the encryption data also contains: 
    - (2 bytes) `subsample_encryption_data_length`. 
    - (`subsample_encryption_data_length * 6` bytes) Subsample encryption data (repeated `subsample_encryption_data_length` times: 
      - (2 bytes) Size of a clear section in sample. 
      - (4 bytes) Size of an encryption section in sample. 

See Also:Constant Field Values

- 

SAMPLE_DATA_PART_SUPPLEMENTAL

static final int SAMPLE_DATA_PART_SUPPLEMENTAL

Deprecated.

Sample supplemental data.

If a sample contains supplemental data, the format of the entire sample data will be:

  - If the sample has the [`C.BUFFER_FLAG_ENCRYPTED`](../C.html#BUFFER_FLAG_ENCRYPTED) flag set, all encryption information. 
  - (4 bytes) `sample_data_size`: The size of the actual sample data, not including supplemental data or encryption information. 
  - (`sample_data_size` bytes): The media sample data. 
  - (remaining bytes) The supplemental data. 

See Also:Constant Field Values

Method Detail

- 

format

void format​([Format](../Format.html "class in com.google.android.exoplayer2")format)

Deprecated.

Called when the Format of the track has been extracted from the stream. Parameters:format - The extracted Format.

- 

sampleData

default int sampleData​([DataReader](../upstream/DataReader.html "interface in com.google.android.exoplayer2.upstream")input,
                       int length,
                       boolean allowEndOfInput)
                throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")

Deprecated.

Equivalent to sampleData(input, length, allowEndOfInput, SAMPLE_DATA_PART_MAIN). Throws:IOException

- 

sampleData

default void sampleData​([ParsableByteArray](../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")data,
                        int length)

Deprecated.

Equivalent to sampleData(ParsableByteArray, int, int) sampleData(data, length, SAMPLE_DATA_PART_MAIN)}.

- 

sampleData

int sampleData​([DataReader](../upstream/DataReader.html "interface in com.google.android.exoplayer2.upstream")input,
               int length,
               boolean allowEndOfInput,
               @com.google.android.exoplayer2.extractor.TrackOutput.SampleDataPart int sampleDataPart)
        throws[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")

Deprecated.

Called to write sample data to the output. Parameters:input - A DataReader from which to read the sample data.length - The maximum length to read from the input.allowEndOfInput - True if encountering the end of the input having read no data is allowed, and should result in C.RESULT_END_OF_INPUT being returned. False if it should be considered an error, causing an EOFException to be thrown.sampleDataPart - The part of the sample data to which this call corresponds.Returns:The number of bytes appended.Throws:IOException - If an error occurred reading from the input.

- 

sampleData

void sampleData​([ParsableByteArray](../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")data,
                int length,
                @com.google.android.exoplayer2.extractor.TrackOutput.SampleDataPart int sampleDataPart)

Deprecated.

Called to write sample data to the output. Parameters:data - A ParsableByteArray from which to read the sample data.length - The number of bytes to read, starting from data.getPosition().sampleDataPart - The part of the sample data to which this call corresponds.

- 

sampleMetadata

void sampleMetadata​(long timeUs,
                    @com.google.android.exoplayer2.C.BufferFlags int flags,
                    int size,
                    int offset,
                    @Nullable[TrackOutput.CryptoData](TrackOutput.CryptoData.html "class in com.google.android.exoplayer2.extractor")cryptoData)

Deprecated.

Called when metadata associated with a sample has been extracted from the stream.

The corresponding sample data will have already been passed to the output via calls to sampleData(DataReader, int, boolean) or sampleData(ParsableByteArray, int).

Parameters:timeUs - The media timestamp associated with the sample, in microseconds.flags - Flags associated with the sample. See C.BUFFER_FLAG_*.size - The size of the sample data, in bytes.offset - The number of bytes that have been passed to sampleData(DataReader, int, boolean) or sampleData(ParsableByteArray, int) since the last byte belonging to the sample whose metadata is being passed.cryptoData - The encryption data required to decrypt the sample. May be null.