summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangchul Lee <sc11.lee@samsung.com>2016-04-26 16:19:09 +0900
committerSangchul Lee <sc11.lee@samsung.com>2016-04-26 16:20:55 +0900
commitf8d6e723269939482f162fedf6da3598f7a0a664 (patch)
treed1f035c15ea8c4053243f27830889a1e285224af
parent3679c4c79d5bd4f60a3f4552e879c31c960ffe59 (diff)
downloadaudio-hal-wm1831-f8d6e723269939482f162fedf6da3598f7a0a664.tar.gz
audio-hal-wm1831-f8d6e723269939482f162fedf6da3598f7a0a664.tar.bz2
audio-hal-wm1831-f8d6e723269939482f162fedf6da3598f7a0a664.zip
rename audio_do_route() to audio_update_route() rename audio_update_stream_connection_info() to audio_notify_stream_connection_changed() remove audio_set_message_cb() and tizen-audio-comm.c [Version] 0.1.4 [Profile] Common [Issue Type] Revise API Change-Id: I7cb666b794d2acc8cf9c6ac004fbef8df7ccad80
-rw-r--r--Makefile.am1
-rw-r--r--packaging/audio-hal-wm1831.spec2
-rw-r--r--tizen-audio-comm.c91
-rw-r--r--tizen-audio-device.c29
-rw-r--r--tizen-audio-internal.h11
-rw-r--r--tizen-audio.c17
-rw-r--r--tizen-audio.h19
7 files changed, 20 insertions, 150 deletions
diff --git a/Makefile.am b/Makefile.am
index b5c6943..1145f10 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,6 @@ libtizen_audio_la_SOURCES = tizen-audio.c \
tizen-audio-device.c \
tizen-audio-volume.c \
tizen-audio-ucm.c \
- tizen-audio-comm.c \
tizen-audio-util.c
libtizen_audio_la_LDFLAGS = $(AM_LDFLAGS) -disable-static -avoid-version
if USE_TINYALSA
diff --git a/packaging/audio-hal-wm1831.spec b/packaging/audio-hal-wm1831.spec
index 5aec7d3..7c13d8e 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.3
+Version: 0.1.4
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/tizen-audio-comm.c b/tizen-audio-comm.c
deleted file mode 100644
index d94aa22..0000000
--- a/tizen-audio-comm.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * audio-hal
- *
- * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "tizen-audio-internal.h"
-
-audio_return_t _audio_comm_send_message(audio_hal_t *ah, const char *name, int value)
-{
- 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);
- }
-
- 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;
-}
-
-audio_return_t _audio_comm_deinit(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;
-}
diff --git a/tizen-audio-device.c b/tizen-audio-device.c
index e9c4d11..6f3bbb7 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;
@@ -290,9 +290,7 @@ static audio_return_t _do_route_reset(audio_hal_t *ah, uint32_t direction)
return audio_ret;
}
-#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,23 +304,18 @@ 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);
}
} else {
- /* send latency and adjust time for loopback */
- if (!strncmp("loopback", info->role, MAX_NAME_LEN)) {
- _audio_comm_send_message(ah, "loopback::latency", LOOPBACK_ARG_LATENCY_MSEC);
- _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);
}
@@ -330,7 +323,7 @@ audio_return_t audio_do_route(void *audio_handle, audio_route_info_t *info)
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;
diff --git a/tizen-audio-internal.h b/tizen-audio-internal.h
index f7b28cb..21c79b7 100644
--- a/tizen-audio-internal.h
+++ b/tizen-audio-internal.h
@@ -271,18 +271,12 @@ typedef enum audio_sample_format {
AUDIO_SAMPLE_INVALID = -1
} audio_sample_format_t;
-typedef struct audio_hal_comm {
- message_cb msg_cb;
- void *user_data;
-} audio_hal_comm_t;
-
/* Overall */
typedef struct audio_hal {
audio_hal_device_t device;
audio_hal_volume_t volume;
audio_hal_ucm_t ucm;
audio_hal_mixer_t mixer;
- audio_hal_comm_t comm;
} audio_hal_t;
typedef struct {
@@ -304,8 +298,6 @@ audio_return_t _audio_ucm_init(audio_hal_t *ah);
audio_return_t _audio_ucm_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_comm_init(audio_hal_t *ah);
-audio_return_t _audio_comm_deinit(audio_hal_t *ah);
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
@@ -320,9 +312,6 @@ audio_return_t _audio_mixer_control_set_value(audio_hal_t *ah, const char *ctl_n
audio_return_t _audio_mixer_control_set_value_string(audio_hal_t *ah, const char* ctl_name, const char* value);
audio_return_t _audio_mixer_control_get_value(audio_hal_t *ah, const char *ctl_name, int *val);
audio_return_t _audio_mixer_control_get_element(audio_hal_t *ah, const char *ctl_name, snd_hctl_elem_t **elem);
-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_pcm_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min, uint8_t period_event);
audio_return_t _audio_pcm_set_hw_params(snd_pcm_t *pcm, audio_pcm_sample_spec_t *sample_spec, uint8_t *use_mmap, snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size);
uint32_t _convert_format(audio_sample_format_t format);
diff --git a/tizen-audio.c b/tizen-audio.c
index d8f7a70..882a9b4 100644
--- a/tizen-audio.c
+++ b/tizen-audio.c
@@ -29,18 +29,6 @@ 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 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_set_message_callback((audio_hal_t *)audio_handle, callback, user_data);
-
- return ret;
-}
-
audio_return_t audio_init(void **audio_handle)
{
audio_hal_t *ah;
@@ -68,10 +56,6 @@ audio_return_t audio_init(void **audio_handle)
AUDIO_LOG_ERROR("mixer init failed");
goto error_exit;
}
- if (AUDIO_IS_ERROR((ret = _audio_comm_init(ah)))) {
- AUDIO_LOG_ERROR("comm init failed");
- goto error_exit;
- }
*audio_handle = (void *)ah;
return AUDIO_RET_OK;
@@ -93,7 +77,6 @@ audio_return_t audio_deinit(void *audio_handle)
_audio_volume_deinit(ah);
_audio_ucm_deinit(ah);
_audio_util_deinit(ah);
- _audio_comm_deinit(ah);
free(ah);
ah = NULL;
diff --git a/tizen-audio.h b/tizen-audio.h
index 794cdd7..0207844 100644
--- a/tizen-audio.h
+++ b/tizen-audio.h
@@ -71,10 +71,9 @@ typedef struct audio_stream_info {
uint32_t idx;
} audio_stream_info_t ;
-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 +84,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);
@@ -103,8 +103,6 @@ typedef struct audio_interface {
audio_return_t (*pcm_recover)(void *audio_handle, void *pcm_handle, int revents);
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_interface_t;
audio_return_t audio_init(void **audio_handle);
@@ -115,9 +113,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 +129,4 @@ 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);
#endif