# Sniffer

Artifact: [androidx.media3:media3-extractor](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/extractor/mp4/Sniffer.java+class:androidx.media3.extractor.mp4.Sniffer)

*** ** * ** ***


```
@UnstableApi
public final class Sniffer
```

<br />

*** ** * ** ***

Provides methods that peek data from an `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput` and return whether the input appears to be in MP4 format.

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/media3/extractor/mp4/Sniffer#BRAND_QUICKTIME() = 1903435808` Brand stored in the ftyp atom for QuickTime media. |

| ### Public methods |
|---|---|
| `static @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/SniffFailure` | `https://developer.android.com/reference/androidx/media3/extractor/mp4/Sniffer#sniffFragmented(androidx.media3.extractor.ExtractorInput)(https://developer.android.com/reference/androidx/media3/extractor/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 `https://developer.android.com/reference/androidx/media3/extractor/SniffFailure` describing the first detected inconsistency.. |
| `static @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/SniffFailure` | `https://developer.android.com/reference/androidx/media3/extractor/mp4/Sniffer#sniffUnfragmented(androidx.media3.extractor.ExtractorInput)(https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput input)` Returns `null` if data peeked from the current position in `input` is consistent with the input being an unfragmented MP4 file, otherwise returns a `https://developer.android.com/reference/androidx/media3/extractor/SniffFailure` describing the first detected inconsistency. |

## Constants

### 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 `https://developer.android.com/reference/androidx/media3/extractor/SniffFailure` describing the first detected inconsistency..

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput input` | The extractor input from which to peek data. The peek position will be modified. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/SniffFailure` | `null` if the input appears to be in the fragmented MP4 format, otherwise a `https://developer.android.com/reference/androidx/media3/extractor/SniffFailure` describing why the input isn't deemed to be a fragmented MP4. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an error occurs reading from the input. |

### sniffUnfragmented

```
public static @Nullable SniffFailure sniffUnfragmented(ExtractorInput input)
```

Returns `null` if data peeked from the current position in `input` is consistent with the input being an unfragmented MP4 file, otherwise returns a `https://developer.android.com/reference/androidx/media3/extractor/SniffFailure` describing the first detected inconsistency.

| Parameters |
|---|---|
| `https://developer.android.com/reference/androidx/media3/extractor/ExtractorInput input` | The extractor input from which to peek data. The peek position will be modified. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/androidx/media3/extractor/SniffFailure` | `null` if the input appears to be in the fragmented MP4 format, otherwise a `https://developer.android.com/reference/androidx/media3/extractor/SniffFailure` describing why the input isn't deemed to be a fragmented MP4. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/IOException.html` | If an error occurs reading from the input. |