Back to Exoplayer

TsUtil (ExoPlayer library)

docs/doc/reference/com/google/android/exoplayer2/extractor/ts/TsUtil.html

latest4.4 KB
Original Source

Package com.google.android.exoplayer2.extractor.ts

Class TsUtil


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

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.

Utilities method for extracting MPEG-TS streams.

Method Summary

All Methods Static Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description | | --- | --- | --- | | static int | findSyncBytePosition​(byte[] data, int startPosition, int limitPosition) | Deprecated.

Returns the position of the first TS_SYNC_BYTE within the range [startPosition, limitPosition) from the provided data array, or returns limitPosition if sync byte could not be found. | | static boolean | isStartOfTsPacket​(byte[] data, int start, int limit, int searchPosition) | Deprecated.

Returns whether a TS packet starts at searchPosition according to the MPEG-TS synchronization recommendations. | | static long | readPcrFromPacket​(ParsableByteArray packetBuffer, int startOfPacket, int pcrPid) | Deprecated.

Returns the PCR value read from a given TS packet. |

- 

Methods inherited from class java.lang.Object

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

Method Detail

- 

isStartOfTsPacket

public static boolean isStartOfTsPacket​(byte[] data,
                                        int start,
                                        int limit,
                                        int searchPosition)

Deprecated.

Returns whether a TS packet starts at searchPosition according to the MPEG-TS synchronization recommendations.

ISO/IEC 13818-1:2015 Annex G recommends that 5 sync bytes emulating the start of 5 consecutive TS packets should never occur as part of the TS packets' contents. So, this method returns true when data contains a sync byte at searchPosition, and said sync byte is also one of five consecutive sync bytes separated from each other by the size of a TS packet.

Parameters:data - The array holding the data to search in.start - The first valid position in data from which a sync byte can be read.limit - The first invalid position in data, after which no data should be read.searchPosition - The position to check for a TS packet start.Returns:Whether a TS packet starts at searchPosition.

- 

findSyncBytePosition

public static int findSyncBytePosition​(byte[] data,
                                       int startPosition,
                                       int limitPosition)

Deprecated.

Returns the position of the first TS_SYNC_BYTE within the range [startPosition, limitPosition) from the provided data array, or returns limitPosition if sync byte could not be found.

- 

readPcrFromPacket

public static long readPcrFromPacket​([ParsableByteArray](../../util/ParsableByteArray.html "class in com.google.android.exoplayer2.util")packetBuffer,
                                     int startOfPacket,
                                     int pcrPid)

Deprecated.

Returns the PCR value read from a given TS packet. Parameters:packetBuffer - The buffer that holds the packet.startOfPacket - The starting position of the packet in the buffer.pcrPid - The PID for valid packets that contain PCR values.Returns:The PCR value read from the packet, if its PID is equal to pcrPid and it contains a valid PCR value. Returns C.TIME_UNSET otherwise.