Eolian: Integration of Ecore Audio Out
authorYossi Kantor <yossi.kantor@samsung.com>
Wed, 26 Mar 2014 16:01:36 +0000 (18:01 +0200)
committerDaniel Zaoui <daniel.zaoui@samsung.com>
Wed, 2 Apr 2014 12:56:14 +0000 (15:56 +0300)
src/Makefile_Ecore_Audio.am
src/lib/ecore_audio/ecore_audio_obj_out.c
src/lib/ecore_audio/ecore_audio_obj_out.h
src/lib/ecore_audio/ecore_audio_out.eo [new file with mode: 0644]
src/tests/ecore/ecore_test_ecore_audio.c

index 6124f34..f5efa95 100644 (file)
@@ -6,12 +6,15 @@ BUILT_SOURCES += \
                  lib/ecore_audio/ecore_audio.eo.c \
                  lib/ecore_audio/ecore_audio.eo.h \
                  lib/ecore_audio/ecore_audio_in.eo.c \
-                 lib/ecore_audio/ecore_audio_in.eo.h
+                 lib/ecore_audio/ecore_audio_in.eo.h \
+                 lib/ecore_audio/ecore_audio_out.eo.c \
+                 lib/ecore_audio/ecore_audio_out.eo.h
 
 ecore_audioeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
 ecore_audioeolianfiles_DATA = \
               lib/ecore_audio/ecore_audio.eo \
-              lib/ecore_audio/ecore_audio_in.eo
+              lib/ecore_audio/ecore_audio_in.eo \
+              lib/ecore_audio/ecore_audio_out.eo
 
 EXTRA_DIST += \
               ${ecore_audioeolianfiles_DATA}
@@ -29,7 +32,8 @@ lib/ecore_audio/ecore_audio_protected.h
 
 nodist_installed_ecoreaudiomainheaders_DATA = \
                                         lib/ecore_audio/ecore_audio.eo.h \
-                                        lib/ecore_audio/ecore_audio_in.eo.h
+                                        lib/ecore_audio/ecore_audio_in.eo.h \
+                                        lib/ecore_audio/ecore_audio_out.eo.h
                                       
 lib_ecore_audio_libecore_audio_la_SOURCES = \
 lib/ecore_audio/ecore_audio.c \
index b269411..40d1600 100644 (file)
@@ -14,8 +14,6 @@
 
 #include "ecore_audio_private.h"
 
-EAPI Eo_Op ECORE_AUDIO_OBJ_OUT_BASE_ID = EO_NOOP;
-
 #define MY_CLASS ECORE_AUDIO_OBJ_OUT_CLASS
 #define MY_CLASS_NAME "Ecore_Audio_Out"
 
@@ -51,23 +49,17 @@ static Eina_Bool _write_cb(void *data)
   return EINA_TRUE;
 }
 
-static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
+EOLIAN static Eina_Bool
+_ecore_audio_out_input_attach(Eo *eo_obj, Ecore_Audio_Output *obj, Eo *input)
 {
-  Ecore_Audio_Output *obj = _pd;
   Ecore_Audio_Input *in;
 
   Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
 
-  Eo *input = va_arg(*list, Eo *);
-  Eina_Bool *ret = va_arg(*list, Eina_Bool *);
-
   in = eo_data_scope_get(input, ECORE_AUDIO_OBJ_IN_CLASS);
 
-  if (ret)
-    *ret = EINA_FALSE;
-
   if (in->output == eo_obj)
-    return;
+    return EINA_FALSE;
 
   if (in->output) eo_do(in->output, ecore_audio_obj_out_input_detach(input, NULL));
   in->output = eo_obj;
@@ -81,25 +73,18 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
     obj->write_idler = ecore_idler_add(_write_cb, eo_obj);
 
 
-  if (ret)
-    *ret = EINA_TRUE;
+  return EINA_TRUE;
 }
 
-static void _input_detach(Eo *eo_obj, void *_pd, va_list *list)
+EOLIAN static Eina_Bool
+_ecore_audio_out_input_detach(Eo *eo_obj, Ecore_Audio_Output *obj, Eo *input)
 {
-  Ecore_Audio_Output *obj = _pd;
   Ecore_Audio_Input *in;
 
-  Eo *input = va_arg(*list, Eo *);
-  Eina_Bool *ret = va_arg(*list, Eina_Bool *);
-
   in = eo_data_scope_get(input, ECORE_AUDIO_OBJ_IN_CLASS);
 
-  if (ret)
-    *ret = EINA_FALSE;
-
   if (in->output != eo_obj)
-    return;
+    return EINA_FALSE;
 
   in->output = NULL;
 
@@ -109,18 +94,13 @@ static void _input_detach(Eo *eo_obj, void *_pd, va_list *list)
 
   obj->inputs = eina_list_remove(obj->inputs, input);
 
-  if (ret)
-    *ret = EINA_TRUE;
+  return EINA_TRUE;
 }
 
-static void _inputs_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
+EOLIAN static Eina_List *
+_ecore_audio_out_inputs_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Output *obj)
 {
-  const Ecore_Audio_Output *obj = _pd;
-
-  Eina_List **inputs = va_arg(*list, Eina_List **);
-
-  if (inputs)
-    *inputs = obj->inputs;
+   return obj->inputs;
 }
 
 static void _free_vio(Ecore_Audio_Object *ea_obj)
@@ -132,14 +112,11 @@ static void _free_vio(Ecore_Audio_Object *ea_obj)
   ea_obj->vio = NULL;
 }
 
