summaryrefslogtreecommitdiff
path: root/src/lib/ecore_audio
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-04-18 19:21:05 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-04-18 19:32:46 +0100
commite99ab4623a936e06758ae837fadd183d89d8c5d1 (patch)
tree2a92e90b4b14a9e1a3161caaf39d6d2d09872cd2 /src/lib/ecore_audio
parent43299ade4582fe5f56517a60aa93a0ceef34a82b (diff)
ecore_audio: Add return value to input_attach method
Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
Diffstat (limited to 'src/lib/ecore_audio')
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out.c3
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out.h2
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out_pulse.c16
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c3
4 files changed, 18 insertions, 6 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out.c b/src/lib/ecore_audio/ecore_audio_obj_out.c
index f4d39fdf80..141d26bc17 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out.c
@@ -25,6 +25,7 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
25 Ecore_Audio_Input *in; 25 Ecore_Audio_Input *in;
26 26
27 Eo *input = va_arg(*list, Eo *); 27 Eo *input = va_arg(*list, Eo *);
28 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
28 29
29 in = eo_data_get(input, ECORE_AUDIO_OBJ_IN_CLASS); 30 in = eo_data_get(input, ECORE_AUDIO_OBJ_IN_CLASS);
30 31
@@ -37,6 +38,8 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
37 38
38 obj->inputs = eina_list_append(obj->inputs, input); 39 obj->inputs = eina_list_append(obj->inputs, input);
39 40
41 if (ret)
42 *ret = EINA_TRUE;
40} 43}
41 44
42static void _input_detach(Eo *eo_obj, void *_pd, va_list *list) 45static void _input_detach(Eo *eo_obj, void *_pd, va_list *list)
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out.h b/src/lib/ecore_audio/ecore_audio_obj_out.h
index 7fc0cf7dd5..ec5e9bf773 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out.h
+++ b/src/lib/ecore_audio/ecore_audio_obj_out.h
@@ -49,7 +49,7 @@ enum Ecore_Audio_Obj_Out_Sub_Ids
49 49
50#define ECORE_AUDIO_OBJ_OUT_ID(sub_id) (ECORE_AUDIO_OBJ_OUT_BASE_ID + EO_TYPECHECK(enum Ecore_Audio_Obj_Out_Sub_Ids, sub_id)) 50#define ECORE_AUDIO_OBJ_OUT_ID(sub_id) (ECORE_AUDIO_OBJ_OUT_BASE_ID + EO_TYPECHECK(enum Ecore_Audio_Obj_Out_Sub_Ids, sub_id))
51 51
52#define ecore_audio_obj_out_input_attach(input) ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_ATTACH), EO_TYPECHECK(Eo *, input) 52#define ecore_audio_obj_out_input_attach(input, ret) ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_ATTACH), EO_TYPECHECK(Eo *, input), EO_TYPECHECK(Eina_Bool *, ret)
53 53
54#define ecore_audio_obj_out_input_detach(input) ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_DETACH), EO_TYPECHECK(Eo *, input) 54#define ecore_audio_obj_out_input_detach(input) ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_DETACH), EO_TYPECHECK(Eo *, input)
55 55
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 c103b738cd..3e3a1ba490 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
@@ -106,12 +106,13 @@ static Eina_Bool _update_samplerate_cb(void *data, Eo *eo_obj, const Eo_Event_De
106 pa_operation_unref(pa_stream_update_sample_rate(stream, samplerate * speed, NULL, NULL)); 106 pa_operation_unref(pa_stream_update_sample_rate(stream, samplerate * speed, NULL, NULL));
107} 107}
108 108
109static void _input_attach_internal(Eo *eo_obj, Eo *in) 109static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in)
110{ 110{
111 const char *name; 111 const char *name;
112 pa_sample_spec ss; 112 pa_sample_spec ss;
113 double speed; 113 double speed;
114 pa_stream *stream; 114 pa_stream *stream;
115 Eina_Bool ret;
115 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); 116 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
116 117
117 ss.format = PA_SAMPLE_FLOAT32LE; 118 ss.format = PA_SAMPLE_FLOAT32LE;
@@ -125,10 +126,10 @@ static void _input_attach_internal(Eo *eo_obj, Eo *in)
125 stream = pa_stream_new(class_vars.context, name, &ss, NULL); 126 stream = pa_stream_new(class_vars.context, name, &ss, NULL);
126 if (!stream) { 127 if (!stream) {
127 ERR("Could not create stream"); 128 ERR("Could not create stream");
128 return; 129 return EINA_FALSE;
129 } 130 }
130 131
131 eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in)); 132 eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, &ret));
132 133
133 eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED, _update_samplerate_cb, eo_obj)); 134 eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED, _update_samplerate_cb, eo_obj));
134 135
@@ -138,6 +139,8 @@ static void _input_attach_internal(Eo *eo_obj, Eo *in)
138 139
139 pa_stream_set_write_callback(stream, _write_cb, in); 140 pa_stream_set_write_callback(stream, _write_cb, in);
140 pa_stream_connect_playback(stream, NULL, NULL, PA_STREAM_VARIABLE_RATE, NULL, NULL); 141 pa_stream_connect_playback(stream, NULL, NULL, PA_STREAM_VARIABLE_RATE, NULL, NULL);
142
143 return ret;
141} 144}
142 145
143static Eina_Bool _delayed_attach_cb(void *data, Eo *eo_obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) 146static Eina_Bool _delayed_attach_cb(void *data, Eo *eo_obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
@@ -152,14 +155,19 @@ static Eina_Bool _delayed_attach_cb(void *data, Eo *eo_obj, const Eo_Event_Descr
152 155
153static void _input_attach(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) 156static void _input_attach(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
154{ 157{
158 Eina_Bool retval = EINA_TRUE;
159
155 Eo *in = va_arg(*list, Eo *); 160 Eo *in = va_arg(*list, Eo *);
161 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
156 162
157 if (class_vars.state != PA_CONTEXT_READY) { 163 if (class_vars.state != PA_CONTEXT_READY) {
158 DBG("Delaying input_attach because PA context is not ready."); 164 DBG("Delaying input_attach because PA context is not ready.");
159 eo_do(eo_obj, eo_event_callback_add(ECORE_AUDIO_EV_OUT_PULSE_CONTEXT_READY, _delayed_attach_cb, in)); 165 eo_do(eo_obj, eo_event_callback_add(ECORE_AUDIO_EV_OUT_PULSE_CONTEXT_READY, _delayed_attach_cb, in));
160 } else { 166 } else {
161 _input_attach_internal(eo_obj, in); 167 retval = _input_attach_internal(eo_obj, in);
162 } 168 }
169 if (ret)
170 *ret = retval;
163} 171}
164 172
165static void _drain_cb(pa_stream *stream, int success EINA_UNUSED, void *data EINA_UNUSED) 173static void _drain_cb(pa_stream *stream, int success EINA_UNUSED, void *data EINA_UNUSED)
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c b/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c
index b5fd2d59ff..db0ca4b19f 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c
@@ -66,8 +66,9 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
66 Ecore_Audio_Output *out_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS); 66 Ecore_Audio_Output *out_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
67 67
68 Eo *in = va_arg(*list, Eo *); 68 Eo *in = va_arg(*list, Eo *);
69 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
69 70
70 eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in)); 71 eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, ret));
71 72
72 eo_do(in, ecore_audio_obj_in_samplerate_get(&obj->sfinfo.samplerate)); 73 eo_do(in, ecore_audio_obj_in_samplerate_get(&obj->sfinfo.samplerate));
73 eo_do(in, ecore_audio_obj_in_channels_get(&obj->sfinfo.channels)); 74 eo_do(in, ecore_audio_obj_in_channels_get(&obj->sfinfo.channels));