Eolian: Integration of Ecore Audio Out Sndfile
This commit is contained in:
parent
6295d77a3c
commit
88860a209e
|
@ -10,14 +10,17 @@ BUILT_SOURCES += \
|
||||||
lib/ecore_audio/ecore_audio_out.eo.c \
|
lib/ecore_audio/ecore_audio_out.eo.c \
|
||||||
lib/ecore_audio/ecore_audio_out.eo.h \
|
lib/ecore_audio/ecore_audio_out.eo.h \
|
||||||
lib/ecore_audio/ecore_audio_in_sndfile.eo.c \
|
lib/ecore_audio/ecore_audio_in_sndfile.eo.c \
|
||||||
lib/ecore_audio/ecore_audio_in_sndfile.eo.h
|
lib/ecore_audio/ecore_audio_in_sndfile.eo.h \
|
||||||
|
lib/ecore_audio/ecore_audio_out_sndfile.eo.c \
|
||||||
|
lib/ecore_audio/ecore_audio_out_sndfile.eo.h
|
||||||
|
|
||||||
ecore_audioeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
|
ecore_audioeolianfilesdir = $(datadir)/eolian/include/ecore-@VMAJ@
|
||||||
ecore_audioeolianfiles_DATA = \
|
ecore_audioeolianfiles_DATA = \
|
||||||
lib/ecore_audio/ecore_audio.eo \
|
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 \
|
lib/ecore_audio/ecore_audio_out.eo \
|
||||||
lib/ecore_audio/ecore_audio_in_sndfile.eo
|
lib/ecore_audio/ecore_audio_in_sndfile.eo \
|
||||||
|
lib/ecore_audio/ecore_audio_out_sndfile.eo
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
${ecore_audioeolianfiles_DATA}
|
${ecore_audioeolianfiles_DATA}
|
||||||
|
@ -37,7 +40,8 @@ nodist_installed_ecoreaudiomainheaders_DATA = \
|
||||||
lib/ecore_audio/ecore_audio.eo.h \
|
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/ecore_audio_out.eo.h \
|
||||||
lib/ecore_audio/ecore_audio_in_sndfile.eo.h
|
lib/ecore_audio/ecore_audio_in_sndfile.eo.h \
|
||||||
|
lib/ecore_audio/ecore_audio_out_sndfile.eo.h
|
||||||
|
|
||||||
lib_ecore_audio_libecore_audio_la_SOURCES = \
|
lib_ecore_audio_libecore_audio_la_SOURCES = \
|
||||||
lib/ecore_audio/ecore_audio.c \
|
lib/ecore_audio/ecore_audio.c \
|
||||||
|
|
|
@ -14,28 +14,26 @@
|
||||||
#include "ecore_audio_private.h"
|
#include "ecore_audio_private.h"
|
||||||
#include <sndfile.h>
|
#include <sndfile.h>
|
||||||
|
|
||||||
EAPI Eo_Op ECORE_AUDIO_OBJ_OUT_SNDFILE_BASE_ID = EO_NOOP;
|
|
||||||
|
|
||||||
#define MY_CLASS ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS
|
#define MY_CLASS ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS
|
||||||
#define MY_CLASS_NAME "Ecore_Audio_Out_Sndfile"
|
#define MY_CLASS_NAME "Ecore_Audio_Out_Sndfile"
|
||||||
|
|
||||||
extern SF_VIRTUAL_IO vio_wrapper;
|
extern SF_VIRTUAL_IO vio_wrapper;
|
||||||
|
|
||||||
struct _Ecore_Audio_Sndfile
|
struct _Ecore_Audio_Out_Sndfile_Data
|
||||||
{
|
{
|
||||||
SNDFILE *handle;
|
SNDFILE *handle;
|
||||||
SF_INFO sfinfo;
|
SF_INFO sfinfo;
|
||||||
Ecore_Audio_Vio *vio;
|
Ecore_Audio_Vio *vio;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _Ecore_Audio_Sndfile Ecore_Audio_Sndfile;
|
typedef struct _Ecore_Audio_Out_Sndfile_Data Ecore_Audio_Out_Sndfile_Data;
|
||||||
|
|
||||||
static Eina_Bool _write_cb(void *data)
|
static Eina_Bool _write_cb(void *data)
|
||||||
{
|
{
|
||||||
Eo *eo_obj = data;
|
Eo *eo_obj = data;
|
||||||
Eo *in;
|
Eo *in;
|
||||||
|
|
||||||
Ecore_Audio_Sndfile *obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS);
|
Ecore_Audio_Out_Sndfile_Data *obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS);
|
||||||
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
|
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
|
||||||
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
||||||
|
|
||||||
|
@ -61,22 +59,16 @@ static Eina_Bool _write_cb(void *data)
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
|
EOLIAN static Eina_Bool
|
||||||
|
_ecore_audio_out_sndfile_ecore_audio_out_input_attach(Eo *eo_obj, Ecore_Audio_Out_Sndfile_Data *obj, Eo *in)
|
||||||
{
|
{
|
||||||
Ecore_Audio_Sndfile *obj = _pd;
|
|
||||||
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
||||||
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
|
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
|
||||||
Eina_Bool ret2;
|
Eina_Bool ret2;
|
||||||
|
|
||||||
Eo *in = va_arg(*list, Eo *);
|
|
||||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
|
||||||
|
|
||||||
if (ret)
|
|
||||||
*ret = EINA_FALSE;
|
|
||||||
|
|
||||||
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, &ret2));
|
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, &ret2));
|
||||||
if (!ret2)
|
if (!ret2)
|
||||||
return;
|
return EINA_FALSE;
|
||||||
|
|
||||||
eo_do(in, ecore_audio_obj_in_samplerate_get(&obj->sfinfo.samplerate));
|
eo_do(in, ecore_audio_obj_in_samplerate_get(&obj->sfinfo.samplerate));
|
||||||
eo_do(in, ecore_audio_obj_in_channels_get(&obj->sfinfo.channels));
|
eo_do(in, ecore_audio_obj_in_channels_get(&obj->sfinfo.channels));
|
||||||
|
@ -87,32 +79,24 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list)
|
||||||
eina_stringshare_del(ea_obj->source);
|
eina_stringshare_del(ea_obj->source);
|
||||||
ea_obj->source = NULL;
|
ea_obj->source = NULL;
|
||||||
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in, NULL));
|
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in, NULL));
|
||||||
return;
|
return EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret)
|
|
||||||
*ret = EINA_TRUE;
|
|
||||||
|
|
||||||
if (ea_obj->paused)
|
if (ea_obj->paused)
|
||||||
return;
|
return EINA_TRUE;
|
||||||
|
|
||||||
if (out_obj->inputs) {
|
if (out_obj->inputs) {
|
||||||
out_obj->write_idler = ecore_idler_add(_write_cb, eo_obj);
|
out_obj->write_idler = ecore_idler_add(_write_cb, eo_obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _source_set(Eo *eo_obj, void *_pd, va_list *list)
|
EOLIAN static Eina_Bool
|
||||||
|
_ecore_audio_out_sndfile_ecore_audio_source_set(Eo *eo_obj, Ecore_Audio_Out_Sndfile_Data *obj, const char *source)
|
||||||
{
|
{
|
||||||
Ecore_Audio_Sndfile *obj = _pd;
|
|
||||||
|
|
||||||
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
||||||
|
|
||||||
const char *source = va_arg(*list, const char *);
|
|
||||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
|
||||||
|
|
||||||
if (ret)
|
|
||||||
*ret = EINA_FALSE;
|
|
||||||
|
|
||||||
if (obj->handle) {
|
if (obj->handle) {
|
||||||
sf_close(obj->handle);
|
sf_close(obj->handle);
|
||||||
obj->handle = NULL;
|
obj->handle = NULL;
|
||||||
|
@ -121,38 +105,28 @@ static void _source_set(Eo *eo_obj, void *_pd, va_list *list)
|
||||||
eina_stringshare_replace(&ea_obj->source, source);
|
eina_stringshare_replace(&ea_obj->source, source);
|
||||||
|
|
||||||
if (!ea_obj->source)
|
if (!ea_obj->source)
|
||||||
return;
|
return EINA_FALSE;
|
||||||
|
|
||||||
//FIXME: Open the file here
|
//FIXME: Open the file here
|
||||||
|
|
||||||
if (ret)
|
return EINA_TRUE;
|
||||||
*ret = EINA_TRUE;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _source_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
EOLIAN static const char*
|
||||||
|
_ecore_audio_out_sndfile_ecore_audio_source_get(Eo *eo_obj, Ecore_Audio_Out_Sndfile_Data *_pd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Ecore_Audio_Object *obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
Ecore_Audio_Object *obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
||||||
|
return obj->source;
|
||||||
const char **ret = va_arg(*list, const char **);
|
|
||||||
|
|
||||||
if (ret)
|
|
||||||
*ret = obj->source;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _format_set(Eo *eo_obj, void *_pd, va_list *list)
|
EOLIAN static Eina_Bool
|
||||||
|
_ecore_audio_out_sndfile_ecore_audio_format_set(Eo *eo_obj, Ecore_Audio_Out_Sndfile_Data *obj, Ecore_Audio_Format format)
|
||||||
{
|
{
|
||||||
Ecore_Audio_Sndfile *obj = _pd;
|
|
||||||
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
||||||
|
|
||||||
Ecore_Audio_Format format= va_arg(*list, Ecore_Audio_Format);
|
|
||||||
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
|
|
||||||
|
|
||||||
if (ea_obj->source) {
|
if (ea_obj->source) {
|
||||||
ERR("Input is already open - cannot change format");
|
ERR("Input is already open - cannot change format");
|
||||||
if (ret)
|
return EINA_FALSE;
|
||||||
*ret = EINA_FALSE;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (format) {
|
switch (format) {
|
||||||
|
@ -170,26 +144,22 @@ static void _format_set(Eo *eo_obj, void *_pd, va_list *list)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ERR("Format not supported!");
|
ERR("Format not supported!");
|
||||||
if (ret)
|
return EINA_FALSE;
|
||||||
*ret = EINA_FALSE;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
ea_obj->format = format;
|
ea_obj->format = format;
|
||||||
if (ret)
|
|
||||||
*ret = EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _format_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
|
EOLIAN static Ecore_Audio_Format
|
||||||
|
_ecore_audio_out_sndfile_ecore_audio_format_get(Eo *eo_obj, Ecore_Audio_Out_Sndfile_Data *_pd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Ecore_Audio_Object *obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
Ecore_Audio_Object *obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
|
||||||
|
return obj->format;
|
||||||
Ecore_Audio_Format *ret = va_arg(*list, Ecore_Audio_Format *);
|
|
||||||
|
|
||||||
if (ret)
|
|
||||||
*ret = obj->format;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _constructor(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
EOLIAN static void
|
||||||
|
_ecore_audio_out_sndfile_eo_base_constructor(Eo *eo_obj, Ecore_Audio_Out_Sndfile_Data *_pd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
|
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
|
||||||
|
|
||||||
|
@ -201,9 +171,9 @@ static void _constructor(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_U
|
||||||
out_obj->need_writer = EINA_FALSE;
|
out_obj->need_writer = EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
|
EOLIAN static void
|
||||||
|
_ecore_audio_out_sndfile_eo_base_destructor(Eo *eo_obj, Ecore_Audio_Out_Sndfile_Data *obj)
|
||||||
{
|
{
|
||||||
Ecore_Audio_Sndfile *obj = _pd;
|
|
||||||
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
|
Ecore_Audio_Output *out_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_OUT_CLASS);
|
||||||
|
|
||||||
if (obj->handle)
|
if (obj->handle)
|
||||||
|
@ -214,39 +184,4 @@ static void _destructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
|
||||||
eo_do_super(eo_obj, MY_CLASS, eo_destructor());
|
eo_do_super(eo_obj, MY_CLASS, eo_destructor());
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _class_constructor(Eo_Class *klass)
|
#include "ecore_audio_out_sndfile.eo.c"
|
||||||
{
|
|
||||||
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_SOURCE_SET), _source_set),
|
|
||||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_SOURCE_GET), _source_get),
|
|
||||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_FORMAT_SET), _format_set),
|
|
||||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_SUB_ID_FORMAT_GET), _format_get),
|
|
||||||
|
|
||||||
EO_OP_FUNC(ECORE_AUDIO_OBJ_OUT_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_INPUT_ATTACH), _input_attach),
|
|
||||||
//EO_OP_FUNC(ECORE_AUDIO_OBJ_ID(ECORE_AUDIO_OBJ_OUT_SUB_ID_FORMAT_GET), _format_get),
|
|
||||||
EO_OP_FUNC_SENTINEL
|
|
||||||
};
|
|
||||||
|
|
||||||
eo_class_funcs_set(klass, func_desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const Eo_Op_Description op_desc[] = {
|
|
||||||
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_SNDFILE_BASE_ID, op_desc, ECORE_AUDIO_OBJ_OUT_SNDFILE_SUB_ID_LAST),
|
|
||||||
NULL,
|
|
||||||
sizeof(Ecore_Audio_Sndfile),
|
|
||||||
_class_constructor,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
EO_DEFINE_CLASS(ecore_audio_obj_out_sndfile_class_get, &class_desc, ECORE_AUDIO_OBJ_OUT_CLASS, NULL);
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ extern "C"
|
||||||
* @ingroup Ecore_Audio_Group
|
* @ingroup Ecore_Audio_Group
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
#include "ecore_audio_out_sndfile.eo.h"
|
||||||
|
#if 0
|
||||||
|
|
||||||
#define ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS ecore_audio_obj_out_sndfile_class_get() /**< Ecore_Audio sndfile output */
|
#define ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS ecore_audio_obj_out_sndfile_class_get() /**< Ecore_Audio sndfile output */
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ enum _Ecore_Audio_Obj_Out_Sndfile_Sub_Ids
|
||||||
|
|
||||||
#define ECORE_AUDIO_OBJ_OUT_SNDFILE_ID(sub_id) (ECORE_AUDIO_OBJ_OUT_SNDFILE_BASE_ID + EO_TYPECHECK(enum _Ecore_Audio_Obj_Out_Sndfile_Sub_Ids, sub_id))
|
#define ECORE_AUDIO_OBJ_OUT_SNDFILE_ID(sub_id) (ECORE_AUDIO_OBJ_OUT_SNDFILE_BASE_ID + EO_TYPECHECK(enum _Ecore_Audio_Obj_Out_Sndfile_Sub_Ids, sub_id))
|
||||||
|
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
class Ecore_Audio_Out_Sndfile (Ecore_Audio_Out)
|
||||||
|
{
|
||||||
|
eo_prefix: ecore_audio_obj_out_sndfile;
|
||||||
|
implements {
|
||||||
|
Eo_Base::constructor;
|
||||||
|
Eo_Base::destructor;
|
||||||
|
Ecore_Audio::source::get;
|
||||||
|
Ecore_Audio::source::set;
|
||||||
|
Ecore_Audio::format::get;
|
||||||
|
Ecore_Audio::format::set;
|
||||||
|
Ecore_Audio_Out::input_attach;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue