summaryrefslogtreecommitdiff
path: root/src/lib/ecore_audio
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-04-17 18:52:14 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-04-18 19:14:32 +0100
commit01e4c9597e344ce4e34f7889883452ae0dd0a928 (patch)
tree31ebfb35c104e8c7cd9a62fa5f2ded2415eaf9a6 /src/lib/ecore_audio
parent76509b23406cb0349e183ddbf5a4f05c076b40ce (diff)
ecore_audio: Change signature of read function, reorder methods
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_in.c65
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in.h2
2 files changed, 34 insertions, 33 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in.c b/src/lib/ecore_audio/ecore_audio_obj_in.c
index 92dc48d982..983b310e5a 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in.c
@@ -114,16 +114,41 @@ static void _looped_get(Eo *eo_obj, void *_pd, va_list *list)
114 *ret = obj->looped; 114 *ret = obj->looped;
115} 115}
116 116
117static void _length_get(Eo *eo_obj, void *_pd, va_list *list)
118{
119 const Ecore_Audio_Input *obj = _pd;
120
121 double *ret = va_arg(*list, double *);
122
123 if (ret) {
124 *ret = obj->length;
125 }
126}
127
128static void _remaining_get(Eo *eo_obj, void *_pd, va_list *list)
129{
130 const Ecore_Audio_Input *obj = _pd;
131 Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
132
133 double *ret = va_arg(*list, double *);
134
135 if (ret) {
136 eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_CUR, ret));
137 *ret = obj->length - *ret;
138 }
139}
140
117static void _read(Eo *eo_obj, void *_pd, va_list *list) 141static void _read(Eo *eo_obj, void *_pd, va_list *list)
118{ 142{
119 const Ecore_Audio_Input *obj = _pd; 143 const Ecore_Audio_Input *obj = _pd;
120 int len_read = 0; 144 ssize_t len_read = 0;
145 const Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
121 146
122 char *buf = va_arg(*list, char *); 147 char *buf = va_arg(*list, char *);
123 int len = va_arg(*list, int); 148 size_t len = va_arg(*list, size_t);
124 int *ret = va_arg(*list, int *); 149 ssize_t *ret = va_arg(*list, ssize_t *);
125 150
126 if (obj->paused) { 151 if (ea_obj->paused) {
127 memset(buf, 0, len); 152 memset(buf, 0, len);
128 len_read = len; 153 len_read = len;
129 } else { 154 } else {
@@ -144,29 +169,6 @@ static void _read(Eo *eo_obj, void *_pd, va_list *list)
144 *ret = len_read; 169 *ret = len_read;
145} 170}
146 171
147static void _length_get(Eo *eo_obj, void *_pd, va_list *list)
148{
149 const Ecore_Audio_Input *obj = _pd;
150
151 double *ret = va_arg(*list, double *);
152
153 if (ret) {
154 *ret = obj->length;
155 }
156}
157
158static void _remaining_get(Eo *eo_obj, void *_pd, va_list *list)
159{
160 const Ecore_Audio_Input *obj = _pd;
161
162 double *ret = va_arg(*list, double *);
163
164 if (ret) {
165 eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_CUR, ret));
166 *ret = obj->length - *ret;
167 }
168}
169
170static void _output_get(Eo *eo_obj, void *_pd, va_list *list) 172static void _output_get(Eo *eo_obj, void *_pd, va_list *list)
171{ 173{
172 const Ecore_Audio_Input *obj = _pd; 174 const Ecore_Audio_Input *obj = _pd;
@@ -210,13 +212,12 @@ static void _class_constructor(Eo_Class *klass)
210 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SAMPLERATE_GET), _samplerate_get), 212 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SAMPLERATE_GET), _samplerate_get),
211 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_CHANNELS_SET), _channels_set), 213 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_CHANNELS_SET), _channels_set),
212 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_CHANNELS_GET), _channels_get), 214 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_CHANNELS_GET), _channels_get),
213 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_PRELOADED_SET), NULL), 215 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET), _looped_set),
214 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_PRELOADED_GET), NULL), 216 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET), _looped_get),
215 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ), _read),
216 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK), NULL),
217 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET), _output_get),
218 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET), _length_get), 217 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET), _length_get),
219 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET), _remaining_get), 218 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET), _remaining_get),
219 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ), _read),
220 EO_OP_FUNC(ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET), _output_get),
220 221
221 EO_OP_FUNC_SENTINEL 222 EO_OP_FUNC_SENTINEL
222 }; 223 };
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in.h b/src/lib/ecore_audio/ecore_audio_obj_in.h
index f2aa6e3290..9d88df51fe 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in.h
+++ b/src/lib/ecore_audio/ecore_audio_obj_in.h
@@ -104,7 +104,7 @@ enum Ecore_Audio_Obj_In_Sub_Ids
104 104
105#define ecore_audio_obj_in_length_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET), EO_TYPECHECK(double *, ret) 105#define ecore_audio_obj_in_length_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET), EO_TYPECHECK(double *, ret)
106 106
107#define ecore_audio_obj_in_read(buf, len, ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ), EO_TYPECHECK(char *, buf), EO_TYPECHECK(int, len), EO_TYPECHECK(int *, ret) 107#define ecore_audio_obj_in_read(buf, len, ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ), EO_TYPECHECK(char *, buf), EO_TYPECHECK(size_t, len), EO_TYPECHECK(ssize_t *, ret)
108 108
109#define ecore_audio_obj_in_seek(offs, mode, ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK), EO_TYPECHECK(double, offs), EO_TYPECHECK(int, mode), EO_TYPECHECK(double *, ret) 109#define ecore_audio_obj_in_seek(offs, mode, ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK), EO_TYPECHECK(double, offs), EO_TYPECHECK(int, mode), EO_TYPECHECK(double *, ret)
110 110