stream_type_t stream_type = STREAM_SINK_INPUT;
DBusMessage *reply = NULL;
pa_stream_manager *m = (pa_stream_manager*)userdata;
+ int ret = 0;
pa_assert(conn);
pa_assert(msg);
goto finish;
}
+ /* check vconf update here, mute will not be set if update fails */
+ if ((ret = update_mute_vconf(type, do_mute))) {
+ pa_assert_se(dbus_message_append_args(reply, DBUS_TYPE_STRING, &stream_manager_dbus_ret_str[RET_MSG_ERROR_INTERNAL], DBUS_TYPE_INVALID));
+ goto finish;
+ }
+
if (set_volume_mute_by_type(m, stream_type, type, (bool)do_mute))
pa_assert_se(dbus_message_append_args(reply, DBUS_TYPE_STRING, &stream_manager_dbus_ret_str[RET_MSG_ERROR_INTERNAL], DBUS_TYPE_INVALID));
else
#include <vconf-keys.h>
#define VCONFKEY_OUT_VOLUME_PREFIX "file/private/sound/volume/"
+#define VCONFKEY_OUT_MUTE_PREFIX "file/private/sound/mute/"
#define MASTER_VOLUME_TYPE "master"
#define MASTER_VOLUME_LEVEL_MAX 100
int32_t set_volume_mute_with_new_data(pa_stream_manager *m, void *stream, stream_type_t stream_type, bool volume_mute);
int32_t get_volume_mute_by_idx(pa_stream_manager *m, stream_type_t stream_type, uint32_t stream_idx, bool *volume_mute);
int32_t update_volume_vconf(const char *type, unsigned int value);
+int32_t update_mute_vconf(const char *type, unsigned int mute);
#endif
#define VOLUME_INI_DEFAULT_PATH SYSCONFDIR"/multimedia/mmfw_audio_volume.ini" /* SYSCONFDIR is defined at .spec */
#define VOLUME_INI_TUNED_PATH "/opt/system/mmfw_audio_volume.ini"
#define DEFAULT_TABLE "volumes"
+#define VCONF_PATH_MAX 128
#define CONVERT_TO_HAL_DIRECTION(stream_type)\
((stream_type == STREAM_SINK_INPUT) ? DIRECTION_OUT : DIRECTION_IN)
int32_t update_volume_vconf(const char *type, unsigned int value)
{
- char str[128];
+ char str[VCONF_PATH_MAX];
pa_snprintf(str, sizeof(str), "%s%s", VCONFKEY_OUT_VOLUME_PREFIX, type);
return 0;
}
+int32_t update_mute_vconf(const char *type, unsigned int mute)
+{
+ char str[VCONF_PATH_MAX];
+
+ pa_snprintf(str, sizeof(str), "%s%s", VCONFKEY_OUT_MUTE_PREFIX, type);
+
+ /* Set mute value to VCONF */
+ if ((vconf_set_bool(str, mute)) != 0) {
+ pa_log_error("vconf_set_bool(%s) failed...errno(%d)",
+ str, vconf_get_ext_errno());
+ return -1;
+ }
+
+ pa_log_info("mute set type(%s) value(%d)", str, mute);
+
+ return 0;
+}
+
int32_t set_volume_level_by_type(pa_stream_manager *m, stream_type_t stream_type, const char *volume_type, uint32_t volume_level) {
bool is_hal_volume = false;
volume_info *v = NULL;
char vconf_vol_type_addr[VCONF_ADDR_LEN] = {0,};
const char *volume_type = NULL;
int level = 10;
+ int muted = 0;
state = NULL;
while ((v = pa_hashmap_iterate(m->volume_infos, &state, (const void**)&volume_type))) {
memset(vconf_vol_type_addr, 0, VCONF_ADDR_LEN);
set_volume_level_by_type(m, STREAM_SINK_INPUT, volume_type, (uint32_t)level);
pa_log_debug("type[%s], current level[%u]", volume_type, v->values[STREAM_DIRECTION_OUT].current_level);
}
+ memset(vconf_vol_type_addr, 0, VCONF_ADDR_LEN);
+ pa_snprintf(vconf_vol_type_addr, VCONF_ADDR_LEN, "%s%s", VCONFKEY_OUT_MUTE_PREFIX, volume_type);
+ if (vconf_get_bool(vconf_vol_type_addr, &muted))
+ pa_log_error("failed to get mute state of the vconf[%s]", vconf_vol_type_addr);
+ else {
+ set_volume_mute_by_type(m, STREAM_SINK_INPUT, volume_type, (bool)muted);
+ pa_log_debug("type[%s], is_muted[%d]", volume_type, v->values[STREAM_DIRECTION_OUT].is_muted);
+ }
}
}
#if 0