summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
Diffstat (limited to 'audio')
-rw-r--r--[-rwxr-xr-x]audio/audio_hw.c59
-rw-r--r--[-rwxr-xr-x]audio/ril_interface.c23
-rw-r--r--[-rwxr-xr-x]audio/ril_interface.h1
3 files changed, 35 insertions, 48 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index bbd849a..873f025 100755..100644
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -483,7 +483,7 @@ struct tuna_audio_device {
pthread_mutex_t lock; /* see note below on mutex acquisition order */
struct mixer *mixer;
struct mixer_ctls mixer_ctls;
- int mode;
+ audio_mode_t mode;
int devices;
struct pcm *pcm_modem_dl;
struct pcm *pcm_modem_ul;
@@ -616,7 +616,7 @@ static int set_route_by_array(struct mixer *mixer, struct route_setting *route,
static int start_call(struct tuna_audio_device *adev)
{
- LOGE("Opening modem PCMs");
+ ALOGE("Opening modem PCMs");
pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE;
@@ -624,7 +624,7 @@ static int start_call(struct tuna_audio_device *adev)
if (adev->pcm_modem_dl == NULL) {
adev->pcm_modem_dl = pcm_open(0, PORT_MODEM, PCM_OUT, &pcm_config_vx);
if (!pcm_is_ready(adev->pcm_modem_dl)) {
- LOGE("cannot open PCM modem DL stream: %s", pcm_get_error(adev->pcm_modem_dl));
+ ALOGE("cannot open PCM modem DL stream: %s", pcm_get_error(adev->pcm_modem_dl));
goto err_open_dl;
}
}
@@ -632,7 +632,7 @@ static int start_call(struct tuna_audio_device *adev)
if (adev->pcm_modem_ul == NULL) {
adev->pcm_modem_ul = pcm_open(0, PORT_MODEM, PCM_IN, &pcm_config_vx);
if (!pcm_is_ready(adev->pcm_modem_ul)) {
- LOGE("cannot open PCM modem UL stream: %s", pcm_get_error(adev->pcm_modem_ul));
+ ALOGE("cannot open PCM modem UL stream: %s", pcm_get_error(adev->pcm_modem_ul));
goto err_open_ul;
}
}
@@ -654,7 +654,7 @@ err_open_dl:
static void end_call(struct tuna_audio_device *adev)
{
- LOGE("Closing modem PCMs");
+ ALOGE("Closing modem PCMs");
pcm_stop(adev->pcm_modem_dl);
pcm_stop(adev->pcm_modem_ul);
@@ -876,7 +876,7 @@ static void force_all_standby(struct tuna_audio_device *adev)
static void select_mode(struct tuna_audio_device *adev)
{
if (adev->mode == AUDIO_MODE_IN_CALL) {
- LOGE("Entering IN_CALL state, in_call=%d", adev->in_call);
+ ALOGE("Entering IN_CALL state, in_call=%d", adev->in_call);
if (!adev->in_call) {
force_all_standby(adev);
/* force earpiece route for in call state if speaker is the
@@ -896,12 +896,11 @@ static void select_mode(struct tuna_audio_device *adev)
adev->devices &= ~AUDIO_DEVICE_OUT_SPEAKER;
select_output_device(adev);
start_call(adev);
- ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_START);
adev_set_voice_volume(&adev->hw_device, adev->voice_volume);
adev->in_call = 1;
}
} else {
- LOGE("Leaving IN_CALL state, in_call=%d, mode=%d",
+ ALOGE("Leaving IN_CALL state, in_call=%d, mode=%d",
adev->in_call, adev->mode);
if (adev->in_call) {
adev->in_call = 0;
@@ -1147,7 +1146,7 @@ static int start_output_stream(struct tuna_stream_out *out)
/* Close any PCMs that could not be opened properly and return an error */
for (i = 0; i < PCM_TOTAL; i++) {
if (out->pcm[i] && !pcm_is_ready(out->pcm[i])) {
- LOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm[i]));
+ ALOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm[i]));
pcm_close(out->pcm[i]);
out->pcm[i] = NULL;
success = false;
@@ -1166,7 +1165,7 @@ static int start_output_stream(struct tuna_stream_out *out)
return -ENOMEM;
}
-static int check_input_parameters(uint32_t sample_rate, int format, int channel_count)
+static int check_input_parameters(uint32_t sample_rate, audio_format_t format, int channel_count)
{
if (format != AUDIO_FORMAT_PCM_16_BIT)
return -EINVAL;
@@ -1191,7 +1190,7 @@ static int check_input_parameters(uint32_t sample_rate, int format, int channel_
return 0;
}
-static size_t get_input_buffer_size(uint32_t sample_rate, int format, int channel_count)
+static size_t get_input_buffer_size(uint32_t sample_rate, audio_format_t format, int channel_count)
{
size_t size;
size_t device_rate;
@@ -1281,7 +1280,7 @@ static int get_playback_delay(struct tuna_stream_out *out,
buffer->time_stamp.tv_sec = 0;
buffer->time_stamp.tv_nsec = 0;
buffer->delay_ns = 0;
- LOGV("get_playback_delay(): pcm_get_htimestamp error,"
+ ALOGV("get_playback_delay(): pcm_get_htimestamp error,"
"setting playbackTimestamp to 0");
return status;
}
@@ -1325,12 +1324,12 @@ static uint32_t out_get_channels(const struct audio_stream *stream)
return AUDIO_CHANNEL_OUT_STEREO;
}
-static int out_get_format(const struct audio_stream *stream)
+static audio_format_t out_get_format(const struct audio_stream *stream)
{
return AUDIO_FORMAT_PCM_16_BIT;
}
-static int out_set_format(struct audio_stream *stream, int format)
+static int out_set_format(struct audio_stream *stream, audio_format_t format)
{
return 0;
}
@@ -1642,7 +1641,7 @@ static int start_input_stream(struct tuna_stream_in *in)
/* this assumes routing is done previously */
in->pcm = pcm_open(0, PORT_MM2_UL, PCM_IN, &in->config);
if (!pcm_is_ready(in->pcm)) {
- LOGE("cannot open pcm_in driver: %s", pcm_get_error(in->pcm));
+ ALOGE("cannot open pcm_in driver: %s", pcm_get_error(in->pcm));
pcm_close(in->pcm);
adev->active_input = NULL;
return -ENOMEM;
@@ -1688,12 +1687,12 @@ static uint32_t in_get_channels(const struct audio_stream *stream)
}
}
-static int in_get_format(const struct audio_stream *stream)
+static audio_format_t in_get_format(const struct audio_stream *stream)
{
return AUDIO_FORMAT_PCM_16_BIT;
}
-static int in_set_format(struct audio_stream *stream, int format)
+static int in_set_format(struct audio_stream *stream, audio_format_t format)
{
return 0;
}
@@ -1814,7 +1813,7 @@ static void get_capture_delay(struct tuna_stream_in *in,
buffer->time_stamp.tv_sec = 0;
buffer->time_stamp.tv_nsec = 0;
buffer->delay_ns = 0;
- LOGW("read get_capture_delay(): pcm_htimestamp error");
+ ALOGW("read get_capture_delay(): pcm_htimestamp error");
return;
}
@@ -1835,7 +1834,7 @@ static void get_capture_delay(struct tuna_stream_in *in,
buffer->time_stamp = tstamp;
buffer->delay_ns = delay_ns;
- LOGV("get_capture_delay time_stamp = [%ld].[%ld], delay_ns: [%d],"
+ ALOGV("get_capture_delay time_stamp = [%ld].[%ld], delay_ns: [%d],"
" kernel_delay:[%ld], buf_delay:[%ld], rsmp_delay:[%ld], kernel_frames:[%d], "
"in->frames_in:[%d], in->proc_frames_in:[%d], frames:[%d]",
buffer->time_stamp.tv_sec , buffer->time_stamp.tv_nsec, buffer->delay_ns,
@@ -1849,7 +1848,7 @@ static int32_t update_echo_reference(struct tuna_stream_in *in, size_t frames)
struct echo_reference_buffer b;
b.delay_ns = 0;
- LOGV("update_echo_reference, frames = [%d], in->ref_frames_in = [%d], "
+ ALOGV("update_echo_reference, frames = [%d], in->ref_frames_in = [%d], "
"b.frame_count = [%d]",
frames, in->ref_frames_in, frames - in->ref_frames_in);
if (in->ref_frames_in < frames) {
@@ -1868,12 +1867,12 @@ static int32_t update_echo_reference(struct tuna_stream_in *in, size_t frames)
if (in->echo_reference->read(in->echo_reference, &b) == 0)
{
in->ref_frames_in += b.frame_count;
- LOGV("update_echo_reference: in->ref_frames_in:[%d], "
+ ALOGV("update_echo_reference: in->ref_frames_in:[%d], "
"in->ref_buf_size:[%d], frames:[%d], b.frame_count:[%d]",
in->ref_frames_in, in->ref_buf_size, frames, b.frame_count);
}
} else
- LOGW("update_echo_reference: NOT enough frames to read ref buffer");
+ ALOGW("update_echo_reference: NOT enough frames to read ref buffer");
return b.delay_ns;
}
@@ -1966,7 +1965,7 @@ static int get_next_buffer(struct resampler_buffer_provider *buffer_provider,
in->config.period_size *
audio_stream_frame_size(&in->stream.common));
if (in->read_status != 0) {
- LOGE("get_next_buffer() pcm_read error %d", in->read_status);
+ ALOGE("get_next_buffer() pcm_read error %d", in->read_status);
buffer->raw = NULL;
buffer->frame_count = 0;
return in->read_status;
@@ -2055,7 +2054,7 @@ static ssize_t process_frames(struct tuna_stream_in *in, void* buffer, ssize_t f
in->proc_buf = (int16_t *)realloc(in->proc_buf,
in->proc_buf_size *
in->config.channels * sizeof(int16_t));
- LOGV("process_frames(): in->proc_buf %p size extended to %d frames",
+ ALOGV("process_frames(): in->proc_buf %p size extended to %d frames",
in->proc_buf, in->proc_buf_size);
}
frames_rd = read_frames(in,
@@ -2236,7 +2235,7 @@ exit:
static int adev_open_output_stream(struct audio_hw_device *dev,
- uint32_t devices, int *format,
+ uint32_t devices, audio_format_t *format,
uint32_t *channels, uint32_t *sample_rate,
struct audio_stream_out **stream_out)
{
@@ -2393,7 +2392,7 @@ static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
return -ENOSYS;
}
-static int adev_set_mode(struct audio_hw_device *dev, int mode)
+static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
{
struct tuna_audio_device *adev = (struct tuna_audio_device *)dev;
@@ -2426,7 +2425,7 @@ static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state)
}
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
- uint32_t sample_rate, int format,
+ uint32_t sample_rate, audio_format_t format,
int channel_count)
{
size_t size;
@@ -2438,7 +2437,7 @@ static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
}
static int adev_open_input_stream(struct audio_hw_device *dev, uint32_t devices,
- int *format, uint32_t *channel_mask,
+ audio_format_t *format, uint32_t *channel_mask,
uint32_t *sample_rate,
audio_in_acoustics_t acoustics,
struct audio_stream_in **stream_in)
@@ -2612,7 +2611,7 @@ static int adev_open(const hw_module_t* module, const char* name,
adev->mixer = mixer_open(0);
if (!adev->mixer) {
free(adev);
- LOGE("Unable to open the mixer, aborting.");
+ ALOGE("Unable to open the mixer, aborting.");
return -EINVAL;
}
@@ -2667,7 +2666,7 @@ static int adev_open(const hw_module_t* module, const char* name,
!adev->mixer_ctls.earpiece_volume) {
mixer_close(adev->mixer);
free(adev);
- LOGE("Unable to locate all mixer controls, aborting.");
+ ALOGE("Unable to locate all mixer controls, aborting.");
return -EINVAL;
}
diff --git a/audio/ril_interface.c b/audio/ril_interface.c
index 4e1e2a1..3d7ce06 100755..100644
--- a/audio/ril_interface.c
+++ b/audio/ril_interface.c
@@ -36,7 +36,6 @@ int (*_ril_is_connected)(void *);
int (*_ril_disconnect)(void *);
int (*_ril_set_call_volume)(void *, enum ril_sound_type, int);
int (*_ril_set_call_audio_path)(void *, enum ril_audio_path);
-int (*_ril_set_call_clock_sync)(void *, enum ril_clock_state);
int (*_ril_register_unsolicited_handler)(void *, int, void *);
int (*_ril_get_wb_amr)(void *, void *);
@@ -72,7 +71,7 @@ static int ril_connect_if_required(struct ril_handle *ril)
return 0;
if (_ril_connect(ril->client) != RIL_CLIENT_ERR_SUCCESS) {
- LOGE("ril_connect() failed");
+ ALOGE("ril_connect() failed");
return -1;
}
@@ -94,7 +93,7 @@ int ril_open(struct ril_handle *ril)
ril->handle = dlopen(RIL_CLIENT_LIBPATH, RTLD_NOW);
if (!ril->handle) {
- LOGE("Cannot open '%s'", RIL_CLIENT_LIBPATH);
+ ALOGE("Cannot open '%s'", RIL_CLIENT_LIBPATH);
return -1;
}
@@ -105,7 +104,6 @@ int ril_open(struct ril_handle *ril)
_ril_disconnect = dlsym(ril->handle, "Disconnect_RILD");
_ril_set_call_volume = dlsym(ril->handle, "SetCallVolume");
_ril_set_call_audio_path = dlsym(ril->handle, "SetCallAudioPath");
- _ril_set_call_clock_sync = dlsym(ril->handle, "SetCallClockSync");
_ril_register_unsolicited_handler = dlsym(ril->handle,
"RegisterUnsolicitedHandler");
/* since this function is not supported in all RILs, don't require it */
@@ -113,16 +111,15 @@ int ril_open(struct ril_handle *ril)
if (!_ril_open_client || !_ril_close_client || !_ril_connect ||
!_ril_is_connected || !_ril_disconnect || !_ril_set_call_volume ||
- !_ril_set_call_audio_path || !_ril_set_call_clock_sync ||
- !_ril_register_unsolicited_handler) {
- LOGE("Cannot get symbols from '%s'", RIL_CLIENT_LIBPATH);
+ !_ril_set_call_audio_path || !_ril_register_unsolicited_handler) {
+ ALOGE("Cannot get symbols from '%s'", RIL_CLIENT_LIBPATH);
dlclose(ril->handle);
return -1;
}
ril->client = _ril_open_client();
if (!ril->client) {
- LOGE("ril_open_client() failed");
+ ALOGE("ril_open_client() failed");
dlclose(ril->handle);
return -1;
}
@@ -148,7 +145,7 @@ int ril_close(struct ril_handle *ril)
if ((_ril_disconnect(ril->client) != RIL_CLIENT_ERR_SUCCESS) ||
(_ril_close_client(ril->client) != RIL_CLIENT_ERR_SUCCESS)) {
- LOGE("ril_disconnect() or ril_close_client() failed");
+ ALOGE("ril_disconnect() or ril_close_client() failed");
return -1;
}
@@ -173,11 +170,3 @@ int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path)
return _ril_set_call_audio_path(ril->client, path);
}
-
-int ril_set_call_clock_sync(struct ril_handle *ril, enum ril_clock_state state)
-{
- if (ril_connect_if_required(ril))
- return 0;
-
- return _ril_set_call_clock_sync(ril->client, state);
-}
diff --git a/audio/ril_interface.h b/audio/ril_interface.h
index 676772c..2ea83f8 100755..100644
--- a/audio/ril_interface.h
+++ b/audio/ril_interface.h
@@ -66,7 +66,6 @@ int ril_close(struct ril_handle *ril);
int ril_set_call_volume(struct ril_handle *ril, enum ril_sound_type sound_type,
float volume);
int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path);
-int ril_set_call_clock_sync(struct ril_handle *ril, enum ril_clock_state state);
void ril_register_set_wb_amr_callback(void *function, void *data);
#endif