summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-04-26 18:24:15 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-04-26 18:49:24 +0100
commit72870c0b6ebc564cff283ce7549972bccd79e6df (patch)
tree6f5d7f0ca172ab8e08fde73875c53c2d3dcae137
parent3fdc608da16d5071a5b0f3a2b3be4a1e2f7124bc (diff)
ecore_audio: Remove duplicate variables/move to appropriate place
* The idler for the write callback is now in the output struct because different outputs might need it. * Remove paused attribute from output - we have it in Ecore_Audio_Object already Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c13
-rw-r--r--src/lib/ecore_audio/ecore_audio_private.h3
2 files changed, 8 insertions, 8 deletions
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 0d62283..3e90590 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c
@@ -26,7 +26,6 @@ struct _Ecore_Audio_Sndfile
26 SNDFILE *handle; 26 SNDFILE *handle;
27 SF_INFO sfinfo; 27 SF_INFO sfinfo;
28 Ecore_Audio_Vio *vio; 28 Ecore_Audio_Vio *vio;
29 Ecore_Idler *idler;
30}; 29};
31 30
32typedef struct _Ecore_Audio_Sndfile Ecore_Audio_Sndfile; 31typedef struct _Ecore_Audio_Sndfile Ecore_Audio_Sndfile;
@@ -38,6 +37,7 @@ static Eina_Bool _write_cb(void *data)
38 37
39 Ecore_Audio_Sndfile *obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS); 38 Ecore_Audio_Sndfile *obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS);
40 Ecore_Audio_Output *out_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS); 39 Ecore_Audio_Output *out_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
40 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
41 41
42 ssize_t written, bread; 42 ssize_t written, bread;
43 float buf[1024]; 43 float buf[1024];
@@ -49,8 +49,8 @@ static Eina_Bool _write_cb(void *data)
49 49
50 if (bread == 0) { 50 if (bread == 0) {
51 sf_write_sync(obj->handle); 51 sf_write_sync(obj->handle);
52 out_obj->paused = EINA_TRUE; 52 ea_obj->paused = EINA_TRUE;
53 obj->idler = NULL; 53 out_obj->write_idler = NULL;
54 return EINA_FALSE; 54 return EINA_FALSE;
55 } 55 }
56 written = sf_write_float(obj->handle, buf, bread/4)*4; 56 written = sf_write_float(obj->handle, buf, bread/4)*4;
@@ -97,7 +97,7 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
97 return; 97 return;
98 98
99 if (out_obj->inputs) { 99 if (out_obj->inputs) {
100 obj->idler = ecore_idler_add(_write_cb, eo_obj); 100 out_obj->write_idler = ecore_idler_add(_write_cb, eo_obj);
101 } 101 }
102} 102}
103 103
@@ -198,11 +198,12 @@ static void _constructor(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_U
198static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) 198static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
199{ 199{
200 Ecore_Audio_Sndfile *obj = _pd; 200 Ecore_Audio_Sndfile *obj = _pd;
201 Ecore_Audio_Output *out_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
201 202
202 if (obj->handle) 203 if (obj->handle)
203 sf_close(obj->handle); 204 sf_close(obj->handle);
204 if (obj->idler) 205 if (out_obj->write_idler)
205 ecore_idler_del(obj->idler); 206 ecore_idler_del(out_obj->write_idler);
206 207
207 eo_do_super(eo_obj, MY_CLASS, eo_destructor()); 208 eo_do_super(eo_obj, MY_CLASS, eo_destructor());
208} 209}
diff --git a/src/lib/ecore_audio/ecore_audio_private.h b/src/lib/ecore_audio/ecore_audio_private.h
index 0b0bfec..a7a8915 100644
--- a/src/lib/ecore_audio/ecore_audio_private.h
+++ b/src/lib/ecore_audio/ecore_audio_private.h
@@ -117,9 +117,8 @@ struct _Ecore_Audio_Object
117 */ 117 */
118struct _Ecore_Audio_Output 118struct _Ecore_Audio_Output
119{ 119{
120 Eina_Bool paused;
121
122 Eina_List *inputs; /**< The inputs that are connected to this output */ 120 Eina_List *inputs; /**< The inputs that are connected to this output */
121 Ecore_Idler *write_idler;
123}; 122};
124 123
125/** 124/**