mixer: add const to immutable params of mixer api

strengthen mixer's api
This commit is contained in:
Jérémy Zurcher 2013-02-28 15:11:43 +01:00
parent d75622c33c
commit 330490ad85
5 changed files with 139 additions and 109 deletions

View File

@ -86,7 +86,7 @@ void e_mod_mixer_channel_info_free(E_Mixer_Channel_Info* info)
}
Eina_List *
e_mod_mixer_channel_infos_get(E_Mixer_System *sys)
e_mod_mixer_channel_infos_get(const E_Mixer_System *sys)
{
return eina_list_sort(e_mod_mixer_channels_get(sys), -1, _channel_info_cmp);
}

View File

@ -22,12 +22,12 @@ typedef struct _E_Mixer_Channel_Info
E_Mixer_App *app;
} E_Mixer_Channel_Info;
typedef int (*E_Mixer_Volume_Set_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *, int, int);
typedef int (*E_Mixer_Volume_Get_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *, int *, int *);
typedef int (*E_Mixer_Mute_Get_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *, int *);
typedef int (*E_Mixer_Mute_Set_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *, int);
typedef int (*E_Mixer_State_Get_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *, E_Mixer_Channel_State *);
typedef int (*E_Mixer_Capture_Cb)(E_Mixer_System *, E_Mixer_Channel_Info *);
typedef int (*E_Mixer_Volume_Set_Cb)(const E_Mixer_System *, const E_Mixer_Channel_Info *, int, int);
typedef int (*E_Mixer_Volume_Get_Cb)(const E_Mixer_System *, const E_Mixer_Channel_Info *, int *, int *);
typedef int (*E_Mixer_Mute_Get_Cb)(const E_Mixer_System *, const E_Mixer_Channel_Info *, int *);
typedef int (*E_Mixer_Mute_Set_Cb)(const E_Mixer_System *, const E_Mixer_Channel_Info *, int);
typedef int (*E_Mixer_State_Get_Cb)(const E_Mixer_System *, const E_Mixer_Channel_Info *, E_Mixer_Channel_State *);
typedef int (*E_Mixer_Capture_Cb)(const E_Mixer_System *, const E_Mixer_Channel_Info *);
typedef void *(*E_Mixer_Cb)();
extern Eina_Bool _mixer_using_default;
@ -49,7 +49,7 @@ extern E_Mixer_Cb e_mod_mixer_card_names_get;
extern E_Mixer_Cb e_mod_mixer_card_default_get;
void e_mod_mixer_channel_info_free(E_Mixer_Channel_Info*);
Eina_List *e_mod_mixer_channel_infos_get(E_Mixer_System *sys);
Eina_List *e_mod_mixer_channel_infos_get(const E_Mixer_System *sys);
void e_mod_mixer_channel_infos_free(Eina_List*);
void e_mod_mixer_channel_names_free(Eina_List*);
void e_mod_mixer_card_names_free(Eina_List*);
@ -57,8 +57,8 @@ void e_mod_mixer_card_names_free(Eina_List*);
void e_mixer_default_setup(void);
void e_mixer_pulse_setup();
/* ALSA */
int e_mixer_system_callback_set(E_Mixer_System *self, int (*func)(void *data, E_Mixer_System *self), void *data);
/* ALSA | DUMMY */
int e_mixer_system_callback_set(const E_Mixer_System *self, int (*func)(void *data, E_Mixer_System *self), void *data);
E_Mixer_System *e_mixer_system_new(const char *card);
void e_mixer_system_del(E_Mixer_System *self);
@ -66,22 +66,22 @@ void e_mixer_system_del(E_Mixer_System *self);
Eina_List *e_mixer_system_get_cards(void);
const char *e_mixer_system_get_default_card(void);
const char *e_mixer_system_get_card_name(const char *card);
const char *e_mixer_system_get_channel_name(E_Mixer_System *self, E_Mixer_Channel_Info *channel);
const char *e_mixer_system_get_channel_name(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel);
Eina_List *e_mixer_system_get_channels(E_Mixer_System *self);
Eina_List *e_mixer_system_get_channel_names(E_Mixer_System *self);
Eina_List *e_mixer_system_get_channels(const E_Mixer_System *self);
Eina_List *e_mixer_system_get_channel_names(const E_Mixer_System *self);
const char *e_mixer_system_get_default_channel_name(E_Mixer_System *self);
E_Mixer_Channel_Info *e_mixer_system_get_channel_by_name(E_Mixer_System *self, const char *name);
const char *e_mixer_system_get_default_channel_name(const E_Mixer_System *self);
E_Mixer_Channel_Info *e_mixer_system_get_channel_by_name(const E_Mixer_System *self, const char *name);
int e_mixer_system_has_capture(E_Mixer_System *self, E_Mixer_Channel_Info *channel);
int e_mixer_system_get_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int *left, int *right);
int e_mixer_system_set_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int left, int right);
int e_mixer_system_can_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel);
int e_mixer_system_get_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int *mute);
int e_mixer_system_set_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int mute);
int e_mixer_system_get_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, E_Mixer_Channel_State *state);
int e_mixer_system_set_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, const E_Mixer_Channel_State *state);
int e_mixer_system_has_capture(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel);
int e_mixer_system_get_volume(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, int *left, int *right);
int e_mixer_system_set_volume(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, int left, int right);
int e_mixer_system_can_mute(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel);
int e_mixer_system_get_mute(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, int *mute);
int e_mixer_system_set_mute(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, int mute);
int e_mixer_system_get_state(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, E_Mixer_Channel_State *state);
int e_mixer_system_set_state(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, const E_Mixer_Channel_State *state);
/* PULSE */
int pulse_init(void);
@ -95,22 +95,22 @@ void e_mixer_pulse_del(E_Mixer_System *self);
Eina_List *e_mixer_pulse_get_cards(void);
const char *e_mixer_pulse_get_default_card(void);
const char *e_mixer_pulse_get_card_name(const char *card);
const char *e_mixer_pulse_get_channel_name(E_Mixer_System *self, E_Mixer_Channel_Info *channel);
const char *e_mixer_pulse_get_channel_name(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel);
Eina_List *e_mixer_pulse_get_channels(E_Mixer_System *self);
Eina_List *e_mixer_pulse_get_channel_names(E_Mixer_System *self);
Eina_List *e_mixer_pulse_get_channels(const E_Mixer_System *self);
Eina_List *e_mixer_pulse_get_channel_names(const E_Mixer_System *self);
const char *e_mixer_pulse_get_default_channel_name(E_Mixer_System *self);
E_Mixer_Channel_Info *e_mixer_pulse_get_channel_by_name(E_Mixer_System *self, const char *name);
const char *e_mixer_pulse_get_default_channel_name(const E_Mixer_System *self);
E_Mixer_Channel_Info *e_mixer_pulse_get_channel_by_name(const E_Mixer_System *self, const char *name);
int e_mixer_pulse_has_capture(E_Mixer_System *self, E_Mixer_Channel_Info *channel);
int e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int *left, int *right);
int e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int left, int right);
int e_mixer_pulse_can_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel);
int e_mixer_pulse_get_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int *mute);
int e_mixer_pulse_set_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int mute);
int e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, E_Mixer_Channel_State *state);
int e_mixer_pulse_set_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, const E_Mixer_Channel_State *state);
int e_mixer_pulse_has_capture(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel);
int e_mixer_pulse_get_volume(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, int *left, int *right);
int e_mixer_pulse_set_volume(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, int left, int right);
int e_mixer_pulse_can_mute(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel);
int e_mixer_pulse_get_mute(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, int *mute);
int e_mixer_pulse_set_mute(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, int mute);
int e_mixer_pulse_get_state(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, E_Mixer_Channel_State *state);
int e_mixer_pulse_set_state(const E_Mixer_System *self, const E_Mixer_Channel_Info *channel, const E_Mixer_Channel_State *state);
/**
* @addtogroup Optional_Devices

View File

@ -12,10 +12,10 @@ struct e_mixer_callback_desc
Eina_List *handlers;
};
static int _mixer_callback_add(E_Mixer_System *self,
static int _mixer_callback_add(const E_Mixer_System *self,
int (*func)(void *data, E_Mixer_System *self),
void *data);
static int _mixer_callback_del(E_Mixer_System *self,
static int _mixer_callback_del(const E_Mixer_System *self,
struct e_mixer_callback_desc *desc);
static Eina_Bool
@ -68,7 +68,7 @@ _cb_fd_handler(void *data,
}
static int
_mixer_callback_add(E_Mixer_System *self,
_mixer_callback_add(const E_Mixer_System *self,
int (*func)(void *data, E_Mixer_System *self),
void *data)
{
@ -76,7 +76,7 @@ _mixer_callback_add(E_Mixer_System *self,
struct pollfd *pfds;
int len;
len = snd_mixer_poll_descriptors_count(self);
len = snd_mixer_poll_descriptors_count((snd_mixer_t *)self);
if (len <= 0)
return 0;
@ -86,12 +86,12 @@ _mixer_callback_add(E_Mixer_System *self,
desc->func = func;
desc->data = data;
desc->self = self;
desc->self = (E_Mixer_System *)self;
desc->idler = NULL;
desc->handlers = NULL;
pfds = alloca(len * sizeof(struct pollfd));
len = snd_mixer_poll_descriptors(self, pfds, len);
len = snd_mixer_poll_descriptors((snd_mixer_t *)self, pfds, len);
if (len <= 0)
{
free(desc);
@ -108,13 +108,13 @@ _mixer_callback_add(E_Mixer_System *self,
desc->handlers = eina_list_prepend(desc->handlers, fd_handler);
}
snd_mixer_set_callback_private(self, desc);
snd_mixer_set_callback_private((snd_mixer_t *)self, desc);
return 1;
}
static int
_mixer_callback_del(E_Mixer_System *self,
_mixer_callback_del(const E_Mixer_System *self,
struct e_mixer_callback_desc *desc)
{
Ecore_Fd_Handler *handler;
@ -122,7 +122,7 @@ _mixer_callback_del(E_Mixer_System *self,
EINA_LIST_FREE(desc->handlers, handler)
ecore_main_fd_handler_del(handler);
snd_mixer_set_callback_private(self, NULL);
snd_mixer_set_callback_private((snd_mixer_t *)self, NULL);
memset(desc, 0, sizeof(*desc));
free(desc);
@ -131,7 +131,7 @@ _mixer_callback_del(E_Mixer_System *self,
}
static int
_mixer_callback_replace(E_Mixer_System *self __UNUSED__,
_mixer_callback_replace(const E_Mixer_System *self __UNUSED__,
struct e_mixer_callback_desc *desc,
int (*func)(void *data, E_Mixer_System *self),
void *data)
@ -192,7 +192,7 @@ e_mixer_system_del(E_Mixer_System *self)
}
int
e_mixer_system_callback_set(E_Mixer_System *self,
e_mixer_system_callback_set(const E_Mixer_System *self,
int (*func)(void *data, E_Mixer_System *self),
void *data)
{
@ -295,7 +295,7 @@ e_mixer_system_get_card_name(const char *card)
}
Eina_List *
e_mixer_system_get_channels(E_Mixer_System *self)
e_mixer_system_get_channels(const E_Mixer_System *self)
{
Eina_List *channels;
snd_mixer_elem_t *elem;
@ -305,7 +305,7 @@ e_mixer_system_get_channels(E_Mixer_System *self)
channels = NULL;
elem = snd_mixer_first_elem(self);
elem = snd_mixer_first_elem((snd_mixer_t *)self);
for (; elem; elem = snd_mixer_elem_next(elem))
{
if ((!snd_mixer_selem_is_active(elem)) ||
@ -326,7 +326,7 @@ e_mixer_system_get_channels(E_Mixer_System *self)
}
Eina_List *
e_mixer_system_get_channel_names(E_Mixer_System *self)
e_mixer_system_get_channel_names(const E_Mixer_System *self)
{
Eina_List *channels;
snd_mixer_elem_t *elem;
@ -338,7 +338,7 @@ e_mixer_system_get_channel_names(E_Mixer_System *self)
channels = NULL;
snd_mixer_selem_id_alloca(&sid);
elem = snd_mixer_first_elem(self);
elem = snd_mixer_first_elem((snd_mixer_t *)self);
for (; elem; elem = snd_mixer_elem_next(elem))
{
const char *name;
@ -356,7 +356,7 @@ e_mixer_system_get_channel_names(E_Mixer_System *self)
}
const char *
e_mixer_system_get_default_channel_name(E_Mixer_System *self)
e_mixer_system_get_default_channel_name(const E_Mixer_System *self)
{
snd_mixer_elem_t *elem;
snd_mixer_selem_id_t *sid;
@ -366,7 +366,7 @@ e_mixer_system_get_default_channel_name(E_Mixer_System *self)
snd_mixer_selem_id_alloca(&sid);
elem = snd_mixer_first_elem(self);
elem = snd_mixer_first_elem((snd_mixer_t *)self);
for (; elem; elem = snd_mixer_elem_next(elem))
{
const char *name;
@ -384,7 +384,7 @@ e_mixer_system_get_default_channel_name(E_Mixer_System *self)
}
E_Mixer_Channel_Info *
e_mixer_system_get_channel_by_name(E_Mixer_System *self,
e_mixer_system_get_channel_by_name(const E_Mixer_System *self,
const char *name)
{
snd_mixer_elem_t *elem;
@ -396,7 +396,7 @@ e_mixer_system_get_channel_by_name(E_Mixer_System *self,
snd_mixer_selem_id_alloca(&sid);
elem = snd_mixer_first_elem(self);
elem = snd_mixer_first_elem((snd_mixer_t *)self);
for (; elem; elem = snd_mixer_elem_next(elem))
{
const char *n;
@ -421,8 +421,8 @@ e_mixer_system_get_channel_by_name(E_Mixer_System *self,
}
const char *
e_mixer_system_get_channel_name(E_Mixer_System *self,
E_Mixer_Channel_Info *channel)
e_mixer_system_get_channel_name(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel)
{
snd_mixer_selem_id_t *sid;
const char *name;
@ -438,8 +438,8 @@ e_mixer_system_get_channel_name(E_Mixer_System *self,
}
int
e_mixer_system_get_volume(E_Mixer_System *self,
E_Mixer_Channel_Info *channel,
e_mixer_system_get_volume(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel,
int *left,
int *right)
{
@ -448,7 +448,7 @@ e_mixer_system_get_volume(E_Mixer_System *self,
if ((!self) || (!channel) || (!channel->id) || (!left) || (!right))
return 0;
snd_mixer_handle_events(self);
snd_mixer_handle_events((snd_mixer_t *)self);
snd_mixer_selem_get_playback_volume_range(channel->id, &min, &max);
range = max - min;
if (range < 1)
@ -475,8 +475,8 @@ e_mixer_system_get_volume(E_Mixer_System *self,
}
int
e_mixer_system_set_volume(E_Mixer_System *self,
E_Mixer_Channel_Info *channel,
e_mixer_system_set_volume(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel,
int left,
int right)
{
@ -486,7 +486,7 @@ e_mixer_system_set_volume(E_Mixer_System *self,
if ((!self) || (!channel) || (!channel->id))
return 0;
snd_mixer_handle_events(self);
snd_mixer_handle_events((snd_mixer_t *)self);
snd_mixer_selem_get_playback_volume_range(channel->id, &min, &max);
divide = 100 + min;
if (divide == 0)
@ -527,26 +527,26 @@ e_mixer_system_set_volume(E_Mixer_System *self,
}
int
e_mixer_system_can_mute(E_Mixer_System *self,
E_Mixer_Channel_Info *channel)
e_mixer_system_can_mute(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel)
{
if ((!self) || (!channel) || (!channel->id))
return 0;
snd_mixer_handle_events(self);
snd_mixer_handle_events((snd_mixer_t *)self);
return snd_mixer_selem_has_playback_switch(channel->id) ||
snd_mixer_selem_has_playback_switch_joined(channel->id);
}
int
e_mixer_system_get_mute(E_Mixer_System *self,
E_Mixer_Channel_Info *channel,
e_mixer_system_get_mute(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel,
int *mute)
{
if ((!self) || (!channel) || (!channel->id) || (!mute))
return 0;
snd_mixer_handle_events(self);
snd_mixer_handle_events((snd_mixer_t *)self);
if (snd_mixer_selem_has_playback_switch(channel->id) ||
snd_mixer_selem_has_playback_switch_joined(channel->id))
{
@ -565,14 +565,14 @@ e_mixer_system_get_mute(E_Mixer_System *self,
}
int
e_mixer_system_set_mute(E_Mixer_System *self,
E_Mixer_Channel_Info *channel,
e_mixer_system_set_mute(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel,
int mute)
{
if ((!self) || (!channel) || (!channel->id))
return 0;
snd_mixer_handle_events(self);
snd_mixer_handle_events((snd_mixer_t *)self);
if (snd_mixer_selem_has_playback_switch(channel->id) ||
snd_mixer_selem_has_playback_switch_joined(channel->id))
return snd_mixer_selem_set_playback_switch_all(channel->id, !mute);
@ -581,8 +581,8 @@ e_mixer_system_set_mute(E_Mixer_System *self,
}
int
e_mixer_system_get_state(E_Mixer_System *self,
E_Mixer_Channel_Info *channel,
e_mixer_system_get_state(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel,
E_Mixer_Channel_State *state)
{
int r;
@ -596,8 +596,8 @@ e_mixer_system_get_state(E_Mixer_System *self,
}
int
e_mixer_system_set_state(E_Mixer_System *self,
E_Mixer_Channel_Info *channel,
e_mixer_system_set_state(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel,
const E_Mixer_Channel_State *state)
{
int r;
@ -611,8 +611,8 @@ e_mixer_system_set_state(E_Mixer_System *self,
}
int
e_mixer_system_has_capture(E_Mixer_System *self,
E_Mixer_Channel_Info *channel)
e_mixer_system_has_capture(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel)
{
if ((!self) || (!channel) || (!channel->id))
return 0;

View File

@ -27,7 +27,7 @@ e_mixer_system_del(E_Mixer_System *self __UNUSED__)
}
int
e_mixer_system_callback_set(E_Mixer_System *self __UNUSED__, int (*func)(void *data, E_Mixer_System *self) __UNUSED__, void *data __UNUSED__)
e_mixer_system_callback_set(const E_Mixer_System *self __UNUSED__, int (*func)(void *data, E_Mixer_System *self) __UNUSED__, void *data __UNUSED__)
{
return 0;
}
@ -60,7 +60,7 @@ e_mixer_system_get_card_name(const char *card)
}
Eina_List *
e_mixer_system_get_channels(E_Mixer_System *self __UNUSED__)
e_mixer_system_get_channels(const E_Mixer_System *self __UNUSED__)
{
_e_mixer_dummy_set();
@ -75,7 +75,7 @@ e_mixer_system_get_channels(E_Mixer_System *self __UNUSED__)
}
Eina_List *
e_mixer_system_get_channel_names(E_Mixer_System *self __UNUSED__)
e_mixer_system_get_channel_names(const E_Mixer_System *self __UNUSED__)
{
_e_mixer_dummy_set();
@ -83,7 +83,7 @@ e_mixer_system_get_channel_names(E_Mixer_System *self __UNUSED__)
}
const char *
e_mixer_system_get_default_channel_name(E_Mixer_System *self __UNUSED__)
e_mixer_system_get_default_channel_name(const E_Mixer_System *self __UNUSED__)
{
_e_mixer_dummy_set();
@ -91,7 +91,7 @@ e_mixer_system_get_default_channel_name(E_Mixer_System *self __UNUSED__)
}
E_Mixer_Channel_Info *
e_mixer_system_get_channel_by_name(E_Mixer_System *self __UNUSED__, const char *name)
e_mixer_system_get_channel_by_name(const E_Mixer_System *self __UNUSED__, const char *name)
{
E_Mixer_Channel_Info *ch_info;
@ -111,7 +111,8 @@ e_mixer_system_get_channel_by_name(E_Mixer_System *self __UNUSED__, const char *
}
const char *
e_mixer_system_get_channel_name(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel)
e_mixer_system_get_channel_name(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel)
{
_e_mixer_dummy_set();
@ -124,7 +125,9 @@ e_mixer_system_get_channel_name(E_Mixer_System *self __UNUSED__, E_Mixer_Channel
}
int
e_mixer_system_get_volume(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel __UNUSED__, int *left, int *right)
e_mixer_system_get_volume(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel __UNUSED__,
int *left, int *right)
{
if (left)
*left = 0;
@ -135,19 +138,24 @@ e_mixer_system_get_volume(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info
}
int
e_mixer_system_set_volume(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel __UNUSED__, int left __UNUSED__, int right __UNUSED__)
e_mixer_system_set_volume(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel __UNUSED__,
int left __UNUSED__, int right __UNUSED__)
{
return 0;
}
int
e_mixer_system_can_mute(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel __UNUSED__)
e_mixer_system_can_mute(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel __UNUSED__)
{
return 1;
}
int
e_mixer_system_get_mute(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel __UNUSED__, int *mute)
e_mixer_system_get_mute(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel __UNUSED__,
int *mute)
{
if (mute)
*mute = 1;
@ -156,13 +164,17 @@ e_mixer_system_get_mute(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *c
}
int
e_mixer_system_set_mute(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel __UNUSED__, int mute __UNUSED__)
e_mixer_system_set_mute(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel __UNUSED__,
int mute __UNUSED__)
{
return 0;
}
int
e_mixer_system_get_state(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel __UNUSED__, E_Mixer_Channel_State *state)
e_mixer_system_get_state(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel __UNUSED__,
E_Mixer_Channel_State *state)
{
const E_Mixer_Channel_State def = {1, 0, 0};
@ -173,13 +185,16 @@ e_mixer_system_get_state(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *
}
int
e_mixer_system_set_state(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel __UNUSED__, const E_Mixer_Channel_State *state __UNUSED__)
e_mixer_system_set_state(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel __UNUSED__,
const E_Mixer_Channel_State *state __UNUSED__)
{
return 0;
}
int
e_mixer_system_has_capture(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel __UNUSED__)
e_mixer_system_has_capture(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel __UNUSED__)
{
return 0;
}

View File

@ -294,7 +294,8 @@ _pulse_sink_find(const char *name)
}
static Eina_Bool
_pulse_queue_process(const Eina_Hash *h EINA_UNUSED, const char *key, E_Mixer_Channel_State *state, void *d EINA_UNUSED)
_pulse_queue_process(const Eina_Hash *h EINA_UNUSED, const char *key,
E_Mixer_Channel_State *state, void *d EINA_UNUSED)
{
Eina_List *l, *list[2] = {sinks, sources};
E_Mixer_Channel_Info ch;
@ -357,12 +358,14 @@ e_mixer_pulse_init(void)
{
interval = ecore_poller_poll_interval_get(ECORE_POLLER_CORE);
/* polling every 5 seconds or so I guess ? */
pulse_poller = ecore_poller_add(ECORE_POLLER_CORE, 5.0 / interval, _pulse_poller_cb, NULL);
pulse_poller = ecore_poller_add(ECORE_POLLER_CORE, 5.0 / interval,
_pulse_poller_cb, NULL);
}
if (!dbus_handler)
dbus_handler = edbus_signal_handler_add(dbus, EDBUS_FDO_BUS,
EDBUS_FDO_PATH,
EDBUS_FDO_INTERFACE, "NameOwnerChanged", _dbus_poll, NULL);
EDBUS_FDO_INTERFACE,
"NameOwnerChanged", _dbus_poll, NULL);
msg = edbus_message_method_call_new(PULSE_BUS, PULSE_PATH, PULSE_INTERFACE, "suuuuuup");
edbus_connection_send(dbus, msg, _dbus_test, NULL, -1); /* test for not running pulse */
@ -470,7 +473,7 @@ e_mixer_pulse_get_card_name(const char *card)
}
Eina_List *
e_mixer_pulse_get_channels(E_Mixer_System *self EINA_UNUSED)
e_mixer_pulse_get_channels(const E_Mixer_System *self EINA_UNUSED)
{
E_Mixer_Channel_Info *ch_info;
@ -483,19 +486,20 @@ e_mixer_pulse_get_channels(E_Mixer_System *self EINA_UNUSED)
}
Eina_List *
e_mixer_pulse_get_channel_names(E_Mixer_System *self EINA_UNUSED)
e_mixer_pulse_get_channel_names(const E_Mixer_System *self EINA_UNUSED)
{
return eina_list_append(NULL, eina_stringshare_ref(_name));
}
const char *
e_mixer_pulse_get_default_channel_name(E_Mixer_System *self EINA_UNUSED)
e_mixer_pulse_get_default_channel_name(const E_Mixer_System *self EINA_UNUSED)
{
return eina_stringshare_ref(_name);
}
E_Mixer_Channel_Info *
e_mixer_pulse_get_channel_by_name(E_Mixer_System *self EINA_UNUSED, const char *name EINA_UNUSED)
e_mixer_pulse_get_channel_by_name(const E_Mixer_System *self EINA_UNUSED,
const char *name EINA_UNUSED)
{
E_Mixer_Channel_Info *ch_info;
@ -508,14 +512,16 @@ e_mixer_pulse_get_channel_by_name(E_Mixer_System *self EINA_UNUSED, const char *
}
const char *
e_mixer_pulse_get_channel_name(E_Mixer_System *self EINA_UNUSED, E_Mixer_Channel_Info *channel)
e_mixer_pulse_get_channel_name(const E_Mixer_System *self EINA_UNUSED,
const E_Mixer_Channel_Info *channel)
{
if (!channel) return NULL;
return eina_stringshare_ref(_name);
}
int
e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int *left, int *right)
e_mixer_pulse_get_volume(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel, int *left, int *right)
{
double volume;
int x, n;
@ -539,7 +545,8 @@ e_mixer_pulse_get_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, in
}
int
e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, int left, int right)
e_mixer_pulse_set_volume(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel, int left, int right)
{
uint32_t id = 0;
int x, n;
@ -555,7 +562,7 @@ e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, in
{
double vol;
vol = lround(pulse_sink_channel_volume_get(self, x));
vol = lround(pulse_sink_channel_volume_get((void *)self, x));
if (x == 0)
{
if (vol != left)
@ -576,20 +583,23 @@ e_mixer_pulse_set_volume(E_Mixer_System *self, E_Mixer_Channel_Info *channel, in
}
int
e_mixer_pulse_can_mute(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel __UNUSED__)
e_mixer_pulse_can_mute(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel __UNUSED__)
{
return 1;
}
int
e_mixer_pulse_get_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel __UNUSED__, int *mute)
e_mixer_pulse_get_mute(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel __UNUSED__, int *mute)
{
if (mute) *mute = pulse_sink_muted_get((void *)self);
return 1;
}
int
e_mixer_pulse_set_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel __UNUSED__, int mute)
e_mixer_pulse_set_mute(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel __UNUSED__, int mute)
{
uint32_t id;
Eina_Bool source = EINA_FALSE;
@ -608,7 +618,9 @@ e_mixer_pulse_set_mute(E_Mixer_System *self, E_Mixer_Channel_Info *channel __UNU
}
int
e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, E_Mixer_Channel_State *state)
e_mixer_pulse_get_state(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel,
E_Mixer_Channel_State *state)
{
if (!state) return 0;
if (!channel) return 0;
@ -618,7 +630,9 @@ e_mixer_pulse_get_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, E_M
}
int
e_mixer_pulse_set_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, const E_Mixer_Channel_State *state)
e_mixer_pulse_set_state(const E_Mixer_System *self,
const E_Mixer_Channel_Info *channel,
const E_Mixer_Channel_State *state)
{
e_mixer_pulse_set_volume(self, channel, state->left, state->right);
e_mixer_pulse_set_mute(self, channel, state->mute);
@ -626,7 +640,8 @@ e_mixer_pulse_set_state(E_Mixer_System *self, E_Mixer_Channel_Info *channel, con
}
int
e_mixer_pulse_has_capture(E_Mixer_System *self __UNUSED__, E_Mixer_Channel_Info *channel __UNUSED__)
e_mixer_pulse_has_capture(const E_Mixer_System *self __UNUSED__,
const E_Mixer_Channel_Info *channel __UNUSED__)
{
return 0;
}