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)

  1. Applications can use the AudioManager.ACTION_HDMI_AUDIO_PLUG intent to detect if there is an HDMI device connected
  2. If the Extra Encodings parameter includes ENCODING_E_AC3, then Dolby Digital Plus is supported by the HDMI device
  3. The application can then use AudioTrack.write() with AudioFormat.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. 

How 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.