Name: pulseaudio
Summary: Improved Linux sound server
Version: 5.0
-Release: 26
+Release: 27
Group: Multimedia/Audio
License: GPL-2.0+ and LGPL-2.1+
URL: http://pulseaudio.org
#endif
#include "module-sound-player-symdef.h"
-#include "tizen-audio.h"
#include <pulsecore/core-scache.h>
{ "role", "s", "in" },
{ "volume_gain", "s", "in" }};
-static char* signature_args_for_in[] = { "sss", "sss" };
+static const char* signature_args_for_in[] = { "sss", "sss" };
static pa_dbus_method_handler method_handlers[METHOD_HANDLER_MAX] = {
[METHOD_HANDLER_SIMPLE_PLAY] = {
static pa_hook_result_t sink_input_unlink_cb(pa_core *core, pa_sink_input *i, struct userdata *u) {
int32_t *stream_idx = NULL;
- uint32_t *idx = NULL;
+ uint32_t idx = 0;
pa_core_assert_ref(core);
pa_sink_input_assert_ref(i);
pa_xfree(h);
}
-int32_t pa_hal_manager_get_buffer_attribute(pa_hal_manager *h, audio_latency_t latency, pa_sink_input_new_data *new_data, uint32_t *maxlength, uint32_t *tlength, uint32_t *prebuf, uint32_t* minreq, uint32_t *fragsize) {
+int32_t pa_hal_manager_get_buffer_attribute(pa_hal_manager *h, io_direction_t direction, uint32_t latency, void *new_data, uint32_t *maxlength, uint32_t *tlength, uint32_t *prebuf, uint32_t* minreq, uint32_t *fragsize) {
int32_t ret = 0;
audio_return_t hal_ret = AUDIO_RET_OK;
+ pa_sample_spec *sample_spec = NULL;
pa_assert(h);
pa_assert(new_data);
- pa_log_info("latency:%d, rate:%u, format:%d, channels:%u", latency, new_data->sample_spec.rate, new_data->sample_spec.format, new_data->sample_spec.channels);
+ sample_spec = (direction==DIRECTION_OUT)?(&((pa_sink_input_new_data*)new_data)->sample_spec):(&((pa_source_output_new_data*)new_data)->sample_spec);
+ pa_log_info("latency:%d, rate:%u, format:%d, channels:%u", latency, sample_spec->rate, sample_spec->format, sample_spec->channels);
- if (AUDIO_IS_ERROR(hal_ret = h->intf.get_buffer_attr(h->data, latency, new_data->sample_spec.rate, new_data->sample_spec.format, new_data->sample_spec.channels, maxlength, tlength, prebuf, minreq, fragsize))) {
+ if (AUDIO_IS_ERROR(hal_ret = h->intf.get_buffer_attr(h->data, latency, sample_spec->rate, sample_spec->format, sample_spec->channels, maxlength, tlength, prebuf, minreq, fragsize))) {
pa_log_error("get_buffer_attr returns error:0x%x", hal_ret);
ret = -1;
} else
pa_hal_manager* pa_hal_manager_get(pa_core *core, void *user_data);
pa_hal_manager* pa_hal_manager_ref(pa_hal_manager *h);
void pa_hal_manager_unref(pa_hal_manager *h);
-int32_t pa_hal_manager_get_buffer_attribute(pa_hal_manager *h, audio_latency_t latency, pa_sink_input_new_data *new_data, uint32_t *maxlength, uint32_t *tlength, uint32_t *prebuf, uint32_t* minreq, uint32_t *fragsize);
+int32_t pa_hal_manager_get_buffer_attribute(pa_hal_manager *h, io_direction_t direction, uint32_t latency, void *new_data, uint32_t *maxlength, uint32_t *tlength, uint32_t *prebuf, uint32_t* minreq, uint32_t *fragsize);
int32_t pa_hal_manager_reset_volume (pa_hal_manager *h);
int32_t pa_hal_manager_get_volume_level_max (pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t *level);
int32_t pa_hal_manager_get_volume_level (pa_hal_manager *h, const char *volume_type, io_direction_t direction, uint32_t *level);
SIGNAL_MAX
};
-static pa_dbus_arg_info signal_test1_args[] = { { "arg1", "i", NULL } };
-static pa_dbus_arg_info signal_test2_args[] = { { "arg1", "s", NULL } };
-
-static pa_dbus_signal_info signals[SIGNAL_MAX] = {
- [SIGNAL_PROP_CHANGED] = { .name = "PropertyTest1Changed", .arguments = signal_test1_args, .n_arguments = 1 },
- [SIGNAL_TEST2] = { .name = "SignalTest2", .arguments = signal_test2_args, .n_arguments = 1 },
-};
-
-/*** For handle module-policy dbus interface ***/
-static pa_dbus_interface_info policy_interface_info = {
- .name = INTERFACE_POLICY,
- .method_handlers = method_handlers,
- .n_method_handlers = METHOD_HANDLER_MAX,
- .property_handlers = property_handlers,
- .n_property_handlers = PROPERTY_MAX,
- .get_all_properties_cb = handle_get_all,
- .signals = signals,
- .n_signals = SIGNAL_MAX
-};
-
/*** Defines for get signal ***/
#define SOUND_SERVER_INTERFACE_NAME "org.tizen.soundserver.service"
#define AUDIO_CLIENT_INTERFACE_NAME "org.tizen.audioclient.service"
uint32_t stream_idx = PA_INVALID_INDEX;
uint32_t volume_type = 0;
uint32_t direction = 0;
- uint32_t mute = 0;
+ pa_bool_t mute = FALSE;
const char *volume_str = NULL;
pa_tagstruct_getu32(t, &stream_idx);
__convert_volume_type_to_string(volume_type, &volume_str);
pa_stream_manager_volume_get_mute(u->stream_manager, STREAM_SINK_INPUT, volume_str, &mute);
- pa_tagstruct_putu32(reply, mute);
+ pa_tagstruct_putu32(reply, (uint32_t)mute);
break;
}
/* it will be removed soon */
pa_tagstruct_getu32(t, &mute);
__convert_volume_type_to_string(volume_type, &volume_str);
- if (stream_idx == -1)
- pa_stream_manager_volume_set_mute(u->stream_manager, STREAM_SINK_INPUT, volume_str, mute);
+ if ((int32_t)stream_idx == -1)
+ pa_stream_manager_volume_set_mute(u->stream_manager, STREAM_SINK_INPUT, volume_str, (pa_bool_t)mute);
else
- pa_stream_manager_volume_set_mute_by_idx(u->stream_manager, STREAM_SINK_INPUT, stream_idx, mute);
+ pa_stream_manager_volume_set_mute_by_idx(u->stream_manager, STREAM_SINK_INPUT, stream_idx, (pa_bool_t)mute);
break;
}
dm_device *device = NULL;
dm_device_direction_t device_direction = DM_DEVICE_DIRECTION_NONE;
pa_idxset *conn_devices = NULL;
- pa_sink *combine_sink_arg1 = NULL;
- pa_sink *combine_sink_arg2 = NULL;
pa_log_info("select_proper_sink_or_source_hook_cb is called. (%p), stream_type(%d), stream_role(%s), route_type(%d)",
data, data->stream_type, data->stream_role, data->route_type);
dm_device_type = pa_device_manager_get_device_type(device);
dm_device_subtype = pa_device_manager_get_device_subtype(device);
device_direction = pa_device_manager_get_device_direction(device);
- pa_log_debug("[AUTO(_ALL)] conn_devices, type[%s], subtype[%s], direction[%p]", dm_device_type, dm_device_subtype, device_direction);
+ pa_log_debug("[AUTO(_ALL)] conn_devices, type[%s], subtype[%s], direction[0x%x]", dm_device_type, dm_device_subtype, device_direction);
if (pa_streq(device_type, dm_device_type) &&
(((data->stream_type==STREAM_SINK_INPUT) && (device_direction & DM_DEVICE_DIRECTION_OUT)) ||
((data->stream_type==STREAM_SOURCE_OUTPUT) && (device_direction & DM_DEVICE_DIRECTION_IN)))) {
- pa_log_debug("[AUTO(_ALL)] found a matched device: type[%s], direction[%p]", device_type, device_direction);
+ pa_log_debug("[AUTO(_ALL)] found a matched device: type[%s], direction[0x%x]", device_type, device_direction);
if (data->stream_type == STREAM_SINK_INPUT && u->module_combine_sink) {
*(data->proper_sink) = pa_namereg_get(u->module->core, SINK_COMBINED, PA_NAMEREG_SINK);
dm_device_type = pa_device_manager_get_device_type(device);
dm_device_subtype = pa_device_manager_get_device_subtype(device);
device_direction = pa_device_manager_get_device_direction(device);
- pa_log_debug("[MANUAL] manual_devices, type[%s], subtype[%s], direction[%p], device id[%u]",
+ pa_log_debug("[MANUAL] manual_devices, type[%s], subtype[%s], direction[0x%x], device id[%u]",
dm_device_type, dm_device_subtype, device_direction, *device_id);
if (pa_streq(device_type, dm_device_type) &&
(((data->stream_type==STREAM_SINK_INPUT) && (device_direction & DM_DEVICE_DIRECTION_OUT)) ||
/* 3. Call HAL API to apply the routing setting */
static pa_hook_result_t route_change_hook_cb(pa_core *c, pa_stream_manager_hook_data_for_route *data, struct userdata *u) {
#ifdef DEVICE_MANAGER
- int32_t i = 0;
+ uint32_t i = 0;
uint32_t idx = 0;
uint32_t d_idx = 0;
uint32_t s_idx = 0;
if (device_state == DM_DEVICE_STATE_ACTIVATED &&
(((data->stream_type==STREAM_SINK_INPUT) && (device_direction & DM_DEVICE_DIRECTION_OUT)) ||
((data->stream_type==STREAM_SOURCE_OUTPUT) && (device_direction & DM_DEVICE_DIRECTION_IN)))) {
- pa_log_debug("[RESET] found a matched device and set state to DE-ACTIVATED: type[%s], direction[%p]", dm_device_type, device_direction);
+ pa_log_debug("[RESET] found a matched device and set state to DE-ACTIVATED: type[%s], direction[0x%x]", dm_device_type, device_direction);
/* set device state to deactivated */
pa_device_manager_set_device_state(device, DM_DEVICE_STATE_DEACTIVATED);
}
dm_device_subtype = pa_device_manager_get_device_subtype(device);
device_direction = pa_device_manager_get_device_direction(device);
device_idx = pa_device_manager_get_device_id(device);
- pa_log_debug("[AUTO(_ALL)] conn_devices, type[%s], subtype[%s], direction[%p], id[%u]",
+ pa_log_debug("[AUTO(_ALL)] conn_devices, type[%s], subtype[%s], direction[0x%x], id[%u]",
dm_device_type, dm_device_subtype, device_direction, device_idx);
if (pa_streq(device_type, dm_device_type) &&
(((data->stream_type==STREAM_SINK_INPUT) && (device_direction & DM_DEVICE_DIRECTION_OUT)) ||
route_info.device_infos[route_info.num_of_devices-1].type = dm_device_type;
route_info.device_infos[route_info.num_of_devices-1].direction = (data->stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN;
route_info.device_infos[route_info.num_of_devices-1].id = device_idx;
- pa_log_debug("[AUTO(_ALL)] found a matched device and set state to ACTIVATED: type[%s], direction[%p], id[%u]",
+ pa_log_debug("[AUTO(_ALL)] found a matched device and set state to ACTIVATED: type[%s], direction[0x%x], id[%u]",
route_info.device_infos[route_info.num_of_devices-1].type, device_direction, device_idx);
/* Set device state to activated */
pa_device_manager_set_device_state(device, DM_DEVICE_STATE_ACTIVATED);
dm_device_type = pa_device_manager_get_device_type(device);
dm_device_subtype = pa_device_manager_get_device_subtype(device);
device_direction = pa_device_manager_get_device_direction(device);
- pa_log_debug("[MANUAL] manual_device, type[%s], subtype[%s], direction[%p]", dm_device_type, dm_device_subtype, device_direction);
+ pa_log_debug("[MANUAL] manual_device, type[%s], subtype[%s], direction[0x%x]", dm_device_type, dm_device_subtype, device_direction);
if (pa_streq(device_type, dm_device_type) &&
(((data->stream_type==STREAM_SINK_INPUT) && (device_direction & DM_DEVICE_DIRECTION_OUT)) ||
((data->stream_type==STREAM_SOURCE_OUTPUT) && (device_direction & DM_DEVICE_DIRECTION_IN)))) {
- pa_log_debug("[MANUAL] found a matched device: type[%s], direction[%p]", device_type, device_direction);
+ pa_log_debug("[MANUAL] found a matched device: type[%s], direction[0x%x]", device_type, device_direction);
route_info.num_of_devices++;
route_info.device_infos = pa_xrealloc(route_info.device_infos, sizeof(hal_device_info)*route_info.num_of_devices);
route_info.device_infos[route_info.num_of_devices-1].type = dm_device_type;
route_info.device_infos[route_info.num_of_devices-1].direction = (data->stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN;
- pa_log_debug("[MANUAL] found a matched device and set state to ACTIVATED: type[%s], direction[%p]",
+ pa_log_debug("[MANUAL] found a matched device and set state to ACTIVATED: type[%s], direction[0x%x]",
route_info.device_infos[route_info.num_of_devices-1].type, device_direction);
/* Set device state to activated */
pa_device_manager_set_device_state(device, DM_DEVICE_STATE_ACTIVATED);
/* Forward routing option to HAL */
static pa_hook_result_t route_option_update_hook_cb(pa_core *c, pa_stream_manager_hook_data_for_option *data, struct userdata *u) {
- void *state = NULL;
- int i = 0;
hal_route_option route_option;
pa_log_info("route_option_update_hook_cb is called. (%p), stream_role(%s), option[name(%s)/value(%d)]",
device_direction = pa_device_manager_get_device_direction(conn->device);
device_type = pa_device_manager_get_device_type(conn->device);
device_subtype = pa_device_manager_get_device_subtype(conn->device);
- pa_log_info("device_connection_changed_hook_cb is called. conn(%p), is_connected(%d), device(%p,%s,%s), direction(%p)",
+ pa_log_info("device_connection_changed_hook_cb is called. conn(%p), is_connected(%d), device(%p,%s,%s), direction(0x%x)",
conn, conn->is_connected, conn->device, device_type, device_subtype, device_direction);
if (!conn->is_connected && pa_streq(DEVICE_TYPE_BT, device_type) &&
typedef struct _stream_info {
int32_t priority;
- char *volume_type[STREAM_DIRECTION_MAX];
+ const char *volume_type[STREAM_DIRECTION_MAX];
pa_bool_t is_hal_volume[STREAM_DIRECTION_MAX];
stream_route_type_t route_type;
pa_idxset *idx_avail_in_devices;
int32_t get_volume_level_by_type(pa_stream_manager *m, pa_volume_get_command_t command, stream_type_t stream_type, const char *volume_type, uint32_t *volume_level);
int32_t set_volume_level_by_type(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, uint32_t volume_level);
int32_t set_volume_level_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t idx, uint32_t volume_level);
-int32_t get_volume_mute_by_type(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t *mute);
-int32_t set_volume_mute_by_type(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t mute);
-int32_t set_volume_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t mute);
-int32_t get_volume_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t *mute);
+int32_t set_volume_level_with_new_data(pa_stream_manager *m, stream_type_t stream_type, void *nd, uint32_t volume_level);
+int32_t get_volume_mute_by_type(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t *volume_mute);
+int32_t set_volume_mute_by_type(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t volume_mute);
+int32_t set_volume_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t volume_mute);
+int32_t get_volume_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t *volume_mute);
+int32_t set_volume_mute_with_new_data(pa_stream_manager *m, stream_type_t stream_type, void *nd, pa_bool_t volume_mute);
#endif
#endif
#include <iniparser.h>
+#include <math.h>
#include "stream-manager-priv.h"
#include "stream-manager-volume.h"
#include "stream-manager-volume-priv.h"
}
/* Load volume table */
- while ((v = pa_hashmap_iterate(m->volume_map.out_volumes, &state, &vol_type_str))) {
+ while ((v = pa_hashmap_iterate(m->volume_map.out_volumes, &state, (const void**)&vol_type_str))) {
size = strlen(table_str) + strlen(vol_type_str) + 2;
key = pa_xmalloc0(size);
if (key) {
*modifier_gain = atof(token);
if (!m->volume_map.out_modifier_gains)
m->volume_map.out_modifier_gains = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- pa_hashmap_put(m->volume_map.out_modifier_gains, gain_type_str, modifier_gain);
+ pa_hashmap_put(m->volume_map.out_modifier_gains, (void*)gain_type_str, modifier_gain);
} else {
pa_log_error("failed to parse [%s]", key);
ret = -1;
return 0;
}
-int32_t set_volume_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t mute) {
+int32_t get_volume_mute_by_type(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t *volume_mute) {
+ volume_info *v = NULL;
+ pa_hashmap *volumes = NULL;
+ pa_assert(m);
+ pa_assert(volume_type);
+ pa_assert(volume_mute);
+
+ /* Get mute */
+ volumes = (stream_type==STREAM_SINK_INPUT)?m->volume_map.out_volumes:m->volume_map.in_volumes;
+ if (volumes) {
+ v = pa_hashmap_get(volumes, volume_type);
+ if (v)
+ *volume_mute = v->is_muted;
+ else {
+ pa_log_error("could not get volume_info, stream_type(%d), volume_type(%s)", stream_type, volume_type);
+ return -1;
+ }
+ } else {
+ pa_log_error("could not get volumes in volume map, stream_type(%d), volume_type(%s)", stream_type, volume_type);
+ return -1;
+ }
+
+ pa_log_info("pa_stream_manager_volume_get_mute, stream_type:%d volume_type:%s mute:%d", stream_type, volume_type, *volume_mute);
+
+ return 0;
+}
+
+int32_t set_volume_mute_by_type(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t volume_mute) {
pa_bool_t is_hal_volume = FALSE;
+ volume_info *v = NULL;
+ void *s = NULL;
+ pa_hashmap *volumes = NULL;
+ uint32_t idx;
+ const char *volume_type_str = NULL;
+ pa_assert(m);
+ pa_assert(volume_type);
+
+ /* Check if it is related to HAL volume */
+ if (is_hal_volume_by_type(m, stream_type, volume_type, &is_hal_volume)) {
+ pa_log_error("failed to is_hal_volume_by_type(), 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))
+ return -1;
+
+ /* Set mute */
+ volumes = (stream_type==STREAM_SINK_INPUT)?m->volume_map.out_volumes:m->volume_map.in_volumes;
+ if (volumes) {
+ v = pa_hashmap_get(volumes, volume_type);
+ if (v)
+ v->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;
+ }
+ } else {
+ pa_log_error("could not get volumes in volume map, stream_type(%d), volume_type(%s)", stream_type, volume_type);
+ return -1;
+ }
+
+ PA_IDXSET_FOREACH(s, (stream_type==STREAM_SINK_INPUT)?m->core->sink_inputs:m->core->source_outputs, idx) {
+ if ((volume_type_str = pa_proplist_gets((stream_type==STREAM_SINK_INPUT)?((pa_sink_input*)s)->proplist:((pa_source_output*)s)->proplist, PA_PROP_MEDIA_TIZEN_VOLUME_TYPE))) {
+ /* do nothing */
+ } else {
+ continue;
+ }
+ /* Update mute of stream if it has requested the volume type */
+ if (pa_streq(volume_type_str, volume_type)) {
+ if (stream_type == STREAM_SINK_INPUT)
+ pa_sink_input_set_mute((pa_sink_input*)s, volume_mute, TRUE);
+ else if (stream_type == STREAM_SOURCE_OUTPUT)
+ pa_source_output_set_mute((pa_source_output*)s, volume_mute, TRUE);
+ }
+ }
+
+ pa_log_info("pa_stream_manager_volume_set_mute, stream_type:%d volume_type:%s mute:%d", stream_type, volume_type, volume_mute);
+
+ return 0;
+}
+
+int32_t set_volume_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t volume_mute) {
void *s = NULL;
uint32_t idx = 0;
const char *volume_type_str = NULL;
pa_bool_t muted_by_type = FALSE;
pa_assert(m);
- pa_log_info("set_volume_mute_by_idx, stream_type:%d stream_idx:%u mute:%d", stream_type, stream_idx, mute);
+ pa_log_info("set_volume_mute_by_idx, stream_type:%d stream_idx:%u mute:%d", stream_type, stream_idx, volume_mute);
if (stream_idx != (uint32_t)-1) {
if ((s = pa_idxset_get_by_index((stream_type==STREAM_SINK_INPUT)?m->core->sink_inputs:m->core->source_outputs, stream_idx))) {
/* Update mute of the stream if it has requested idx */
if (stream_idx == idx) {
if (stream_type == STREAM_SINK_INPUT)
- pa_sink_input_set_mute((pa_sink_input*)s, mute, TRUE);
+ pa_sink_input_set_mute((pa_sink_input*)s, volume_mute, TRUE);
else if (stream_type == STREAM_SOURCE_OUTPUT)
- pa_source_output_set_mute((pa_source_output*)s, mute, TRUE);
+ pa_source_output_set_mute((pa_source_output*)s, volume_mute, TRUE);
break;
}
}
return 0;
}
-int32_t get_volume_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t *mute) {
+int32_t get_volume_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t *volume_mute) {
int32_t ret = 0;
void *s = NULL;
uint32_t idx = 0;
pa_assert(m);
- pa_assert(mute);
+ pa_assert(volume_mute);
PA_IDXSET_FOREACH(s, (stream_type==STREAM_SINK_INPUT)?m->core->sink_inputs:m->core->source_outputs, idx) {
/* Update mute of the stream if it has requested idx */
if (stream_idx == idx) {
if (stream_type == STREAM_SINK_INPUT)
- *mute = ((pa_sink_input*)s)->muted;
+ *volume_mute = ((pa_sink_input*)s)->muted;
else if (stream_type == STREAM_SOURCE_OUTPUT)
- *mute = ((pa_source_output*)s)->muted;
+ *volume_mute = ((pa_source_output*)s)->muted;
break;
}
}
if (!s)
ret = -1;
- pa_log_info("get_volume_mute_by_idx, stream_type:%d stream_idx:%u mute:%d, ret:%d", stream_type, stream_idx, *mute, ret);
+ pa_log_info("get_volume_mute_by_idx, stream_type:%d stream_idx:%u mute:%d, ret:%d", stream_type, stream_idx, *volume_mute, ret);
return ret;
}
-int32_t set_volume_mute_with_new_data(pa_stream_manager *m, stream_type_t stream_type, void *nd, pa_bool_t mute) {
+int32_t set_volume_mute_with_new_data(pa_stream_manager *m, stream_type_t stream_type, void *nd, pa_bool_t volume_mute) {
pa_bool_t is_hal_volume = FALSE;
const char *volume_type_str = NULL;
pa_assert(m);
- pa_log_info("set_volume_mute_with_new_data, stream_type:%d mute:%d", stream_type, mute);
+ pa_log_info("set_volume_mute_with_new_data, stream_type:%d mute:%d", stream_type, volume_mute);
if ((volume_type_str = pa_proplist_gets((stream_type==STREAM_SINK_INPUT)?((pa_sink_input_new_data*)nd)->proplist:((pa_source_output_new_data*)nd)->proplist, PA_PROP_MEDIA_TIZEN_VOLUME_TYPE))) {
/* do nothing */
}
if (is_hal_volume)
- if (pa_hal_manager_set_mute(m->hal, volume_type_str, (stream_type==STREAM_SINK_INPUT)?DIRECTION_OUT:DIRECTION_IN, mute))
+ if (pa_hal_manager_set_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)
- pa_sink_input_new_data_set_muted((pa_sink_input_new_data*)nd, mute);
+ pa_sink_input_new_data_set_muted((pa_sink_input_new_data*)nd, volume_mute);
else if (stream_type == STREAM_SOURCE_OUTPUT)
- pa_source_output_new_data_set_muted((pa_source_output_new_data*)nd, mute);
+ pa_source_output_new_data_set_muted((pa_source_output_new_data*)nd, volume_mute);
return 0;
}
static void dump_volume_map (pa_stream_manager *m) {
volume_info *s = NULL;
- char *volume_type = NULL;
- char *modifier_gain = NULL;
+ const char *volume_type = NULL;
+ const char *modifier_gain = NULL;
double *level = NULL;
double *gain_value = NULL;
void *state = NULL;
pa_assert(m);
pa_log_debug("==========[START volume-map dump]==========");
- while (m->volume_map.in_volumes && (s = pa_hashmap_iterate(m->volume_map.in_volumes, &state, &volume_type))) {
+ while (m->volume_map.in_volumes && (s = pa_hashmap_iterate(m->volume_map.in_volumes, &state, (const void**)&volume_type))) {
if (s) {
pa_log_debug("[in volume_type : %s]", volume_type);
pa_log_debug(" - is_hal_volume_type : %d", s->is_hal_volume_type);
}
}
state = NULL;
- while (m->volume_map.out_volumes && (s = pa_hashmap_iterate(m->volume_map.out_volumes, &state, &volume_type))) {
+ while (m->volume_map.out_volumes && (s = pa_hashmap_iterate(m->volume_map.out_volumes, &state, (const void**)&volume_type))) {
if (s) {
pa_log_debug("[out volume_type : %s]", volume_type);
pa_log_debug(" - is_hal_volume_type : %d", s->is_hal_volume_type);
}
}
state = NULL;
- while (m->volume_map.in_modifier_gains && (gain_value = pa_hashmap_iterate(m->volume_map.in_modifier_gains, &state, &modifier_gain)))
+ while (m->volume_map.in_modifier_gains && (gain_value = pa_hashmap_iterate(m->volume_map.in_modifier_gains, &state, (const void**)&modifier_gain)))
pa_log_debug("[in modifier gain:%s, value:%f]", modifier_gain, *gain_value);
state = NULL;
- while (m->volume_map.out_modifier_gains && (gain_value = pa_hashmap_iterate(m->volume_map.out_modifier_gains, &state, &modifier_gain)))
+ while (m->volume_map.out_modifier_gains && (gain_value = pa_hashmap_iterate(m->volume_map.out_modifier_gains, &state, (const void**)&modifier_gain)))
pa_log_debug("[out modifier gain:%s, value:%f]", modifier_gain, *gain_value);
pa_log_debug("===========[END stream-map dump]===========");
if (v) {
v->is_hal_volume_type = s->is_hal_volume[i];
v->idx_volume_values = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
- pa_hashmap_put(volumes, s->volume_type[i], v);
+ pa_hashmap_put(volumes, (void*)s->volume_type[i], v);
} else {
pa_log_error("failed to pa_xmalloc0()");
ret = -1;
{
#define VCONF_ADDR_LEN 64
const char *volume_type = NULL;
- void *state = NULL;
- while ((v = pa_hashmap_iterate(m->volume_map.out_volumes, &state, &volume_type))) {
+ state = NULL;
+ while ((v = pa_hashmap_iterate(m->volume_map.out_volumes, &state, (const void**)&volume_type))) {
int level = 5;
char vconf_vol_type_addr[VCONF_ADDR_LEN] = {0,};
pa_snprintf(vconf_vol_type_addr, VCONF_ADDR_LEN, "%s%s", VCONFKEY_OUT_VOLUME_PREFIX, volume_type);
return ret;
}
-int32_t get_volume_mute_by_type(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t *mute) {
- volume_info *v = NULL;
- pa_hashmap *volumes = NULL;
- pa_assert(m);
- pa_assert(volume_type);
- pa_assert(mute);
-
- /* Get mute */
- volumes = (stream_type==STREAM_SINK_INPUT)?m->volume_map.out_volumes:m->volume_map.in_volumes;
- if (volumes) {
- v = pa_hashmap_get(volumes, volume_type);
- if (v)
- *mute = v->is_muted;
- else {
- pa_log_error("could not get volume_info, stream_type(%d), volume_type(%s)", stream_type, volume_type);
- return -1;
- }
- } else {
- pa_log_error("could not get volumes in volume map, stream_type(%d), volume_type(%s)", stream_type, volume_type);
- return -1;
- }
-
- pa_log_info("pa_stream_manager_volume_get_mute, stream_type:%d volume_type:%s mute:%d", stream_type, volume_type, *mute);
-
- return 0;
-}
-
-int32_t set_volume_mute_by_type(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t mute) {
- pa_bool_t is_hal_volume = FALSE;
- volume_info *v = NULL;
- void *s = NULL;
- pa_hashmap *volumes = NULL;
- uint32_t idx;
- const char *volume_type_str = NULL;
- pa_assert(m);
- pa_assert(volume_type);
-
- /* Check if it is related to HAL volume */
- if (is_hal_volume_by_type(m, stream_type, volume_type, &is_hal_volume)) {
- pa_log_error("failed to is_hal_volume_by_type(), 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)mute))
- return -1;
-
- /* Set mute */
- volumes = (stream_type==STREAM_SINK_INPUT)?m->volume_map.out_volumes:m->volume_map.in_volumes;
- if (volumes) {
- v = pa_hashmap_get(volumes, volume_type);
- if (v)
- v->is_muted = mute;
- else {
- pa_log_error("could not get volume_info, stream_type(%d), volume_type(%s)", stream_type, volume_type);
- return -1;
- }
- } else {
- pa_log_error("could not get volumes in volume map, stream_type(%d), volume_type(%s)", stream_type, volume_type);
- return -1;
- }
-
- PA_IDXSET_FOREACH(s, (stream_type==STREAM_SINK_INPUT)?m->core->sink_inputs:m->core->source_outputs, idx) {
- if ((volume_type_str = pa_proplist_gets((stream_type==STREAM_SINK_INPUT)?((pa_sink_input*)s)->proplist:((pa_source_output*)s)->proplist, PA_PROP_MEDIA_TIZEN_VOLUME_TYPE))) {
- /* do nothing */
- } else {
- continue;
- }
- /* Update mute of stream if it has requested the volume type */
- if (pa_streq(volume_type_str, volume_type))
- if (stream_type == STREAM_SINK_INPUT)
- pa_sink_input_set_mute((pa_sink_input*)s, mute, TRUE);
- else if (stream_type == STREAM_SOURCE_OUTPUT)
- pa_source_output_set_mute((pa_source_output*)s, mute, TRUE);
- }
-
- pa_log_info("pa_stream_manager_volume_set_mute, stream_type:%d volume_type:%s mute:%d", stream_type, volume_type, mute);
-
- return 0;
-}
-
-int32_t pa_stream_manager_volume_get_mute(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t *mute) {
- return get_volume_mute_by_type(m, stream_type, volume_type, mute);
+int32_t pa_stream_manager_volume_get_mute(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t *volume_mute) {
+ return get_volume_mute_by_type(m, stream_type, volume_type, volume_mute);
}
-int32_t pa_stream_manager_volume_set_mute(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t mute) {
- return set_volume_mute_by_type(m, stream_type, volume_type, mute);
+int32_t pa_stream_manager_volume_set_mute(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t volume_mute) {
+ return set_volume_mute_by_type(m, stream_type, volume_type, volume_mute);
}
-int32_t pa_stream_manager_volume_get_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t *mute) {
- return get_volume_mute_by_idx(m, stream_type, stream_idx, mute);
+int32_t pa_stream_manager_volume_get_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t *volume_mute) {
+ return get_volume_mute_by_idx(m, stream_type, stream_idx, volume_mute);
}
-int32_t pa_stream_manager_volume_set_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t mute) {
- return set_volume_mute_by_idx(m, stream_type, stream_idx, mute);
+int32_t pa_stream_manager_volume_set_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t volume_mute) {
+ return set_volume_mute_by_idx(m, stream_type, stream_idx, volume_mute);
}
int32_t pa_stream_manager_volume_get_level(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, uint32_t *volume_level);
int32_t pa_stream_manager_volume_set_level(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, uint32_t volume_level);
-int32_t pa_stream_manager_volume_get_mute(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t *mute);
-int32_t pa_stream_manager_volume_set_mute(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t mute);
+int32_t pa_stream_manager_volume_get_mute(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t *volume_mute);
+int32_t pa_stream_manager_volume_set_mute(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, pa_bool_t volume_mute);
int32_t pa_stream_manager_volume_get_max_level(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, uint32_t *volume_level);
-int32_t pa_stream_manager_volume_get_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t *mute);
-int32_t pa_stream_manager_volume_set_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t mute);
+int32_t pa_stream_manager_volume_get_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t *volume_mute);
+int32_t pa_stream_manager_volume_set_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, pa_bool_t volume_mute);
#endif
static pa_dbus_arg_info get_current_volume_type_args[] = { { "io_direction", "s", "in" },
{ "type", "s", "out" },
{ "ret_msg", "s", "out" } };
-static char* signature_args_for_in[] = { "s", "", "uauau", "usi", "ssu", "ss", "ss", "ssu", "ss", "s"};
+static const char* signature_args_for_in[] = { "s", "", "uauau", "usi", "ssu", "ss", "ss", "ssu", "ss", "s"};
static pa_dbus_method_handler method_handlers[METHOD_HANDLER_MAX] = {
[METHOD_HANDLER_GET_STREAM_INFO] = {
static int get_available_streams_from_map(pa_stream_manager *m, stream_list *list) {
void *state = NULL;
stream_info *s = NULL;
- const char *role = NULL;
+ char *role = NULL;
int i = 0;
pa_log_info("get_available_streams_from_map");
pa_assert_se((reply = dbus_message_new_method_return(msg)));
- sp = pa_hashmap_get(m->stream_parents, id);
+ sp = pa_hashmap_get(m->stream_parents, (const void*)id);
if (sp) {
if (!in_device_list && !out_device_list) {
pa_log_error("invalid arguments");
static void handle_set_stream_route_option(DBusConnection *conn, DBusMessage *msg, void *userdata) {
uint32_t id = 0;
- int i = 0;
const char *name = NULL;
int32_t value = 0;
- int list_len = 0;
pa_bool_t updated = FALSE;
stream_parent *sp = NULL;
stream_route_option route_option;
pa_assert_se((reply = dbus_message_new_method_return(msg)));
- sp = pa_hashmap_get(m->stream_parents, id);
+ sp = pa_hashmap_get(m->stream_parents, (const void*)id);
if (sp) {
if (name) {
route_option.name = name;
goto FAILURE;
}
- if (get_volume_mute_by_type(m, stream_type, type, (uint32_t*)&is_muted)) {
+ if (get_volume_mute_by_type(m, stream_type, type, (pa_bool_t*)&is_muted)) {
pa_assert_se(dbus_message_append_args(reply, DBUS_TYPE_UINT32, 0, DBUS_TYPE_INVALID));
pa_assert_se(dbus_message_append_args(reply, DBUS_TYPE_STRING, &stream_manager_dbus_ret_str[RET_MSG_INDEX_ERROR], DBUS_TYPE_INVALID));
} else {
goto FAILURE;
}
- s = (stream_type == STREAM_SINK_INPUT)?m->cur_highest_priority.sink_input:m->cur_highest_priority.source_output;
+ s = (stream_type == STREAM_SINK_INPUT)?(void*)(m->cur_highest_priority.sink_input):(void*)(m->cur_highest_priority.source_output);
if (s) {
type = pa_proplist_gets(GET_STREAM_PROPLIST(s, stream_type), PA_PROP_MEDIA_TIZEN_VOLUME_TYPE);
pa_assert_se(dbus_message_append_args(reply, DBUS_TYPE_STRING, &type, DBUS_TYPE_INVALID));
json_object *stream_o;
json_object *is_hal_volume_in_o;
json_object *is_hal_volume_out_o;
- char *volume_type_in_str = NULL;
- char *volume_type_out_str = NULL;
+ const char *volume_type_in_str = NULL;
+ const char *volume_type_out_str = NULL;
json_object *volume_type_in_o;
json_object *volume_type_out_o;
void *state = NULL;
pa_log_debug(" - avail-in-devices");
for (j = 0; j < num_of_avail_in_devices; j++) {
if((in_device_o = json_object_array_get_idx(avail_in_devices_o, j)) && json_object_is_type(in_device_o, json_type_string)) {
- pa_idxset_put(s->idx_avail_in_devices, json_object_get_string(in_device_o), NULL);
+ pa_idxset_put(s->idx_avail_in_devices, (void*)json_object_get_string(in_device_o), NULL);
pa_log_debug(" device[%d] : %s", j, json_object_get_string(in_device_o));
}
}
pa_log_debug(" - avail-out-devices");
for (j = 0; j < num_of_avail_out_devices; j++) {
if((out_device_o = json_object_array_get_idx(avail_out_devices_o, j)) && json_object_is_type(out_device_o, json_type_string)) {
- pa_idxset_put(s->idx_avail_out_devices, json_object_get_string(out_device_o), NULL);
+ pa_idxset_put(s->idx_avail_out_devices, (void*)json_object_get_string(out_device_o), NULL);
pa_log_debug(" device[%d] : %s", j, json_object_get_string(out_device_o));
}
}
pa_log_debug(" - avail-frameworks");
for (j = 0; j < num_of_avail_frameworks; j++) {
if((framework_o = json_object_array_get_idx(avail_frameworks_o, j)) && json_object_is_type(framework_o, json_type_string)) {
- pa_idxset_put(s->idx_avail_frameworks, json_object_get_string(framework_o), NULL);
+ pa_idxset_put(s->idx_avail_frameworks, (void*)json_object_get_string(framework_o), NULL);
pa_log_debug(" framework[%d] : %s", j, json_object_get_string(framework_o));
}
}
pa_log_error("Get stream avail-frameworks failed");
goto failed;
}
- pa_hashmap_put(m->stream_map, role, s);
+ pa_hashmap_put(m->stream_map,(void*)role, s);
}
}
} else {
}
static pa_bool_t update_stream_parent_info(pa_stream_manager *m, process_command_type_t command, stream_type_t type, void *stream) {
- char *p_idx;
+ const char *p_idx;
uint32_t parent_idx;
stream_parent *sp = NULL;
p_idx = pa_proplist_gets(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_PARENT_ID);
if (p_idx && !pa_atou(p_idx, &parent_idx)) {
pa_log_debug("p_idx(%s), idx(%u)", p_idx, parent_idx);
- sp = pa_hashmap_get(m->stream_parents, parent_idx);
+ sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx);
if (sp) {
uint32_t idx = (type==STREAM_SINK_INPUT)?((pa_sink_input*)stream)->index:((pa_source_output*)stream)->index;
if (command == PROCESS_COMMAND_ADD_PARENT_ID) {
uint32_t idx = 0;
int32_t p_max = 0;
int32_t p_mine = 0;
- char *priority = NULL;
+ const char *priority = NULL;
void *cur_max_stream = NULL;
- char *cur_max_priority = NULL;
- char *cur_max_role = NULL;
+ const char *cur_max_priority = NULL;
+ const char *cur_max_role = NULL;
pa_assert(m);
pa_assert(mine);
if (command == PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED_WITH_NEW_DATA)
priority = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(mine, type), PA_PROP_MEDIA_ROLE_PRIORITY);
else {
- if (cur_max_stream == (type==STREAM_SINK_INPUT)?((pa_sink_input*)mine):((pa_source_output*)mine)) {
+ if (cur_max_stream == mine) {
pa_log_debug("it has already been processed for PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED, skip it..");
return FALSE;
}
} else if (command == PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED) {
void *cur_max_stream_tmp = NULL;
void *i = NULL;
- char *role = NULL;
- char *priority = NULL;
+ const char *_role = NULL;
int32_t p;
pa_idxset *streams = NULL;
if (cur_max_stream == mine) {
/* find the next highest priority input */
//PA_IDXSET_FOREACH(i, m->core->sinks, idx) { /* need to check a sink which this stream belongs to */
PA_IDXSET_FOREACH(i, streams, idx) {
- if (!(role = pa_proplist_gets(GET_STREAM_PROPLIST(i, type), PA_PROP_MEDIA_ROLE))){
+ if (!(_role = pa_proplist_gets(GET_STREAM_PROPLIST(i, type), PA_PROP_MEDIA_ROLE))){
pa_log_error("Failed to pa_proplist_gets() for role");
continue;
}
pa_log_error("Failed to pa_proplist_gets() for priority");
continue;
}
- pa_log_debug("role(%s)/priority(%s)/stream(%p)", role, priority, i);
+ pa_log_debug("role(%s)/priority(%s)/stream(%p)", _role, priority, i);
if (cur_max_priority == NULL) {
cur_max_priority = priority;
cur_max_stream_tmp = i;
static void fill_device_info_to_hook_data(void *hook_data, notify_command_type_t command, stream_type_t type, void *stream, pa_stream_manager *m) {
char *device_name = NULL;
- char *p_idx = NULL;
+ const char *p_idx = NULL;
uint32_t parent_idx = 0;
stream_parent *sp = NULL;
uint32_t idx = 0;
pa_stream_manager_hook_data_for_select *select_data = NULL;
pa_stream_manager_hook_data_for_route *route_data = NULL;
stream_info *si;
- pa_hashmap *avail_devices;
+ pa_idxset *avail_devices;
int list_len;
pa_assert(hook_data);
p_idx = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(stream, type), PA_PROP_MEDIA_PARENT_ID);
if (p_idx && !pa_atou(p_idx, &parent_idx)) {
/* find parent idx, it's device info. and it's stream idxs */
- sp = pa_hashmap_get(m->stream_parents, parent_idx);
+ sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx);
if (sp)
select_data->idx_manual_devices = (type==STREAM_SINK_INPUT)?(sp->idx_route_out_devices):(sp->idx_route_in_devices);
else
else if (command == NOTIFY_COMMAND_CHANGE_ROUTE_START || command == NOTIFY_COMMAND_CHANGE_ROUTE_END)
p_idx = pa_proplist_gets(GET_STREAM_PROPLIST(stream, type), PA_PROP_MEDIA_PARENT_ID);
if (p_idx && !pa_atou(p_idx, &parent_idx)) {
- sp = pa_hashmap_get(m->stream_parents, parent_idx);
+ sp = pa_hashmap_get(m->stream_parents, (const void*)parent_idx);
if (!sp)
pa_log_warn("Failed to get the stream parent of idx(%u)", parent_idx);
} else
}
static void do_notify(pa_stream_manager *m, notify_command_type_t command, stream_type_t type, void *user_data) {
- char *priority = NULL;
- char *role = NULL;
pa_stream_manager_hook_data_for_select hook_call_select_data;
pa_stream_manager_hook_data_for_route hook_call_route_data;
pa_stream_manager_hook_data_for_option hook_call_option_data;
hal_stream_connection_info stream_conn_info;
- void *s;
+ const char *role = NULL;
+ void *s = NULL;
pa_assert(m);
pa_log_debug("do_notify(%s): type(%d), user_data(%p)", notify_command_type_str[command], type, user_data);
}
case NOTIFY_COMMAND_CHANGE_ROUTE_START_WITH_NEW_DATA:
case NOTIFY_COMMAND_CHANGE_ROUTE_START: {
+ pa_assert(user_data);
memset(&hook_call_route_data, 0, sizeof(pa_stream_manager_hook_data_for_route));
s = user_data;
if (s) {
if (command == NOTIFY_COMMAND_CHANGE_ROUTE_START_WITH_NEW_DATA) {
hook_call_route_data.origins_from_new_data = TRUE;
- priority = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(s, type), PA_PROP_MEDIA_ROLE_PRIORITY);
role = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(s, type), PA_PROP_MEDIA_ROLE);
hook_call_route_data.sample_spec = GET_STREAM_NEW_SAMPLE_SPEC(s, type);
if (type == STREAM_SINK_INPUT) {
hook_call_route_data.proper_source = &(((pa_source_output_new_data*)s)->source);
}
} else {
- priority = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_ROLE_PRIORITY);
role = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_ROLE);
hook_call_route_data.sample_spec = GET_STREAM_SAMPLE_SPEC(s, type);
if (type == STREAM_SINK_INPUT) {
}
case NOTIFY_COMMAND_CHANGE_ROUTE_END: {
memset(&hook_call_route_data, 0, sizeof(pa_stream_manager_hook_data_for_route));
- s = (type==STREAM_SINK_INPUT)?m->cur_highest_priority.sink_input:m->cur_highest_priority.source_output;
+ s = (type==STREAM_SINK_INPUT)?(void*)(m->cur_highest_priority.sink_input):(void*)(m->cur_highest_priority.source_output);
if (s) {
- priority = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_ROLE_PRIORITY);
role = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_ROLE);
hook_call_route_data.stream_type = type;
hook_call_route_data.stream_role = role;
case NOTIFY_COMMAND_UPDATE_ROUTE_OPTION: {
pa_assert(user_data);
memset(&hook_call_option_data, 0, sizeof(pa_stream_manager_hook_data_for_option));
- s = (type==STREAM_SINK_INPUT)?m->cur_highest_priority.sink_input:m->cur_highest_priority.source_output;
+ s = (type==STREAM_SINK_INPUT)?(void*)(m->cur_highest_priority.sink_input):(void*)(m->cur_highest_priority.source_output);
if (s) {
role = pa_proplist_gets(GET_STREAM_PROPLIST(s, type), PA_PROP_MEDIA_ROLE);
hook_call_option_data.stream_role = role;
}
static pa_process_stream_result_t process_stream(stream_type_t type, void *stream, process_command_type_t command, pa_stream_manager *m) {
- const char *role;
- pa_bool_t ret = TRUE;
pa_process_stream_result_t result = PA_PROCESS_STREAM_OK;
+ const char *role = NULL;
+ pa_bool_t ret = TRUE;
pa_bool_t need_update = FALSE;
int32_t volume_ret = 0;
volume_info *v = NULL;
const char *prior_priority = NULL;
int32_t prior_p = 0;
pa_format_info *req_format = NULL;
- const char *format_str = NULL;
+ char *format_str = NULL;
const char *rate_str = NULL;
const char *ch_str = NULL;
rate_str = pa_proplist_gets(req_format->plist, PA_PROP_FORMAT_RATE);
ch_str = pa_proplist_gets(req_format->plist, PA_PROP_FORMAT_CHANNELS);
if (pa_format_info_get_prop_string(req_format, PA_PROP_FORMAT_SAMPLE_FORMAT, &format_str)==0)
- ((pa_sink_input_new_data*)stream)->sample_spec.format = pa_parse_sample_format(format_str);
+ ((pa_sink_input_new_data*)stream)->sample_spec.format = pa_parse_sample_format((const char*)format_str);
pa_log_info("req rate(%s), req ch(%s), req format(%s)", rate_str, ch_str, format_str);
if (ch_str)
((pa_sink_input_new_data*)stream)->sample_spec.channels = atoi (ch_str);
return result;
}
-static void update_buffer_attribute(pa_hal_manager *h, pa_sink_input_new_data *new_data) {
+static void update_buffer_attribute(stream_type_t stream_type, void *new_data, pa_stream_manager *m) {
int32_t latency = 0;
int32_t maxlength = -1;
int32_t tlength = -1;
int32_t fragsize = -1;
const char* audio_latency = NULL;
- pa_assert(new_data->proplist);
+ pa_assert(m);
+ pa_assert(new_data);
- if (h == NULL)
+ if (m->hal == NULL)
return;
- audio_latency = pa_proplist_gets(new_data->proplist, PA_PROP_MEDIA_TIZEN_AUDIO_LATENCY);
- pa_log_info("auido_latency : %s", audio_latency);
+ audio_latency = pa_proplist_gets(GET_STREAM_NEW_PROPLIST(new_data, stream_type), PA_PROP_MEDIA_TIZEN_AUDIO_LATENCY);
+ pa_log_info("audio_latency : %s", audio_latency);
if (audio_latency == NULL)
return;
if(pa_atoi(audio_latency, &latency))
return;
- if (!pa_hal_manager_get_buffer_attribute(h, latency, new_data, &maxlength, &tlength, &prebuf, &minreq, &fragsize)) {
+ if (!pa_hal_manager_get_buffer_attribute(m->hal, (io_direction_t)!stream_type, (uint32_t)latency, new_data, (uint32_t*)&maxlength, (uint32_t*)&tlength, (uint32_t*)&prebuf, (uint32_t*)&minreq, (uint32_t*)&fragsize)) {
pa_log_info(" - maxlength:%d, tlength:%d, prebuf:%d, minreq:%d, fragsize:%d", maxlength, tlength, prebuf, minreq, fragsize);
- pa_proplist_setf(new_data->proplist, "maxlength", "%d", maxlength);
- pa_proplist_setf(new_data->proplist, "tlength", "%d", tlength);
- pa_proplist_setf(new_data->proplist, "prebuf", "%d", prebuf);
- pa_proplist_setf(new_data->proplist, "minreq", "%d", minreq);
- pa_proplist_setf(new_data->proplist, "fragsize", "%d", fragsize);
+ pa_proplist_setf(GET_STREAM_NEW_PROPLIST(new_data, stream_type), "maxlength", "%d", maxlength);
+ pa_proplist_setf(GET_STREAM_NEW_PROPLIST(new_data, stream_type), "tlength", "%d", tlength);
+ pa_proplist_setf(GET_STREAM_NEW_PROPLIST(new_data, stream_type), "prebuf", "%d", prebuf);
+ pa_proplist_setf(GET_STREAM_NEW_PROPLIST(new_data, stream_type), "minreq", "%d", minreq);
+ pa_proplist_setf(GET_STREAM_NEW_PROPLIST(new_data, stream_type), "fragsize", "%d", fragsize);
}
return;
}
static pa_hook_result_t sink_input_new_cb(pa_core *core, pa_sink_input_new_data *new_data, pa_stream_manager *m) {
- pa_process_stream_result_t process_result = PA_PROCESS_STREAM_OK;
-
pa_core_assert_ref(core);
pa_log_info("start sink_input_new_cb");
- process_result = process_stream(STREAM_SINK_INPUT, new_data, PROCESS_COMMAND_PREPARE, m);
+
+ process_stream(STREAM_SINK_INPUT, new_data, PROCESS_COMMAND_PREPARE, m);
/* Update buffer attributes from HAL */
- update_buffer_attribute(m->hal, new_data);
- process_result = process_stream(STREAM_SINK_INPUT, new_data, PROCESS_COMMAND_UPDATE_VOLUME, m);
- process_result = process_stream(STREAM_SINK_INPUT, new_data, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED_WITH_NEW_DATA, m);
+ update_buffer_attribute(STREAM_SINK_INPUT, new_data, m);
+ process_stream(STREAM_SINK_INPUT, new_data, PROCESS_COMMAND_UPDATE_VOLUME, m);
+ process_stream(STREAM_SINK_INPUT, new_data, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED_WITH_NEW_DATA, m);
return PA_HOOK_OK;
}
static pa_hook_result_t sink_input_put_cb(pa_core *core, pa_sink_input *i, pa_stream_manager *m) {
- const char *si_volume_type_str = NULL;
- pa_process_stream_result_t process_result = PA_PROCESS_STREAM_OK;
-
pa_core_assert_ref(core);
pa_sink_input_assert_ref(i);
pa_log_info("start sink_input_put_cb, i(%p, index:%u)", i, i->index);
- process_result = process_stream(STREAM_SINK_INPUT, i, PROCESS_COMMAND_ADD_PARENT_ID, m);
+
+ process_stream(STREAM_SINK_INPUT, i, PROCESS_COMMAND_ADD_PARENT_ID, m);
return PA_HOOK_OK;
}
static pa_hook_result_t sink_input_unlink_cb(pa_core *core, pa_sink_input *i, pa_stream_manager *m) {
- pa_process_stream_result_t process_result = PA_PROCESS_STREAM_OK;
-
pa_core_assert_ref(core);
pa_sink_input_assert_ref(i);
pa_log_info("start sink_input_unlink_cb, i(%p, index:%u)", i, i->index);
- process_result = process_stream(STREAM_SINK_INPUT, i, PROCESS_COMMAND_REMOVE_PARENT_ID, m);
- process_result = process_stream(STREAM_SINK_INPUT, i, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, m);
+ process_stream(STREAM_SINK_INPUT, i, PROCESS_COMMAND_REMOVE_PARENT_ID, m);
+ process_stream(STREAM_SINK_INPUT, i, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, m);
return PA_HOOK_OK;
}
static pa_hook_result_t sink_input_state_changed_cb(pa_core *core, pa_sink_input *i, pa_stream_manager *m) {
pa_sink_input_state_t state;
- pa_process_stream_result_t process_result = PA_PROCESS_STREAM_OK;
pa_assert(i);
pa_assert(m);
switch(state) {
case PA_SINK_INPUT_CORKED: {
- process_result = process_stream(STREAM_SINK_INPUT, i, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, m);
+ process_stream(STREAM_SINK_INPUT, i, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, m);
break;
}
case PA_SINK_INPUT_DRAINED:
case PA_SINK_INPUT_RUNNING: {
- process_result = process_stream(STREAM_SINK_INPUT, i, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED, m);
+ process_stream(STREAM_SINK_INPUT, i, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED, m);
break;
}
default:
}
static pa_hook_result_t sink_input_move_start_cb(pa_core *core, pa_sink_input *i, pa_stream_manager *m) {
- int32_t audio_ret = 0;
-
pa_core_assert_ref(core);
pa_sink_input_assert_ref(i);
}
static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, pa_stream_manager *m) {
- int32_t audio_ret = 0;
-
pa_core_assert_ref(core);
pa_sink_input_assert_ref(i);
}
static pa_hook_result_t source_output_new_cb(pa_core *core, pa_source_output_new_data *new_data, pa_stream_manager *m) {
- pa_process_stream_result_t process_result = PA_PROCESS_STREAM_OK;
-
pa_core_assert_ref(core);
pa_log_info("start source_output_new_new_cb");
- process_result = process_stream(STREAM_SOURCE_OUTPUT, new_data, PROCESS_COMMAND_PREPARE, m);
+ process_stream(STREAM_SOURCE_OUTPUT, new_data, PROCESS_COMMAND_PREPARE, m);
/* Update buffer attributes from HAL */
- update_buffer_attribute(m->hal, new_data);
- process_result = process_stream(STREAM_SOURCE_OUTPUT, new_data, PROCESS_COMMAND_UPDATE_VOLUME, m);
- process_result = process_stream(STREAM_SOURCE_OUTPUT, new_data, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED_WITH_NEW_DATA, m);
+ update_buffer_attribute(STREAM_SOURCE_OUTPUT, new_data, m);
+ process_stream(STREAM_SOURCE_OUTPUT, new_data, PROCESS_COMMAND_UPDATE_VOLUME, m);
+ process_stream(STREAM_SOURCE_OUTPUT, new_data, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED_WITH_NEW_DATA, m);
return PA_HOOK_OK;
}
static pa_hook_result_t source_output_put_cb(pa_core *core, pa_source_output *o, pa_stream_manager *m) {
- pa_process_stream_result_t process_result = PA_PROCESS_STREAM_OK;
-
pa_core_assert_ref(core);
pa_source_output_assert_ref(o);
pa_log_info("start source_output_put_cb, o(%p, index:%u)", o, o->index);
- process_result = process_stream(STREAM_SOURCE_OUTPUT, o, PROCESS_COMMAND_ADD_PARENT_ID, m);
+ process_stream(STREAM_SOURCE_OUTPUT, o, PROCESS_COMMAND_ADD_PARENT_ID, m);
return PA_HOOK_OK;
}
static pa_hook_result_t source_output_unlink_cb(pa_core *core, pa_source_output *o, pa_stream_manager *m) {
- pa_process_stream_result_t process_result = PA_PROCESS_STREAM_OK;
-
pa_core_assert_ref(core);
pa_source_output_assert_ref(o);
pa_log_info("start source_output_unlink_cb, o(%p, index:%u)", o, o->index);
- process_result = process_stream(STREAM_SOURCE_OUTPUT, o, PROCESS_COMMAND_REMOVE_PARENT_ID, m);
- process_result = process_stream(STREAM_SOURCE_OUTPUT, o, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, m);
+ process_stream(STREAM_SOURCE_OUTPUT, o, PROCESS_COMMAND_REMOVE_PARENT_ID, m);
+ process_stream(STREAM_SOURCE_OUTPUT, o, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, m);
return PA_HOOK_OK;
}
static pa_hook_result_t source_output_state_changed_cb(pa_core *core, pa_source_output *o, pa_stream_manager *m) {
pa_source_output_state_t state;
- pa_process_stream_result_t process_result = PA_PROCESS_STREAM_OK;
pa_assert(o);
pa_assert(m);
switch(state) {
case PA_SOURCE_OUTPUT_CORKED: {
- process_result = process_stream(STREAM_SOURCE_OUTPUT, o, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, m);
+ process_stream(STREAM_SOURCE_OUTPUT, o, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_ENDED, m);
break;
}
case PA_SOURCE_OUTPUT_RUNNING: {
- process_result = process_stream(STREAM_SOURCE_OUTPUT, o, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED, m);
+ process_stream(STREAM_SOURCE_OUTPUT, o, PROCESS_COMMAND_CHANGE_ROUTE_BY_STREAM_STARTED, m);
break;
}
default:
dm_device_direction_t device_direction = DM_DEVICE_DIRECTION_OUT;
device_direction = pa_device_manager_get_device_direction(conn->device);
- pa_log_info("device_connection_changed_hook_cb is called. conn(%p), is_connected(%d), device(%p), direction(%p)",
+ pa_log_info("device_connection_changed_hook_cb is called. conn(%p), is_connected(%d), device(%p), direction(0x%x)",
conn, conn->is_connected, conn->device, device_direction);
/* If the route type of the stream is not manual, notify again */
if (m->cur_highest_priority.source_output && (device_direction & DM_DEVICE_DIRECTION_IN)) {
route_type_str = pa_proplist_gets(GET_STREAM_PROPLIST(m->cur_highest_priority.source_output, STREAM_SOURCE_OUTPUT), PA_PROP_MEDIA_ROLE_ROUTE_TYPE);
- if(!pa_atoi(route_type_str, &route_type))
+ if(!pa_atoi(route_type_str, (int32_t*)&route_type))
if (route_type != STREAM_ROUTE_TYPE_MANUAL)
do_notify(m, NOTIFY_COMMAND_CHANGE_ROUTE_START, STREAM_SOURCE_OUTPUT, m->cur_highest_priority.source_output);
} if (m->cur_highest_priority.sink_input && (device_direction & DM_DEVICE_DIRECTION_OUT)) {
route_type_str = pa_proplist_gets(GET_STREAM_PROPLIST(m->cur_highest_priority.sink_input, STREAM_SINK_INPUT), PA_PROP_MEDIA_ROLE_ROUTE_TYPE);
- if(!pa_atoi(route_type_str, &route_type))
+ if(!pa_atoi(route_type_str, (int32_t*)&route_type))
if (route_type != STREAM_ROUTE_TYPE_MANUAL)
do_notify(m, NOTIFY_COMMAND_CHANGE_ROUTE_START, STREAM_SINK_INPUT, m->cur_highest_priority.sink_input);
}
sp->idx_source_outputs = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
sp->idx_route_in_devices = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
sp->idx_route_out_devices = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
- pa_hashmap_put(m->stream_parents, idx, sp);
+ pa_hashmap_put(m->stream_parents, (void*)idx, sp);
pa_log_debug(" - add sp(%p), idx(%u)", sp, idx);
} else if (t == (PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_REMOVE)) {
/* remove the stream parent */
- sp = pa_hashmap_get(m->stream_parents, idx);
+ sp = pa_hashmap_get(m->stream_parents, (const void*)idx);
if (sp) {
pa_log_debug(" - remove sp(%p), idx(%u)", sp, idx);
- pa_hashmap_remove(m->stream_parents, idx);
+ pa_hashmap_remove(m->stream_parents, (const void*)idx);
if (sp->idx_route_in_devices)
PA_IDXSET_FOREACH(device_id, sp->idx_route_in_devices, _idx)
pa_xfree(device_id);
m->source_output_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_STATE_CHANGED], PA_HOOK_EARLY, (pa_hook_cb_t) source_output_state_changed_cb, m);
- m->subscription = pa_subscription_new(m->core, PA_SUBSCRIPTION_MASK_CLIENT | PA_SUBSCRIPTION_MASK_SAMPLE_CACHE, subscribe_cb, m);
+ m->subscription = pa_subscription_new(m->core, PA_SUBSCRIPTION_MASK_CLIENT | PA_SUBSCRIPTION_MASK_SAMPLE_CACHE, (pa_subscription_cb_t)subscribe_cb, m);
m->comm.comm = pa_communicator_get(c);
m->comm.comm_hook_device_connection_changed_slot = pa_hook_connect(pa_communicator_hook(m->comm.comm,PA_COMMUNICATOR_HOOK_DEVICE_CONNECTION_CHANGED),