diff options
author | Sangchul Lee <sc11.lee@samsung.com> | 2016-07-15 16:30:18 +0900 |
---|---|---|
committer | Sangchul Lee <sc11.lee@samsung.com> | 2016-07-21 10:13:01 +0900 |
commit | bf1946dd2f2b6b7d83dc28b87133d565144068d4 (patch) | |
tree | 72b5b3b7a129d4c650e26107e7cd7d5c0dbac599 | |
parent | cd1d8b9c3d6d1c9dbf5bd7f5a0032f72ab06ee47 (diff) | |
download | audio-hal-wm1831-bf1946dd2f2b6b7d83dc28b87133d565144068d4.tar.gz audio-hal-wm1831-bf1946dd2f2b6b7d83dc28b87133d565144068d4.tar.bz2 audio-hal-wm1831-bf1946dd2f2b6b7d83dc28b87133d565144068d4.zip |
Enhance to check parameters and move volume_level_max array to audio_hal_volume_tsubmit/tizen_3.0_wearable/20161015.000000submit/tizen_3.0_tv/20161015.000000submit/tizen_3.0_mobile/20161015.000000submit/tizen_3.0_ivi/20161010.000010submit/tizen_3.0_ivi/20161010.000000submit/tizen_3.0_common/20161104.104000submit/tizen/20160805.054353accepted/tizen/wearable/20160808.081059accepted/tizen/tv/20160808.081007accepted/tizen/mobile/20160808.080805accepted/tizen/ivi/20160808.081159accepted/tizen/common/20160805.130203accepted/tizen/3.0/wearable/20161015.080354accepted/tizen/3.0/tv/20161016.003537accepted/tizen/3.0/mobile/20161015.032204accepted/tizen/3.0/ivi/20161011.053537accepted/tizen/3.0/common/20161114.105109
[Version] 0.1.8
[Profile] Common
[Issue Type] Description
Change-Id: I33fd5b54e7ed9fd1ef4bebe66a0fa319ccca414c
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
-rw-r--r-- | packaging/audio-hal-wm1831.spec | 2 | ||||
-rw-r--r-- | tizen-audio-internal.h | 2 | ||||
-rw-r--r-- | tizen-audio-routing.c | 1 | ||||
-rw-r--r-- | tizen-audio-stream.c | 2 | ||||
-rw-r--r-- | tizen-audio-volume.c | 27 |
5 files changed, 23 insertions, 11 deletions
diff --git a/packaging/audio-hal-wm1831.spec b/packaging/audio-hal-wm1831.spec index 66d4a0a..263fc4e 100644 --- a/packaging/audio-hal-wm1831.spec +++ b/packaging/audio-hal-wm1831.spec @@ -1,6 +1,6 @@ Name: audio-hal-wm1831 Summary: TIZEN Audio HAL for WM1831 -Version: 0.1.7 +Version: 0.1.8 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/tizen-audio-internal.h b/tizen-audio-internal.h index cc2f41d..f5430b1 100644 --- a/tizen-audio-internal.h +++ b/tizen-audio-internal.h @@ -196,7 +196,6 @@ typedef enum audio_gain { typedef struct audio_volume_value_table { double volume[AUDIO_VOLUME_TYPE_MAX][AUDIO_VOLUME_LEVEL_MAX]; - uint32_t volume_level_max[AUDIO_VOLUME_LEVEL_MAX]; double gain[AUDIO_GAIN_TYPE_MAX]; } audio_volume_value_table_t; @@ -206,6 +205,7 @@ enum { }; typedef struct audio_hal_volume { + uint32_t volume_level_max[AUDIO_VOLUME_LEVEL_MAX]; uint32_t volume_level[AUDIO_VOLUME_TYPE_MAX]; audio_volume_value_table_t *volume_value_table; } audio_hal_volume_t; diff --git a/tizen-audio-routing.c b/tizen-audio-routing.c index 1194fb3..513384e 100644 --- a/tizen-audio-routing.c +++ b/tizen-audio-routing.c @@ -300,6 +300,7 @@ audio_return_t audio_update_route(void *audio_handle, audio_route_info_t *info) AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER); AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(info->role, AUDIO_ERR_PARAMETER); AUDIO_LOG_INFO("role:%s", info->role); diff --git a/tizen-audio-stream.c b/tizen-audio-stream.c index d07ed33..c60a443 100644 --- a/tizen-audio-stream.c +++ b/tizen-audio-stream.c @@ -44,6 +44,8 @@ audio_return_t audio_notify_stream_connection_changed(void *audio_handle, audio_ AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER); AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(info->role, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL((info->direction <= AUDIO_DIRECTION_OUT), AUDIO_ERR_PARAMETER); AUDIO_LOG_INFO("role:%s, direction:%u, idx:%u, is_connected:%d", info->role, info->direction, info->idx, is_connected); diff --git a/tizen-audio-volume.c b/tizen-audio-volume.c index 6d83d29..89d5124 100644 --- a/tizen-audio-volume.c +++ b/tizen-audio-volume.c @@ -135,7 +135,7 @@ static void __dump_tb(audio_hal_t *ah) snprintf(dump_str_ptr, 8, "%6s:", vol_type_str); dump_str_ptr += strlen(dump_str_ptr); - for (vol_level_idx = 0; vol_level_idx < volume_value_table->volume_level_max[vol_type_idx]; vol_level_idx++) { + for (vol_level_idx = 0; vol_level_idx < ah->volume.volume_level_max[vol_type_idx]; vol_level_idx++) { snprintf(dump_str_ptr, 6, "%01.2f ", volume_value_table->volume[vol_type_idx][vol_level_idx]); dump_str_ptr += strlen(dump_str_ptr); } @@ -198,7 +198,7 @@ static audio_return_t __load_volume_value_table_from_ini(audio_hal_t *ah) for (vol_type_idx = 0; vol_type_idx < AUDIO_VOLUME_TYPE_MAX; vol_type_idx++) { const char *vol_type_str = __get_volume_type_string_by_idx(vol_type_idx); - volume_value_table->volume_level_max[vol_type_idx] = 0; + ah->volume.volume_level_max[vol_type_idx] = 0; size = strlen(table_str) + strlen(vol_type_str) + 2; key = malloc(size); if (key) { @@ -211,11 +211,11 @@ static audio_return_t __load_volume_value_table_from_ini(audio_hal_t *ah) double vol_value = 0.0f; if (strncmp(token, "0", strlen(token))) vol_value = pow(10.0, (atof(token) - 100) / 20.0); - volume_value_table->volume[vol_type_idx][volume_value_table->volume_level_max[vol_type_idx]++] = vol_value; + volume_value_table->volume[vol_type_idx][ah->volume.volume_level_max[vol_type_idx]++] = vol_value; token = strtok_r(NULL, delimiter, &ptr); } } else { - volume_value_table->volume_level_max[vol_type_idx] = 1; + ah->volume.volume_level_max[vol_type_idx] = 1; for (vol_level_idx = 0; vol_level_idx < AUDIO_VOLUME_LEVEL_MAX; vol_level_idx++) { volume_value_table->volume[vol_type_idx][vol_level_idx] = VOLUME_VALUE_MAX; } @@ -305,14 +305,13 @@ audio_return_t _audio_volume_deinit(audio_hal_t *ah) audio_return_t audio_get_volume_level_max(void *audio_handle, audio_volume_info_t *info, uint32_t *level) { audio_hal_t *ah = (audio_hal_t *)audio_handle; - audio_volume_value_table_t *volume_value_table; AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER); - AUDIO_RETURN_VAL_IF_FAIL(ah->volume.volume_value_table, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(level, AUDIO_ERR_PARAMETER); /* Get max volume level by device & type */ - volume_value_table = ah->volume.volume_value_table; - *level = volume_value_table->volume_level_max[__get_volume_idx_by_string_type(info->type)]; + *level = ah->volume.volume_level_max[__get_volume_idx_by_string_type(info->type)]; AUDIO_LOG_DEBUG("get_[%s] volume_level_max: %d", info->type, *level); @@ -324,6 +323,8 @@ audio_return_t audio_get_volume_level(void *audio_handle, audio_volume_info_t *i audio_hal_t *ah = (audio_hal_t *)audio_handle; AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(level, AUDIO_ERR_PARAMETER); *level = ah->volume.volume_level[__get_volume_idx_by_string_type(info->type)]; @@ -339,11 +340,13 @@ audio_return_t audio_get_volume_value(void *audio_handle, audio_volume_info_t *i char dump_str[AUDIO_DUMP_STR_LEN] = {0,}; AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(value, AUDIO_ERR_PARAMETER); AUDIO_RETURN_VAL_IF_FAIL(ah->volume.volume_value_table, AUDIO_ERR_PARAMETER); /* Get basic volume by device & type & level */ volume_value_table = ah->volume.volume_value_table; - if (volume_value_table->volume_level_max[__get_volume_idx_by_string_type(info->type)] < level) + if (ah->volume.volume_level_max[__get_volume_idx_by_string_type(info->type)] < level) *value = VOLUME_VALUE_MAX; else *value = volume_value_table->volume[__get_volume_idx_by_string_type(info->type)][level]; @@ -360,6 +363,8 @@ audio_return_t audio_set_volume_level(void *audio_handle, audio_volume_info_t *i audio_hal_t *ah = (audio_hal_t *)audio_handle; AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL((ah->volume.volume_level_max[__get_volume_idx_by_string_type(info->type)] >= level), AUDIO_ERR_PARAMETER); /* Update volume level */ ah->volume.volume_level[__get_volume_idx_by_string_type(info->type)] = level; @@ -376,6 +381,8 @@ audio_return_t audio_get_volume_mute(void *audio_handle, audio_volume_info_t *in audio_hal_t *ah = (audio_hal_t *)audio_handle; AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(mute, AUDIO_ERR_PARAMETER); /* TODO. Not implemented */ @@ -388,6 +395,8 @@ audio_return_t audio_set_volume_mute(void *audio_handle, audio_volume_info_t *in audio_hal_t *ah = (audio_hal_t *)audio_handle; AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER); + AUDIO_RETURN_VAL_IF_FAIL(info, AUDIO_ERR_PARAMETER); + /* TODO. Not implemented */ return audio_ret; |