forked from enlightenment/enlightenment
ok - lets make pa use correct channels to start with so it doesnt fail
instead of assume "front" take the first channel in the lsit - also chanel id's stuffed inot pointers are no good if other code assume ptr of NULL == no channel'mixer channel as it was a ptr... so incriment id's by 1 in the interface to make sure id 0 doesnt happen. SVN revision: 63578
This commit is contained in:
parent
d0fc3802d0
commit
5c80993982
|
@ -264,7 +264,7 @@ _populate_channels(E_Mixer_App_Dialog_Data *app)
|
||||||
|
|
||||||
eina_stringshare_del(app->channel_name);
|
eina_stringshare_del(app->channel_name);
|
||||||
app->channel_name = e_mod_mixer_channel_default_name_get(app->sys);
|
app->channel_name = e_mod_mixer_channel_default_name_get(app->sys);
|
||||||
|
|
||||||
if (app->channels_infos)
|
if (app->channels_infos)
|
||||||
_channels_info_free(app->channels_infos);
|
_channels_info_free(app->channels_infos);
|
||||||
app->channels_infos = _channels_info_new(app->sys);
|
app->channels_infos = _channels_info_new(app->sys);
|
||||||
|
|
|
@ -226,9 +226,8 @@ pulse_sink_channel_names_get(Pulse_Sink *sink)
|
||||||
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->channel_map.channels; x++)
|
ret = eina_list_append(ret, pulse_sink_channel_id_get_name(sink, x));
|
||||||
ret = eina_list_append(ret, eina_stringshare_add(channel_name_table[x]));
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +239,10 @@ pulse_sink_channel_name_get_id(Pulse_Sink *sink, const char *name)
|
||||||
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++)
|
||||||
if (!strcmp(name, channel_name_table[sink->channel_map.map[x]])) return x;
|
{
|
||||||
|
if (!strcmp(name, channel_name_table[sink->channel_map.map[x]]))
|
||||||
|
return x;
|
||||||
|
}
|
||||||
return UINT_MAX;
|
return UINT_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -294,8 +294,8 @@ e_mixer_pulse_get_channels(E_Mixer_System *self)
|
||||||
uintptr_t id;
|
uintptr_t id;
|
||||||
Eina_List *ret = NULL;
|
Eina_List *ret = NULL;
|
||||||
|
|
||||||
for (id=0; id < pulse_sink_channels_count((void*)self); id++)
|
for (id = 0; id < pulse_sink_channels_count((void *)self); id++)
|
||||||
ret = eina_list_append(ret, (void*)id);
|
ret = eina_list_append(ret, (void *)(id + 1));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,30 +308,29 @@ e_mixer_pulse_free_channels(Eina_List *channels)
|
||||||
Eina_List *
|
Eina_List *
|
||||||
e_mixer_pulse_get_channels_names(E_Mixer_System *self)
|
e_mixer_pulse_get_channels_names(E_Mixer_System *self)
|
||||||
{
|
{
|
||||||
return pulse_sink_channel_names_get((void*)self);;
|
return pulse_sink_channel_names_get((void *)self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
e_mixer_pulse_free_channels_names(Eina_List *channels_names)
|
e_mixer_pulse_free_channels_names(Eina_List *channels_names)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
EINA_LIST_FREE(channels_names, str)
|
EINA_LIST_FREE(channels_names, str) eina_stringshare_del(str);
|
||||||
eina_stringshare_del(str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
e_mixer_pulse_get_default_channel_name(E_Mixer_System *self __UNUSED__)
|
e_mixer_pulse_get_default_channel_name(E_Mixer_System *self)
|
||||||
{
|
{
|
||||||
return eina_stringshare_add("Front");
|
return e_mixer_pulse_get_channel_name(self, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
E_Mixer_Channel *
|
E_Mixer_Channel *
|
||||||
e_mixer_pulse_get_channel_by_name(E_Mixer_System *self, const char *name)
|
e_mixer_pulse_get_channel_by_name(E_Mixer_System *self, const char *name)
|
||||||
{
|
{
|
||||||
unsigned int x;
|
unsigned int x;
|
||||||
x = pulse_sink_channel_name_get_id((void*)self, name);
|
x = pulse_sink_channel_name_get_id((void *)self, name);
|
||||||
if (x == UINT_MAX) return (intptr_t*)-2;
|
if (x == UINT_MAX) return NULL;
|
||||||
return (uintptr_t*)((uintptr_t)x);
|
return (E_Mixer_Channel *)((uintptr_t)(x + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -342,8 +341,9 @@ e_mixer_pulse_channel_del(E_Mixer_Channel *channel __UNUSED__)
|
||||||
const char *
|
const char *
|
||||||
e_mixer_pulse_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel)
|
e_mixer_pulse_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel)
|
||||||
{
|
{
|
||||||
if (channel == (E_Mixer_Channel *)-2) return NULL;
|
if (!channel) return NULL;
|
||||||
return pulse_sink_channel_id_get_name((void*)self, (uintptr_t)channel);
|
return pulse_sink_channel_id_get_name((void *)self,
|
||||||
|
((uintptr_t)channel) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -351,10 +351,11 @@ e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *le
|
||||||
{
|
{
|
||||||
double volume;
|
double volume;
|
||||||
|
|
||||||
volume = pulse_sink_channel_volume_get((void*)self, (uintptr_t)channel);
|
if (!channel) return 0;
|
||||||
|
volume = pulse_sink_channel_volume_get((void *)self,
|
||||||
|
((uintptr_t)channel) - 1);
|
||||||
if (left) *left = (int)volume;
|
if (left) *left = (int)volume;
|
||||||
if (right) *right = (int)volume;
|
if (right) *right = (int)volume;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +364,10 @@ e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int lef
|
||||||
{
|
{
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
|
||||||
id = pulse_sink_channel_volume_set(conn, (void*)self, (uintptr_t)channel, (left + right) / 2);
|
if (!channel) return 0;
|
||||||
|
id = pulse_sink_channel_volume_set(conn, (void *)self,
|
||||||
|
((uintptr_t)channel) - 1,
|
||||||
|
(left + right) / 2);
|
||||||
if (!id) return 0;
|
if (!id) return 0;
|
||||||
pulse_cb_set(conn, id, (Pulse_Cb)_pulse_result_cb);
|
pulse_cb_set(conn, id, (Pulse_Cb)_pulse_result_cb);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -378,7 +382,7 @@ e_mixer_pulse_can_mute(E_Mixer_System *self __UNUSED__, E_Mixer_Channel *channel
|
||||||
int
|
int
|
||||||
e_mixer_pulse_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel __UNUSED__, int *mute)
|
e_mixer_pulse_get_mute(E_Mixer_System *self, E_Mixer_Channel *channel __UNUSED__, int *mute)
|
||||||
{
|
{
|
||||||
if (mute) *mute = pulse_sink_muted_get((void*)self);
|
if (mute) *mute = pulse_sink_muted_get((void *)self);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -388,8 +392,8 @@ e_mixer_pulse_set_mute(E_Mixer_System *self, E_Mixer_Channel *channel __UNUSED__
|
||||||
{
|
{
|
||||||
uint32_t idx, id;
|
uint32_t idx, id;
|
||||||
|
|
||||||
idx = pulse_sink_idx_get((void*)self);
|
idx = pulse_sink_idx_get((void *)self);
|
||||||
id = pulse_sink_mute_set(conn, pulse_sink_idx_get((void*)self), mute);
|
id = pulse_sink_mute_set(conn, pulse_sink_idx_get((void *)self), mute);
|
||||||
if (!id) return 0;
|
if (!id) return 0;
|
||||||
pulse_cb_set(conn, id, (Pulse_Cb)_pulse_result_cb);
|
pulse_cb_set(conn, id, (Pulse_Cb)_pulse_result_cb);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -402,8 +406,10 @@ e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer_
|
||||||
|
|
||||||
if (!state) return 0;
|
if (!state) return 0;
|
||||||
|
|
||||||
vol = pulse_sink_channel_volume_get((void*)self, (uintptr_t)channel);
|
if (!channel) return 0;
|
||||||
state->mute = pulse_sink_muted_get((void*)self);
|
vol = pulse_sink_channel_volume_get((void *)self,
|
||||||
|
((uintptr_t)channel) - 1);
|
||||||
|
state->mute = pulse_sink_muted_get((void *)self);
|
||||||
state->left = state->right = (int)vol;
|
state->left = state->right = (int)vol;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -414,7 +420,10 @@ e_mixer_pulse_set_state(E_Mixer_System *self, E_Mixer_Channel *channel, const E_
|
||||||
{
|
{
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
|
||||||
id = pulse_sink_channel_volume_set(conn, (void*)self, (uintptr_t)channel, (state->left + state->right) / 2);
|
if (!channel) return 0;
|
||||||
|
id = pulse_sink_channel_volume_set(conn, (void *)self,
|
||||||
|
((uintptr_t)channel) - 1,
|
||||||
|
(state->left + state->right) / 2);
|
||||||
if (!id) return 0;
|
if (!id) return 0;
|
||||||
pulse_cb_set(conn, id, (Pulse_Cb)_pulse_result_cb);
|
pulse_cb_set(conn, id, (Pulse_Cb)_pulse_result_cb);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in New Issue