AdtsReader
@UnstableApi
public final class AdtsReader implements ElementaryStreamReader
Parses a continuous ADTS byte stream and extracts individual frames.
Summary
Public fields |
|
|---|---|
long |
Public constructors |
|---|
AdtsReader(boolean exposeId3, String containerMimeType) |
AdtsReader( |
Public methods |
|
|---|---|
void |
consume(ParsableByteArray data)Consumes (possibly partial) data from the current packet. |
void |
createTracks(Initializes the reader by providing outputs and ids for the tracks. |
long |
Returns the duration in microseconds per sample, or |
static boolean |
isAdtsSyncWord(int candidateSyncWord)Returns whether an integer matches an ADTS SYNC word. |
void |
packetFinished(boolean isEndOfInput)Called when a packet ends. |
void |
packetStarted(long pesTimeUs, @TsPayloadReader.Flags int flags)Called when a packet starts. |
void |
seek()Notifies the reader that a seek has occurred. |
Public fields
Public constructors
AdtsReader
public AdtsReader(boolean exposeId3, String containerMimeType)
| Parameters | |
|---|---|
boolean exposeId3 |
True if the reader should expose ID3 information. |
String containerMimeType |
The MIME type of the container holding the stream. |
AdtsReader
public AdtsReader(
boolean exposeId3,
@Nullable String language,
@C.RoleFlags int roleFlags,
String containerMimeType
)
| Parameters | |
|---|---|
boolean exposeId3 |
True if the reader should expose ID3 information. |
@Nullable String language |
Track language. |
@C.RoleFlags int roleFlags |
Track role flags. |
String containerMimeType |
The MIME type of the container holding the stream. |
Public methods
consume
public void consume(ParsableByteArray data)
Consumes (possibly partial) data from the current packet.
| Parameters | |
|---|---|
ParsableByteArray data |
The data to consume. |
| Throws | |
|---|---|
androidx.media3.common.ParserException |
If the data could not be parsed. |
createTracks
public void createTracks(
ExtractorOutput extractorOutput,
TsPayloadReader.TrackIdGenerator idGenerator
)
Initializes the reader by providing outputs and ids for the tracks.
| Parameters | |
|---|---|
ExtractorOutput extractorOutput |
The |
TsPayloadReader.TrackIdGenerator idGenerator |
A |
getSampleDurationUs
public long getSampleDurationUs()
Returns the duration in microseconds per sample, or TIME_UNSET if the sample duration is not available.
isAdtsSyncWord
public static boolean isAdtsSyncWord(int candidateSyncWord)
Returns whether an integer matches an ADTS SYNC word.
packetStarted
public void packetStarted(long pesTimeUs, @TsPayloadReader.Flags int flags)
Called when a packet starts.
| Parameters | |
|---|---|
long pesTimeUs |
The timestamp associated with the packet. |
@TsPayloadReader.Flags int flags |