forked from enlightenment/enlightenment
parent
1a7fedc699
commit
fbf6de511a
|
@ -176,13 +176,13 @@ _populate_channel_editor(E_Mixer_App_Dialog_Data *app)
|
||||||
const char *card_name;
|
const char *card_name;
|
||||||
|
|
||||||
card_name = e_mod_mixer_card_name_get(app->card);
|
card_name = e_mod_mixer_card_name_get(app->card);
|
||||||
|
|
||||||
if (!card_name)
|
if (!card_name)
|
||||||
{
|
{
|
||||||
_disable_channel_editor(app);
|
_disable_channel_editor(app);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
e_widget_entry_text_set(ui->card, card_name);
|
e_widget_entry_text_set(ui->card, card_name);
|
||||||
eina_stringshare_del(card_name);
|
eina_stringshare_del(card_name);
|
||||||
|
|
||||||
|
@ -380,7 +380,7 @@ _create_cards(E_Dialog *dialog __UNUSED__, Evas *evas, E_Mixer_App_Dialog_Data *
|
||||||
const char *card_name;
|
const char *card_name;
|
||||||
|
|
||||||
card_name = e_mod_mixer_card_name_get(card);
|
card_name = e_mod_mixer_card_name_get(card);
|
||||||
|
|
||||||
if (!card_name)
|
if (!card_name)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -566,7 +566,7 @@ _find_card_by_name(E_Mixer_App_Dialog_Data *app, const char *card_name)
|
||||||
|
|
||||||
if (!card_name)
|
if (!card_name)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0, l = app->cards; l; i++, l = l->next)
|
for (i = 0, l = app->cards; l; i++, l = l->next)
|
||||||
if (strcmp(card_name, l->data) == 0)
|
if (strcmp(card_name, l->data) == 0)
|
||||||
return i;
|
return i;
|
||||||
|
@ -584,7 +584,7 @@ _find_channel_by_name(E_Mixer_App_Dialog_Data *app, const char *channel_name)
|
||||||
|
|
||||||
if (!channel_name)
|
if (!channel_name)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (app->channels_infos)
|
if (app->channels_infos)
|
||||||
{
|
{
|
||||||
info = app->channels_infos->data;
|
info = app->channels_infos->data;
|
||||||
|
@ -618,7 +618,7 @@ e_mixer_app_dialog_select(E_Dialog *dialog, const char *card_name, const char *c
|
||||||
|
|
||||||
if (!dialog)
|
if (!dialog)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((!card_name) || (!channel_name))
|
if ((!card_name) || (!channel_name))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -337,7 +337,7 @@ _basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
e_dialog_resizable_set(cfd->dia, 1);
|
e_dialog_resizable_set(cfd->dia, 1);
|
||||||
|
|
||||||
cfdata->ui.table = e_widget_table_add(evas, 0);
|
cfdata->ui.table = e_widget_table_add(evas, 0);
|
||||||
_basic_create_general(evas, cfdata);
|
_basic_create_general(evas, cfdata);
|
||||||
_basic_create_cards(evas, cfdata);
|
_basic_create_cards(evas, cfdata);
|
||||||
|
|
|
@ -850,7 +850,7 @@ _mixer_sys_setup(E_Mixer_Instance *inst)
|
||||||
ERR("conf->card in mixer sys setup is NULL");
|
ERR("conf->card in mixer sys setup is NULL");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inst->sys)
|
if (inst->sys)
|
||||||
e_mod_mixer_del(inst->sys);
|
e_mod_mixer_del(inst->sys);
|
||||||
|
|
||||||
|
@ -1018,7 +1018,7 @@ e_mod_mixer_pulse_update(void)
|
||||||
ctxt = mixer_mod->data;
|
ctxt = mixer_mod->data;
|
||||||
EINA_LIST_FOREACH(ctxt->instances, l, inst)
|
EINA_LIST_FOREACH(ctxt->instances, l, inst)
|
||||||
{
|
{
|
||||||
if (inst->conf->using_default)
|
if (inst->conf->using_default)
|
||||||
_mixer_sys_setup_default_card(inst);
|
_mixer_sys_setup_default_card(inst);
|
||||||
e_mod_mixer_state_get(inst->sys, inst->channel, &inst->mixer_state);
|
e_mod_mixer_state_get(inst->sys, inst->channel, &inst->mixer_state);
|
||||||
_mixer_gadget_update(inst);
|
_mixer_gadget_update(inst);
|
||||||
|
|
|
@ -44,7 +44,7 @@ msg_recv_creds(Pulse *conn, Pulse_Tag *tag)
|
||||||
#else
|
#else
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
tag = NULL;
|
tag = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_Bool
|
Eina_Bool
|
||||||
|
@ -91,14 +91,14 @@ msg_recv(Pulse *conn, Pulse_Tag *tag)
|
||||||
#else
|
#else
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
tag = NULL;
|
tag = NULL;
|
||||||
#endif
|
#endif
|
||||||
return EINA_FALSE;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
msg_sendmsg_creds(Pulse *conn, Pulse_Tag *tag)
|
msg_sendmsg_creds(Pulse *conn, Pulse_Tag *tag)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
int r;
|
int r;
|
||||||
struct msghdr mh;
|
struct msghdr mh;
|
||||||
struct iovec iov;
|
struct iovec iov;
|
||||||
|
@ -144,13 +144,13 @@ msg_sendmsg_creds(Pulse *conn, Pulse_Tag *tag)
|
||||||
#else
|
#else
|
||||||
conn = NULL;
|
conn = NULL;
|
||||||
tag = NULL;
|
tag = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
msg_send_creds(Pulse *conn, Pulse_Tag *tag)
|
msg_send_creds(Pulse *conn, Pulse_Tag *tag)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
INF("trying to send 20 byte auth header");
|
INF("trying to send 20 byte auth header");
|
||||||
|
|
|
@ -57,11 +57,11 @@ proplist_init(Pulse_Tag *tag)
|
||||||
snprintf(pid, sizeof(pid), "%"PRIu32, getpid());
|
snprintf(pid, sizeof(pid), "%"PRIu32, getpid());
|
||||||
eina_hash_add(tag->props, "application.process.id", eina_stringshare_add(pid));
|
eina_hash_add(tag->props, "application.process.id", eina_stringshare_add(pid));
|
||||||
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.process.id") + strlen(pid) + 2 + PA_TAG_SIZE_U32;
|
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.process.id") + strlen(pid) + 2 + PA_TAG_SIZE_U32;
|
||||||
|
|
||||||
str = getenv("USER");
|
str = getenv("USER");
|
||||||
eina_hash_add(tag->props, "application.process.user", eina_stringshare_add(str));
|
eina_hash_add(tag->props, "application.process.user", eina_stringshare_add(str));
|
||||||
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.process.user") + strlen(str) + 2 + PA_TAG_SIZE_U32;
|
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.process.user") + strlen(str) + 2 + PA_TAG_SIZE_U32;
|
||||||
|
|
||||||
file = eina_file_open("/etc/hostname", EINA_FALSE);
|
file = eina_file_open("/etc/hostname", EINA_FALSE);
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ proplist_init(Pulse_Tag *tag)
|
||||||
eina_hash_add(tag->props, "application.process.host", eina_stringshare_add(""));
|
eina_hash_add(tag->props, "application.process.host", eina_stringshare_add(""));
|
||||||
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.process.host") + 2 + PA_TAG_SIZE_U32;
|
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.process.host") + 2 + PA_TAG_SIZE_U32;
|
||||||
}
|
}
|
||||||
|
|
||||||
ecore_app_args_get(&argc, &argv);
|
ecore_app_args_get(&argc, &argv);
|
||||||
str = strrchr(argv[0], '/');
|
str = strrchr(argv[0], '/');
|
||||||
str = (str) ? str + 1 : argv[0];
|
str = (str) ? str + 1 : argv[0];
|
||||||
|
@ -85,14 +85,14 @@ proplist_init(Pulse_Tag *tag)
|
||||||
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.process.binary") + strlen(str) + 2 + PA_TAG_SIZE_U32;
|
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.process.binary") + strlen(str) + 2 + PA_TAG_SIZE_U32;
|
||||||
eina_hash_add(tag->props, "application.name", eina_stringshare_add(str));
|
eina_hash_add(tag->props, "application.name", eina_stringshare_add(str));
|
||||||
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.name") + strlen(str) + 2 + PA_TAG_SIZE_U32;
|
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.name") + strlen(str) + 2 + PA_TAG_SIZE_U32;
|
||||||
|
|
||||||
str = getenv("LANG");
|
str = getenv("LANG");
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
eina_hash_add(tag->props, "application.language", eina_stringshare_add(str));
|
eina_hash_add(tag->props, "application.language", eina_stringshare_add(str));
|
||||||
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.language") + strlen(str) + 2 + PA_TAG_SIZE_U32;
|
tag->dsize += PA_TAG_SIZE_ARBITRARY + sizeof("application.language") + strlen(str) + 2 + PA_TAG_SIZE_U32;
|
||||||
}
|
}
|
||||||
|
|
||||||
str = getenv("DISPLAY");
|
str = getenv("DISPLAY");
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ cookie_file(uint8_t *cookie)
|
||||||
size_t size;
|
size_t size;
|
||||||
void *cookie_data;
|
void *cookie_data;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/.pulse-cookie", getenv("HOME"));
|
snprintf(buf, sizeof(buf), "%s/.pulse-cookie", getenv("HOME"));
|
||||||
file = eina_file_open(buf, EINA_FALSE);
|
file = eina_file_open(buf, EINA_FALSE);
|
||||||
size = eina_file_size_get(file);
|
size = eina_file_size_get(file);
|
||||||
cookie_data = eina_file_map_all(file, EINA_FILE_WILLNEED);
|
cookie_data = eina_file_map_all(file, EINA_FILE_WILLNEED);
|
||||||
|
@ -151,26 +151,26 @@ login_setup(Pulse *conn)
|
||||||
Pulse_Tag *tag;
|
Pulse_Tag *tag;
|
||||||
uint32_t x;
|
uint32_t x;
|
||||||
uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
|
uint8_t cookie[PA_NATIVE_COOKIE_LENGTH];
|
||||||
|
|
||||||
tag = calloc(1, sizeof(Pulse_Tag));
|
tag = calloc(1, sizeof(Pulse_Tag));
|
||||||
tag->dsize = 4 * PA_TAG_SIZE_U32 + sizeof(cookie);
|
tag->dsize = 4 * PA_TAG_SIZE_U32 + sizeof(cookie);
|
||||||
tag->data = malloc(tag->dsize);
|
tag->data = malloc(tag->dsize);
|
||||||
tag_simple_init(conn, tag, PA_COMMAND_AUTH, PA_TAG_U32);
|
tag_simple_init(conn, tag, PA_COMMAND_AUTH, PA_TAG_U32);
|
||||||
DBG("%zu bytes", tag->dsize);
|
DBG("%zu bytes", tag->dsize);
|
||||||
|
|
||||||
if (!getuid())
|
if (!getuid())
|
||||||
x = PA_PROTOCOL_VERSION;
|
x = PA_PROTOCOL_VERSION;
|
||||||
else
|
else
|
||||||
x = PA_PROTOCOL_VERSION | 0x80000000U;
|
x = PA_PROTOCOL_VERSION | 0x80000000U;
|
||||||
tag_uint32(tag, x);
|
tag_uint32(tag, x);
|
||||||
DBG("%zu bytes", tag->dsize);
|
DBG("%zu bytes", tag->dsize);
|
||||||
|
|
||||||
cookie_file(cookie);
|
cookie_file(cookie);
|
||||||
tag_arbitrary(tag, cookie, sizeof(cookie));
|
tag_arbitrary(tag, cookie, sizeof(cookie));
|
||||||
DBG("%zu bytes", tag->dsize);
|
DBG("%zu bytes", tag->dsize);
|
||||||
|
|
||||||
tag_finish(tag);
|
tag_finish(tag);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ fdh_func(Pulse *conn, Ecore_Fd_Handler *fdh)
|
||||||
pa_write = !!ecore_main_fd_handler_active_get(fdh, ECORE_FD_WRITE) * ECORE_FD_WRITE;
|
pa_write = !!ecore_main_fd_handler_active_get(fdh, ECORE_FD_WRITE) * ECORE_FD_WRITE;
|
||||||
rprev = eina_list_data_get(conn->iq);
|
rprev = eina_list_data_get(conn->iq);
|
||||||
wprev = eina_list_data_get(conn->oq);
|
wprev = eina_list_data_get(conn->oq);
|
||||||
|
|
||||||
switch (conn->state)
|
switch (conn->state)
|
||||||
{
|
{
|
||||||
case PA_STATE_INIT:
|
case PA_STATE_INIT:
|
||||||
|
@ -274,7 +274,7 @@ fdh_func(Pulse *conn, Ecore_Fd_Handler *fdh)
|
||||||
|
|
||||||
if (!wprev->auth)
|
if (!wprev->auth)
|
||||||
msg_sendmsg_creds(conn, wprev);
|
msg_sendmsg_creds(conn, wprev);
|
||||||
|
|
||||||
|
|
||||||
if (wprev->auth && msg_send(conn, wprev))
|
if (wprev->auth && msg_send(conn, wprev))
|
||||||
{
|
{
|
||||||
|
@ -326,7 +326,7 @@ fdh_func(Pulse *conn, Ecore_Fd_Handler *fdh)
|
||||||
Pulse_Tag *tag;
|
Pulse_Tag *tag;
|
||||||
PA_Commands command;
|
PA_Commands command;
|
||||||
if (!pulse_recv(conn, fdh, &tag)) break;
|
if (!pulse_recv(conn, fdh, &tag)) break;
|
||||||
|
|
||||||
command = (uintptr_t)eina_hash_find(conn->tag_handlers, &tag->tag_count);
|
command = (uintptr_t)eina_hash_find(conn->tag_handlers, &tag->tag_count);
|
||||||
eina_hash_del_by_key(conn->tag_handlers, &tag->tag_count);
|
eina_hash_del_by_key(conn->tag_handlers, &tag->tag_count);
|
||||||
deserialize_tag(conn, command, tag);
|
deserialize_tag(conn, command, tag);
|
||||||
|
@ -623,7 +623,7 @@ int
|
||||||
pulse_init(void)
|
pulse_init(void)
|
||||||
{
|
{
|
||||||
if (pulse_init_count++) return pulse_init_count;
|
if (pulse_init_count++) return pulse_init_count;
|
||||||
|
|
||||||
eina_init();
|
eina_init();
|
||||||
ecore_init();
|
ecore_init();
|
||||||
ecore_con_init();
|
ecore_con_init();
|
||||||
|
|
|
@ -253,7 +253,7 @@ typedef enum
|
||||||
PA_TAG_SIZE_CVOLUME = 2,
|
PA_TAG_SIZE_CVOLUME = 2,
|
||||||
PA_TAG_SIZE_PROPLIST = 1 + PA_TAG_SIZE_STRING_NULL,
|
PA_TAG_SIZE_PROPLIST = 1 + PA_TAG_SIZE_STRING_NULL,
|
||||||
PA_TAG_SIZE_VOLUME = 2
|
PA_TAG_SIZE_VOLUME = 2
|
||||||
} PA_Tag_Size;
|
} PA_Tag_Size;
|
||||||
|
|
||||||
/** Volume specification:
|
/** Volume specification:
|
||||||
* PA_VOLUME_MUTED: silence;
|
* PA_VOLUME_MUTED: silence;
|
||||||
|
|
|
@ -16,7 +16,7 @@ deserialize_server_info(Pulse *conn, Pulse_Tag *tag)
|
||||||
EINA_SAFETY_ON_FALSE_GOTO(untag_sample(tag, &spec), error);
|
EINA_SAFETY_ON_FALSE_GOTO(untag_sample(tag, &spec), error);
|
||||||
EINA_SAFETY_ON_FALSE_GOTO(untag_string(tag, &ev->default_sink), error);
|
EINA_SAFETY_ON_FALSE_GOTO(untag_string(tag, &ev->default_sink), error);
|
||||||
EINA_SAFETY_ON_FALSE_GOTO(untag_string(tag, &ev->default_source), error);
|
EINA_SAFETY_ON_FALSE_GOTO(untag_string(tag, &ev->default_source), error);
|
||||||
|
|
||||||
return ev;
|
return ev;
|
||||||
error:
|
error:
|
||||||
pulse_server_info_free(ev);
|
pulse_server_info_free(ev);
|
||||||
|
|
|
@ -264,7 +264,7 @@ pulse_sink_channel_names_get(Pulse_Sink *sink)
|
||||||
{
|
{
|
||||||
Eina_List *ret = NULL;
|
Eina_List *ret = NULL;
|
||||||
unsigned int x;
|
unsigned int x;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(sink, NULL);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sink, NULL);
|
||||||
for (x = 0; x < sink->volume.channels; x++)
|
for (x = 0; x < sink->volume.channels; x++)
|
||||||
ret = eina_list_append(ret, pulse_sink_channel_id_get_name(sink, x));
|
ret = eina_list_append(ret, pulse_sink_channel_id_get_name(sink, x));
|
||||||
|
@ -275,7 +275,7 @@ unsigned int
|
||||||
pulse_sink_channel_name_get_id(Pulse_Sink *sink, const char *name)
|
pulse_sink_channel_name_get_id(Pulse_Sink *sink, const char *name)
|
||||||
{
|
{
|
||||||
unsigned int x;
|
unsigned int x;
|
||||||
|
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(sink, UINT_MAX);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(sink, UINT_MAX);
|
||||||
EINA_SAFETY_ON_NULL_RETURN_VAL(name, UINT_MAX);
|
EINA_SAFETY_ON_NULL_RETURN_VAL(name, UINT_MAX);
|
||||||
for (x = 0; x < sink->channel_map.channels; x++)
|
for (x = 0; x < sink->channel_map.channels; x++)
|
||||||
|
|
|
@ -174,7 +174,7 @@ untag_arbitrary(Pulse_Tag *tag, Eina_Binbuf **val)
|
||||||
ret = tag->data + tag->size;
|
ret = tag->data + tag->size;
|
||||||
if (*ret != PA_TAG_ARBITRARY) return 0;
|
if (*ret != PA_TAG_ARBITRARY) return 0;
|
||||||
ret += PA_TAG_SIZE_ARBITRARY;
|
ret += PA_TAG_SIZE_ARBITRARY;
|
||||||
|
|
||||||
*val = eina_binbuf_new();
|
*val = eina_binbuf_new();
|
||||||
eina_binbuf_append_length(*val, ret, len);
|
eina_binbuf_append_length(*val, ret, len);
|
||||||
ret += len;
|
ret += len;
|
||||||
|
@ -215,7 +215,7 @@ tag_proplist(Pulse_Tag *tag)
|
||||||
|
|
||||||
ret = tag->data + tag->size;
|
ret = tag->data + tag->size;
|
||||||
*ret = PA_TAG_PROPLIST, tag->size++;
|
*ret = PA_TAG_PROPLIST, tag->size++;
|
||||||
|
|
||||||
eina_hash_foreach(tag->props, (Eina_Hash_Foreach)tag_proplist_foreach, tag);
|
eina_hash_foreach(tag->props, (Eina_Hash_Foreach)tag_proplist_foreach, tag);
|
||||||
return tag_string(tag, NULL);
|
return tag_string(tag, NULL);
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ untag_cvol(Pulse_Tag *tag, pa_cvolume *cvol)
|
||||||
memcpy(&pa_vol, ret, sizeof(pa_vol));
|
memcpy(&pa_vol, ret, sizeof(pa_vol));
|
||||||
cvol->values[x] = ntohl(pa_vol);
|
cvol->values[x] = ntohl(pa_vol);
|
||||||
}
|
}
|
||||||
|
|
||||||
tag->size = ret - tag->data;
|
tag->size = ret - tag->data;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue