summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packaging/audio-hal-max98090.spec2
-rw-r--r--tizen-audio-device.c20
-rw-r--r--tizen-audio.c16
-rw-r--r--tizen-audio.h20
4 files changed, 38 insertions, 20 deletions
diff --git a/packaging/audio-hal-max98090.spec b/packaging/audio-hal-max98090.spec
index d3f2f7f..36959b7 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.17
+Version: 0.2.18
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/tizen-audio-device.c b/tizen-audio-device.c
index e9c4d11..3460e2e 100644
--- a/tizen-audio-device.c
+++ b/tizen-audio-device.c
@@ -173,7 +173,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;
@@ -188,7 +188,7 @@ static audio_return_t _do_route_ap_playback_capture(audio_hal_t *ah, audio_route
/* int mod_idx = 0; */
/* const char *modifiers[MAX_MODIFIERS] = {NULL,}; */
- 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) {
@@ -218,7 +218,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_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];
@@ -226,7 +226,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) {
@@ -240,7 +240,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,};
@@ -252,7 +252,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;
@@ -292,7 +292,7 @@ static audio_return_t _do_route_reset(audio_hal_t *ah, uint32_t direction)
#define LOOPBACK_ARG_LATENCY_MSEC 40
#define LOOPBACK_ARG_ADJUST_TIME_SEC 3
-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;
@@ -306,12 +306,12 @@ audio_return_t audio_do_route(void *audio_handle, audio_route_info_t *info)
devices = info->device_infos;
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);
}
@@ -322,7 +322,7 @@ audio_return_t audio_do_route(void *audio_handle, audio_route_info_t *info)
_audio_comm_send_message(ah, "loopback::adjust_time", LOOPBACK_ARG_ADJUST_TIME_SEC);
}
/* 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);
}
diff --git a/tizen-audio.c b/tizen-audio.c
index d8f7a70..413759e 100644
--- a/tizen-audio.c
+++ b/tizen-audio.c
@@ -29,18 +29,32 @@ 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_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);
+ /* 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);
+
+ ret = _audio_comm_unset_message_callback((audio_hal_t *)audio_handle);
+
+ return ret;
+}
+
audio_return_t audio_init(void **audio_handle)
{
audio_hal_t *ah;
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