summaryrefslogtreecommitdiff
path: root/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ecore_audio/ecore_audio_obj_out_pulse.c')
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out_pulse.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
index 2c869fd..95aa0c0 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
@@ -61,10 +61,10 @@ _ecore_audio_out_pulse_ecore_audio_volume_set(Eo *eo_obj, Ecore_Audio_Out_Pulse_
61 61
62 pa_cvolume_set(&pa_volume, 2, volume * PA_VOLUME_NORM); 62 pa_cvolume_set(&pa_volume, 2, volume * PA_VOLUME_NORM);
63 63
64 eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_volume_set(volume)); 64 ecore_audio_obj_volume_set(eo_super(eo_obj, MY_CLASS), volume);
65 65
66 EINA_LIST_FOREACH(out_obj->inputs, input, in) { 66 EINA_LIST_FOREACH(out_obj->inputs, input, in) {
67 eo_do(in, stream = eo_key_data_get("pulse_data")); 67 stream = eo_key_data_get(in, "pulse_data");
68 idx = pa_stream_get_index(stream); 68 idx = pa_stream_get_index(stream);
69 pa_operation_unref(pa_context_set_sink_input_volume(class_vars.context, idx, &pa_volume, NULL, NULL)); 69 pa_operation_unref(pa_context_set_sink_input_volume(class_vars.context, idx, &pa_volume, NULL, NULL));
70 } 70 }
@@ -81,7 +81,7 @@ static void _write_cb(pa_stream *stream, size_t len, void *data)
81 81
82 pa_stream_begin_write(stream, &buf, &wlen); 82 pa_stream_begin_write(stream, &buf, &wlen);
83 83
84 eo_do(in, bread = ecore_audio_obj_in_read(buf, wlen)); 84 bread = ecore_audio_obj_in_read(in, buf, wlen);
85 85
86 pa_stream_write(stream, buf, bread, NULL, 0, PA_SEEK_RELATIVE); 86 pa_stream_write(stream, buf, bread, NULL, 0, PA_SEEK_RELATIVE);
87 if (bread < (int)len) 87 if (bread < (int)len)
@@ -96,10 +96,10 @@ static Eina_Bool _update_samplerate_cb(void *data EINA_UNUSED, const Eo_Event *e
96 int samplerate = 0; 96 int samplerate = 0;
97 double speed = 0; 97 double speed = 0;
98 98
99 eo_do(event->obj, samplerate = ecore_audio_obj_in_samplerate_get()); 99 samplerate = ecore_audio_obj_in_samplerate_get(event->obj);
100 eo_do(event->obj, speed = ecore_audio_obj_in_speed_get()); 100 speed = ecore_audio_obj_in_speed_get(event->obj);
101 101
102 eo_do(event->obj, stream = eo_key_data_get("pulse_data")); 102 stream = eo_key_data_get(event->obj, "pulse_data");
103 103
104 pa_operation_unref(pa_stream_update_sample_rate(stream, samplerate * speed, NULL, NULL)); 104 pa_operation_unref(pa_stream_update_sample_rate(stream, samplerate * speed, NULL, NULL));
105 105
@@ -115,28 +115,28 @@ static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in)
115 Eina_Bool ret = EINA_FALSE; 115 Eina_Bool ret = EINA_FALSE;
116 Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_CLASS); 116 Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_CLASS);
117 117
118 eo_do_super(eo_obj, MY_CLASS, ret = ecore_audio_obj_out_input_attach(in)); 118 ret = ecore_audio_obj_out_input_attach(eo_super(eo_obj, MY_CLASS), in);
119 if (!ret) 119 if (!ret)
120 return EINA_FALSE; 120 return EINA_FALSE;
121 121
122 ss.format = PA_SAMPLE_FLOAT32LE; 122 ss.format = PA_SAMPLE_FLOAT32LE;
123 eo_do(in, ss.rate = ecore_audio_obj_in_samplerate_get()); 123 ss.rate = ecore_audio_obj_in_samplerate_get(in);
124 eo_do(in, speed = ecore_audio_obj_in_speed_get()); 124 speed = ecore_audio_obj_in_speed_get(in);
125 eo_do(in, ss.channels = ecore_audio_obj_in_channels_get()); 125 ss.channels = ecore_audio_obj_in_channels_get(in);
126 eo_do(in, name = ecore_audio_obj_name_get()); 126 name = ecore_audio_obj_name_get(in);
127 127
128 ss.rate = ss.rate * speed; 128 ss.rate = ss.rate * speed;
129 129
130 stream = pa_stream_new(class_vars.context, name, &ss, NULL); 130 stream = pa_stream_new(class_vars.context, name, &ss, NULL);
131 if (!stream) { 131 if (!stream) {
132 ERR("Could not create stream"); 132 ERR("Could not create stream");
133 eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in)); 133 ecore_audio_obj_out_input_detach(eo_super(eo_obj, MY_CLASS), in);
134 return EINA_FALSE; 134 return EINA_FALSE;
135 } 135 }
136 136
137 eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, _update_samplerate_cb, eo_obj)); 137 eo_event_callback_add(in, ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, _update_samplerate_cb, eo_obj);
138 138
139 eo_do(in, eo_key_data_set("pulse_data", stream)); 139 eo_key_data_set(in, "pulse_data", stream);
140 140
141 141
142 pa_stream_set_write_callback(stream, _write_cb, in); 142 pa_stream_set_write_callback(stream, _write_cb, in);
@@ -151,7 +151,7 @@ static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in)
151static Eina_Bool _delayed_attach_cb(void *data, const Eo_Event *event) 151static Eina_Bool _delayed_attach_cb(void *data, const Eo_Event *event)
152{ 152{
153 Eo *in = data; 153 Eo *in = data;
154 eo_do(event->obj, eo_event_callback_del(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_READY, _delayed_attach_cb, in)); 154 eo_event_callback_del(event->obj, ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_READY, _delayed_attach_cb, in);
155 155
156 _input_attach_internal(event->obj, in); 156 _input_attach_internal(event->obj, in);
157 157
@@ -165,7 +165,7 @@ _ecore_audio_out_pulse_ecore_audio_out_input_attach(Eo *eo_obj, Ecore_Audio_Out_
165 165
166 if (class_vars.state != PA_CONTEXT_READY) { 166 if (class_vars.state != PA_CONTEXT_READY) {
167 DBG("Delaying input_attach because PA context is not ready."); 167 DBG("Delaying input_attach because PA context is not ready.");
168 eo_do(eo_obj, eo_event_callback_add(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_READY, _delayed_attach_cb, in)); 168 eo_event_callback_add(eo_obj, ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_READY, _delayed_attach_cb, in);
169 } else { 169 } else {
170 retval = _input_attach_internal(eo_obj, in); 170 retval = _input_attach_internal(eo_obj, in);
171 } 171 }
@@ -186,11 +186,11 @@ _ecore_audio_out_pulse_ecore_audio_out_input_detach(Eo *eo_obj, Ecore_Audio_Out_
186 Eina_Bool ret2 = EINA_FALSE; 186 Eina_Bool ret2 = EINA_FALSE;
187 pa_operation *op; 187 pa_operation *op;
188 188
189 eo_do_super(eo_obj, MY_CLASS, ret2 = ecore_audio_obj_out_input_detach(in)); 189 ret2 = ecore_audio_obj_out_input_detach(eo_super(eo_obj, MY_CLASS), in);
190 if (!ret2) 190 if (!ret2)
191 return EINA_FALSE; 191 return EINA_FALSE;
192 192
193 eo_do(in, stream = eo_key_data_get("pulse_data")); 193 stream = eo_key_data_get(in, "pulse_data");
194 194
195 pa_stream_set_write_callback(stream, NULL, NULL); 195 pa_stream_set_write_callback(stream, NULL, NULL);
196 op = pa_stream_drain(stream, _drain_cb, NULL); 196 op = pa_stream_drain(stream, _drain_cb, NULL);
@@ -221,12 +221,12 @@ static void _state_cb(pa_context *context, void *data EINA_UNUSED)
221 if (state == PA_CONTEXT_READY) { 221 if (state == PA_CONTEXT_READY) {
222 DBG("PA context ready."); 222 DBG("PA context ready.");
223 EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) { 223 EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
224 eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_READY, NULL)); 224 eo_event_callback_call(eo_obj, ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_READY, NULL);
225 } 225 }
226 } else if ((state == PA_CONTEXT_FAILED) || (state == PA_CONTEXT_TERMINATED)) { 226 } else if ((state == PA_CONTEXT_FAILED) || (state == PA_CONTEXT_TERMINATED)) {
227 DBG("PA context fail."); 227 DBG("PA context fail.");
228 EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) { 228 EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
229 eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL)); 229 eo_event_callback_call(eo_obj, ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL);
230 } 230 }
231 } else { 231 } else {
232 DBG("Connection state %i", state); 232 DBG("Connection state %i", state);
@@ -252,7 +252,7 @@ static void _state_job(void *data EINA_UNUSED)
252 } 252 }
253 // the callback here can delete things in the list.. 253 // the callback here can delete things in the list..
254 EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) { 254 EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
255 eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL)); 255 eo_event_callback_call(eo_obj, ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL);
256 } 256 }
257 // now unref everything safely 257 // now unref everything safely
258 EINA_LIST_FOREACH_SAFE(class_vars.outputs, out, tmp, eo_obj) { 258 EINA_LIST_FOREACH_SAFE(class_vars.outputs, out, tmp, eo_obj) {
@@ -269,7 +269,7 @@ _ecore_audio_out_pulse_eo_base_constructor(Eo *eo_obj, Ecore_Audio_Out_Pulse_Dat
269 char **argv; 269 char **argv;
270 Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OUT_CLASS); 270 Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OUT_CLASS);
271 271
272 eo_obj = eo_do_super_ret(eo_obj, MY_CLASS, eo_obj, eo_constructor()); 272 eo_obj = eo_constructor(eo_super(eo_obj, MY_CLASS));
273 273
274 out_obj->need_writer = EINA_FALSE; 274 out_obj->need_writer = EINA_FALSE;
275 275
@@ -296,7 +296,7 @@ EOLIAN static void
296_ecore_audio_out_pulse_eo_base_destructor(Eo *eo_obj, Ecore_Audio_Out_Pulse_Data *_pd EINA_UNUSED) 296_ecore_audio_out_pulse_eo_base_destructor(Eo *eo_obj, Ecore_Audio_Out_Pulse_Data *_pd EINA_UNUSED)
297{ 297{
298 class_vars.outputs = eina_list_remove(class_vars.outputs, eo_obj); 298 class_vars.outputs = eina_list_remove(class_vars.outputs, eo_obj);
299 eo_do_super(eo_obj, MY_CLASS, eo_destructor()); 299 eo_destructor(eo_super(eo_obj, MY_CLASS));
300} 300}
301 301
302#include "ecore_audio_out_pulse.eo.c" 302#include "ecore_audio_out_pulse.eo.c"