@UnstableApi
public final class IamfUtil


Constants and utils for configuring IAMF decoding.

Summary

Nested types

Represents the different output sound systems supported by IAMF.

Constants

static final int
static final ImmutableSet<Integer>
static final int

Decoder rendered binaural audio.

static final int

Mono.

static final int

IAMF extension 3.1.2.

static final int

IAMF extension 7.1.2.

static final int

IAMF Extension 9.1.6.

static final int

ITU-R B.S.

static final int

ITU-R B.S.

static final int

ITU-R B.S.

static final int

ITU-R B.S.

static final int

ITU-R B.S.

static final int

ITU-R B.S.

static final int

ITU-R B.S.

static final int

ITU-R B.S.

static final int

ITU-R B.S.

static final int

ITU-R B.S.

static final int

Value to be used to not specify an output layout.

static final long

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

Public methods

static int

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

static int

Returns an appropriate channel mask for the current AudioCapabilities.

static int

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

static int
@IamfUtil.OutputLayout
getOutputLayoutForCurrentConfiguration(
    AudioCapabilities audioCapabilities,
    boolean useIntegratedBinauralRenderer
)

Returns an appropriate output layout for the current AudioCapabilities.

Constants

CHANNEL_OUT_ITU_2051_SOUND_SYSTEM_H_9_10_3

@RequiresApi(value = 32)
public static final int CHANNEL_OUT_ITU_2051_SOUND_SYSTEM_H_9_10_3 = 67108860

IAMF_SUPPORTED_CHANNEL_MASKS

@VisibleForTesting
public static final ImmutableSet<IntegerIAMF_SUPPORTED_CHANNEL_MASKS

OUTPUT_LAYOUT_BINAURAL

public static final int OUTPUT_LAYOUT_BINAURAL = 14

Decoder rendered binaural audio.

OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_0_1_0

public static final int OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_0_1_0 = 12

Mono.

OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_2_3_0

public static final int OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_2_3_0 = 11

IAMF extension 3.1.2.

OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_2_7_0

public static final int OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_2_7_0 = 10

IAMF extension 7.1.2.

OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_6_9_0

public static final int OUTPUT_LAYOUT_IAMF_SOUND_SYSTEM_EXTENSION_6_9_0 = 13

IAMF Extension 9.1.6.

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_A_0_2_0

public static final int OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_A_0_2_0 = 0

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

public static final int OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_B_0_5_0 = 1

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

public static final int OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_C_2_5_0 = 2

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

public static final int OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_D_4_5_0 = 3

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

public static final int OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_E_4_5_1 = 4

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

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_F_3_7_0

public static final int OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_F_3_7_0 = 5

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

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_G_4_9_0

public static final int OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_G_4_9_0 = 6

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

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_H_9_10_3

public static final int OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_H_9_10_3 = 7

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

OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_I_0_7_0

public static final int OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_I_0_7_0 = 8

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

public static final int OUTPUT_LAYOUT_ITU2051_SOUND_SYSTEM_J_4_7_0 = 9

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

OUTPUT_LAYOUT_UNSET

public static final int OUTPUT_LAYOUT_UNSET = -1

Value to be used to not specify an output layout.

REQUESTED_MIX_PRESENTATION_ID_UNSET

public static final long REQUESTED_MIX_PRESENTATION_ID_UNSET = -1

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 methods

getChannelMaskForOutputLayout

public static int getChannelMaskForOutputLayout(@IamfUtil.OutputLayout int outputLayout)

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

public static int getOutputChannelMaskForCurrentConfiguration(
    AudioCapabilities audioCapabilities
)

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
public static int getOutputLayoutForChannelMask(int channelMask)

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
public static int getOutputLayoutForCurrentConfiguration(
    AudioCapabilities audioCapabilities,
    boolean useIntegratedBinauralRenderer
)

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.

boolean useIntegratedBinauralRenderer

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.