summaryrefslogtreecommitdiff
path: root/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-04-23 17:10:16 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-04-23 17:13:39 +0100
commit97d4b50c91adcb8b779f5449b27e2265f2f243f0 (patch)
tree4528951705a4f945f451401a04db900be02e58c2 /src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c
parent4e3804041f8e865e007b2a6a0d45a05f39500c3b (diff)
ecore_audio: Add more return values for methods, catch up with API
input_attach, input_detach, format_set, and source_set now return an Eina_Bool Tests, examples and edje_multisense adapted Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
Diffstat (limited to '')
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c30
1 files changed, 28 insertions, 2 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 99e89d1838..68c2a3d84f 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c
@@ -64,11 +64,17 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
64 Ecore_Audio_Sndfile *obj = _pd; 64 Ecore_Audio_Sndfile *obj = _pd;
65 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); 65 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
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 Eina_Bool ret2;
67 68
68 Eo *in = va_arg(*list, Eo *); 69 Eo *in = va_arg(*list, Eo *);
69 Eina_Bool *ret = va_arg(*list, Eina_Bool *); 70 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
70 71
71 eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, ret)); 72 if (ret)
73 *ret = EINA_FALSE;
74
75 eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, &ret2));
76 if (!ret2)
77 return;
72 78
73 eo_do(in, ecore_audio_obj_in_samplerate_get(&obj->sfinfo.samplerate)); 79 eo_do(in, ecore_audio_obj_in_samplerate_get(&obj->sfinfo.samplerate));
74 eo_do(in, ecore_audio_obj_in_channels_get(&obj->sfinfo.channels)); 80 eo_do(in, ecore_audio_obj_in_channels_get(&obj->sfinfo.channels));
@@ -78,9 +84,13 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
78 if (!obj->handle) { 84 if (!obj->handle) {
79 eina_stringshare_del(ea_obj->source); 85 eina_stringshare_del(ea_obj->source);
80 ea_obj->source = NULL; 86 ea_obj->source = NULL;
87 eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in, NULL));
81 return; 88 return;
82 } 89 }
83 90
91 if (ret)
92 *ret = EINA_TRUE;
93
84 if (ea_obj->paused) 94 if (ea_obj->paused)
85 return; 95 return;
86 96
@@ -96,6 +106,10 @@ static void _source_set(Eo *eo_obj, void *_pd, va_list *list)
96 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); 106 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
97 107
98 const char *source = va_arg(*list, const char *); 108 const char *source = va_arg(*list, const char *);
109 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
110
111 if (ret)
112 *ret = EINA_FALSE;
99 113
100 if (obj->handle) { 114 if (obj->handle) {
101 sf_close(obj->handle); 115 sf_close(obj->handle);
@@ -107,6 +121,11 @@ static void _source_set(Eo *eo_obj, void *_pd, va_list *list)
107 if (!ea_obj->source) 121 if (!ea_obj->source)
108 return; 122 return;
109 123
124 //FIXME: Open the file here
125
126 if (ret)
127 *ret = EINA_TRUE;
128
110} 129}
111 130
112static void _source_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) 131static void _source_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
@@ -125,9 +144,12 @@ static void _format_set(Eo *eo_obj, void *_pd, va_list *list)
125 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); 144 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
126 145
127 Ecore_Audio_Format format= va_arg(*list, Ecore_Audio_Format); 146 Ecore_Audio_Format format= va_arg(*list, Ecore_Audio_Format);
147 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
128 148
129 if (ea_obj->source) { 149 if (ea_obj->source) {
130 ERR("Input is already open - cannot change format"); 150 ERR("Input is already open - cannot change format");
151 if (ret)
152 *ret = EINA_FALSE;
131 return; 153 return;
132 } 154 }
133 155
@@ -145,9 +167,13 @@ static void _format_set(Eo *eo_obj, void *_pd, va_list *list)
145 break; 167 break;
146 default: 168 default:
147 ERR("Format not supported!"); 169 ERR("Format not supported!");
170 if (ret)
171 *ret = EINA_FALSE;
148 return; 172 return;
149 } 173 }
150 ea_obj->format = format; 174 ea_obj->format = format;
175 if (ret)
176 *ret = EINA_TRUE;
151} 177}
152 178
153static void _format_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) 179static void _format_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
@@ -164,7 +190,7 @@ static void _constructor(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_U
164{ 190{
165 eo_do_super(eo_obj, MY_CLASS, eo_constructor()); 191 eo_do_super(eo_obj, MY_CLASS, eo_constructor());
166 192
167 eo_do(eo_obj, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_OGG)); 193 eo_do(eo_obj, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_OGG, NULL));
168} 194}
169 195
170static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) 196static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)