diff options
| author | Francescodario Cuzzocrea <bosconovic@gmail.com> | 2020-04-22 00:59:27 +0200 |
|---|---|---|
| committer | Chih-Wei Huang <cwhuang@linux.org.tw> | 2020-04-28 13:53:41 +0800 |
| commit | d9cfa852a34b299be1de178ef59257cf4bcc5e14 (patch) | |
| tree | 40bb5bc4b2dcef56ca65e0e654e0db72c5b06843 | |
| parent | 43bc5b5a9e09086e4a323293959e187d3f92e2a7 (diff) | |
| download | platform_hardware_libaudio-d9cfa852a34b299be1de178ef59257cf4bcc5e14.tar.gz platform_hardware_libaudio-d9cfa852a34b299be1de178ef59257cf4bcc5e14.tar.bz2 platform_hardware_libaudio-d9cfa852a34b299be1de178ef59257cf4bcc5e14.zip | |
libaudio: remove panel orientation code
- makes little sense to keep this logic as the vast majority of PCs
have only one microphone. This was something Grouper specific.
| -rw-r--r-- | audio_hw.c | 45 |
1 files changed, 3 insertions, 42 deletions
@@ -107,7 +107,6 @@ struct audio_device { bool standby; bool mic_mute; struct audio_route *ar; - int orientation; bool screen_off; struct stream_out *active_out; @@ -152,13 +151,6 @@ struct stream_in { struct audio_device *dev; }; -enum { - ORIENTATION_LANDSCAPE, - ORIENTATION_PORTRAIT, - ORIENTATION_SQUARE, - ORIENTATION_UNDEFINED, -}; - static uint32_t out_get_sample_rate(const struct audio_stream *stream); static size_t out_get_buffer_size(const struct audio_stream *stream); static audio_format_t out_get_format(const struct audio_stream *stream); @@ -281,12 +273,8 @@ static void select_devices(struct audio_device *adev) audio_route_apply_path(adev->ar, "headphone"); if (docked) audio_route_apply_path(adev->ar, "dock"); - if (main_mic_on) { - if (adev->orientation == ORIENTATION_LANDSCAPE) - audio_route_apply_path(adev->ar, "main-mic-left"); - else - audio_route_apply_path(adev->ar, "main-mic-top"); - } + if (main_mic_on) + audio_route_apply_path(adev->ar, "main-mic"); update_mixer_state(adev->ar); @@ -1138,33 +1126,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) int ret; parms = str_parms_create_str(kvpairs); - ret = str_parms_get_str(parms, "orientation", value, sizeof(value)); - if (ret >= 0) { - int orientation; - - if (strcmp(value, "landscape") == 0) - orientation = ORIENTATION_LANDSCAPE; - else if (strcmp(value, "portrait") == 0) - orientation = ORIENTATION_PORTRAIT; - else if (strcmp(value, "square") == 0) - orientation = ORIENTATION_SQUARE; - else - orientation = ORIENTATION_UNDEFINED; - - pthread_mutex_lock(&adev->lock); - if (orientation != adev->orientation) { - adev->orientation = orientation; - /* - * Orientation changes can occur with the input device - * closed so we must call select_devices() here to set - * up the mixer. This is because select_devices() will - * not be called when the input device is opened if no - * other input parameter is changed. - */ - select_devices(adev); - } - pthread_mutex_unlock(&adev->lock); - } ret = str_parms_get_str(parms, "screen_state", value, sizeof(value)); if (ret >= 0) { @@ -1348,7 +1309,7 @@ static int adev_open(const hw_module_t* module, const char* name, adev->hw_device.dump = adev_dump; adev->ar = audio_route_init(); - adev->orientation = ORIENTATION_UNDEFINED; + adev->out_device = AUDIO_DEVICE_OUT_SPEAKER; adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN; |
