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
|
@ -226,9 +226,8 @@ pulse_sink_channel_names_get(Pulse_Sink *sink)
|
|||
unsigned int x;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(sink, NULL);
|
||||
|
||||
for (x = 0; x < sink->channel_map.channels; x++)
|
||||
ret = eina_list_append(ret, eina_stringshare_add(channel_name_table[x]));
|
||||
for (x = 0; x < sink->volume.channels; x++)
|
||||
ret = eina_list_append(ret, pulse_sink_channel_id_get_name(sink, x));
|
||||
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(name, UINT_MAX);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ e_mixer_pulse_get_channels(E_Mixer_System *self)
|
|||
Eina_List *ret = NULL;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -308,21 +308,20 @@ e_mixer_pulse_free_channels(Eina_List *channels)
|
|||
Eina_List *
|
||||
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
|
||||
e_mixer_pulse_free_channels_names(Eina_List *channels_names)
|
||||
{
|
||||
const char *str;
|
||||
EINA_LIST_FREE(channels_names, str)
|
||||
eina_stringshare_del(str);
|
||||
EINA_LIST_FREE(channels_names, str) eina_stringshare_del(str);
|
||||
}
|
||||
|
||||
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 *
|
||||
|
@ -330,8 +329,8 @@ e_mixer_pulse_get_channel_by_name(E_Mixer_System *self, const char *name)
|
|||
{
|
||||
unsigned int x;
|
||||
x = pulse_sink_channel_name_get_id((void *)self, name);
|
||||
if (x == UINT_MAX) return (intptr_t*)-2;
|
||||
return (uintptr_t*)((uintptr_t)x);
|
||||
if (x == UINT_MAX) return NULL;
|
||||
return (E_Mixer_Channel *)((uintptr_t)(x + 1));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -342,8 +341,9 @@ e_mixer_pulse_channel_del(E_Mixer_Channel *channel __UNUSED__)
|
|||
const char *
|
||||
e_mixer_pulse_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel)
|
||||
{
|
||||
if (channel == (E_Mixer_Channel *)-2) return NULL;
|
||||
return pulse_sink_channel_id_get_name((void*)self, (uintptr_t)channel);
|
||||
if (!channel) return NULL;
|
||||
return pulse_sink_channel_id_get_name((void *)self,
|
||||
((uintptr_t)channel) - 1);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -351,10 +351,11 @@ e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int *le
|
|||
{
|
||||
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 (right) *right = (int)volume;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -363,7 +364,10 @@ e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel *channel, int lef
|
|||
{
|
||||
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;
|
||||
pulse_cb_set(conn, id, (Pulse_Cb)_pulse_result_cb);
|
||||
return 1;
|
||||
|
@ -402,7 +406,9 @@ e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel *channel, E_Mixer_
|
|||
|
||||
if (!state) return 0;
|
||||
|
||||
vol = pulse_sink_channel_volume_get((void*)self, (uintptr_t)channel);
|
||||
if (!channel) return 0;
|
||||
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;
|
||||
|
||||
|
@ -414,7 +420,10 @@ e_mixer_pulse_set_state(E_Mixer_System *self, E_Mixer_Channel *channel, const E_
|
|||
{
|
||||
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;
|
||||
pulse_cb_set(conn, id, (Pulse_Cb)_pulse_result_cb);
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue