summaryrefslogtreecommitdiff
path: root/src/lib/ecore_audio
diff options
context:
space:
mode:
authorYossi Kantor <yossi.kantor@samsung.com>2014-03-26 18:01:36 +0200
committerDaniel Zaoui <daniel.zaoui@samsung.com>2014-04-02 15:56:14 +0300
commit70b39368e61e6740e741f8ff34bb0c1bddbaaacd (patch)
tree499532c919e7e9229499a095bd8783590117bd41 /src/lib/ecore_audio
parent2c8bc8df52d7d5774475e01c4c296145c1581f13 (diff)
Eolian: Integration of Ecore Audio Out
Diffstat (limited to 'src/lib/ecore_audio')
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out.c100
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out.h3
-rw-r--r--src/lib/ecore_audio/ecore_audio_out.eo42
3 files changed, 63 insertions, 82 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out.c b/src/lib/ecore_audio/ecore_audio_obj_out.c
index b269411c21..40d16004e9 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out.c
@@ -14,8 +14,6 @@
14 14
15#include "ecore_audio_private.h" 15#include "ecore_audio_private.h"
16 16
17EAPI Eo_Op ECORE_AUDIO_OBJ_OUT_BASE_ID = EO_NOOP;
18
19#define MY_CLASS ECORE_AUDIO_OBJ_OUT_CLASS 17#define MY_CLASS ECORE_AUDIO_OBJ_OUT_CLASS
20#define MY_CLASS_NAME "Ecore_Audio_Out" 18#define MY_CLASS_NAME "Ecore_Audio_Out"
21 19
@@ -51,23 +49,17 @@ static Eina_Bool _write_cb(void *data)
51 return EINA_TRUE; 49 return EINA_TRUE;
52} 50}
53 51
54static void _input_attach(Eo *eo_obj, void *_pd, va_list *list) 52EOLIAN static Eina_Bool
53_ecore_audio_out_input_attach(Eo *eo_obj, Ecore_Audio_Output *obj, Eo *input)
55{ 54{
56 Ecore_Audio_Output *obj = _pd;
57 Ecore_Audio_Input *in; 55 Ecore_Audio_Input *in;
58 56
59 Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); 57 Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
60 58
61 Eo *input = va_arg(*list, Eo *);
62 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
63
64 in = eo_data_scope_get(input, ECORE_AUDIO_OBJ_IN_CLASS); 59 in = eo_data_scope_get(input, ECORE_AUDIO_OBJ_IN_CLASS);
65 60
66 if (ret)
67 *ret = EINA_FALSE;
68
69 if (in->output == eo_obj) 61 if (in->output == eo_obj)
70 return; 62 return EINA_FALSE;
71 63
72 if (in->output) eo_do(in->output, ecore_audio_obj_out_input_detach(input, NULL)); 64 if (in->output) eo_do(in->output, ecore_audio_obj_out_input_detach(input, NULL));
73 in->output = eo_obj; 65 in->output = eo_obj;
@@ -81,25 +73,18 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
81 obj->write_idler = ecore_idler_add(_write_cb, eo_obj); 73 obj->write_idler = ecore_idler_add(_write_cb, eo_obj);
82 74
83 75
84 if (ret) 76 return EINA_TRUE;
85 *ret = EINA_TRUE;
86} 77}
87 78
88static void _input_detach(Eo *eo_obj, void *_pd, va_list *list) 79EOLIAN static Eina_Bool
80_ecore_audio_out_input_detach(Eo *eo_obj, Ecore_Audio_Output *obj, Eo *input)
89{ 81{
90 Ecore_Audio_Output *obj = _pd;
91 Ecore_Audio_Input *in; 82 Ecore_Audio_Input *in;
92 83
93 Eo *input = va_arg(*list, Eo *);
94 Eina_Bool *ret = va_arg(*list, Eina_Bool *);
95
96 in = eo_data_scope_get(input, ECORE_AUDIO_OBJ_IN_CLASS); 84 in = eo_data_scope_get(input, ECORE_AUDIO_OBJ_IN_CLASS);
97 85
98 if (ret)
99 *ret = EINA_FALSE;
100
101 if (in->output != eo_obj) 86 if (in->output != eo_obj)
102 return; 87 return EINA_FALSE;
103 88
104 in->output = NULL; 89 in->output = NULL;
105 90
@@ -109,18 +94,13 @@ static void _input_detach(Eo *eo_obj, void *_pd, va_list *list)
109 94
110 obj->inputs = eina_list_remove(obj->inputs, input); 95 obj->inputs = eina_list_remove(obj->inputs, input);
111 96
112 if (ret) 97 return EINA_TRUE;
113 *ret = EINA_TRUE;
114} 98}
115 99
116static void _inputs_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) 100EOLIAN static Eina_List *
101_ecore_audio_out_inputs_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Output *obj)
117{ 102{
118 const Ecore_Audio_Output *obj = _pd; 103 return obj->inputs;
119
120 Eina_List **inputs = va_arg(*list, Eina_List **);
121
122 if (inputs)
123 *inputs = obj->inputs;
124} 104}
125 105
126static void _free_vio(Ecore_Audio_Object *ea_obj) 106static void _free_vio(Ecore_Audio_Object *ea_obj)
@@ -132,14 +112,11 @@ static void _free_vio(Ecore_Audio_Object *ea_obj)
132 ea_obj->vio = NULL; 112 ea_obj->vio = NULL;
133} 113}
134 114
135static void _vio_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) 115EOLIAN static void
116_ecore_audio_out_ecore_audio_vio_set(Eo *eo_obj, Ecore_Audio_Output *_pd EINA_UNUSED, Ecore_Audio_Vio *vio, void *data, eo_base_data_free_func free_func)
136{ 117{
137 Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); 118 Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
138 119
139 Ecore_Audio_Vio *vio = va_arg(*list, Ecore_Audio_Vio *);
140 void *data = va_arg(*list, Ecore_Audio_Vio *);
141 eo_base_data_free_func free_func = va_arg(*list, eo_base_data_free_func);
142
143 if (ea_obj->vio) 120 if (ea_obj->vio)
144 _free_vio(ea_obj); 121 _free_vio(ea_obj);
145 122
@@ -152,18 +129,17 @@ static void _vio_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
152 ea_obj->vio->free_func = free_func; 129 ea_obj->vio->free_func = free_func;
153} 130}
154 131
155static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) 132EOLIAN static void
133_ecore_audio_out_eo_base_constructor(Eo *eo_obj, Ecore_Audio_Output *obj)
156{ 134{
157 Ecore_Audio_Output *obj = _pd;
158
159 eo_do_super(eo_obj, MY_CLASS, eo_constructor()); 135 eo_do_super(eo_obj, MY_CLASS, eo_constructor());
160 136
161 obj->need_writer = EINA_TRUE; 137 obj->need_writer = EINA_TRUE;
162} 138}
163 139
164static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) 140EOLIAN static void
141_ecore_audio_out_eo_base_destructor(Eo *eo_obj, Ecore_Audio_Output *obj)
165{ 142{
166 const Ecore_Audio_Output *obj = _pd;
167 Eina_List *cur, *tmp; 143 Eina_List *cur, *tmp;
168 Eo *in; 144 Eo *in;
169 145
@@ -174,44 +150,4 @@ static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
174 eo_do_super(eo_obj, MY_CLASS, eo_destructor()); 150 eo_do_super(eo_obj, MY_CLASS, eo_destructor());
175} 151}
176 152
177static void _class_constructor(Eo_Class *klass) 153#include "ecore_audio_out.eo.c"
178{
179 const Eo_Op_Func_Description func_desc[] = {
180 /* Virtual functions of parent class implemented in this class */
181 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
182 EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
183
184 EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VIO_SET), _vio_set),
185 /* Specific functions to this class */
186 EO_OP_FUNC(ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_ATTACH), _input_attach),
187 EO_OP_FUNC(ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_DETACH), _input_detach),
188 EO_OP_FUNC(ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUTS_GET), _inputs_get),
189
190 EO_OP_FUNC_SENTINEL
191 };
192
193 eo_class_funcs_set(klass, func_desc);
194}
195
196#define S(val) "Sets the " #val " of the output."
197#define G(val) "Gets the " #val " of the output."
198
199static const Eo_Op_Description op_desc[] = {
200 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_ATTACH, "Add an input."),
201 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_DETACH, "Delete an input."),
202 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUTS_GET, "Get the connected inputs."),
203 EO_OP_DESCRIPTION_SENTINEL
204};
205
206static const Eo_Class_Description class_desc = {
207 EO_VERSION,
208 MY_CLASS_NAME,
209 EO_CLASS_TYPE_REGULAR,
210 EO_CLASS_DESCRIPTION_OPS(&ECORE_AUDIO_OBJ_OUT_BASE_ID, op_desc, ECORE_AUDIO_OBJ_OUT_SUB_ID_LAST),
211 NULL,
212 sizeof(Ecore_Audio_Output),
213 _class_constructor,
214 NULL
215};
216
217EO_DEFINE_CLASS(ecore_audio_obj_out_class_get, &class_desc, ECORE_AUDIO_OBJ_CLASS, NULL);
diff --git a/src/lib/ecore_audio/ecore_audio_obj_out.h b/src/lib/ecore_audio/ecore_audio_obj_out.h
index 0052545306..bd5bd64df3 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out.h
+++ b/src/lib/ecore_audio/ecore_audio_obj_out.h
@@ -33,7 +33,9 @@ extern "C"
33 * @ingroup Ecore_Audio_Group 33 * @ingroup Ecore_Audio_Group
34 * @{ 34 * @{
35 */ 35 */
36#include "ecore_audio_out.eo.h"
36 37
38#if 0
37#define ECORE_AUDIO_OBJ_OUT_CLASS ecore_audio_obj_out_class_get() /**< Ecore_Audio output object class */ 39#define ECORE_AUDIO_OBJ_OUT_CLASS ecore_audio_obj_out_class_get() /**< Ecore_Audio output object class */
38 40
39/** 41/**
@@ -85,6 +87,7 @@ enum Ecore_Audio_Obj_Out_Sub_Ids
85 */ 87 */
86#define ecore_audio_obj_out_inputs_get(inputs) ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUTS_GET), EO_TYPECHECK(Eina_List **, inputs) 88#define ecore_audio_obj_out_inputs_get(inputs) ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUTS_GET), EO_TYPECHECK(Eina_List **, inputs)
87 89
90#endif
88/** 91/**
89 * @} 92 * @}
90 */ 93 */
diff --git a/src/lib/ecore_audio/ecore_audio_out.eo b/src/lib/ecore_audio/ecore_audio_out.eo
new file mode 100644
index 0000000000..4b9ef89fe8
--- /dev/null
+++ b/src/lib/ecore_audio/ecore_audio_out.eo
@@ -0,0 +1,42 @@
1class Ecore_Audio_Out (Ecore_Audio)
2{
3 eo_prefix: ecore_audio_obj_out;
4 data: Ecore_Audio_Output;
5 methods {
6 input_attach {
7 /*@
8 Attach an input to an output
9
10 @since 1.8 */
11 legacy null;
12 return Eina_Bool; /*EINA_TRUE if the input was attached, EINA_FALSE otherwise*/
13 params {
14 @in Eo *input; /*The input to attach to the output*/
15 }
16 }
17 input_detach {
18 /*@
19 Detach an input from an output
20
21 @since 1.8 */
22 legacy null;
23 return Eina_Bool; /*EINA_TRUE if the input was detached, EINA_FALSE otherwise*/
24 params {
25 @in Eo *input; /*he input to detach to the output*/
26 }
27 }
28 inputs_get {
29 /*@
30 Returns the list of all attached inputs
31
32 @since 1.8 */
33 legacy null;
34 return Eina_List *; /*An @ref Eina_List of the inputs that are attached to the output*/
35 }
36 }
37 implements {
38 Eo_Base::constructor;
39 Eo_Base::destructor;
40 Ecore_Audio::vio_set;
41 }
42} \ No newline at end of file