Implementation
Through standard Android APIs (API level 21), Android applications can detect a device's capabilities, can detect the endpoint (eg: HDMI) and select a Dolby Digital Plus™ stream for a playback.
How to check if the endpoint device supports Dolby Digital Plus via HDMI
How to determine if a digital media adaptor (DMA) is connected to the AVR or TV that supports Dolby Digital Plus (allows passing Dolby Digital Plus Bitstream directly)
- Applications can use the
AudioManager.ACTION_HDMI_AUDIO_PLUG
intent to detect if there is an HDMI device connected - If the Extra Encodings parameter includes
ENCODING_E_AC3
, then Dolby Digital Plus is supported by the HDMI device - The application can then use
AudioTrack.write()
withAudioFormat.ENCODING_E_AC3
encoding
Note: Using the Android MediaCodec class is also an acceptable way to decode, however it will decode Dolby Digital Plus to raw PCM. We recommend using AudioTrack for passthrough support.
Use Audiomanager class to determine endpoint device Step 1 Check to see if the Extra Encoding parameter includes ENCODING_E_AC3 Step 2 Create Audiotrack and use the encoded file Step 3How to Android MediaPlayer API to playback Dolby Digital Plus content
There are other ways to playback Dolby Digital Plus, one common approach is to use Android's MediaPlayer APIs. The document below will explain how to implement this.
Dolby Digital Plus playback guide View guide