@UnstableApi
class IamfUtil


Constants and utils for configuring IAMF decoding.

Summary

Nested types

Represents the different output sound systems supported by IAMF.

Constants

const Int
const ImmutableSet<Int!>!
const Int

Decoder rendered binaural audio.

const Int

Mono.

const Int

IAMF extension 3.1.2.

const Int

IAMF extension 7.1.2.

const Int

IAMF Extension 9.1.6.

const Int

ITU-R B.S.

const Int

ITU-R B.S.

const Int

ITU-R B.S.

const Int

ITU-R B.S.

const Int

ITU-R B.S.

const Int

ITU-R B.S.

const Int

ITU-R B.S.

const Int

ITU-R B.S.

const Int

ITU-R B.S.

const Int

ITU-R B.S.

const Int

Value to be used to not specify an output layout.

const Long

Used to indicate no requested Mix Presentation ID when creating a decoder.

Public functions

java-static Int

Returns the Android channel mask that most closely matches the given IAMF output layout.

java-static Int

Returns an appropriate channel mask for the current AudioCapabilities.

java-static Int

Returns an IAMF output layout to try to match a given channel mask.

java-static Int
@IamfUtil.OutputLayout
getOutputLayoutForCurrentConfiguration(
    audioCapabilities: AudioCapabilities!,
    useIntegratedBinauralRenderer: Boolean
)

Returns an appropriate output layout for the current AudioCapabilities.

Constants

CHANNEL_OUT_ITU_2051_SOUND_SYSTEM_H_9_10_3

@RequiresApi(value = 32)
const val CHANNEL_OUT_ITU_2051_SOUND_SYSTEM_H_9_10_3 = 67108860: Int

IAMF_SUPPORTED_CHANNEL_MASKS

@VisibleForTesting
const val IAMF_SUPPORTED_CHANNEL_MASKSImmutableSet<Int!>!

OUTPUT_LAYOUT_BINAURAL

const val OUTPUT_LAYOUT_BINAURAL = 14: Int

Decoder rendered binaural audio.

OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_0_1_0

const val OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_0_1_0 = 12: Int

Mono.

OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_2_3_0

const val OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_2_3_0 = 11: Int

IAMF extension 3.1.2.

OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_2_7_0

const val OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_2_7_0 = 10: Int

IAMF extension 7.1.2.

OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_6_9_0

const val OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_6_9_0 = 13: Int

IAMF Extension 9.1.6.

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_A_0_2_0

const val OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_A_0_2_0 = 0: Int

ITU-R B.S. 2051-3 sound system A (0+2+0), commonly known as stereo.

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_B_0_5_0

const val OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_B_0_5_0 = 1: Int

ITU-R B.S. 2051-3 sound system B (0+5+0), commonly known as 5.1.

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_C_2_5_0

const val OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_C_2_5_0 = 2: Int

ITU-R B.S. 2051-3 sound system C (2+5+0), commonly known as 5.1.2.

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_D_4_5_0

const val OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_D_4_5_0 = 3: Int

ITU-R B.S. 2051-3 sound system D (4+5+0), commonly known as 5.1.4.

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_E_4_5_1

const val OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_E_4_5_1 = 4: Int

ITU-R B.S. 2051-3 sound system E (4+5+1).

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_F_3_7_0

const val OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_F_3_7_0 = 5: Int

ITU-R B.S. 2051-3 sound system F (3+7+0).

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_G_4_9_0

const val OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_G_4_9_0 = 6: Int

ITU-R B.S. 2051-3 sound system G (4+9+0).

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_H_9_10_3

const val OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_H_9_10_3 = 7: Int

ITU-R B.S. 2051-3 sound system H (9+10+3).

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_I_0_7_0

const val OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_I_0_7_0 = 8: Int

ITU-R B.S. 2051-3 sound system I (0+7+0), commonly known as 7.1.

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_J_4_7_0

const val OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_J_4_7_0 = 9: Int

ITU-R B.S. 2051-3 sound system J (4+7+0), commonly known as 7.1.4.

OUTPUT_LAYOUT_UNSET

const val OUTPUT_LAYOUT_UNSET = -1: Int

Value to be used to not specify an output layout.

REQUESTED_MIX_PRESENTATION_ID_UNSET

const val REQUESTED_MIX_PRESENTATION_ID_UNSET = -1: Long

Used to indicate no requested Mix Presentation ID when creating a decoder.

When this value is used, the decoder will select a Mix Presentation ID based on the default logic, including considering the requested OutputLayout, if provided.

Public functions

getChannelMaskForOutputLayout

java-static fun getChannelMaskForOutputLayout(@IamfUtil.OutputLayout outputLayout: Int): Int

Returns the Android channel mask that most closely matches the given IAMF output layout.

Some AudioFormat-defined channel masks do not exactly match IAMF/ITU spec. Where there are differences, this method returns the more exact IAMF version.

Throws
java.lang.IllegalArgumentException

for invalid values of OutputLayout or OUTPUT_LAYOUT_UNSET.

getOutputChannelMaskForCurrentConfiguration

java-static fun getOutputChannelMaskForCurrentConfiguration(
    audioCapabilities: AudioCapabilities!
): Int

Returns an appropriate channel mask for the current AudioCapabilities.

This is used to set the channel count and channel mask when using the framework Codec2 software decoder, which takes a ChannelMask to indicate the output layout and does not currently support direct binaural output from the decoder.

getOutputLayoutForChannelMask

@IamfUtil.OutputLayout
java-static fun getOutputLayoutForChannelMask(channelMask: Int): Int

Returns an IAMF output layout to try to match a given channel mask.

Where there are differences between the placement of speakers as defined by AudioFormat channel masks and channel masks matching the IAMF/ITU standard, we permissively match both.

Throws
java.lang.IllegalArgumentException

if the channelMask has no matching IAMF output layout.

getOutputLayoutForCurrentConfiguration

@IamfUtil.OutputLayout
java-static fun getOutputLayoutForCurrentConfiguration(
    audioCapabilities: AudioCapabilities!,
    useIntegratedBinauralRenderer: Boolean
): Int

Returns an appropriate output layout for the current AudioCapabilities.

This is used to configure the IAMF extension decoder, which requires an OutputLayout to configure.

Parameters
audioCapabilities: AudioCapabilities!

The current AudioCapabilities.

useIntegratedBinauralRenderer: Boolean

When it seems the user is using headphones (because getSpatializerChannelMasks is non-empty), if useIntegratedBinauralRenderer is true, this method will return OUTPUT_LAYOUT_BINAURAL to get binaural audio directly from the decoder, otherwise, it will return an output layout appropriate for the android.media.Spatializer based on the available Spatializer channel masks.