Back to Exoplayer

FakeTrackOutput (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/testutil/FakeTrackOutput.html

latest10.4 KB
Original Source

Package com.google.android.exoplayer2.testutil

Class FakeTrackOutput

  • java.lang.Object

    • com.google.android.exoplayer2.testutil.FakeTrackOutput
  • All Implemented Interfaces:TrackOutput, Dumper.Dumpable


public final classFakeTrackOutputextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")implements[TrackOutput](../extractor/TrackOutput.html "interface in com.google.android.exoplayer2.extractor"),[Dumper.Dumpable](Dumper.Dumpable.html "interface in com.google.android.exoplayer2.testutil")

A fake TrackOutput.

Nested Class Summary

Nested Classes | Modifier and Type | Class | Description | | --- | --- | --- | | static interface | FakeTrackOutput.Factory | Factory for FakeTrackOutput instances. |

- 

Nested classes/interfaces inherited from interface com.google.android.exoplayer2.extractor.TrackOutput

TrackOutput.CryptoData, TrackOutput.SampleDataPart

Field Summary

Fields | Modifier and Type | Field | Description | | --- | --- | --- | | static FakeTrackOutput.Factory | DEFAULT_FACTORY | | | Format | lastFormat | |

- 

Fields inherited from interface com.google.android.exoplayer2.extractor.TrackOutput

SAMPLE_DATA_PART_ENCRYPTION, SAMPLE_DATA_PART_MAIN, SAMPLE_DATA_PART_SUPPLEMENTAL

Constructor Summary

Constructors | Constructor | Description | | --- | --- | | FakeTrackOutput​(boolean deduplicateConsecutiveFormats) | |

Method Summary

All Methods Instance Methods Concrete Methods | Modifier and Type | Method | Description | | --- | --- | --- | | void | assertSample​(int index, byte[] data, long timeUs, int flags, TrackOutput.CryptoData cryptoData) | | | void | assertSampleCount​(int count) | | | void | clear() | | | void | dump​(Dumper dumper) | Dumps the fields of the object using the dumper. | | void | format​(Format format) | Called when the Format of the track has been extracted from the stream. | | int | getSampleCount() | | | TrackOutput.CryptoData | getSampleCryptoData​(int index) | | | byte[] | getSampleData​(int index) | | | int | getSampleFlags​(int index) | | | List<Long> | getSampleTimesUs() | | | long | getSampleTimeUs​(int index) | | | int | sampleData​(DataReader input, int length, boolean allowEndOfInput, @com.google.android.exoplayer2.extractor.TrackOutput.SampleDataPart int sampleDataPart) | Called to write sample data to the output. | | void | sampleData​(ParsableByteArray data, int length, @com.google.android.exoplayer2.extractor.TrackOutput.SampleDataPart int sampleDataPart) | 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) | Called when metadata associated with a sample has been extracted from the stream. |

- 

Methods inherited from class java.lang.Object

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

- 

Methods inherited from interface com.google.android.exoplayer2.extractor.TrackOutput

sampleData, sampleData

Field Detail

- 

DEFAULT_FACTORY

public static final[FakeTrackOutput.Factory](FakeTrackOutput.Factory.html "interface in com.google.android.exoplayer2.testutil")DEFAULT_FACTORY
- 

lastFormat

@Nullable
public[Format](../Format.html "class in com.google.android.exoplayer2")lastFormat

Constructor Detail

- 

FakeTrackOutput

public FakeTrackOutput​(boolean deduplicateConsecutiveFormats)

Method Detail

- 

clear

public void clear()
- 

format

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

Description copied from interface: TrackOutput

Called when the Format of the track has been extracted from the stream. Specified by:format in interface TrackOutputParameters:format - The extracted Format.

- 

sampleData

public 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")

Description copied from interface: TrackOutput

Called to write sample data to the output. Specified by:sampleData in interface TrackOutputParameters: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

public 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)

Description copied from interface: TrackOutput

Called to write sample data to the output. Specified by:sampleData in interface TrackOutputParameters: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

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

Description copied from interface: TrackOutput

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 TrackOutput.sampleData(DataReader, int, boolean) or TrackOutput.sampleData(ParsableByteArray, int).

Specified by:sampleMetadata in interface TrackOutputParameters: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 TrackOutput.sampleData(DataReader, int, boolean) or TrackOutput.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.

- 

assertSampleCount

public void assertSampleCount​(int count)
- 

assertSample

public void assertSample​(int index,
                         byte[] data,
                         long timeUs,
                         int flags,
                         @Nullable[TrackOutput.CryptoData](../extractor/TrackOutput.CryptoData.html "class in com.google.android.exoplayer2.extractor")cryptoData)
- 

getSampleData

public byte[] getSampleData​(int index)
- 

getSampleTimeUs

public long getSampleTimeUs​(int index)
- 

getSampleFlags

public int getSampleFlags​(int index)
- 

getSampleCryptoData

@Nullable
public[TrackOutput.CryptoData](../extractor/TrackOutput.CryptoData.html "class in com.google.android.exoplayer2.extractor")getSampleCryptoData​(int index)
- 

getSampleCount

public int getSampleCount()
- 

getSampleTimesUs

public[List](https://developer.android.com/reference/java/util/List.html "class or interface in java.util")<[Long](https://developer.android.com/reference/java/lang/Long.html?is-external=true "class or interface in java.lang")> getSampleTimesUs()
- 

dump

public void dump​([Dumper](Dumper.html "class in com.google.android.exoplayer2.testutil")dumper)

Description copied from interface: Dumper.Dumpable

Dumps the fields of the object using the dumper. Specified by:dump in interface Dumper.DumpableParameters:dumper - The Dumper to be used to dump fields.