summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangchul Lee <sc11.lee@samsung.com>2016-04-26 13:31:41 +0900
committerSangchul Lee <sc11.lee@samsung.com>2016-04-26 15:40:27 +0900
commitf9601397f1066e6dcca2db048d36a8193b9504a0 (patch)
treea6e306b0d4b29aecd484e34ec17d174331bb1514
parentb2f735e4d71fc3eaef336644caef085c0ebdc9c0 (diff)
downloadaudio-hal-sc7727-f9601397f1066e6dcca2db048d36a8193b9504a0.tar.gz
audio-hal-sc7727-f9601397f1066e6dcca2db048d36a8193b9504a0.tar.bz2
audio-hal-sc7727-f9601397f1066e6dcca2db048d36a8193b9504a0.zip
rename audio_do_route() to audio_update_route() rename audio_update_stream_connection_info() to audio_notify_stream_connection_changed() rename audio_set_message_cb() to audio_add_message_cb() add audio_remove_message_cb() [Version] 0.1.9 [Profile] Mobile [Issue Type] Revise API Change-Id: I611032a2b45f1254664161997bdca63b568ddd19
-rw-r--r--packaging/audio-hal-sc7727.spec2
-rw-r--r--tizen-audio-comm.c38
-rw-r--r--tizen-audio-device.c32
-rw-r--r--tizen-audio-internal.h4
-rw-r--r--tizen-audio-modem.c2
-rw-r--r--tizen-audio.c21
-rw-r--r--tizen-audio.h20
7 files changed, 86 insertions, 33 deletions
diff --git a/packaging/audio-hal-sc7727.spec b/packaging/audio-hal-sc7727.spec
index c068660..109226f 100644
--- a/packaging/audio-hal-sc7727.spec
+++ b/packaging/audio-hal-sc7727.spec
@@ -1,6 +1,6 @@
Name: audio-hal-sc7727
Summary: TIZEN Audio HAL for SC7727
-Version: 0.1.8
+Version: 0.1.9
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/tizen-audio-comm.c b/tizen-audio-comm.c
index 58b115c..d94aa22 100644
--- a/tizen-audio-comm.c
+++ b/tizen-audio-comm.c
@@ -26,6 +26,9 @@ audio_return_t _audio_comm_send_message(audio_hal_t *ah, const char *name, int v
{
audio_return_t audio_ret = AUDIO_RET_OK;
+ AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
+ AUDIO_RETURN_VAL_IF_FAIL(name, AUDIO_ERR_PARAMETER);
+
AUDIO_LOG_DEBUG("send message : name(%s), value(%d)", name, value);
if (ah->comm.msg_cb) {
ah->comm.msg_cb(name, value, ah->comm.user_data);
@@ -34,12 +37,44 @@ audio_return_t _audio_comm_send_message(audio_hal_t *ah, const char *name, int v
return audio_ret;
}
+audio_return_t _audio_comm_set_message_callback(audio_hal_t *ah, message_cb callback, void *user_data)
+{
+ audio_return_t audio_ret = AUDIO_RET_OK;
+
+ AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
+ AUDIO_RETURN_VAL_IF_FAIL(callback, AUDIO_ERR_PARAMETER);
+
+ ah->comm.msg_cb = callback;
+ ah->comm.user_data = user_data;
+
+ AUDIO_LOG_DEBUG("message callback is set, callback(%p), user_data(%p)", ah->comm.msg_cb, ah->comm.user_data);
+
+ return audio_ret;
+}
+
+audio_return_t _audio_comm_unset_message_callback(audio_hal_t *ah)
+{
+ audio_return_t audio_ret = AUDIO_RET_OK;
+
+ AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
+
+ ah->comm.msg_cb = NULL;
+ ah->comm.user_data = NULL;
+
+ AUDIO_LOG_DEBUG("message callback is unset");
+
+ return audio_ret;
+}
+
audio_return_t _audio_comm_init(audio_hal_t *ah)
{
audio_return_t audio_ret = AUDIO_RET_OK;
AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
+ ah->comm.msg_cb = NULL;
+ ah->comm.user_data = NULL;
+
return audio_ret;
}
@@ -49,5 +84,8 @@ audio_return_t _audio_comm_deinit(audio_hal_t *ah)
AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
+ ah->comm.msg_cb = NULL;
+ ah->comm.user_data = NULL;
+
return audio_ret;
}
diff --git a/tizen-audio-device.c b/tizen-audio-device.c
index 0f33117..db6c1ac 100644
--- a/tizen-audio-device.c
+++ b/tizen-audio-device.c
@@ -184,7 +184,7 @@ audio_return_t _audio_device_deinit(audio_hal_t *ah)
return AUDIO_RET_OK;
}
-static audio_return_t _do_route_ap_playback_capture(audio_hal_t *ah, audio_route_info_t *route_info)
+static audio_return_t _update_route_ap_playback_capture(audio_hal_t *ah, audio_route_info_t *route_info)
{
audio_return_t audio_ret = AUDIO_RET_OK;
device_info_t *devices = NULL;
@@ -213,7 +213,7 @@ static audio_return_t _do_route_ap_playback_capture(audio_hal_t *ah, audio_route
devices = route_info->device_infos;
- AUDIO_LOG_INFO("do_route_ap_playback_capture++ ");
+ AUDIO_LOG_INFO("update_route_ap_playback_capture++ ");
audio_ret = set_devices(ah, verb, devices, route_info->num_of_devices);
if (audio_ret) {
@@ -245,7 +245,7 @@ static audio_return_t _do_route_ap_playback_capture(audio_hal_t *ah, audio_route
return audio_ret;
}
-static audio_return_t _do_route_voicecall(audio_hal_t *ah, device_info_t *devices, int32_t num_of_devices)
+static audio_return_t _update_route_voicecall(audio_hal_t *ah, device_info_t *devices, int32_t num_of_devices)
{
audio_return_t audio_ret = AUDIO_RET_OK;
const char *verb = mode_to_verb_str[VERB_VOICECALL];
@@ -256,7 +256,7 @@ static audio_return_t _do_route_voicecall(audio_hal_t *ah, device_info_t *device
AUDIO_RETURN_VAL_IF_FAIL((devices||num_of_devices), AUDIO_ERR_INVALID_STATE);
AUDIO_RETURN_VAL_IF_FAIL(devices, AUDIO_ERR_PARAMETER);
- AUDIO_LOG_INFO("do_route_voicecall++");
+ AUDIO_LOG_INFO("update_route_voicecall++");
audio_ret = set_devices(ah, verb, devices, num_of_devices);
if (audio_ret) {
@@ -273,7 +273,7 @@ static audio_return_t _do_route_voicecall(audio_hal_t *ah, device_info_t *device
return audio_ret;
}
-static audio_return_t _do_route_voip(audio_hal_t *ah, device_info_t *devices, int32_t num_of_devices)
+static audio_return_t _update_route_voip(audio_hal_t *ah, device_info_t *devices, int32_t num_of_devices)
{
audio_return_t audio_ret = AUDIO_RET_OK;
const char *verb = mode_to_verb_str[VERB_NORMAL];
@@ -281,7 +281,7 @@ static audio_return_t _do_route_voip(audio_hal_t *ah, device_info_t *devices, in
AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
AUDIO_RETURN_VAL_IF_FAIL(devices, AUDIO_ERR_PARAMETER);
- AUDIO_LOG_INFO("do_route_voip++");
+ AUDIO_LOG_INFO("update_route_voip++");
audio_ret = set_devices(ah, verb, devices, num_of_devices);
if (audio_ret) {
@@ -295,7 +295,7 @@ static audio_return_t _do_route_voip(audio_hal_t *ah, device_info_t *devices, in
return audio_ret;
}
-static audio_return_t _do_route_reset(audio_hal_t *ah, uint32_t direction)
+static audio_return_t _update_route_reset(audio_hal_t *ah, uint32_t direction)
{
audio_return_t audio_ret = AUDIO_RET_OK;
const char *active_devices[MAX_DEVICES] = {NULL,};
@@ -303,7 +303,7 @@ static audio_return_t _do_route_reset(audio_hal_t *ah, uint32_t direction)
AUDIO_RETURN_VAL_IF_FAIL(ah, AUDIO_ERR_PARAMETER);
- AUDIO_LOG_INFO("do_route_reset++, direction(0x%x)", direction);
+ AUDIO_LOG_INFO("update_route_reset++, direction(0x%x)", direction);
if (direction == AUDIO_DIRECTION_OUT) {
ah->device.active_out &= 0x0;
@@ -348,7 +348,7 @@ static audio_return_t _do_route_reset(audio_hal_t *ah, uint32_t direction)
return audio_ret;
}
-audio_return_t audio_do_route(void *audio_handle, audio_route_info_t *info)
+audio_return_t audio_update_route(void *audio_handle, audio_route_info_t *info)
{
audio_return_t audio_ret = AUDIO_RET_OK;
audio_hal_t *ah = (audio_hal_t *)audio_handle;
@@ -413,25 +413,25 @@ audio_return_t audio_do_route(void *audio_handle, audio_route_info_t *info)
}
AUDIO_LOG_INFO("modem is not ready, skip...");
} else {
- audio_ret = _do_route_voicecall(ah, devices, info->num_of_devices);
+ audio_ret = _update_route_voicecall(ah, devices, info->num_of_devices);
if (AUDIO_IS_ERROR(audio_ret)) {
AUDIO_LOG_WARN("set voicecall route return 0x%x", audio_ret);
}
COND_SIGNAL(ah->device.device_cond, "device_cond");
}
} else if (!strncmp("voip", info->role, MAX_NAME_LEN)) {
- audio_ret = _do_route_voip(ah, devices, info->num_of_devices);
+ audio_ret = _update_route_voip(ah, devices, info->num_of_devices);
if (AUDIO_IS_ERROR(audio_ret)) {
AUDIO_LOG_WARN("set voip route return 0x%x", audio_ret);
}
} else if (!strncmp("reset", info->role, MAX_NAME_LEN)) {
- audio_ret = _do_route_reset(ah, devices->direction);
+ audio_ret = _update_route_reset(ah, devices->direction);
if (AUDIO_IS_ERROR(audio_ret)) {
AUDIO_LOG_WARN("set reset return 0x%x", audio_ret);
}
} else {
/* need to prepare for "alarm","notification","emergency","voice-information","voice-recognition","ringtone" */
- audio_ret = _do_route_ap_playback_capture(ah, info);
+ audio_ret = _update_route_ap_playback_capture(ah, info);
if (AUDIO_IS_ERROR(audio_ret)) {
AUDIO_LOG_WARN("set playback route return 0x%x", audio_ret);
}
@@ -441,7 +441,7 @@ ERROR:
return audio_ret;
}
-audio_return_t audio_update_stream_connection_info(void *audio_handle, audio_stream_info_t *info, uint32_t is_connected)
+audio_return_t audio_notify_stream_connection_changed(void *audio_handle, audio_stream_info_t *info, uint32_t is_connected)
{
audio_return_t audio_ret = AUDIO_RET_OK;
audio_hal_t *ah = (audio_hal_t *)audio_handle;
@@ -641,9 +641,9 @@ static struct pcm *__tinyalsa_open_device(audio_pcm_sample_spec_t *ss, size_t pe
}
#endif
-audio_return_t _audio_do_route_voicecall(audio_hal_t *ah, device_info_t *devices, int32_t num_of_devices)
+audio_return_t _audio_update_route_voicecall(audio_hal_t *ah, device_info_t *devices, int32_t num_of_devices)
{
- return _do_route_voicecall(ah, devices, num_of_devices);
+ return _update_route_voicecall(ah, devices, num_of_devices);
}
audio_return_t audio_pcm_open(void *audio_handle, void **pcm_handle, uint32_t direction, void *sample_spec, uint32_t period_size, uint32_t periods)
diff --git a/tizen-audio-internal.h b/tizen-audio-internal.h
index a850095..e603abf 100644
--- a/tizen-audio-internal.h
+++ b/tizen-audio-internal.h
@@ -360,7 +360,7 @@ audio_return_t _audio_comm_deinit(audio_hal_t *ah);
audio_return_t _audio_util_init(audio_hal_t *ah);
audio_return_t _audio_util_deinit(audio_hal_t *ah);
-audio_return_t _audio_do_route_voicecall(audio_hal_t *ah, device_info_t *devices, int32_t num_of_devices);
+audio_return_t _audio_update_route_voicecall(audio_hal_t *ah, device_info_t *devices, int32_t num_of_devices);
void _audio_ucm_get_device_name(audio_hal_t *ah, const char *use_case, audio_direction_t direction, const char **value);
#define _audio_ucm_update_use_case _audio_ucm_set_use_case
audio_return_t _audio_ucm_set_use_case(audio_hal_t *ah, const char *verb, const char *devices[], const char *modifiers[]);
@@ -371,6 +371,8 @@ audio_return_t _audio_ucm_get_verb(audio_hal_t *ah, const char **value);
audio_return_t _audio_ucm_reset_use_case(audio_hal_t *ah);
int _audio_modem_is_call_connected(audio_hal_t *ah);
audio_return_t _audio_comm_send_message(audio_hal_t *ah, const char *name, int value);
+audio_return_t _audio_comm_set_message_callback(audio_hal_t *ah, message_cb callback, void *user_data);
+audio_return_t _audio_comm_unset_message_callback(audio_hal_t *ah);
audio_return_t _audio_mixer_control_set_param(audio_hal_t *ah, const char* ctl_name, snd_ctl_elem_value_t* value, int size);
audio_return_t _audio_mixer_control_set_value(audio_hal_t *ah, const char *ctl_name, int val);
audio_return_t _audio_mixer_control_set_value_string(audio_hal_t *ah, const char* ctl_name, const char* value);
diff --git a/tizen-audio-modem.c b/tizen-audio-modem.c
index 9229c13..6769350 100644
--- a/tizen-audio-modem.c
+++ b/tizen-audio-modem.c
@@ -354,7 +354,7 @@ again:
AUDIO_LOG_INFO("[voice] Received VBC_CMD_PCM_OPEN");
ah->modem.is_connected = 1;
- audio_ret = _audio_do_route_voicecall(ah, ah->device.init_call_devices, ah->device.num_of_call_devices);
+ audio_ret = _audio_update_route_voicecall(ah, ah->device.init_call_devices, ah->device.num_of_call_devices);
if (AUDIO_IS_ERROR(audio_ret)) {
AUDIO_LOG_WARN("set voicecall route return 0x%x", audio_ret);
if (audio_ret == AUDIO_ERR_INVALID_STATE) {
diff --git a/tizen-audio.c b/tizen-audio.c
index a37a7ab..3e628c2 100644
--- a/tizen-audio.c
+++ b/tizen-audio.c
@@ -29,19 +29,28 @@ static const char* AUDIO_LATENCY_MID = "mid";
static const char* AUDIO_LATENCY_HIGH = "high";
static const char* AUDIO_LATENCY_VOIP = "voip";
-audio_return_t audio_set_message_cb(void *audio_handle, message_cb callback, void *user_data)
+audio_return_t audio_add_message_cb(void *audio_handle, message_cb callback, void *user_data)
{
- audio_hal_t *ah;
audio_return_t ret = AUDIO_RET_OK;
AUDIO_RETURN_VAL_IF_FAIL(audio_handle, AUDIO_ERR_PARAMETER);
AUDIO_RETURN_VAL_IF_FAIL(callback, AUDIO_ERR_PARAMETER);
- ah = (audio_hal_t *)audio_handle;
- ah->comm.msg_cb = callback;
- ah->comm.user_data = user_data;
+ /* NOTE: Management of several callbacks could be implemented.
+ But we do not care of it for now.*/
+ ret = _audio_comm_set_message_callback((audio_hal_t *)audio_handle, callback, user_data);
+
+ return ret;
+}
+
+audio_return_t audio_remove_message_cb(void *audio_handle, message_cb callback)
+{
+ audio_return_t ret = AUDIO_RET_OK;
+
+ AUDIO_RETURN_VAL_IF_FAIL(audio_handle, AUDIO_ERR_PARAMETER);
+ AUDIO_RETURN_VAL_IF_FAIL(callback, AUDIO_ERR_PARAMETER);
- AUDIO_LOG_DEBUG("message callback is set, callback(%p), user_data(%p)", ah->comm.msg_cb, ah->comm.user_data);
+ ret = _audio_comm_unset_message_callback((audio_hal_t *)audio_handle);
return ret;
}
diff --git a/tizen-audio.h b/tizen-audio.h
index 794cdd7..fcaf018 100644
--- a/tizen-audio.h
+++ b/tizen-audio.h
@@ -75,6 +75,7 @@ typedef void (*message_cb)(const char *name, int value, void *user_data);
/* Overall */
typedef struct audio_interface {
+ /* Initialization & de-initialization */
audio_return_t (*init)(void **audio_handle);
audio_return_t (*deinit)(void *audio_handle);
/* Volume */
@@ -85,13 +86,14 @@ typedef struct audio_interface {
audio_return_t (*get_volume_mute)(void *audio_handle, audio_volume_info_t *info, uint32_t *mute);
audio_return_t (*set_volume_mute)(void *audio_handle, audio_volume_info_t *info, uint32_t mute);
/* Routing */
- audio_return_t (*do_route)(void *audio_handle, audio_route_info_t *info);
+ audio_return_t (*update_route)(void *audio_handle, audio_route_info_t *info);
audio_return_t (*update_route_option)(void *audio_handle, audio_route_option_t *option);
- audio_return_t (*update_stream_connection_info) (void *audio_handle, audio_stream_info_t *info, uint32_t is_connected);
- /* Buffer Attribute */
+ /* Stream */
+ audio_return_t (*notify_stream_connection_changed)(void *audio_handle, audio_stream_info_t *info, uint32_t is_connected);
+ /* Buffer attribute */
audio_return_t (*get_buffer_attr)(void *audio_handle, uint32_t direction, const char *latency, uint32_t samplerate, int format, uint32_t channels,
uint32_t *maxlength, uint32_t *tlength, uint32_t *prebuf, uint32_t* minreq, uint32_t *fragsize);
- /* Interface of PCM device */
+ /* PCM device */
audio_return_t (*pcm_open)(void *audio_handle, void **pcm_handle, uint32_t direction, void *sample_spec, uint32_t period_size, uint32_t periods);
audio_return_t (*pcm_start)(void *audio_handle, void *pcm_handle);
audio_return_t (*pcm_stop)(void *audio_handle, void *pcm_handle);
@@ -104,7 +106,8 @@ typedef struct audio_interface {
audio_return_t (*pcm_get_params)(void *audio_handle, void *pcm_handle, uint32_t direction, void **sample_spec, uint32_t *period_size, uint32_t *periods);
audio_return_t (*pcm_set_params)(void *audio_handle, void *pcm_handle, uint32_t direction, void *sample_spec, uint32_t period_size, uint32_t periods);
/* Message callback */
- audio_return_t (*set_message_cb)(void *audio_handle, message_cb callback, void *user_data);
+ audio_return_t (*add_message_cb)(void *audio_handle, message_cb callback, void *user_data);
+ audio_return_t (*remove_message_cb)(void *audio_handle, message_cb callback);
} audio_interface_t;
audio_return_t audio_init(void **audio_handle);
@@ -115,9 +118,9 @@ audio_return_t audio_set_volume_level(void *audio_handle, audio_volume_info_t *i
audio_return_t audio_get_volume_value(void *audio_handle, audio_volume_info_t *info, uint32_t level, double *value);
audio_return_t audio_get_volume_mute(void *audio_handle, audio_volume_info_t *info, uint32_t *mute);
audio_return_t audio_set_volume_mute(void *audio_handle, audio_volume_info_t *info, uint32_t mute);
-audio_return_t audio_do_route(void *audio_handle, audio_route_info_t *info);
+audio_return_t audio_update_route(void *audio_handle, audio_route_info_t *info);
audio_return_t audio_update_route_option(void *audio_handle, audio_route_option_t *option);
-audio_return_t audio_update_stream_connection_info(void *audio_handle, audio_stream_info_t *info, uint32_t is_connected);
+audio_return_t audio_notify_stream_connection_changed(void *audio_handle, audio_stream_info_t *info, uint32_t is_connected);
audio_return_t audio_get_buffer_attr(void *audio_handle, uint32_t direction, const char *latency, uint32_t samplerate, int format, uint32_t channels,
uint32_t *maxlength, uint32_t *tlength, uint32_t *prebuf, uint32_t* minreq, uint32_t *fragsize);
audio_return_t audio_pcm_open(void *audio_handle, void **pcm_handle, uint32_t direction, void *sample_spec, uint32_t period_size, uint32_t periods);
@@ -131,5 +134,6 @@ audio_return_t audio_pcm_get_fd(void *audio_handle, void *pcm_handle, int *fd);
audio_return_t audio_pcm_recover(void *audio_handle, void *pcm_handle, int revents);
audio_return_t audio_pcm_get_params(void *audio_handle, void *pcm_handle, uint32_t direction, void **sample_spec, uint32_t *period_size, uint32_t *periods);
audio_return_t audio_pcm_set_params(void *audio_handle, void *pcm_handle, uint32_t direction, void *sample_spec, uint32_t period_size, uint32_t periods);
-audio_return_t audio_set_message_cb(void *audio_handle, message_cb callback, void *user_data);
+audio_return_t audio_add_message_cb(void *audio_handle, message_cb callback, void *user_data);
+audio_return_t audio_remove_message_cb(void *audio_handle, message_cb callback);
#endif