diff options
author | Phil Burk <philburk@google.com> | 2015-04-06 16:22:23 -0700 |
---|---|---|
committer | Phil Burk <philburk@google.com> | 2015-04-09 16:18:34 -0700 |
commit | 23d8997f58bb9c59fa3a1b9a6b2edbf1b2b0f4c6 (patch) | |
tree | eed231c9bd5dc2523b7a0cf7c8b142810079dabc /services/audioflinger/SpdifStreamOut.cpp | |
parent | 31ffe45a22b72ee5d25bb4932d0525e90dbc19fe (diff) | |
download | frameworks_av-23d8997f58bb9c59fa3a1b9a6b2edbf1b2b0f4c6.zip frameworks_av-23d8997f58bb9c59fa3a1b9a6b2edbf1b2b0f4c6.tar.gz frameworks_av-23d8997f58bb9c59fa3a1b9a6b2edbf1b2b0f4c6.tar.bz2 |
AudioFlinger: more DTS passthrough support
Pass format for AC3 or DTS to SPDIF encoder.
Bug: 18292317
Change-Id: I6d80eb548cb431bac3390ebb3235146171344291
Signed-off-by: Phil Burk <philburk@google.com>
Diffstat (limited to 'services/audioflinger/SpdifStreamOut.cpp')
-rw-r--r-- | services/audioflinger/SpdifStreamOut.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/services/audioflinger/SpdifStreamOut.cpp b/services/audioflinger/SpdifStreamOut.cpp index d23588e..45b541a 100644 --- a/services/audioflinger/SpdifStreamOut.cpp +++ b/services/audioflinger/SpdifStreamOut.cpp @@ -32,10 +32,12 @@ namespace android { * If the AudioFlinger is processing encoded data and the HAL expects * PCM then we need to wrap the data in an SPDIF wrapper. */ -SpdifStreamOut::SpdifStreamOut(AudioHwDevice *dev, audio_output_flags_t flags) +SpdifStreamOut::SpdifStreamOut(AudioHwDevice *dev, + audio_output_flags_t flags, + audio_format_t format) : AudioStreamOut(dev,flags) , mRateMultiplier(1) - , mSpdifEncoder(this) + , mSpdifEncoder(this, format) , mRenderPositionHal(0) , mPreviousHalPosition32(0) { @@ -49,15 +51,15 @@ status_t SpdifStreamOut::open( { struct audio_config customConfig = *config; - customConfig.format = AUDIO_FORMAT_PCM_16_BIT; - customConfig.channel_mask = AUDIO_CHANNEL_OUT_STEREO; - // Some data bursts run at a higher sample rate. + // TODO Move this into the audio_utils as a static method. switch(config->format) { case AUDIO_FORMAT_E_AC3: mRateMultiplier = 4; break; case AUDIO_FORMAT_AC3: + case AUDIO_FORMAT_DTS: + case AUDIO_FORMAT_DTS_HD: mRateMultiplier = 1; break; default: @@ -67,6 +69,9 @@ status_t SpdifStreamOut::open( } customConfig.sample_rate = config->sample_rate * mRateMultiplier; + customConfig.format = AUDIO_FORMAT_PCM_16_BIT; + customConfig.channel_mask = AUDIO_CHANNEL_OUT_STEREO; + // Always print this because otherwise it could be very confusing if the // HAL and AudioFlinger are using different formats. // Print before open() because HAL may modify customConfig. |