From 9da64ff201ca97ee7a22b019ccaf82f8306600a3 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Fri, 12 Apr 2013 17:46:20 +0100 Subject: [PATCH] ecore_audio: Update transcoding example to work with eo Signed-off-by: Daniel Willmann --- src/examples/ecore/Makefile.am | 2 ++ src/examples/ecore/ecore_audio_to_ogg.c | 41 ++++++++++++++++----------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/examples/ecore/Makefile.am b/src/examples/ecore/Makefile.am index 45a1898..cba995e 100644 --- a/src/examples/ecore/Makefile.am +++ b/src/examples/ecore/Makefile.am @@ -73,6 +73,8 @@ $(top_builddir)/src/lib/eina/libeina.la \ @ECORE_LDFLAGS@ if HAVE_ECORE_AUDIO +EXTRA_PROGRAMS += \ +ecore_audio_to_ogg ECORE_AUDIO_COMMON_LDADD = \ $(top_builddir)/src/lib/ecore_audio/libecore_audio.la \ diff --git a/src/examples/ecore/ecore_audio_to_ogg.c b/src/examples/ecore/ecore_audio_to_ogg.c index 8cbf288..88035cb 100644 --- a/src/examples/ecore/ecore_audio_to_ogg.c +++ b/src/examples/ecore/ecore_audio_to_ogg.c @@ -7,23 +7,25 @@ #include #include #include +#include #include #include #include -Ecore_Audio_Object *out = NULL; double volume = 1; Eina_List *inputs = NULL; -static Eina_Bool _play_finished(void *data, int type, void *event) +static Eina_Bool _play_finished(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) { - Ecore_Audio_Object *in = (Ecore_Audio_Object *)event; + const char *name; + Eo *out; - printf("Done: %s\n", ecore_audio_input_name_get(in)); + eo_do(obj, ecore_audio_obj_name_get(&name)); + printf("Done: %s\n", name); - ecore_audio_output_input_del(out, in); - ecore_audio_input_del(in); - ecore_audio_output_del(out); + eo_do(obj, ecore_audio_obj_in_output_get(&out)); + eo_del(obj); + eo_del(out); ecore_main_loop_quit(); @@ -33,8 +35,9 @@ static Eina_Bool _play_finished(void *data, int type, void *event) int main(int argc, const char *argv[]) { - - Ecore_Audio_Object *in; + int ret; + Eo *out; + Eo *in; if (argc < 2) { @@ -45,21 +48,17 @@ main(int argc, const char *argv[]) ecore_init(); ecore_audio_init(); - ecore_event_handler_add(ECORE_AUDIO_INPUT_ENDED, _play_finished, NULL); - in = ecore_audio_input_add(ECORE_AUDIO_TYPE_SNDFILE); - ecore_audio_input_name_set(in, basename(argv[1])); - ecore_audio_input_sndfile_filename_set(in, argv[1]); - if (!in) - { - printf("error when creating ecore audio source.\n"); - goto end; - } + in = eo_add(ECORE_AUDIO_OBJ_IN_SNDFILE_CLASS, NULL); + eo_do(in, ecore_audio_obj_name_set(basename(argv[1]))); + eo_do(in, ecore_audio_obj_source_set(argv[1])); + + eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_STOPPED, _play_finished, NULL)); - out = ecore_audio_output_add(ECORE_AUDIO_TYPE_SNDFILE); - ecore_audio_output_sndfile_filename_set(out, "foo.ogg"); + out = eo_add(ECORE_AUDIO_OBJ_OUT_SNDFILE_CLASS, NULL); + eo_do(out, ecore_audio_obj_source_set("foo.ogg")); - ecore_audio_output_input_add(out, in); + eo_do(out, ecore_audio_obj_out_input_attach(in)); ecore_main_loop_begin(); -- 2.7.4