Name: pulseaudio-modules-tizen
Summary: Improved Linux sound server
-Version: 5.0.10
+Version: 5.0.11
Release: 0
Group: Multimedia/Audio
License: LGPL-2.1+
return ret;
}
-int32_t pa_hal_manager_get_mute(pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t *mute) {
+int32_t pa_hal_manager_get_volume_mute(pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t *mute) {
int32_t ret = 0;
audio_return_t hal_ret = AUDIO_RET_OK;
audio_volume_info_t info = {NULL, NULL, 0};
return ret;
}
-int32_t pa_hal_manager_set_mute(pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t mute) {
+int32_t pa_hal_manager_set_volume_mute(pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t mute) {
int32_t ret = 0;
audio_return_t hal_ret = AUDIO_RET_OK;
audio_volume_info_t info = {NULL, NULL, 0};
int32_t pa_hal_manager_get_volume_level(pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t *level);
int32_t pa_hal_manager_set_volume_level(pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t level);
int32_t pa_hal_manager_get_volume_value(pa_hal_manager *h, const char *volume_type, const char *gain_type, io_direction_t direction, uint32_t level, double *value);
-int32_t pa_hal_manager_get_mute(pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t *mute);
-int32_t pa_hal_manager_set_mute(pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t mute);
+int32_t pa_hal_manager_get_volume_mute(pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t *mute);
+int32_t pa_hal_manager_set_volume_mute(pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t mute);
int32_t pa_hal_manager_do_route(pa_hal_manager *h, hal_route_info *info);
int32_t pa_hal_manager_update_route_option(pa_hal_manager *h, hal_route_option *option);
int32_t pa_hal_manager_update_stream_connection_info(pa_hal_manager *h, hal_stream_connection_info *info);
#include "communicator.h"
#include "hal-manager.h"
#include "stream-manager.h"
-#include "stream-manager-volume.h"
#include "device-manager.h"
PA_MODULE_AUTHOR("Seungbae Shin");
STREAM_FOCUS_ACQUIRED_CAPTURE = 0x02,
} focus_acquired_status_t;
-enum stream_direction {
- STREAM_DIRECTION_IN,
+typedef enum _stream_direction {
STREAM_DIRECTION_OUT,
+ STREAM_DIRECTION_IN,
STREAM_DIRECTION_MAX,
-};
+} stream_direction_t;
#define GET_STREAM_NEW_SAMPLE_SPEC(stream, type) \
(type == STREAM_SINK_INPUT? ((pa_sink_input_new_data*)stream)->sample_spec : ((pa_source_output_new_data*)stream)->sample_spec)
/* Get value from stream-manager */
if (volumes) {
v = pa_hashmap_get(volumes, volume_type);
- if (v && v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].idx_volume_values) {
+ if (v && v->values[stream_type].idx_volume_values) {
double *value = NULL;
- value = pa_idxset_get_by_index(v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].idx_volume_values, volume_level);
+ value = pa_idxset_get_by_index(v->values[stream_type].idx_volume_values, volume_level);
if (value) {
volume_linear = *value;
/* Apply master volume */
v = pa_hashmap_get(volumes, MASTER_VOLUME_TYPE);
if (v && !v->is_hal_volume_type)
- volume_linear *= (double)(v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].current_level)/100.0;
+ volume_linear *= (double)(v->values[stream_type].current_level)/100.0;
} else {
pa_log_error("failed to pa_idxset_get_by_index()");
ret = -1;
pa_log_error("could not set volume level of MASTER type, out of range(%u)", volume_level);
return -1;
}
- v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].current_level = volume_level;
+ v->values[stream_type].current_level = volume_level;
if (is_hal_volume && pa_streq(volume_type, MASTER_VOLUME_TYPE)) {
/* no need to update the value of pulseaudio stream */
return 0;
/* Get volume level of this type */
v = pa_hashmap_get(volumes, volume_type_str);
if (v)
- volume_level = v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].current_level;
+ volume_level = v->values[stream_type].current_level;
else
continue;
} else {
if (volumes) {
volume_info *v = pa_hashmap_get(volumes, volume_type);
if (v)
- *volume_level = v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].current_level;
+ *volume_level = v->values[stream_type].current_level;
else {
pa_log_error("could not get volume_info, stream_type(%d), volume_type(%s)", stream_type, volume_type);
return -1;
volumes = m->volume_infos;
if (volumes) {
volume_info *v = pa_hashmap_get(volumes, volume_type);
- if (v && v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].idx_volume_values)
- *volume_level = pa_idxset_size(v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].idx_volume_values);
+ if (v && v->values[stream_type].idx_volume_values)
+ *volume_level = pa_idxset_size(v->values[stream_type].idx_volume_values);
else {
pa_log_error("could not get volume_info, stream_type(%d), volume_type(%s)", stream_type, volume_type);
return -1;
}
if (is_hal_volume)
- if (pa_hal_manager_set_mute(m->hal, volume_type, (stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN, (uint32_t)volume_mute))
+ if (pa_hal_manager_set_volume_mute(m->hal, volume_type, (stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN, (uint32_t)volume_mute))
return -1;
/* Set mute */
if (volumes) {
v = pa_hashmap_get(volumes, volume_type);
if (v)
- v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].is_muted = volume_mute;
+ v->values[stream_type].is_muted = volume_mute;
else {
pa_log_error("could not get volume_info, stream_type(%d), volume_type(%s)", stream_type, volume_type);
return -1;
if (volumes) {
v = pa_hashmap_get(volumes, volume_type);
if (v)
- *volume_mute = v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].is_muted;
+ *volume_mute = v->values[stream_type].is_muted;
else {
pa_log_error("could not get volume_info, stream_type(%d), volume_type(%s)", stream_type, volume_type);
return -1;
if (volumes) {
v = pa_hashmap_get(volumes, volume_type_str);
if (v)
- muted_by_type = v->values[(stream_type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].is_muted;
+ muted_by_type = v->values[stream_type].is_muted;
} else {
pa_log_error("could not get volumes in volume map, stream_type(%d), volume_type(%s)", stream_type, volume_type_str);
return -1;
}
if (is_hal_volume)
- if (pa_hal_manager_set_mute(m->hal, volume_type_str, (stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN, volume_mute))
+ if (pa_hal_manager_set_volume_mute(m->hal, volume_type_str, (stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN, volume_mute))
return -1;
if (stream_type == STREAM_SINK_INPUT)
int32_t num_of_in_devices;
int32_t num_of_out_devices;
int32_t num_of_frameworks;
- char *volume_types[STREAM_DIRECTION_MAX];
- char *avail_in_devices[AVAIL_DEVICES_MAX];
- char *avail_out_devices[AVAIL_DEVICES_MAX];
- char *avail_frameworks[AVAIL_FRAMEWORKS_MAX];
+ const char *volume_types[STREAM_DIRECTION_MAX];
+ const char *avail_in_devices[AVAIL_DEVICES_MAX];
+ const char *avail_out_devices[AVAIL_DEVICES_MAX];
+ const char *avail_frameworks[AVAIL_FRAMEWORKS_MAX];
} stream_info_per_type;
typedef struct _stream_list {
int32_t num_of_streams;
stream_info *s = NULL;
volume_info *v = NULL;
void *state = NULL;
+
pa_assert(m);
if (m->stream_infos) {
stream_info *s = NULL;
pa_assert(m);
+ pa_assert(m->stream_infos);
pa_assert(role);
- if (m->stream_infos) {
- s = pa_hashmap_get(m->stream_infos, role);
- if (s)
- ret = FALSE;
- }
+ if ((s = pa_hashmap_get(m->stream_infos, role)))
+ ret = FALSE;
+
pa_log_info("role is [%s], skip(%d)", role, ret);
return ret;
static pa_bool_t check_route_type_to_skip(process_command_type_t command, const char *route_type_str) {
pa_bool_t ret = FALSE;
stream_route_type_t route_type;
+
pa_assert(route_type_str);
if (!pa_atoi(route_type_str, (int32_t*)&route_type)) {
}
static pa_bool_t update_priority_of_stream(pa_stream_manager *m, stream_type_t type, void *stream, const char *role, pa_bool_t is_new_data) {
+ pa_bool_t ret = FALSE;
stream_info *s = NULL;
pa_assert(m);
+ pa_assert(m->stream_infos);
pa_assert(role);
- if (m->stream_infos)
- s = pa_hashmap_get(m->stream_infos, role);
- else
- return FALSE;
-
- if (s) {
+ if ((s = pa_hashmap_get(m->stream_infos, role))) {
if (is_new_data)
pa_proplist_set(GET_STREAM_NEW_PROPLIST(stream, type), PA_PROP_MEDIA_ROLE_PRIORITY, (const void*)&(s->priority), sizeof(s->priority));
else
pa_proplist_set(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_ROLE_PRIORITY, (const void*)&(s->priority), sizeof(s->priority));
+ ret = TRUE;
}
- return TRUE;
+ return ret;
}
static pa_bool_t update_route_type_of_stream(pa_stream_manager *m, void *stream, stream_type_t type, const char *role) {
+ pa_bool_t ret = FALSE;
stream_route_type_t route_type = STREAM_ROUTE_TYPE_AUTO;
stream_info *s = NULL;
pa_assert(m);
+ pa_assert(m->stream_infos);
pa_assert(role);
- if (m->stream_infos) {
- s = pa_hashmap_get(m->stream_infos, role);
- if (s)
- route_type = s->route_type;
- } else
- return FALSE;
-
- pa_proplist_setf(GET_STREAM_NEW_PROPLIST(stream, type), PA_PROP_MEDIA_ROLE_ROUTE_TYPE, "%d", route_type);
+ if ((s = pa_hashmap_get(m->stream_infos, role))) {
+ route_type = s->route_type;
+ pa_proplist_setf(GET_STREAM_NEW_PROPLIST(stream, type), PA_PROP_MEDIA_ROLE_ROUTE_TYPE, "%d", route_type);
+ ret = TRUE;
+ }
- return TRUE;
+ return ret;
}
static pa_bool_t update_volume_type_of_stream(pa_stream_manager *m, stream_type_t type, void *stream, const char *role) {
+ pa_bool_t ret = FALSE;
const char *volume_type = NULL;
stream_info *s = NULL;
pa_assert(m);
+ pa_assert(m->stream_infos);
pa_assert(role);
- if (m->stream_infos) {
- s = pa_hashmap_get(m->stream_infos, role);
- if (s)
- volume_type = s->volume_types[!type];
- } else
- return FALSE;
+ if ((s = pa_hashmap_get(m->stream_infos, role)))
+ volume_type = s->volume_types[type];
- if (volume_type && (!pa_streq(volume_type, "none")))
+ if (volume_type && (!pa_streq(volume_type, "none"))) {
pa_proplist_sets(GET_STREAM_NEW_PROPLIST(stream, type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE, volume_type);
- else
+ ret = TRUE;
+ } else
pa_log_warn("this stream[%p] does not have any volume type, skip updating volume type. stream_type[%d], role[%s]", stream, type, role);
- return TRUE;
+ return ret;
}
static pa_bool_t update_focus_status_of_stream(pa_stream_manager *m, void *stream, stream_type_t type, pa_bool_t is_new_data) {
} else if (command == PROCESS_COMMAND_UPDATE_VOLUME && is_new_data) {
if ((si_volume_type_str = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(stream, type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE))) {
v = pa_hashmap_get(m->volume_infos, si_volume_type_str);
- if (v && v->values[(type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].idx_volume_values) {
+ if (v && v->values[type].idx_volume_values) {
/* Update volume-level */
- volume_ret = set_volume_level_with_new_data(m, type, stream, v->values[(type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].current_level);
+ volume_ret = set_volume_level_with_new_data(m, type, stream, v->values[type].current_level);
if (volume_ret)
pa_log_error("failed to set_volume_level_by_idx(), stream_type(%d), level(%u), ret(0x%x)",
- STREAM_SINK_INPUT, v->values[(type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].current_level, volume_ret);
+ type, v->values[type].current_level, volume_ret);
/* Update volume-mute */
- volume_ret = set_volume_mute_with_new_data(m, type, stream, v->values[(type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].is_muted);
+ volume_ret = set_volume_mute_with_new_data(m, type, stream, v->values[type].is_muted);
if (volume_ret)
pa_log_error("failed to set_volume_mute_by_idx(), stream_type(%d), mute(%d), ret(0x%x)",
- STREAM_SINK_INPUT, v->values[(type==STREAM_SINK_INPUT)?STREAM_DIRECTION_OUT:STREAM_DIRECTION_IN].is_muted, volume_ret);
+ type, v->values[type].is_muted, volume_ret);
}
}