summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangchul Lee <sc11.lee@samsung.com>2016-07-15 16:30:18 +0900
committerSangchul Lee <sc11.lee@samsung.com>2016-07-21 10:11:31 +0900
commitbb813d9f5505f541b4cb0873b62b076e2cfcf425 (patch)
tree881a5e891b49fcc9e6777952842ebd4150bb43cb
parentcd7216ef7594922f2964023d9dcd51d6b5624a39 (diff)
downloadaudio-hal-max98090-bb813d9f5505f541b4cb0873b62b076e2cfcf425.tar.gz
audio-hal-max98090-bb813d9f5505f541b4cb0873b62b076e2cfcf425.tar.bz2
audio-hal-max98090-bb813d9f5505f541b4cb0873b62b076e2cfcf425.zip
[Version] 0.2.23 [Profile] TV [Issue Type] Description Change-Id: I33fd5b54e7ed9fd1ef4bebe66a0fa319ccca414c Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
-rw-r--r--packaging/audio-hal-max98090.spec2
-rw-r--r--tizen-audio-internal.h2
-rw-r--r--tizen-audio-routing.c1
-rw-r--r--tizen-audio-stream.c2
-rw-r--r--tizen-audio-volume.c27
5 files changed, 23 insertions, 11 deletions
diff --git a/packaging/audio-hal-max98090.spec b/packaging/audio-hal-max98090.spec
index ae313b8..1c537ff 100644
--- a/packaging/audio-hal-max98090.spec
+++ b/packaging/audio-hal-max98090.spec
@@ -1,6 +1,6 @@
Name: audio-hal-max98090
Summary: TIZEN Audio HAL for MAX98090
-Version: 0.2.22
+Version: 0.2.23
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/tizen-audio-internal.h b/tizen-audio-internal.h
index 329a30a..a43c39d 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 ec4fac6..f4994ce 100644
--- a/tizen-audio-routing.c
+++ b/tizen-audio-routing.c
@@ -302,6 +302,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;