-static void _vio_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
+EOLIAN static void
+_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)
 {
   Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
 
-  Ecore_Audio_Vio *vio = va_arg(*list, Ecore_Audio_Vio *);
-  void *data = va_arg(*list, Ecore_Audio_Vio *);
-  eo_base_data_free_func free_func = va_arg(*list, eo_base_data_free_func);
-
   if (ea_obj->vio)
     _free_vio(ea_obj);
 
@@ -152,18 +129,17 @@ static void _vio_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
   ea_obj->vio->free_func = free_func;
 }
 
-static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
+EOLIAN static void
+_ecore_audio_out_eo_base_constructor(Eo *eo_obj, Ecore_Audio_Output *obj)
 {
-  Ecore_Audio_Output *obj = _pd;
-
   eo_do_super(eo_obj, MY_CLASS, eo_constructor());
 
   obj->need_writer = EINA_TRUE;
 }
 
-static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
+EOLIAN static void
+_ecore_audio_out_eo_base_destructor(Eo *eo_obj, Ecore_Audio_Output *obj)
 {
-  const Ecore_Audio_Output *obj = _pd;
   Eina_List *cur, *tmp;
   Eo *in;
 
@@ -174,44 +150,4 @@ static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
   eo_do_super(eo_obj, MY_CLASS, eo_destructor());
 }
 
-static void _class_constructor(Eo_Class *klass)
-{
-  const Eo_Op_Func_Description func_desc[] = {
-      /* Virtual functions of parent class implemented in this class */
-      EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
-      EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DESTRUCTOR), _destructor),
-
-      EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VIO_SET), _vio_set),
-      /* Specific functions to this class */
-      EO_OP_FUNC(ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_ATTACH), _input_attach),
-      EO_OP_FUNC(ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_DETACH), _input_detach),
-      EO_OP_FUNC(ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUTS_GET), _inputs_get),
-
-      EO_OP_FUNC_SENTINEL
-  };
-
-  eo_class_funcs_set(klass, func_desc);
-}
-
-#define S(val) "Sets the " #val " of the output."
-#define G(val) "Gets the " #val " of the output."
-
-static const Eo_Op_Description op_desc[] = {
-    EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_ATTACH, "Add an input."),
-    EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_DETACH, "Delete an input."),
-    EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUTS_GET, "Get the connected inputs."),
-    EO_OP_DESCRIPTION_SENTINEL
-};
-
-static const Eo_Class_Description class_desc = {
-    EO_VERSION,
-    MY_CLASS_NAME,
-    EO_CLASS_TYPE_REGULAR,
-    EO_CLASS_DESCRIPTION_OPS(&ECORE_AUDIO_OBJ_OUT_BASE_ID, op_desc, ECORE_AUDIO_OBJ_OUT_SUB_ID_LAST),
-    NULL,
-    sizeof(Ecore_Audio_Output),
-    _class_constructor,
-    NULL
-};
-
-EO_DEFINE_CLASS(ecore_audio_obj_out_class_get, &class_desc, ECORE_AUDIO_OBJ_CLASS, NULL);
+#include "ecore_audio_out.eo.c"
index 0052545..bd5bd64 100644 (file)
@@ -33,7 +33,9 @@ extern "C"
  * @ingroup Ecore_Audio_Group
  * @{
  */
+#include "ecore_audio_out.eo.h"
 
+#if 0
 #define ECORE_AUDIO_OBJ_OUT_CLASS ecore_audio_obj_out_class_get() /**< Ecore_Audio output object class */
 
 /**
@@ -85,6 +87,7 @@ enum Ecore_Audio_Obj_Out_Sub_Ids
  */
 #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)
 
+#endif
 /**
  * @}
  */
diff --git a/src/lib/ecore_audio/ecore_audio_out.eo b/src/lib/ecore_audio/ecore_audio_out.eo
new file mode 100644 (file)
index 0000000..4b9ef89
--- /dev/null
@@ -0,0 +1,42 @@
+class Ecore_Audio_Out (Ecore_Audio)
+{
+   eo_prefix: ecore_audio_obj_out;
+   data: Ecore_Audio_Output;
+   methods {
+      input_attach {
+         /*@
+         Attach an input to an output
+
+         @since 1.8 */
+         legacy null;
+         return Eina_Bool; /*EINA_TRUE if the input was attached, EINA_FALSE otherwise*/
+         params {
+            @in Eo *input; /*The input to attach to the output*/
+         }
+      }
+      input_detach {
+         /*@
+         Detach an input from an output
+
+         @since 1.8 */
+         legacy null;
+         return Eina_Bool; /*EINA_TRUE if the input was detached, EINA_FALSE otherwise*/
+         params {
+            @in Eo *input; /*he input to detach to the output*/
+         }
+      }
+      inputs_get {
+         /*@
+         Returns the list of all attached inputs
+
+         @since 1.8 */
+         legacy null;
+         return Eina_List *; /*An @ref Eina_List of the inputs that are attached to the output*/
+      }
+   }
+   implements {
+      Eo_Base::constructor;
+      Eo_Base::destructor;
+      Ecore_Audio::vio_set;
+   }
+}
\ No newline at end of file
index e21452c..d628384 100644 (file)
@@ -77,7 +77,7 @@ START_TEST(ecore_test_ecore_audio_obj_pulse)
    ecore_timer_add(0.3, _seek_vol, in);
 
    eo_do(in, eo_event_callback_add(ECORE_AUDIO_IN_EVENT_IN_STOPPED, _finished_cb, NULL));
-   eo_do(out, eo_event_callback_add(ECORE_AUDIO_EV_OUT_PULSE_CONTEXT_FAIL, _failed_cb, &pulse_context_failed));
+   eo_do(out, eo_event_callback_add(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, _failed_cb, &pulse_context_failed));
 
    eo_do(out, ecore_audio_obj_out_input_attach(in, &ret));
    fail_if(!ret);