want_wasapiaudio="no"
+AC_ARG_ENABLE([tizenaudio],
+ [AS_HELP_STRING([--enable-tizenaudio],[enable tizen audio sound support. @<:@default=enabled@:>@])],
+ [
+ if test "x${enableval}" = "xyes" ; then
+ want_tizenaudio="yes"
+ else
+ want_tizenaudio="no"
+ fi
+ ],
+ [want_tizenaudio="no"])
+if test "x${want_tizenaudio}" = "xyes"; then
+ AC_DEFINE([HAVE_TIZENAUDIO], [1], [Tizen Audio support enabled])
+else
+ AC_DEFINE([HAVE_TIZENAUDIO], [0], [Tizen Audio support disabled])
+fi
+
AC_ARG_ENABLE([pulseaudio],
[AS_HELP_STRING([--disable-pulseaudio],[disable pulseaudio sound support. @<:@default=enabled@:>@])],
[
EFL_ADD_FEATURE([ECORE_AUDIO], [sndfile])
EFL_ADD_FEATURE([ECORE_AUDIO], [wasapiaudio])
+EFL_ADD_FEATURE([ECORE_AUDIO], [coreaudio])
+EFL_ADD_FEATURE([ECORE_AUDIO], [tizenaudio])
+
### Checks for header files
### Checks for types
AM_CONDITIONAL([HAVE_ECORE_AUDIO_SNDFILE], [test "x${want_sndfile}" = "xyes"])
AM_CONDITIONAL([HAVE_ECORE_AUDIO_WASASPI], [test "x${want_wasapiaudio}" = "xyes"])
+AM_CONDITIONAL([HAVE_ECORE_AUDIO_CORE_AUDIO], [test "x${want_coreaudio}" = "xyes"])
+AM_CONDITIONAL([HAVE_ECORE_AUDIO_TIZEN], [test "x${want_tizenaudio}" = "xyes"])
+
#### End of Ecore_Audio
#### Ecore Audio CXX
--disable-libraw \
--disable-systemd \
--disable-cserve \
+ --enable-tizenaudio \
--with-elementary-base-dir="share/.elementary" \
--enable-i-really-know-what-i-am-doing-and-that-this-will-probably-break-things-and-i-will-fix-them-myself-and-send-patches-abb \
ac_cv_func_getuid=no
# --enable-drm \
# --enable-gl-drm \
-%__make %{?_smp_mflags} --trace \
-2>&1 | sed \
+%__make %{?_smp_mflags} 2>&1 | \
+sed \
-e 's%^.*: error: .*$%\x1b[37;41m&\x1b[m%' \
-e 's%^.*: warning: .*$%\x1b[30;43m&\x1b[m%'
lib/ecore_audio/ecore_audio_out_wasapi.eo
+if HAVE_ECORE_AUDIO_TIZEN
+ecore_audio_eolian_files += lib/ecore_audio/ecore_audio_out_tizen.eo
+endif
+
+if HAVE_ECORE_AUDIO_CORE_AUDIO
+ecore_audio_eolian_files += lib/ecore_audio/ecore_audio_out_core_audio.eo
+endif
+
ecore_audio_eolian_c = $(ecore_audio_eolian_files:%.eo=%.eo.c)
ecore_audio_eolian_h = $(ecore_audio_eolian_files:%.eo=%.eo.h)
lib/ecore_audio/ecore_audio_obj_in_tone.c \
lib/ecore_audio/ecore_audio_private.h
-lib_ecore_audio_libecore_audio_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_AUDIO_CFLAGS@ @ECORE_AUDIO_ALSA_CFLAGS@ @ECORE_AUDIO_PULSE_CFLAGS@ @ECORE_AUDIO_SNDFILE_CFLAGS@
+lib_ecore_audio_libecore_audio_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl @ECORE_AUDIO_CFLAGS@ @ECORE_AUDIO_ALSA_CFLAGS@ @ECORE_AUDIO_PULSE_CFLAGS@ @ECORE_AUDIO_SNDFILE_CFLAGS@ -DPACKAGE_LIB_DIR=\"$(libdir)\"
+
lib_ecore_audio_libecore_audio_la_LIBADD = @ECORE_AUDIO_LIBS@ @ECORE_AUDIO_ALSA_LIBS@
lib_ecore_audio_libecore_audio_la_DEPENDENCIES = @ECORE_AUDIO_INTERNAL_LIBS@
lib_ecore_audio_libecore_audio_la_LDFLAGS = @EFL_LTLIBRARY_FLAGS@
+if HAVE_ECORE_AUDIO_TIZEN
+dist_installed_ecoreaudiomainheaders_DATA += \
+lib/ecore_audio/ecore_audio_obj_out_tizen.h
+
+lib_ecore_audio_libecore_audio_la_SOURCES += \
+lib/ecore_audio/ecore_audio_obj_out_tizen.c
+endif
+
if HAVE_ECORE_AUDIO_PULSE
lib_ecore_audio_libecore_audio_la_SOURCES += \
lib/ecore_audio/ecore_audio_pulse_ml.c \
#include <ecore_audio_obj_out_wasapi.h>
+/* TIZEN_ONLY(20161109, 20161202)
+ * (20161109): ecore_audio: Add tizen ecore_audio module(e182090493d623212cd0ee7d55ae4ebd679eff42)
+ * (20161202): ecore_audio: Add 'TIZEN_ONLY' comment
+ */
+#if HAVE_TIZENAUDIO
+# include <ecore_audio_obj_out_tizen.h>
+#endif
+/* END */
+
/**
* @}
*/
SYM(sf_open_virtual);
SYM(sf_close);
SYM(sf_read_float);
+ SYM(sf_read_short);
SYM(sf_write_float);
SYM(sf_write_sync);
SYM(sf_seek);
_ecore_audio_in_sndfile_ecore_audio_in_read_internal(Eo *eo_obj EINA_UNUSED, Ecore_Audio_In_Sndfile_Data *obj, void *data, size_t len)
{
if (!ESF_LOAD()) return 0;
+
+ /* TIZEN_ONLY(20161109, 20161202)
+ * (20161109): ecore_audio: Add tizen ecore_audio module(e182090493d623212cd0ee7d55ae4ebd679eff42)
+ * (20161202): ecore_audio: Add 'TIZEN_ONLY' comment
+ * Description: Add signed 16 read if write module only support S16
+ */
+ char *pcm_fmt;
+ pcm_fmt = efl_key_data_get(eo_obj, "pcm_fmt");
+ if (pcm_fmt && !strcmp(pcm_fmt, "S16"))
+ return ESF_CALL(sf_read_short)(obj->handle, data, len/2)*2;
+ /* END */
+
return ESF_CALL(sf_read_float)(obj->handle, data, len/4)*4;
}
if (ea_obj->vio)
_free_vio(ea_obj);
+ /* TIZEN_ONLY(20161109, 20161202)
+ * (20161109): ecore_audio: Add tizen ecore_audio module(e182090493d623212cd0ee7d55ae4ebd679eff42)
+ * (20161202): ecore_audio: Add 'TIZEN_ONLY' comment
+ * Description: Add signed 16 read if write module only support S16
+ */
+ char *pcm_fmt;
+ pcm_fmt = efl_key_data_get(eo_obj, "pcm_fmt");
+ efl_key_data_set(eo_obj, "pcm_fmt", NULL);
+ free(pcm_fmt);
+ /* END */
+
efl_destructor(efl_super(eo_obj, MY_CLASS));
}
--- /dev/null
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#if defined (__MacOSX__) || (defined (__MACH__) && defined (__APPLE__)) || defined (__FreeBSD__)
+# include <libgen.h>
+#endif
+
+#ifdef HAVE_FEATURES_H
+#include <features.h>
+#endif
+
+#include <Eo.h>
+#include "ecore_audio_private.h"
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#define MY_CLASS ECORE_AUDIO_OUT_TIZEN_CLASS
+#define MY_CLASS_NAME "Ecore_Audio_Out_Tizen"
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+# define MODULE_EXT ".dll"
+#else
+# define MODULE_EXT ".so"
+#endif
+
+#define AUDIO_MODULE_NAME "module"MODULE_EXT
+#define MODULE_PATH PACKAGE_LIB_DIR"/ecore_audio/modules/tizen/"MODULE_ARCH
+
+struct _Ecore_Audio_Out_Tizen_Module_Func
+{
+ int (*init) (int sample_rate, int channel, void **handle);
+ int (*deinit) (void *handle);
+ int (*get_buffer_size) (void *handle, size_t *size);
+ int (*write) (void *handle, void *buf, unsigned int len);
+ int (*drain) (void *handle);
+ int (*set_write_cb) (void *handle, void (*out_cb)(void *handle, size_t nbytes, void *user_data), void *data);
+ int (*unset_write_cb) (void *handle);
+};
+
+typedef struct _Ecore_Audio_Out_Tizen_Module_Func Ecore_Audio_Out_Tizen_Module_Func;
+
+static Ecore_Audio_Out_Tizen_Module_Func module_func = { NULL, };
+static Eina_Module *module = NULL;
+
+struct _Ecore_Audio_Out_Tizen_Data
+{
+ Ecore_Audio_Out_Tizen_Module_Func *func;
+ Eo *attached_in;
+};
+
+typedef struct _Ecore_Audio_Out_Tizen_Data Ecore_Audio_Out_Tizen_Data;
+
+static Eina_Bool _module_load(Ecore_Audio_Out_Tizen_Data *td)
+{
+ if (td->func)
+ return EINA_TRUE;
+
+ if (!module)
+ {
+ Eina_Module *em = NULL;
+ em = eina_module_new(MODULE_PATH "/" AUDIO_MODULE_NAME);
+ if (!eina_module_load(em))
+ {
+ eina_module_free(em);
+ return EINA_FALSE;
+ }
+
+ module_func.init = eina_module_symbol_get(em, "ecore_audio_init");
+ module_func.deinit = eina_module_symbol_get(em, "ecore_audio_deinit");
+ module_func.get_buffer_size = eina_module_symbol_get(em, "ecore_audio_get_buffer_size");
+ module_func.write = eina_module_symbol_get(em, "ecore_audio_write");
+ module_func.drain = eina_module_symbol_get(em, "ecore_audio_drain");
+ module_func.set_write_cb = eina_module_symbol_get(em, "ecore_audio_set_write_cb");
+ module_func.unset_write_cb = eina_module_symbol_get(em, "ecore_audio_unset_write_cb");
+
+ if ((!module_func.init) || (!module_func.deinit) || (!module_func.get_buffer_size)
+ || (!module_func.write) || (!module_func.drain) || (!module_func.set_write_cb))
+ {
+ module_func.init = NULL;
+ module_func.deinit = NULL;
+ module_func.get_buffer_size = NULL;
+ module_func.write = NULL;
+ module_func.drain = NULL;
+ module_func.set_write_cb = NULL;
+ module_func.unset_write_cb = NULL;
+
+ eina_module_free(em);
+ return EINA_FALSE;
+ }
+ module = em;
+ }
+
+ td->func = &module_func;
+
+ return EINA_TRUE;
+}
+
+static void _stream_write_cb(void *handle, size_t len EINA_UNUSED, void *data)
+{
+ Eo *in = data;
+ Ecore_Audio_Out_Tizen_Data *_td;
+ _td = efl_key_data_get(in, "mod_data");
+
+ void *buf;
+ ssize_t bread = 0;
+ size_t wlen;
+
+ _td->func->get_buffer_size(handle, &wlen);
+ buf = malloc(wlen);
+ bread = ecore_audio_obj_in_read(in, buf, wlen);
+
+ if (bread > 0)
+ {
+ _td->func->write(handle, buf, (unsigned int)bread);
+ }
+
+ free(buf);
+}
+
+EOLIAN static Eina_Bool
+_ecore_audio_out_tizen_ecore_audio_out_input_attach(Eo *eo_obj, Ecore_Audio_Out_Tizen_Data *_td, Eo *in)
+{
+ int ret;
+ Eina_Bool ret2;
+ void *handle;
+ int samplerate = 0;
+ int channels = 0;
+
+ ret2 = ecore_audio_obj_out_input_attach(efl_super(eo_obj, MY_CLASS), in);
+ if (!ret2)
+ return EINA_FALSE;
+
+ channels = ecore_audio_obj_in_channels_get(in);
+ samplerate = ecore_audio_obj_in_samplerate_get(in);
+
+ ret = _td->func->init(samplerate, channels, &handle);
+ if (ret)
+ {
+ ecore_audio_obj_out_input_detach(efl_super(eo_obj, MY_CLASS), in);
+ ERR("init error : %d", ret);
+ return EINA_FALSE;
+ }
+ efl_key_data_set(in, "mod_handle", handle);
+ efl_key_data_set(in, "mod_data", _td);
+ efl_key_data_set(in, "pcm_fmt", strdup("S16"));
+ _td->attached_in = in;
+ ret = _td->func->set_write_cb(handle, _stream_write_cb, in);
+ if (ret)
+ {
+ ecore_audio_obj_out_input_detach(efl_super(eo_obj, MY_CLASS), in);
+ ERR("set_write_callback error : %d", ret);
+ _td->func->deinit(handle);
+ return EINA_FALSE;
+ }
+
+ return EINA_TRUE;
+}
+
+EOLIAN static Eina_Bool
+_ecore_audio_out_tizen_ecore_audio_out_input_detach(Eo *eo_obj, Ecore_Audio_Out_Tizen_Data *_td, Eo *in)
+{
+ Eina_Bool ret2 = EINA_FALSE;
+ void *handle;
+
+ ret2 = ecore_audio_obj_out_input_detach(efl_super(eo_obj, MY_CLASS), in);
+ if (!ret2)
+ return EINA_FALSE;
+
+ handle = efl_key_data_get(in, "mod_handle");
+ _td->func->unset_write_cb(handle);
+ _td->func->drain(handle);
+ _td->func->deinit(handle);
+
+ return EINA_TRUE;
+}
+
+EOLIAN static Eo *
+_ecore_audio_out_tizen_efl_object_constructor(Eo *eo_obj, Ecore_Audio_Out_Tizen_Data *_td)
+{
+
+ Ecore_Audio_Output *out_obj = efl_data_scope_get(eo_obj, ECORE_AUDIO_OUT_CLASS);
+
+ eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
+
+ if (!_module_load(_td))
+ {
+ // Need to destructing
+ ERR("Faild to load ecore audio module");
+ return NULL;
+ }
+
+ return eo_obj;
+}
+
+EOLIAN static void
+_ecore_audio_out_tizen_efl_object_destructor(Eo *eo_obj, Ecore_Audio_Out_Tizen_Data *_td EINA_UNUSED)
+{
+ efl_destructor(efl_super(eo_obj, MY_CLASS));
+}
+
+#include "ecore_audio_out_tizen.eo.c"
--- /dev/null
+class Ecore_Audio_Out_Tizen (Ecore.Audio.Out)
+{
+ eo_prefix: ecore_audio_obj_out_tizen;
+ implements {
+ Efl.Object.constructor;
+ Efl.Object.destructor;
+ Ecore.Audio.Out.input_attach;
+ Ecore.Audio.Out.input_detach;
+ }
+}
void (*sf_write_sync) (SNDFILE *sndfile);
sf_count_t (*sf_seek) (SNDFILE *sndfile, sf_count_t frames, int whence);
const char *(*sf_strerror) (SNDFILE *sndfile);
+ sf_count_t (*sf_read_short) (SNDFILE *sndfile, short *ptr, sf_count_t items);
};
#define ESF_CALL(x) ecore_audio_sndfile_lib->x
in = efl_add(ECORE_AUDIO_IN_SNDFILE_CLASS, efl_main_loop_get(), efl_name_set(efl_added, snd_id_str), ecore_audio_obj_in_speed_set(efl_added, speed), ecore_audio_obj_vio_set(efl_added, &eet_data->vio, eet_data, _free), efl_event_callback_add(efl_added, ECORE_AUDIO_IN_EVENT_IN_STOPPED, _play_finished, NULL));
if (!out)
{
-
+/* TIZEN_ONLY
# ifdef _WIN32
out = efl_add(ECORE_AUDIO_OUT_WASAPI_CLASS, efl_main_loop_get(), efl_event_callback_add(efl_added, ECORE_AUDIO_OUT_WASAPI_EVENT_CONTEXT_FAIL, _out_fail, NULL));
# else
out = efl_add(ECORE_AUDIO_OUT_PULSE_CLASS, efl_main_loop_get(), efl_event_callback_add(efl_added, ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, _out_fail, NULL));
# endif
# endif
+*/
+
+# ifdef _WIN32
+ out = efl_add(ECORE_AUDIO_OUT_WASAPI_CLASS, NULL, efl_event_callback_add(efl_added, ECORE_AUDIO_OUT_WASAPI_EVENT_CONTEXT_FAIL, _out_fail, NULL));
+# else
+#if HAVE_TIZENAUDIO
+ if (!(out = efl_add(ECORE_AUDIO_OUT_TIZEN_CLASS, NULL)))
+ {
+ ERR("Could not create multisense audio out (Tizen Audio)");
+#endif
+/* END */
+#if HAVE_COREAUDIO
+ out = efl_add(ECORE_AUDIO_OUT_CORE_AUDIO_CLASS, NULL);
+#elif HAVE_PULSE
+ out = efl_add(ECORE_AUDIO_OUT_PULSE_CLASS, NULL, efl_event_callback_add(efl_added, ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, _out_fail, NULL));
+#endif
+
+/* TIZEN_ONLY(20161109, 20161202)
+ * (20161109): ecore_audio: Add tizen ecore_audio module(e182090493d623212cd0ee7d55ae4ebd679eff42)
+ * (20161202): ecore_audio: Add 'TIZEN_ONLY' comment
+ */
+#if HAVE_TIZENAUDIO
+ }
+#endif
+
+# endif
+// END
if (out) outs++;
}
if (!out)