diff options
author | Sangchul Lee <sc11.lee@samsung.com> | 2016-06-23 10:17:33 +0900 |
---|---|---|
committer | Sangchul Lee <sc11.lee@samsung.com> | 2016-06-24 09:45:33 +0900 |
commit | 7218b4119c9cf5230c8f78978ccb0950432a9a27 (patch) | |
tree | 0f244980440c828a70018eb9e1f9991f1b4c52c3 | |
parent | b91394c8ebd927b3ef5f82e48c2877c6dce5930e (diff) | |
download | audio-hal-sc7727-7218b4119c9cf5230c8f78978ccb0950432a9a27.tar.gz audio-hal-sc7727-7218b4119c9cf5230c8f78978ccb0950432a9a27.tar.bz2 audio-hal-sc7727-7218b4119c9cf5230c8f78978ccb0950432a9a27.zip |
Remove a deprecated API: audio_get_buffer_attr()
It is moved to module-tizenaudio-policy of pulseaudio.
[Version] 0.1.14
[Profile] Mobile
[Issue Type] Remove API
Change-Id: Ib57427322f4981f42069c403bd40247a394b860b
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
-rw-r--r-- | packaging/audio-hal-sc7727.spec | 2 | ||||
-rw-r--r-- | tizen-audio-stream.c | 179 | ||||
-rw-r--r-- | tizen-audio.h | 4 |
3 files changed, 1 insertions, 184 deletions
diff --git a/packaging/audio-hal-sc7727.spec b/packaging/audio-hal-sc7727.spec index 984a7b1..82e5e11 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.13 +Version: 0.1.14 Release: 0 Group: System/Libraries License: Apache-2.0 diff --git a/tizen-audio-stream.c b/tizen-audio-stream.c index 582b1aa..32a8130 100644 --- a/tizen-audio-stream.c +++ b/tizen-audio-stream.c @@ -21,70 +21,7 @@ #include <config.h> #endif -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdbool.h> - #include "tizen-audio-internal.h" -#include "tizen-audio-impl.h" - -/* Audio latency */ -static const char* AUDIO_LATENCY_LOW = "low"; -static const char* AUDIO_LATENCY_MID = "mid"; -static const char* AUDIO_LATENCY_HIGH = "high"; -static const char* AUDIO_LATENCY_VOIP = "voip"; - -/* Latency msec */ -static const unsigned int PERIOD_TIME_FOR_ULOW_LATENCY_MSEC = 20; -static const unsigned int PERIOD_TIME_FOR_LOW_LATENCY_MSEC = 25; -static const unsigned int PERIOD_TIME_FOR_MID_LATENCY_MSEC = 50; -static const unsigned int PERIOD_TIME_FOR_HIGH_LATENCY_MSEC = 75; -static const unsigned int PERIOD_TIME_FOR_UHIGH_LATENCY_MSEC = 150; -static const unsigned int PERIOD_TIME_FOR_VOIP_LATENCY_MSEC = 20; - -static const uint32_t g_size_table[] = { - [AUDIO_SAMPLE_U8] = 1, - [AUDIO_SAMPLE_ULAW] = 1, - [AUDIO_SAMPLE_ALAW] = 1, - [AUDIO_SAMPLE_S16LE] = 2, - [AUDIO_SAMPLE_S16BE] = 2, - [AUDIO_SAMPLE_FLOAT32LE] = 4, - [AUDIO_SAMPLE_FLOAT32BE] = 4, - [AUDIO_SAMPLE_S32LE] = 4, - [AUDIO_SAMPLE_S32BE] = 4, - [AUDIO_SAMPLE_S24LE] = 3, - [AUDIO_SAMPLE_S24BE] = 3, - [AUDIO_SAMPLE_S24_32LE] = 4, - [AUDIO_SAMPLE_S24_32BE] = 4 -}; - -static int __sample_spec_valid(uint32_t rate, audio_sample_format_t format, uint32_t channels) -{ - if ((rate <= 0 || - rate > (48000U*4U) || - channels <= 0 || - channels > 32U || - format >= AUDIO_SAMPLE_MAX || - format < AUDIO_SAMPLE_U8)) - return 0; - - AUDIO_LOG_ERROR("hal-latency - __sample_spec_valid() -> return true"); - - return 1; -} - -static uint32_t __usec_to_bytes(uint64_t t, uint32_t rate, audio_sample_format_t format, uint32_t channels) -{ - uint32_t ret = (uint32_t) (((t * rate) / 1000000ULL)) * (g_size_table[format] * channels); - AUDIO_LOG_DEBUG("hal-latency - return %d", ret); - return ret; -} - -static uint32_t __sample_size(audio_sample_format_t format) -{ - return g_size_table[format]; -} audio_return_t _audio_stream_init(audio_hal_t *ah) { @@ -119,119 +56,3 @@ audio_return_t audio_notify_stream_connection_changed(void *audio_handle, audio_ return audio_ret; } -audio_return_t audio_get_buffer_attr(void *audio_handle, - 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_VAL_IF_FAIL(audio_handle, AUDIO_ERR_PARAMETER); - AUDIO_RETURN_VAL_IF_FAIL(latency, AUDIO_ERR_PARAMETER); - AUDIO_RETURN_VAL_IF_FAIL(maxlength, AUDIO_ERR_PARAMETER); - AUDIO_RETURN_VAL_IF_FAIL(tlength, AUDIO_ERR_PARAMETER); - AUDIO_RETURN_VAL_IF_FAIL(prebuf, AUDIO_ERR_PARAMETER); - AUDIO_RETURN_VAL_IF_FAIL(minreq, AUDIO_ERR_PARAMETER); - AUDIO_RETURN_VAL_IF_FAIL(fragsize, AUDIO_ERR_PARAMETER); - - AUDIO_LOG_DEBUG("hal-latency - audio_get_buffer_attr(direction:%d, latency:%s, samplerate:%d, format:%d, channels:%d)", direction, latency, samplerate, format, channels); - - uint32_t period_time = 0, - sample_per_period = 0; - - if (__sample_spec_valid(samplerate, format, channels) == 0) { - return AUDIO_ERR_PARAMETER; - } - - if (direction == AUDIO_DIRECTION_IN) { - if (!strcmp(latency, AUDIO_LATENCY_LOW)) { - AUDIO_LOG_DEBUG("AUDIO_DIRECTION_IN, AUDIO_LATENCY_LOW"); - period_time = PERIOD_TIME_FOR_LOW_LATENCY_MSEC; - sample_per_period = (samplerate * period_time) / 1000; - *prebuf = 0; - *minreq = -1; - *tlength = -1; - *maxlength = -1; - *fragsize = sample_per_period * __sample_size(format); - } else if (!strcmp(latency, AUDIO_LATENCY_MID)) { - AUDIO_LOG_DEBUG("AUDIO_DIRECTION_IN, AUDIO_LATENCY_MID"); - period_time = PERIOD_TIME_FOR_MID_LATENCY_MSEC; - sample_per_period = (samplerate * period_time) / 1000; - *prebuf = 0; - *minreq = -1; - *tlength = -1; - *maxlength = -1; - *fragsize = sample_per_period * __sample_size(format); - } else if (!strcmp(latency, AUDIO_LATENCY_HIGH)) { - AUDIO_LOG_DEBUG("AUDIO_DIRECTION_IN, AUDIO_LATENCY_HIGH"); - period_time = PERIOD_TIME_FOR_HIGH_LATENCY_MSEC; - sample_per_period = (samplerate * period_time) / 1000; - *prebuf = 0; - *minreq = -1; - *tlength = -1; - *maxlength = -1; - *fragsize = sample_per_period * __sample_size(format); - } else if (!strcmp(latency, AUDIO_LATENCY_VOIP)) { - AUDIO_LOG_DEBUG("AUDIO_DIRECTION_IN, AUDIO_LATENCY_VOIP"); - period_time = PERIOD_TIME_FOR_VOIP_LATENCY_MSEC; - sample_per_period = (samplerate * period_time) / 1000; - *prebuf = 0; - *minreq = -1; - *tlength = -1; - *maxlength = -1; - *fragsize = sample_per_period * __sample_size(format); - } else { - AUDIO_LOG_ERROR("hal-latency - The latency(%s) is undefined", latency); - return AUDIO_ERR_UNDEFINED; - } - } else { /* AUDIO_DIRECTION_OUT */ - if (!strcmp(latency, AUDIO_LATENCY_LOW)) { - AUDIO_LOG_DEBUG("AUDIO_DIRECTION_OUT, AUDIO_LATENCY_LOW"); - period_time = PERIOD_TIME_FOR_LOW_LATENCY_MSEC; - sample_per_period = (samplerate * period_time) / 1000; - *prebuf = 0; - *minreq = -1; - *tlength = (samplerate / 10) * __sample_size(format) * channels; /* 100ms */ - *maxlength = -1; - *fragsize = 0; - } else if (!strcmp(latency, AUDIO_LATENCY_MID)) { - AUDIO_LOG_DEBUG("AUDIO_DIRECTION_OUT, AUDIO_LATENCY_MID"); - period_time = PERIOD_TIME_FOR_MID_LATENCY_MSEC; - sample_per_period = (samplerate * period_time) / 1000; - *prebuf = 0; - *minreq = -1; - *tlength = (uint32_t) __usec_to_bytes(200000, samplerate, format, channels); - *maxlength = -1; - *fragsize = -1; - } else if (!strcmp(latency, AUDIO_LATENCY_HIGH)) { - AUDIO_LOG_DEBUG("AUDIO_DIRECTION_OUT, AUDIO_LATENCY_HIGH"); - period_time = PERIOD_TIME_FOR_HIGH_LATENCY_MSEC; - sample_per_period = (samplerate * period_time) / 1000; - *prebuf = 0; - *minreq = -1; - *tlength = (uint32_t) __usec_to_bytes(400000, samplerate, format, channels); - *maxlength = -1; - *fragsize = -1; - } else if (!strcmp(latency, AUDIO_LATENCY_VOIP)) { - AUDIO_LOG_DEBUG("AUDIO_DIRECTION_OUT, AUDIO_LATENCY_VOIP"); - period_time = PERIOD_TIME_FOR_VOIP_LATENCY_MSEC; - sample_per_period = (samplerate * period_time) / 1000; - *prebuf = 0; - *minreq = __usec_to_bytes(20000, samplerate, format, channels); - *tlength = __usec_to_bytes(100000, samplerate, format, channels); - *maxlength = -1; - *fragsize = 0; - } else { - AUDIO_LOG_ERROR("hal-latency - The latency(%s) is undefined", latency); - return AUDIO_ERR_UNDEFINED; - } - } - - AUDIO_LOG_INFO("hal-latency - return attr --> prebuf:%d, minreq:%d, tlength:%d, maxlength:%d, fragsize:%d", *prebuf, *minreq, *tlength, *maxlength, *fragsize); - return AUDIO_RET_OK; -} diff --git a/tizen-audio.h b/tizen-audio.h index 0bfac13..7bf95ab 100644 --- a/tizen-audio.h +++ b/tizen-audio.h @@ -89,8 +89,6 @@ typedef struct audio_interface { audio_return_t (*update_route_option)(void *audio_handle, audio_route_option_t *option); /* Stream */ audio_return_t (*notify_stream_connection_changed)(void *audio_handle, audio_stream_info_t *info, uint32_t is_connected); - 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); /* PCM */ 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); @@ -119,8 +117,6 @@ audio_return_t audio_set_volume_mute(void *audio_handle, audio_volume_info_t *in 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_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); audio_return_t audio_pcm_start(void *audio_handle, void *pcm_handle); audio_return_t audio_pcm_stop(void *audio_handle, void *pcm_handle); |