Class FakeTrackOutput
- java.lang.Object
-
- com.google.android.exoplayer2.testutil.FakeTrackOutput
-
- All Implemented Interfaces:
TrackOutput,Dumper.Dumpable
public final class FakeTrackOutput extends Object implements TrackOutput, Dumper.Dumpable
A fakeTrackOutput.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceFakeTrackOutput.FactoryFactory forFakeTrackOutputinstances.-
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.FactoryDEFAULT_FACTORYFormatlastFormat-
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 voidassertSample(int index, byte[] data, long timeUs, int flags, TrackOutput.CryptoData cryptoData)voidassertSampleCount(int count)voidclear()voiddump(Dumper dumper)Dumps the fields of the object using thedumper.voidformat(Format format)Called when theFormatof the track has been extracted from the stream.intgetSampleCount()TrackOutput.CryptoDatagetSampleCryptoData(int index)byte[]getSampleData(int index)intgetSampleFlags(int index)List<Long>getSampleTimesUs()longgetSampleTimeUs(int index)intsampleData(DataReader input, int length, boolean allowEndOfInput, int sampleDataPart)Called to write sample data to the output.voidsampleData(ParsableByteArray data, int length, int sampleDataPart)Called to write sample data to the output.voidsampleMetadata(long timeUs, 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 DEFAULT_FACTORY
-
lastFormat
@Nullable public Format lastFormat
-
-
Method Detail
-
clear
public void clear()
-
format
public void format(Format format)
Description copied from interface:TrackOutputCalled when theFormatof the track has been extracted from the stream.- Specified by:
formatin interfaceTrackOutput- Parameters:
format- The extractedFormat.
-
sampleData
public int sampleData(DataReader input, int length, boolean allowEndOfInput, @SampleDataPart int sampleDataPart) throws IOException
Description copied from interface:TrackOutputCalled to write sample data to the output.- Specified by:
sampleDatain interfaceTrackOutput- Parameters:
input- ADataReaderfrom 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 inC.RESULT_END_OF_INPUTbeing returned. False if it should be considered an error, causing anEOFExceptionto 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 data, int length, @SampleDataPart int sampleDataPart)
Description copied from interface:TrackOutputCalled to write sample data to the output.- Specified by:
sampleDatain interfaceTrackOutput- Parameters:
data- AParsableByteArrayfrom which to read the sample data.length- The number of bytes to read, starting fromdata.getPosition().sampleDataPart- The part of the sample data to which this call corresponds.
-
sampleMetadata
public void sampleMetadata(long timeUs, @BufferFlags int flags, int size, int offset, @Nullable TrackOutput.CryptoData cryptoData)Description copied from interface:TrackOutputCalled 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)orTrackOutput.sampleData(ParsableByteArray, int).- Specified by:
sampleMetadatain interfaceTrackOutput- Parameters:
timeUs- The media timestamp associated with the sample, in microseconds.flags- Flags associated with the sample. SeeC.BUFFER_FLAG_*.size- The size of the sample data, in bytes.offset- The number of bytes that have been passed toTrackOutput.sampleData(DataReader, int, boolean)orTrackOutput.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 cryptoData)
-
getSampleData
public byte[] getSampleData(int index)
-
getSampleTimeUs
public long getSampleTimeUs(int index)
-
getSampleFlags
public int getSampleFlags(int index)
-
getSampleCryptoData
@Nullable public TrackOutput.CryptoData getSampleCryptoData(int index)
-
getSampleCount
public int getSampleCount()
-
dump
public void dump(Dumper dumper)
Description copied from interface:Dumper.DumpableDumps the fields of the object using thedumper.- Specified by:
dumpin interfaceDumper.Dumpable- Parameters:
dumper- TheDumperto be used to dump fields.
-
-