# MediaCodecInfo.AudioCapabilities

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# AudioCapabilities

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/MediaCodecInfo.AudioCapabilities "View this page in Java")  

```
class AudioCapabilities
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                   ||
| ↳ | [android.media.MediaCodecInfo.AudioCapabilities](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#) |

A class that supports querying the audio capabilities of a codec.

## Summary

|                                                                                                                                                                                                                                                                            Public methods                                                                                                                                                                                                                                                                            ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!                                                                                    | [getBitrateRange](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getBitrateRange())`()` Returns the range of supported bitrates in bits/second.                                                                                                                  |
| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!\>  | [getInputChannelCountRanges](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getInputChannelCountRanges())`()` <br />                                                                                                                                             |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                                          | [getMaxInputChannelCount](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getMaxInputChannelCount())`()` Returns the maximum number of input channels supported.                                                                                                  |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                                          | [getMinInputChannelCount](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getMinInputChannelCount())`()` Returns the minimum number of input channels supported.                                                                                                  |
| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\<[Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>!\>! | [getSupportedSampleRateRanges](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getSupportedSampleRateRanges())`()` Returns the array of supported sample rate ranges.                                                                                             |
| [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)!                                                                                                                                                              | [getSupportedSampleRates](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getSupportedSampleRates())`()` Returns the array of supported sample rates if the codec supports only discrete values.                                                                  |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                                                  | [isSampleRateSupported](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#isSampleRateSupported(kotlin.Int))`(`sampleRate:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Query whether the sample rate is supported by the codec. |

## Public methods

### getBitrateRange

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getBitrateRange(): Range<Int!>!
```

Returns the range of supported bitrates in bits/second.  

### getInputChannelCountRanges

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getInputChannelCountRanges(): Array<Range<Int!>!>
```

|                                                                                                                                   Return                                                                                                                                    ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)<[Range](https://developer.android.com/reference/kotlin/android/util/Range.html#)<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!>!> | This value cannot be`null`. |

### getMaxInputChannelCount

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getMaxInputChannelCount(): Int
```

Returns the maximum number of input channels supported. Through[android.os.Build.VERSION_CODES#R](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#R:kotlin.Int), this method indicated support for any number of input channels between 1 and this maximum value. As of[android.os.Build.VERSION_CODES#S](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int), the implied lower limit of 1 channel is no longer valid. As of[android.os.Build.VERSION_CODES#S](https://developer.android.com/reference/kotlin/android/os/Build.VERSION_CODES.html#S:kotlin.Int),[getMaxInputChannelCount](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getMaxInputChannelCount())is superseded by[getInputChannelCountRanges](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getInputChannelCountRanges()), which returns an array of ranges of channels. The[getMaxInputChannelCount](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getMaxInputChannelCount())method will return the highest value in the ranges returned by[getInputChannelCountRanges](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getInputChannelCountRanges())

|                                                      Return                                                      ||
|----------------------------------------------------------------------------|--------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is between 1 and 255 inclusive |

### getMinInputChannelCount

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getMinInputChannelCount(): Int
```

Returns the minimum number of input channels supported. This is often 1, but does vary for certain mime types. This returns the lowest channel count in the ranges returned by[getInputChannelCountRanges](https://developer.android.com/reference/kotlin/android/media/MediaCodecInfo.AudioCapabilities#getInputChannelCountRanges()).

|                                                      Return                                                      ||
|----------------------------------------------------------------------------|--------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is between 1 and 255 inclusive |

### getSupportedSampleRateRanges

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSupportedSampleRateRanges(): Array<Range<Int!>!>!
```

Returns the array of supported sample rate ranges. The array is sorted in ascending order, and the ranges are distinct.  

### getSupportedSampleRates

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSupportedSampleRates(): IntArray!
```

Returns the array of supported sample rates if the codec supports only discrete values. Otherwise, it returns`null`. The array is sorted in ascending order.  

### isSampleRateSupported

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun isSampleRateSupported(sampleRate: Int): Boolean
```

Query whether the sample rate is supported by the codec.