summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeonmi Jin <seonmi.jin@samsung.com>2015-11-13 20:19:23 +0900
committerSeonmi Jin <seonmi.jin@samsung.com>2015-11-16 21:05:11 +0900
commit86005ee359019044265a3477352a0c8654055ad3 (patch)
tree3679feb639e34b00b5d0c25b618d8d265b55dd4d
parentbb3ac0f23cf4c5f767e90a793b64e9a89d3213ae (diff)
downloadaudio-hal-max98090-86005ee359019044265a3477352a0c8654055ad3.tar.gz
audio-hal-max98090-86005ee359019044265a3477352a0c8654055ad3.tar.bz2
audio-hal-max98090-86005ee359019044265a3477352a0c8654055ad3.zip
[Version] 0.2.11 [Profile] tizen tv [Issue Type] CodeClean [Dependency module] pulseaudio-modules-tizen I033b19587134daba3d36cacbba65def2aa609044 Change-Id: I3b79360ca9fe979668ae0de8ca2b91578b4339b0 Signed-off-by: Seonmi Jin <seonmi.jin@samsung.com>
-rw-r--r--packaging/audio-hal-max98090.spec2
-rw-r--r--tizen-audio-device.c43
-rw-r--r--tizen-audio-internal.h3
-rw-r--r--tizen-audio.c46
-rw-r--r--tizen-audio.h45
5 files changed, 8 insertions, 131 deletions
diff --git a/packaging/audio-hal-max98090.spec b/packaging/audio-hal-max98090.spec
index dc90ac3..f87caae 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.10
+Version: 0.2.11
Release: 0
Group: System/Libraries
License: Apache-2.0
diff --git a/tizen-audio-device.c b/tizen-audio-device.c
index ced1d47..fbde82b 100644
--- a/tizen-audio-device.c
+++ b/tizen-audio-device.c
@@ -141,7 +141,6 @@ audio_return_t _audio_device_init (audio_mgr_t *am)
am->device.active_in = 0x0;
am->device.active_out = 0x0;
- am->device.route_flag = AUDIO_ROUTE_FLAG_NONE;
am->device.pcm_in = NULL;
am->device.pcm_out = NULL;
am->device.mode = VERB_NORMAL;
@@ -301,48 +300,6 @@ audio_return_t audio_update_route_option (void *userdata, audio_route_option_t *
return audio_ret;
}
-audio_return_t audio_alsa_pcm_open (void *userdata, void **pcm_handle, char *device_name, uint32_t direction, int mode)
-{
- audio_return_t audio_ret = AUDIO_RET_OK;
- audio_mgr_t *am = (audio_mgr_t *)userdata;
- int err;
-
- AUDIO_RETURN_VAL_IF_FAIL(am, AUDIO_ERR_PARAMETER);
-
-// pthread_mutex_lock(&am->device.pcm_lock);
- if ((err = snd_pcm_open((snd_pcm_t **)pcm_handle, device_name, (direction == AUDIO_DIRECTION_OUT) ? SND_PCM_STREAM_PLAYBACK : SND_PCM_STREAM_CAPTURE, mode)) < 0) {
- AUDIO_LOG_ERROR("Error opening PCM device %s: %s", device_name, snd_strerror(err));
- pthread_mutex_unlock(&am->device.pcm_lock);
- return AUDIO_ERR_RESOURCE;
- }
- am->device.pcm_count++;
- AUDIO_LOG_INFO("PCM handle 0x%x(%s,%s) opened(count:%d)", *pcm_handle, device_name, (direction == AUDIO_DIRECTION_OUT) ? "playback" : "capture", am->device.pcm_count);
-// pthread_mutex_unlock(&am->device.pcm_lock);
-
- return audio_ret;
-}
-
-audio_return_t audio_alsa_pcm_close (void *userdata, void *pcm_handle)
-{
- audio_return_t audio_ret = AUDIO_RET_OK;
- audio_mgr_t *am = (audio_mgr_t *)userdata;
- int err;
-
- AUDIO_LOG_INFO("Try to close PCM handle 0x%x", pcm_handle);
-// pthread_mutex_lock(&am->device.pcm_lock);
- if ((err = snd_pcm_close(pcm_handle)) < 0) {
- AUDIO_LOG_ERROR("Error closing PCM handle : %s", snd_strerror(err));
- pthread_mutex_unlock(&am->device.pcm_lock);
- return AUDIO_ERR_RESOURCE;
- }
-
- am->device.pcm_count--;
- AUDIO_LOG_INFO("PCM handle close success (count:%d)", am->device.pcm_count);
-// pthread_mutex_unlock(&am->device.pcm_lock);
-
- return audio_ret;
-}
-
#ifdef __USE_TINYALSA__
static struct pcm *__tinyalsa_open_device (audio_pcm_sample_spec_t *ss, size_t period_size, size_t period_count, uint32_t direction)
{
diff --git a/tizen-audio-internal.h b/tizen-audio-internal.h
index 9563fe1..a1c9d96 100644
--- a/tizen-audio-internal.h
+++ b/tizen-audio-internal.h
@@ -167,7 +167,6 @@ typedef enum audio_route_mode{
typedef struct audio_device_mgr {
uint32_t active_in;
uint32_t active_out;
- uint32_t route_flag;
snd_pcm_t *pcm_in;
snd_pcm_t *pcm_out;
pthread_mutex_t pcm_lock;
@@ -213,8 +212,6 @@ typedef struct audio_mixer_mgr {
/* Overall */
typedef struct audio_mgr {
- void *platform_data;
- audio_cb_interface_t cb_intf;
audio_device_mgr_t device;
audio_volume_mgr_t volume;
audio_ucm_mgr_t ucm;
diff --git a/tizen-audio.c b/tizen-audio.c
index b674f62..b7df609 100644
--- a/tizen-audio.c
+++ b/tizen-audio.c
@@ -23,12 +23,7 @@
#include "tizen-audio-internal.h"
-int audio_get_revision (void)
-{
- return AUDIO_REVISION;
-}
-
-audio_return_t audio_init (void **userdata, void *platform_data)
+audio_return_t audio_init (void **userdata)
{
audio_mgr_t *am;
audio_return_t ret = AUDIO_RET_OK;
@@ -37,8 +32,6 @@ audio_return_t audio_init (void **userdata, void *platform_data)
AUDIO_LOG_ERROR("am malloc failed");
return AUDIO_ERR_RESOURCE;
}
- am->platform_data = platform_data;
- memset(&am->cb_intf, 0, sizeof(audio_cb_interface_t));
if (AUDIO_IS_ERROR((ret = _audio_device_init(am)))) {
AUDIO_LOG_ERROR("device init failed");
goto error_exit;
@@ -82,43 +75,6 @@ audio_return_t audio_deinit (void **userdata)
return AUDIO_RET_OK;
}
-audio_return_t audio_reset_volume (void **userdata)
-{
- audio_mgr_t *am = (audio_mgr_t *)*userdata;
- audio_return_t ret = AUDIO_RET_OK;
-
- if (am) {
- _audio_volume_deinit(am);
-
- if (AUDIO_IS_ERROR((ret = _audio_volume_init(am)))) {
- AUDIO_LOG_ERROR("stream init failed");
- goto error_exit;
- }
- }
-
- return AUDIO_RET_OK;
-
-error_exit:
- if (am)
- free(am);
- *userdata = NULL;
-
- return ret;
-}
-
-audio_return_t audio_set_callback (void *userdata, audio_cb_interface_t *cb_interface)
-{
- audio_mgr_t *am = (audio_mgr_t *)userdata;
-
- if (am) {
- memcpy(&am->cb_intf, cb_interface, sizeof(audio_cb_interface_t));
- return AUDIO_RET_OK;
- } else {
- return AUDIO_ERR_PARAMETER;
- }
-}
-
-
static const unsigned int SAMPLES_PER_PERIOD_DEFAULT = 1536; /* Frames */
static const unsigned int PERIODS_PER_BUFFER_FASTMODE = 4;
static const unsigned int PERIODS_PER_BUFFER_DEFAULT = 6;
diff --git a/tizen-audio.h b/tizen-audio.h
index 1e25b15..5b7b075 100644
--- a/tizen-audio.h
+++ b/tizen-audio.h
@@ -24,12 +24,9 @@
#include <stdlib.h>
#include <stdint.h>
-#define AUDIO_REVISION 1
-
/* Error code */
#define AUDIO_IS_ERROR(ret) (ret < 0)
-
typedef enum audio_return {
AUDIO_RET_OK = 0,
AUDIO_ERR_UNDEFINED = (int32_t)0x80001000,
@@ -45,18 +42,6 @@ typedef enum audio_direction {
AUDIO_DIRECTION_OUT, /**< Playback */
} audio_direction_t;
-typedef enum audio_route_flag {
- AUDIO_ROUTE_FLAG_NONE = 0,
- AUDIO_ROUTE_FLAG_MUTE_POLICY = 0x00000001,
- AUDIO_ROUTE_FLAG_DUAL_OUT = 0x00000002,
- AUDIO_ROUTE_FLAG_NOISE_REDUCTION = 0x00000010,
- AUDIO_ROUTE_FLAG_EXTRA_VOL = 0x00000020,
- AUDIO_ROUTE_FLAG_NETWORK_WB = 0x00000040,
- AUDIO_ROUTE_FLAG_BT_WB = 0x00000100,
- AUDIO_ROUTE_FLAG_BT_NREC = 0x00000200,
- AUDIO_ROUTE_FLAG_VOICE_COMMAND = 0x00040000,
-} audio_route_flag_t;
-
typedef enum audio_device_api {
AUDIO_DEVICE_API_UNKNOWN,
AUDIO_DEVICE_API_ALSA,
@@ -196,19 +181,9 @@ typedef enum audio_gain {
} audio_gain_t;
/* Overall */
-
-typedef struct audio_cb_interface {
- audio_return_t (*load_device)(void *platform_data, audio_device_info_t *device_info, audio_device_param_info_t *params);
- audio_return_t (*open_device)(void *platform_data, audio_device_info_t *device_info, audio_device_param_info_t *params);
- audio_return_t (*close_all_devices)(void *platform_data);
- audio_return_t (*close_device)(void *platform_data, audio_device_info_t *device_info);
- audio_return_t (*unload_device)(void *platform_data, audio_device_info_t *device_info);
-} audio_cb_interface_t;
-
typedef struct audio_interface {
- audio_return_t (*init)(void **userdata, void *platform_data);
+ audio_return_t (*init)(void **userdata);
audio_return_t (*deinit)(void **userdata);
- audio_return_t (*reset_volume)(void **userdata);
audio_return_t (*get_volume_level_max)(void *userdata, audio_volume_info_t *info, uint32_t *level);
audio_return_t (*get_volume_level)(void *userdata, audio_volume_info_t *info, uint32_t *level);
audio_return_t (*set_volume_level)(void *userdata, audio_volume_info_t *info, uint32_t level);
@@ -218,9 +193,8 @@ typedef struct audio_interface {
audio_return_t (*do_route)(void *userdata, audio_route_info_t *info);
audio_return_t (*update_route_option)(void *userdata, audio_route_option_t *option);
audio_return_t (*update_stream_connection_info) (void *userdata, audio_stream_info_t *info, uint32_t is_connected);
- audio_return_t (*alsa_pcm_open)(void *userdata, void **pcm_handle, char *device_name, uint32_t direction, int mode);
- audio_return_t (*alsa_pcm_close)(void *userdata, void *pcm_handle);
-
+ audio_return_t (*get_buffer_attr)(void *userdata, 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 */
audio_return_t (*pcm_open)(void *userdata, void **pcm_handle, void *sample_spec, uint32_t direction);
audio_return_t (*pcm_start)(void *userdata, void *pcm_handle);
@@ -229,15 +203,10 @@ typedef struct audio_interface {
audio_return_t (*pcm_avail)(void *userdata, void *pcm_handle, uint32_t *avail);
audio_return_t (*pcm_write)(void *userdata, void *pcm_handle, const void *buffer, uint32_t frames);
audio_return_t (*pcm_read)(void *userdata, void *pcm_handle, void *buffer, uint32_t frames);
-
- audio_return_t (*get_buffer_attr)(void *userdata, uint32_t direction, const char *latency, uint32_t samplerate, audio_sample_format_t format, uint32_t channels, uint32_t *maxlength, uint32_t *tlength, uint32_t *prebuf, uint32_t* minreq, uint32_t *fragsize);
- audio_return_t (*set_callback)(void *userdata, audio_cb_interface_t *cb_interface);
} audio_interface_t;
-int audio_get_revision (void);
-audio_return_t audio_init (void **userdata, void *platform_data);
+audio_return_t audio_init (void **userdata);
audio_return_t audio_deinit (void **userdata);
-audio_return_t audio_reset_volume (void **userdata);
audio_return_t audio_get_volume_level_max (void *userdata, audio_volume_info_t *info, uint32_t *level);
audio_return_t audio_get_volume_level (void *userdata, audio_volume_info_t *info, uint32_t *level);
audio_return_t audio_set_volume_level (void *userdata, audio_volume_info_t *info, uint32_t level);
@@ -247,8 +216,8 @@ audio_return_t audio_set_volume_mute (void *userdata, audio_volume_info_t *info,
audio_return_t audio_do_route (void *userdata, audio_route_info_t *info);
audio_return_t audio_update_route_option (void *userdata, audio_route_option_t *option);
audio_return_t audio_update_stream_connection_info (void *userdata, audio_stream_info_t *info, uint32_t is_connected);
-audio_return_t audio_alsa_pcm_open (void *userdata, void **pcm_handle, char *device_name, uint32_t direction, int mode);
-audio_return_t audio_alsa_pcm_close (void *userdata, void *pcm_handle);
+audio_return_t audio_get_buffer_attr(void *userdata, 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 *userdata, void **pcm_handle, void *sample_spec, uint32_t direction);
audio_return_t audio_pcm_start (void *userdata, void *pcm_handle);
audio_return_t audio_pcm_stop (void *userdata, void *pcm_handle);
@@ -256,6 +225,4 @@ audio_return_t audio_pcm_close (void *userdata, void *pcm_handle);
audio_return_t audio_pcm_avail (void *userdata, void *pcm_handle, uint32_t *avail);
audio_return_t audio_pcm_write (void *userdata, void *pcm_handle, const void *buffer, uint32_t frames);
audio_return_t audio_pcm_read (void *userdata, void *pcm_handle, void *buffer, uint32_t frames);
-audio_return_t audio_get_buffer_attr(void *userdata, uint32_t direction, const char *latency, uint32_t samplerate, audio_sample_format_t format, uint32_t channels, uint32_t *maxlength, uint32_t *tlength, uint32_t *prebuf, uint32_t* minreq, uint32_t *fragsize);
-audio_return_t audio_set_callback (void *userdata, audio_cb_interface_t *cb_interface);
#endif