From eb2821bca0eb6e67e8c2bfe345f923bc419bbfa5 Mon Sep 17 00:00:00 2001 From: Yossi Kantor Date: Wed, 26 Mar 2014 10:17:38 +0200 Subject: [PATCH] Eolian: Integration of Ecore Audio --- src/Makefile_Ecore_Audio.am | 15 ++- src/lib/ecore_audio/ecore_audio.eo | 132 ++++++++++++++++++++++++++ src/lib/ecore_audio/ecore_audio_obj.c | 107 ++++----------------- src/lib/ecore_audio/ecore_audio_obj.h | 4 +- 4 files changed, 167 insertions(+), 91 deletions(-) create mode 100644 src/lib/ecore_audio/ecore_audio.eo diff --git a/src/Makefile_Ecore_Audio.am b/src/Makefile_Ecore_Audio.am index 35a414cc52..737485ba44 100644 --- a/src/Makefile_Ecore_Audio.am +++ b/src/Makefile_Ecore_Audio.am @@ -2,6 +2,17 @@ if HAVE_ECORE_AUDIO ### Library +BUILT_SOURCES += \ + lib/ecore_audio/ecore_audio.eo.c \ + lib/ecore_audio/ecore_audio.eo.h + +ecore_audioeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@ +ecore_audioeolianfiles_DATA = \ + lib/ecore_audio/ecore_audio.eo + +EXTRA_DIST += \ + ${ecore_audioeolianfiles_DATA} + lib_LTLIBRARIES += lib/ecore_audio/libecore_audio.la installed_ecoreaudiomainheadersdir = $(includedir)/ecore-audio-@VMAJ@ @@ -13,7 +24,9 @@ lib/ecore_audio/ecore_audio_obj_out.h \ lib/ecore_audio/ecore_audio_obj_in_tone.h \ lib/ecore_audio/ecore_audio_protected.h - +nodist_installed_ecoreaudiomainheaders_DATA = \ + lib/ecore_audio/ecore_audio.eo.h + lib_ecore_audio_libecore_audio_la_SOURCES = \ lib/ecore_audio/ecore_audio.c \ lib/ecore_audio/ecore_audio_obj.c \ diff --git a/src/lib/ecore_audio/ecore_audio.eo b/src/lib/ecore_audio/ecore_audio.eo new file mode 100644 index 0000000000..6c2d70536e --- /dev/null +++ b/src/lib/ecore_audio/ecore_audio.eo @@ -0,0 +1,132 @@ +class Ecore_Audio (Eo_Base) +{ + eo_prefix: ecore_audio_obj; + data: Ecore_Audio_Object; + properties { + name { + set { + /*@ + Set the name of the object + + @since 1.8 */ + legacy null; + } + get { + /*@ + Get the name of the object + + @since 1.8 */ + legacy null; + } + values { + const char *name; + } + } + paused { + set { + /*@ + Set the pause state of the object + + @since 1.8 */ + legacy null; + } + get { + /*@ + Get the pause state of the object + + @since 1.8 */ + legacy null; + } + values { + Eina_Bool paused; /*ret EINA_TRUE if object is paused, EINA_FALSE if not*/ + } + } + volume { + set { + /*@ + Set the volume of the object + + @since 1.8 */ + legacy null; + } + get { + /*@ + Get the volume of the object + + @since 1.8 */ + legacy null; + } + values { + double volume; /*The volume*/ + } + } + source { + set { + /*@ + Set the source of the object + + What sources are supported depends on the actual object. For example, + the libsndfile class accepts WAV, OGG, FLAC files as source. + + @since 1.8 */ + legacy null; + return Eina_Bool; /*EINA_TRUE if the source was set correctly (i.e. the file was opened), EINA_FALSE otherwise*/ + } + get { + /*@ + Get the source of the object + + @since 1.8 */ + legacy null; + } + values { + const char *source; /*The source to set to (i.e. file, URL, device)*/ + } + } + format { + set { + /*@ + Set the format of the object + + What formats are supported depends on the actual object. Default is + ECORE_AUDIO_FORMAT_AUTO + + @since 1.8 */ + legacy null; + return Eina_Bool; /*EINA_TRUE if the format was supported, EINA_FALSE otherwise*/ + } + get { + /*@ + Get the format of the object + + After setting the source if the format was ECORE_AUDIO_FORMAT_AUTO this + function will now return the actual format. + + @since 1.8 */ + legacy null; + } + values { + Ecore_Audio_Format format; /*The format of the object*/ + } + } + } + methods { + vio_set { + /*@ + Set the virtual IO functions + + @since 1.8 */ + params { + Ecore_Audio_Vio *vio; /*The @ref Ecore_Audio_Vio struct with the function callbacks*/ + void *data; /*User data to pass to the VIO functions*/ + eo_base_data_free_func free_func; /*This function takes care to clean up @ref data when he VIO is destroyed. NULL means do nothing.*/ + } + } + } + implements { + Eo_Base::constructor; + virtual::source; + virtual::format; + virtual::vio_set; + } +} \ No newline at end of file diff --git a/src/lib/ecore_audio/ecore_audio_obj.c b/src/lib/ecore_audio/ecore_audio_obj.c index 9154e4a744..98468a0f74 100644 --- a/src/lib/ecore_audio/ecore_audio_obj.c +++ b/src/lib/ecore_audio/ecore_audio_obj.c @@ -15,122 +15,51 @@ #include #include "ecore_audio_private.h" -EAPI Eo_Op ECORE_AUDIO_OBJ_BASE_ID = EO_NOOP; - #define MY_CLASS ECORE_AUDIO_OBJ_CLASS #define MY_CLASS_NAME "Ecore_Audio" -static void _name_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_ecore_audio_name_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj, const char *name) { - Ecore_Audio_Object *obj = _pd; - - const char *name = va_arg(*list, const char *); - eina_stringshare_replace(&obj->name, name); } -static void _name_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static const char* +_ecore_audio_name_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj) { - const Ecore_Audio_Object *obj = _pd; - - const char **name = va_arg(*list, const char **); - - if (name) - *name = obj->name; + return obj->name; } -static void _paused_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_ecore_audio_paused_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj, Eina_Bool paused) { - Ecore_Audio_Object *obj = _pd; - - Eina_Bool paused = va_arg(*list, int); - obj->paused = paused; } -static void _paused_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static Eina_Bool +_ecore_audio_paused_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj) { - const Ecore_Audio_Object *obj = _pd; - - Eina_Bool *ret = va_arg(*list, Eina_Bool *); - - if (ret) - *ret = obj->paused; + return obj->paused; } -static void _volume_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static void +_ecore_audio_volume_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj, double volume) { - Ecore_Audio_Object *obj = _pd; - - double volume = va_arg(*list, double); - obj->volume = volume; } -static void _volume_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) +EOLIAN static double +_ecore_audio_volume_get(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Object *obj) { - const Ecore_Audio_Object *obj = _pd; - - double *ret = va_arg(*list, double *); - - if (ret) - *ret = obj->volume; + return obj->volume; } -static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) +EOLIAN static void +_ecore_audio_eo_base_constructor(Eo *eo_obj, Ecore_Audio_Object *obj) { - Ecore_Audio_Object *obj = _pd; - eo_do_super(eo_obj, MY_CLASS, eo_constructor()); obj->volume = 1.0; - } -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), - - /* Specific functions to this class */ - EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_NAME_SET), _name_set), - EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_NAME_GET), _name_get), - EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_PAUSED_SET), _paused_set), - EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_PAUSED_GET), _paused_get), - EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VOLUME_SET), _volume_set), - EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VOLUME_GET), _volume_get), - EO_OP_FUNC_SENTINEL - }; - - eo_class_funcs_set(klass, func_desc); -} - -static const Eo_Op_Description op_desc[] = { - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_NAME_SET, "Sets the name of the object."), - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_NAME_GET, "Gets the name of the object."), - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_PAUSED_SET, "Sets the paused stated of the object."), - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_PAUSED_GET, "Gets the paused stated of the object."), - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_VOLUME_SET, "Sets the volume of the object."), - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_VOLUME_GET, "Gets the volume of the object."), - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_SOURCE_SET, "Sets the source of the object."), - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_SOURCE_GET, "Gets the source of the object."), - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_FORMAT_SET, "Sets the format of the object."), - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_FORMAT_GET, "Gets the format of the object."), - EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_SUB_ID_VIO_SET, "Sets virtual IO callbacks for this object."), - 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_BASE_ID, op_desc, ECORE_AUDIO_OBJ_SUB_ID_LAST), - NULL, - sizeof(Ecore_Audio_Object), - _class_constructor, - NULL -}; - -EO_DEFINE_CLASS(ecore_audio_obj_class_get, &class_desc, EO_BASE_CLASS, NULL); +#include "ecore_audio.eo.c" diff --git a/src/lib/ecore_audio/ecore_audio_obj.h b/src/lib/ecore_audio/ecore_audio_obj.h index fc8d8ebb2f..b473a55f11 100644 --- a/src/lib/ecore_audio/ecore_audio_obj.h +++ b/src/lib/ecore_audio/ecore_audio_obj.h @@ -33,7 +33,8 @@ extern "C" * @ingroup Ecore_Audio_Group * @{ */ - +#include "ecore_audio.eo.h" +#if 0 #define ECORE_AUDIO_OBJ_CLASS ecore_audio_obj_class_get() /**< Ecore_Audio object class */ /** @@ -176,6 +177,7 @@ enum Ecore_Audio_Obj_Sub_Ids */ #define ecore_audio_obj_vio_set(vio, data, free_func) ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_VIO_SET), EO_TYPECHECK(Ecore_Audio_Vio *, vio), EO_TYPECHECK(void *, data), EO_TYPECHECK(eo_base_data_free_func, free_func) +#endif /** * @} */