TrackOutput, Dumper.Dumpablepublic final class FakeTrackOutput extends Object implements TrackOutput, Dumper.Dumpable
TrackOutput.| Modifier and Type | Class | Description |
|---|---|---|
static interface |
FakeTrackOutput.Factory |
Factory for
FakeTrackOutput instances. |
TrackOutput.CryptoData, TrackOutput.SampleDataPart| Modifier and Type | Field | Description |
|---|---|---|
static FakeTrackOutput.Factory |
DEFAULT_FACTORY |
|
Format |
lastFormat |
SAMPLE_DATA_PART_ENCRYPTION, SAMPLE_DATA_PART_MAIN, SAMPLE_DATA_PART_SUPPLEMENTAL| Constructor | Description |
|---|---|
FakeTrackOutput(boolean deduplicateConsecutiveFormats) |
| 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,
int sampleDataPart) |
Called to write sample data to the output.
|
void |
sampleData(ParsableByteArray data,
int length,
int sampleDataPart) |
Called to write sample data to the output.
|
void |
sampleMetadata(long timeUs,
int flags,
int size,
int offset,
TrackOutput.CryptoData cryptoData) |
Called when metadata associated with a sample has been extracted from the stream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsampleData, sampleDatapublic static final FakeTrackOutput.Factory DEFAULT_FACTORY
@Nullable public Format lastFormat
public void clear()
public void format(Format format)
TrackOutputFormat of the track has been extracted from the stream.format in interface TrackOutputformat - The extracted Format.public int sampleData(DataReader input, int length, boolean allowEndOfInput, @SampleDataPart int sampleDataPart) throws IOException
TrackOutputsampleData in interface TrackOutputinput - 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.IOException - If an error occurred reading from the input.public void sampleData(ParsableByteArray data, int length, @SampleDataPart int sampleDataPart)
TrackOutputsampleData in interface TrackOutputdata - 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.public void sampleMetadata(long timeUs,
@BufferFlags
int flags,
int size,
int offset,
@Nullable
TrackOutput.CryptoData cryptoData)
TrackOutputThe corresponding sample data will have already been passed to the output via calls to
TrackOutput.sampleData(DataReader, int, boolean) or TrackOutput.sampleData(ParsableByteArray, int).
sampleMetadata in interface TrackOutputtimeUs - 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.public void assertSampleCount(int count)
public void assertSample(int index,
byte[] data,
long timeUs,
int flags,
@Nullable
TrackOutput.CryptoData cryptoData)
public byte[] getSampleData(int index)
public long getSampleTimeUs(int index)
public int getSampleFlags(int index)
@Nullable public TrackOutput.CryptoData getSampleCryptoData(int index)
public int getSampleCount()
public void dump(Dumper dumper)
Dumper.Dumpabledumper.dump in interface Dumper.Dumpabledumper - The Dumper to be used to dump fields.