hardware/libaudio
リビジョン | 4f5006abcb66e923cabc4644b613db8d2c93a2bb (tree) |
---|---|
日時 | 2016-09-14 00:17:02 |
作者 | Chih-Wei Huang <cwhuang@linu...> |
コミッター | Chih-Wei Huang |
audio_hw: select HDMI audio if notified by the framework
@@ -45,6 +45,7 @@ | ||
45 | 45 | #define PCM_CARD 0 |
46 | 46 | #define PCM_DEVICE 0 |
47 | 47 | #define PCM_DEVICE_SCO 2 |
48 | +#define PCM_DEVICE_HDMI 3 | |
48 | 49 | |
49 | 50 | #define OUT_PERIOD_SIZE 512 |
50 | 51 | #define OUT_SHORT_PERIOD_COUNT 2 |
@@ -177,7 +178,7 @@ static void release_buffer(struct resampler_buffer_provider *buffer_provider, | ||
177 | 178 | |
178 | 179 | /* Helper functions */ |
179 | 180 | |
180 | -struct snd_pcm_info *select_card(unsigned int device __unused, unsigned int flags) | |
181 | +struct snd_pcm_info *select_card(unsigned int device, unsigned int flags) | |
181 | 182 | { |
182 | 183 | static struct snd_pcm_info *cached_info[4]; |
183 | 184 | struct snd_pcm_info *info; |
@@ -221,12 +222,12 @@ struct snd_pcm_info *select_card(unsigned int device __unused, unsigned int flag | ||
221 | 222 | free(namelist); |
222 | 223 | } |
223 | 224 | } |
224 | - if (property_get_bool("hal.audio.primary.hdmi", false) && cached_info[d + 2]) { | |
225 | + if (property_get_bool("hal.audio.primary.hdmi", device == PCM_DEVICE_HDMI) && cached_info[d + 2]) { | |
225 | 226 | info = cached_info[d + 2]; |
226 | 227 | } else { |
227 | 228 | info = cached_info[d] ? cached_info[d] : cached_info[d + 2]; |
228 | 229 | } |
229 | - ALOGI_IF(info, "choose pcmC%dD%d%c", info->card, info->device, d ? 'c' : 'p'); | |
230 | + ALOGI_IF(info, "choose pcmC%dD%d%c for %d", info->card, info->device, d ? 'c' : 'p', device); | |
230 | 231 | return info; |
231 | 232 | } |
232 | 233 |
@@ -341,7 +342,7 @@ static int start_output_stream(struct stream_out *out) | ||
341 | 342 | device = PCM_DEVICE_SCO; |
342 | 343 | out->pcm_config = &pcm_config_sco; |
343 | 344 | } else { |
344 | - device = PCM_DEVICE; | |
345 | + device = (adev->out_device & AUDIO_DEVICE_OUT_AUX_DIGITAL) ? PCM_DEVICE_HDMI : PCM_DEVICE; | |
345 | 346 | out->pcm_config = &pcm_config_out; |
346 | 347 | out->buffer_type = OUT_BUFFER_TYPE_UNKNOWN; |
347 | 348 | } |
@@ -26,7 +26,7 @@ audio_hw_modules { | ||
26 | 26 | sampling_rates 48000 |
27 | 27 | channel_masks AUDIO_CHANNEL_OUT_STEREO |
28 | 28 | formats AUDIO_FORMAT_PCM_16_BIT |
29 | - devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO | |
29 | + devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_AUX_DIGITAL | |
30 | 30 | flags AUDIO_OUTPUT_FLAG_PRIMARY |
31 | 31 | } |
32 | 32 | } |