summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Bouchaud <michael.bouchaud@ext.actia.fr>2017-02-20 00:40:48 +0100
committerMichael Bouchaud <michael.bouchaud@ext.actia.fr>2017-02-20 00:46:59 +0100
commit939ac0b93d580bd6bdd12eb6b29871abd91d5061 (patch)
tree4bcecd80824c303357a19a61a00e1aadbedc2c44
parent718f0fe0f443c1841c65fcad27c0d75c863c9948 (diff)
e_client_volume: add sink_name_get API to e_client_volume
-rw-r--r--src/bin/e_client_volume.c12
-rw-r--r--src/bin/e_client_volume.h5
-rw-r--r--src/modules/mixer/e_mod_main.c18
3 files changed, 29 insertions, 6 deletions
diff --git a/src/bin/e_client_volume.c b/src/bin/e_client_volume.c
index 6526b209d..a53082d42 100644
--- a/src/bin/e_client_volume.c
+++ b/src/bin/e_client_volume.c
@@ -117,7 +117,7 @@ e_client_volume_shutdown(void)
117} 117}
118 118
119E_API E_Client_Volume_Sink * 119E_API E_Client_Volume_Sink *
120e_client_volume_sink_new(E_Client_Volume_Sink_Get func_get, E_Client_Volume_Sink_Set func_set, E_Client_Volume_Sink_Min_Get func_min_get, E_Client_Volume_Sink_Max_Get func_max_get, void *data) 120e_client_volume_sink_new(E_Client_Volume_Sink_Get func_get, E_Client_Volume_Sink_Set func_set, E_Client_Volume_Sink_Min_Get func_min_get, E_Client_Volume_Sink_Max_Get func_max_get, E_Client_Volume_Sink_Name_Get func_name_get, void *data)
121{ 121{
122 E_Client_Volume_Sink *sink; 122 E_Client_Volume_Sink *sink;
123 123
@@ -126,6 +126,7 @@ e_client_volume_sink_new(E_Client_Volume_Sink_Get func_get, E_Client_Volume_Sink
126 sink->func_get = func_get; 126 sink->func_get = func_get;
127 sink->func_min_get = func_min_get; 127 sink->func_min_get = func_min_get;
128 sink->func_max_get = func_max_get; 128 sink->func_max_get = func_max_get;
129 sink->func_name_get = func_name_get;
129 sink->data = data; 130 sink->data = data;
130 131
131 return sink; 132 return sink;
@@ -179,6 +180,15 @@ e_client_volume_sink_max_get(const E_Client_Volume_Sink *sink)
179 return 0; 180 return 0;
180} 181}
181 182
183E_API const char *
184e_client_volume_sink_name_get(const E_Client_Volume_Sink *sink)
185{
186 EINA_SAFETY_ON_NULL_RETURN_VAL(sink, 0);
187 if (sink->func_name_get)
188 return sink->func_name_get(sink->data);
189 return NULL;
190}
191
182E_API void 192E_API void
183e_client_volume_sink_append(E_Client *ec, E_Client_Volume_Sink *sink) 193e_client_volume_sink_append(E_Client *ec, E_Client_Volume_Sink *sink)
184{ 194{
diff --git a/src/bin/e_client_volume.h b/src/bin/e_client_volume.h
index 3ef0e164a..44de594f8 100644
--- a/src/bin/e_client_volume.h
+++ b/src/bin/e_client_volume.h
@@ -7,6 +7,7 @@ typedef void (*E_Client_Volume_Sink_Get)(int *volume, Eina_Bool *mute, void *dat
7typedef void (*E_Client_Volume_Sink_Set)(int volume, Eina_Bool mute, void *data); 7typedef void (*E_Client_Volume_Sink_Set)(int volume, Eina_Bool mute, void *data);
8typedef int (*E_Client_Volume_Sink_Min_Get)(void *data); 8typedef int (*E_Client_Volume_Sink_Min_Get)(void *data);
9typedef int (*E_Client_Volume_Sink_Max_Get)(void *data); 9typedef int (*E_Client_Volume_Sink_Max_Get)(void *data);
10typedef const char *(*E_Client_Volume_Sink_Name_Get)(void *data);
10 11
11E_API extern int E_EVENT_CLIENT_VOLUME; 12E_API extern int E_EVENT_CLIENT_VOLUME;
12E_API extern int E_EVENT_CLIENT_MUTE; 13E_API extern int E_EVENT_CLIENT_MUTE;
@@ -18,6 +19,7 @@ struct _E_Client_Volume_Sink
18 E_Client_Volume_Sink_Set func_set; 19 E_Client_Volume_Sink_Set func_set;
19 E_Client_Volume_Sink_Min_Get func_min_get; 20 E_Client_Volume_Sink_Min_Get func_min_get;
20 E_Client_Volume_Sink_Max_Get func_max_get; 21 E_Client_Volume_Sink_Max_Get func_max_get;
22 E_Client_Volume_Sink_Name_Get func_name_get;
21 void *data; 23 void *data;
22 Eina_List *clients; 24 Eina_List *clients;
23}; 25};
@@ -31,12 +33,13 @@ E_API void e_client_volume_mute_set(E_Client *ec, Eina_Bool mute);
31 33
32E_API Evas_Object *e_client_volume_object_add(E_Client *ec, Evas *evas); 34E_API Evas_Object *e_client_volume_object_add(E_Client *ec, Evas *evas);
33 35
34E_API E_Client_Volume_Sink *e_client_volume_sink_new(E_Client_Volume_Sink_Get func_get, E_Client_Volume_Sink_Set func_set, E_Client_Volume_Sink_Min_Get func_min_get, E_Client_Volume_Sink_Max_Get func_max_get, void *data); 36E_API E_Client_Volume_Sink *e_client_volume_sink_new(E_Client_Volume_Sink_Get func_get, E_Client_Volume_Sink_Set func_set, E_Client_Volume_Sink_Min_Get func_min_get, E_Client_Volume_Sink_Max_Get func_max_get, E_Client_Volume_Sink_Name_Get func_name_get, void *data);
35E_API void e_client_volume_sink_del(E_Client_Volume_Sink *mixer); 37E_API void e_client_volume_sink_del(E_Client_Volume_Sink *mixer);
36E_API void e_client_volume_sink_set(E_Client_Volume_Sink *mixer, int volume, Eina_Bool mute); 38E_API void e_client_volume_sink_set(E_Client_Volume_Sink *mixer, int volume, Eina_Bool mute);
37E_API void e_client_volume_sink_get(const E_Client_Volume_Sink *mixer, int *volume, Eina_Bool *mute); 39E_API void e_client_volume_sink_get(const E_Client_Volume_Sink *mixer, int *volume, Eina_Bool *mute);
38E_API int e_client_volume_sink_min_get(const E_Client_Volume_Sink *mixer); 40E_API int e_client_volume_sink_min_get(const E_Client_Volume_Sink *mixer);
39E_API int e_client_volume_sink_max_get(const E_Client_Volume_Sink *mixer); 41E_API int e_client_volume_sink_max_get(const E_Client_Volume_Sink *mixer);
42E_API const char * e_client_volume_sink_name_get(const E_Client_Volume_Sink *mixer);
40E_API void e_client_volume_sink_append(E_Client *ec, E_Client_Volume_Sink *mixer); 43E_API void e_client_volume_sink_append(E_Client *ec, E_Client_Volume_Sink *mixer);
41E_API void e_client_volume_sink_remove(E_Client *ec, E_Client_Volume_Sink *mixer); 44E_API void e_client_volume_sink_remove(E_Client *ec, E_Client_Volume_Sink *mixer);
42E_API void e_client_volume_sink_update(E_Client_Volume_Sink *mixer); 45E_API void e_client_volume_sink_update(E_Client_Volume_Sink *mixer);
diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c
index 51c7e1f61..5c1880d7f 100644
--- a/src/modules/mixer/e_mod_main.c
+++ b/src/modules/mixer/e_mod_main.c
@@ -871,6 +871,15 @@ _sink_input_max_get(void *data EINA_UNUSED)
871 return emix_max_volume_get(); 871 return emix_max_volume_get();
872} 872}
873 873
874static const char *
875_sink_input_name_get(void *data)
876{
877 Emix_Sink_Input *input;
878
879 input = data;
880 return input->name;
881}
882
874static pid_t 883static pid_t
875_get_ppid(pid_t pid) 884_get_ppid(pid_t pid)
876{ 885{
@@ -926,10 +935,11 @@ _sink_input_event(int type, Emix_Sink_Input *input)
926 DBG("Sink found the client %s", 935 DBG("Sink found the client %s",
927 e_client_util_name_get(ec)); 936 e_client_util_name_get(ec));
928 sink = e_client_volume_sink_new(_sink_input_get, 937 sink = e_client_volume_sink_new(_sink_input_get,
929 _sink_input_set, 938 _sink_input_set,
930 _sink_input_min_get, 939 _sink_input_min_get,
931 _sink_input_max_get, 940 _sink_input_max_get,
932 input); 941 _sink_input_name_get,
942 input);
933 e_client_volume_sink_append(ec, sink); 943 e_client_volume_sink_append(ec, sink);
934 _client_sinks = eina_list_append(_client_sinks, sink); 944 _client_sinks = eina_list_append(_client_sinks, sink);
935 return; 945 return;