LoudnessCodecController


public class LoudnessCodecController
extends Object implements AutoCloseable

java.lang.Object
   ↳ android.media.LoudnessCodecController


Class for getting recommended loudness parameter updates for audio decoders as they are used to play back media content according to the encoded format and current audio routing. These audio decoder updates leverage loudness metadata present in compressed audio streams. They ensure the loudness and dynamic range of the content is optimized to the physical characteristics of the audio output device (e.g. phone microspeakers vs headphones vs TV speakers).Those updates can be automatically applied to the MediaCodec instance(s), or be provided to the user. The codec loudness management parameter updates are computed in accordance to the CTA-2075 standard.

A new object should be instantiated for each audio session (see AudioManager.generateAudioSessionId()) using creator methods create(int) or create(int,Executor,OnLoudnessCodecUpdateListener).

Summary

Nested classes

interface LoudnessCodecController.OnLoudnessCodecUpdateListener

Listener used for receiving asynchronous loudness metadata updates. 

Public methods

boolean addMediaCodec(MediaCodec mediaCodec)

Adds a new MediaCodec that will stream data to a player which uses ERROR(/#mSessionId).

void close()

Stops any loudness updates and frees up the resources.

static LoudnessCodecController create(int sessionId, Executor executor, LoudnessCodecController.OnLoudnessCodecUpdateListener listener)

Creates a new instance of LoudnessCodecController

This method should be used when the client wants to alter the codec loudness parameters before they are applied to the audio decoders.

static LoudnessCodecController create(int sessionId)

Creates a new instance of LoudnessCodecController

This method should be used when the client does not need to alter the codec loudness parameters before they are applied to the audio decoders.

Bundle getLoudnessCodecParams(MediaCodec mediaCodec)

Returns the loudness parameters of the registered audio decoders

Those parameters may have been automatically applied if the LoudnessCodecController was created with create(int), or they are the parameters that have been sent to the OnLoudnessCodecUpdateListener if using a codec update listener.

void removeMediaCodec(MediaCodec mediaCodec)

Removes the MediaCodec from