@UnstableApi
public final class Sniffer


Provides methods that peek data from an ExtractorInput and return whether the input appears to be in MP4 format.

Summary

Constants

static final int
BRAND_HEIC = 1751476579

Brand stored in the ftyp atom for HEIC media.

static final int
BRAND_QUICKTIME = 1903435808

Brand stored in the ftyp atom for QuickTime media.

Public methods

static @Nullable SniffFailure

Returns null if data peeked from the current position in input is consistent with the input being a fragmented MP4 file, otherwise returns a SniffFailure describing the first detected inconsistency..

static @Nullable SniffFailure
sniffUnfragmented(ExtractorInput input, boolean acceptHeic)

Returns null if data peeked from the current position in input is consistent with the input being an unfragmented MP4 file, otherwise returns a SniffFailure describing the first detected inconsistency.

Constants

BRAND_HEIC

public static final int BRAND_HEIC = 1751476579

Brand stored in the ftyp atom for HEIC media.

BRAND_QUICKTIME

public static final int BRAND_QUICKTIME = 1903435808

Brand stored in the ftyp atom for QuickTime media.

Public methods

sniffFragmented

public static @Nullable SniffFailure sniffFragmented(ExtractorInput input)

Returns null if data peeked from the current position in input is consistent with the input being a fragmented MP4 file, otherwise returns a SniffFailure describing the first detected inconsistency..

Parameters
ExtractorInput input

The extractor input from which to peek data. The peek position will be modified.

Returns
@Nullable SniffFailure

null if the input appears to be in the fragmented MP4 format, otherwise a SniffFailure describing why the input isn't deemed to be a fragmented MP4.

Throws
java.io.IOException

If an error occurs reading from the input.

sniffUnfragmented

public static @Nullable SniffFailure sniffUnfragmented(ExtractorInput input, boolean acceptHeic)

Returns null if data peeked from the current position in input is consistent with the input being an unfragmented MP4 file, otherwise returns a SniffFailure describing the first detected inconsistency.

Parameters
ExtractorInput input

The extractor input from which to peek data. The peek position will be modified.

boolean acceptHeic

Whether null should be returned for HEIC photos.

Returns
@Nullable SniffFailure

null if the input appears to be in the fragmented MP4 format, otherwise a SniffFailure describing why the input isn't deemed to be a fragmented MP4.

Throws
java.io.IOException

If an error occurs reading from the input.