From 2d859063677ec2a46b3ae3c49d5fa722ff9f7cf8 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Thu, 18 Apr 2013 19:34:33 +0100 Subject: [PATCH] ecore_audio: Fix warnings Signed-off-by: Daniel Willmann --- src/examples/ecore/ecore_audio_custom.c | 2 ++ src/examples/ecore/ecore_audio_playback.c | 17 +++--------- src/examples/ecore/ecore_audio_to_ogg.c | 6 ++--- src/lib/ecore_audio/ecore_audio.c | 1 - src/lib/ecore_audio/ecore_audio_obj.c | 33 +++++------------------ src/lib/ecore_audio/ecore_audio_obj_in.c | 20 +++++++------- src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c | 4 +-- src/lib/ecore_audio/ecore_audio_obj_in_tone.c | 5 +--- src/lib/ecore_audio/ecore_audio_obj_out.c | 8 +++--- src/lib/ecore_audio/ecore_audio_obj_out_pulse.c | 17 +++++++----- src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c | 4 +-- 11 files changed, 42 insertions(+), 75 deletions(-) diff --git a/src/examples/ecore/ecore_audio_custom.c b/src/examples/ecore/ecore_audio_custom.c index 2b6d133..8234b1e 100644 --- a/src/examples/ecore/ecore_audio_custom.c +++ b/src/examples/ecore/ecore_audio_custom.c @@ -52,6 +52,8 @@ main(int argc, const char *argv[]) ecore_init(); ecore_audio_init(); + ecore_app_args_set(argc, argv); + out = eo_add(ECORE_AUDIO_OBJ_OUT_PULSE_CLASS, NULL); in = eo_add(ECORE_AUDIO_OBJ_IN_CLASS, NULL); diff --git a/src/examples/ecore/ecore_audio_playback.c b/src/examples/ecore/ecore_audio_playback.c index c3314ee..788326b 100644 --- a/src/examples/ecore/ecore_audio_playback.c +++ b/src/examples/ecore/ecore_audio_playback.c @@ -159,7 +159,7 @@ handle_cmd(char *cmd, size_t bread) } Eina_Bool -handle_input(void *data, Ecore_Fd_Handler *handler) +handle_input(void *data EINA_UNUSED, Ecore_Fd_Handler *handler) { size_t bread; char buf[20]; @@ -184,17 +184,6 @@ handle_input(void *data, Ecore_Fd_Handler *handler) return EINA_TRUE; } -static Eina_Bool _play_started(void *data, int type, void *event) -{ - const char *name; - Eo *in = event; - - eo_do(in, ecore_audio_obj_name_get(&name)); - printf("Start: %s\n", name); - - return EINA_TRUE; -} - static Eina_Bool _play_finished(void *data EINA_UNUSED, Eo *in, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { const char *name; @@ -279,7 +268,9 @@ main(int argc, const char *argv[]) printf("error when creating ecore audio source.\n"); goto end; } - eo_do(in, ecore_audio_obj_name_set(basename(argv[i]))); + tmp = strdup(argv[i]); + eo_do(in, ecore_audio_obj_name_set(basename(tmp))); + free(tmp); eo_do(in, ecore_audio_obj_source_set(argv[i])); } eo_do(in, eo_event_callback_add(ECORE_AUDIO_EV_IN_STOPPED, _play_finished, NULL)); diff --git a/src/examples/ecore/ecore_audio_to_ogg.c b/src/examples/ecore/ecore_audio_to_ogg.c index e5d05ce..973941d 100644 --- a/src/examples/ecore/ecore_audio_to_ogg.c +++ b/src/examples/ecore/ecore_audio_to_ogg.c @@ -15,7 +15,7 @@ double volume = 1; Eina_List *inputs = NULL; -static Eina_Bool _play_finished(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info) +static Eina_Bool _play_finished(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { const char *name; Eo *out; @@ -33,9 +33,8 @@ static Eina_Bool _play_finished(void *data, Eo *obj, const Eo_Event_Description } int -main(int argc, const char *argv[]) +main(int argc, char *argv[]) { - int ret; Eo *out; Eo *in; @@ -62,7 +61,6 @@ main(int argc, const char *argv[]) ecore_main_loop_begin(); -end: ecore_audio_shutdown(); ecore_shutdown(); diff --git a/src/lib/ecore_audio/ecore_audio.c b/src/lib/ecore_audio/ecore_audio.c index f00fd73..4d38c13 100644 --- a/src/lib/ecore_audio/ecore_audio.c +++ b/src/lib/ecore_audio/ecore_audio.c @@ -24,7 +24,6 @@ Eina_List *ecore_audio_modules; EAPI int ecore_audio_init(void) { - Ecore_Audio_Module *mod; if (++_ecore_audio_init_count != 1) return _ecore_audio_init_count; diff --git a/src/lib/ecore_audio/ecore_audio_obj.c b/src/lib/ecore_audio/ecore_audio_obj.c index 62a784e..83ddbe9 100644 --- a/src/lib/ecore_audio/ecore_audio_obj.c +++ b/src/lib/ecore_audio/ecore_audio_obj.c @@ -20,16 +20,16 @@ EAPI Eo_Op ECORE_AUDIO_OBJ_BASE_ID = EO_NOOP; #define MY_CLASS ECORE_AUDIO_OBJ_CLASS #define MY_CLASS_NAME "ecore_audio_obj" -static void _name_set(Eo *eo_obj, void *_pd, va_list *list) +static void _name_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { - const Ecore_Audio_Object *obj = _pd; + 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, void *_pd, va_list *list) +static void _name_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { const Ecore_Audio_Object *obj = _pd; @@ -39,7 +39,7 @@ static void _name_get(Eo *eo_obj, void *_pd, va_list *list) *name = obj->name; } -static void _paused_set(Eo *eo_obj, void *_pd, va_list *list) +static void _paused_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { Ecore_Audio_Object *obj = _pd; @@ -48,7 +48,7 @@ static void _paused_set(Eo *eo_obj, void *_pd, va_list *list) obj->paused = paused; } -static void _paused_get(Eo *eo_obj, void *_pd, va_list *list) +static void _paused_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { const Ecore_Audio_Object *obj = _pd; @@ -58,26 +58,7 @@ static void _paused_get(Eo *eo_obj, void *_pd, va_list *list) *ret = obj->paused; } -static void _volume_set(Eo *eo_obj, void *_pd, va_list *list) -{ - Ecore_Audio_Object *obj = _pd; - - double volume = va_arg(*list, double); - - obj->volume = volume; -} - -static void _volume_get(Eo *eo_obj, void *_pd, va_list *list) -{ - const Ecore_Audio_Object *obj = _pd; - - double *ret = va_arg(*list, double *); - - if (ret) - *ret = obj->volume; -} - -static void _format_set(Eo *eo_obj, void *_pd, va_list *list) +static void _volume_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { Ecore_Audio_Object *obj = _pd; @@ -86,7 +67,7 @@ static void _format_set(Eo *eo_obj, void *_pd, va_list *list) obj->volume = volume; } -static void _format_get(Eo *eo_obj, void *_pd, va_list *list) +static void _volume_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { const Ecore_Audio_Object *obj = _pd; diff --git a/src/lib/ecore_audio/ecore_audio_obj_in.c b/src/lib/ecore_audio/ecore_audio_obj_in.c index 292d06c..72a0a23 100644 --- a/src/lib/ecore_audio/ecore_audio_obj_in.c +++ b/src/lib/ecore_audio/ecore_audio_obj_in.c @@ -26,7 +26,7 @@ EAPI const Eo_Event_Description _ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED = #define MY_CLASS ECORE_AUDIO_OBJ_IN_CLASS #define MY_CLASS_NAME "ecore_audio_obj_in" -static void _speed_set(Eo *eo_obj, void *_pd, va_list *list) +static void _speed_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { Ecore_Audio_Input *obj = _pd; @@ -42,7 +42,7 @@ static void _speed_set(Eo *eo_obj, void *_pd, va_list *list) eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED, NULL, NULL)); } -static void _speed_get(Eo *eo_obj, void *_pd, va_list *list) +static void _speed_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { const Ecore_Audio_Input *obj = _pd; @@ -52,7 +52,7 @@ static void _speed_get(Eo *eo_obj, void *_pd, va_list *list) *speed = obj->speed; } -static void _samplerate_set(Eo *eo_obj, void *_pd, va_list *list) +static void _samplerate_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { Ecore_Audio_Input *obj = _pd; @@ -63,7 +63,7 @@ static void _samplerate_set(Eo *eo_obj, void *_pd, va_list *list) eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_SAMPLERATE_CHANGED, NULL, NULL)); } -static void _samplerate_get(Eo *eo_obj, void *_pd, va_list *list) +static void _samplerate_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { const Ecore_Audio_Input *obj = _pd; @@ -73,7 +73,7 @@ static void _samplerate_get(Eo *eo_obj, void *_pd, va_list *list) *samplerate = obj->samplerate; } -static void _channels_set(Eo *eo_obj, void *_pd, va_list *list) +static void _channels_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { Ecore_Audio_Input *obj = _pd; @@ -85,7 +85,7 @@ static void _channels_set(Eo *eo_obj, void *_pd, va_list *list) } -static void _channels_get(Eo *eo_obj, void *_pd, va_list *list) +static void _channels_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { const Ecore_Audio_Input *obj = _pd; @@ -95,7 +95,7 @@ static void _channels_get(Eo *eo_obj, void *_pd, va_list *list) *channels = obj->channels; } -static void _looped_set(Eo *eo_obj, void *_pd, va_list *list) +static void _looped_set(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { Ecore_Audio_Input *obj = _pd; @@ -104,7 +104,7 @@ static void _looped_set(Eo *eo_obj, void *_pd, va_list *list) obj->looped = looped; } -static void _looped_get(Eo *eo_obj, void *_pd, va_list *list) +static void _looped_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { const Ecore_Audio_Input *obj = _pd; @@ -114,7 +114,7 @@ static void _looped_get(Eo *eo_obj, void *_pd, va_list *list) *ret = obj->looped; } -static void _length_get(Eo *eo_obj, void *_pd, va_list *list) +static void _length_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { const Ecore_Audio_Input *obj = _pd; @@ -188,7 +188,7 @@ static void _read_internal(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) *ret = len_read; } -static void _output_get(Eo *eo_obj, void *_pd, va_list *list) +static void _output_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { const Ecore_Audio_Input *obj = _pd; diff --git a/src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c b/src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c index 42df376..08ff509 100644 --- a/src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c +++ b/src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c @@ -113,7 +113,7 @@ static void _read(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) *ret = read; } -static void _seek(Eo *eo_obj, void *_pd, va_list *list) +static void _seek(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { Ecore_Audio_Sndfile *obj = _pd; sf_count_t count, pos; @@ -289,7 +289,7 @@ static void _vio_set(Eo *eo_obj, void *_pd, va_list *list) ea_obj->format = ECORE_AUDIO_FORMAT_AUTO; } -static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) +static void _constructor(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) { eo_do_super(eo_obj, MY_CLASS, eo_constructor()); diff --git a/src/lib/ecore_audio/ecore_audio_obj_in_tone.c b/src/lib/ecore_audio/ecore_audio_obj_in_tone.c index e8969c7..f00d5d4 100644 --- a/src/lib/ecore_audio/ecore_audio_obj_in_tone.c +++ b/src/lib/ecore_audio/ecore_audio_obj_in_tone.c @@ -90,12 +90,9 @@ err: *ret = -1.0; } -static void _source_set(Eo *eo_obj, void *_pd, va_list *list) +static void _source_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) { - Ecore_Audio_Tone *obj = _pd; - Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); - Ecore_Audio_Input *in_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_IN_CLASS); const char *source = va_arg(*list, const char *); diff --git a/src/lib/ecore_audio/ecore_audio_obj_out.c b/src/lib/ecore_audio/ecore_audio_obj_out.c index 141d26b..1e7b2d2 100644 --- a/src/lib/ecore_audio/ecore_audio_obj_out.c +++ b/src/lib/ecore_audio/ecore_audio_obj_out.c @@ -42,7 +42,7 @@ static void _input_attach(Eo *eo_obj, void *_pd, va_list *list) *ret = EINA_TRUE; } -static void _input_detach(Eo *eo_obj, void *_pd, va_list *list) +static void _input_detach(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { Ecore_Audio_Output *obj = _pd; Ecore_Audio_Input *in; @@ -61,7 +61,7 @@ static void _input_detach(Eo *eo_obj, void *_pd, va_list *list) } -static void _inputs_get(Eo *eo_obj, void *_pd, va_list *list) +static void _inputs_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list) { const Ecore_Audio_Output *obj = _pd; @@ -72,10 +72,8 @@ static void _inputs_get(Eo *eo_obj, void *_pd, va_list *list) } -static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) +static void _constructor(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) { - const Ecore_Audio_Output *obj = _pd; - eo_do_super(eo_obj, MY_CLASS, eo_constructor()); } diff --git a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c index 3e3a1ba..4402694 100644 --- a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c +++ b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c @@ -83,7 +83,7 @@ static void _write_cb(pa_stream *stream, size_t len, void *data) eo_do(in, ecore_audio_obj_in_read(buf, len, &bread)); pa_stream_write(stream, buf, bread, free, 0, PA_SEEK_RELATIVE); - if (bread < len) + if (bread < (int)len) { pa_operation_unref(pa_stream_trigger(stream, NULL, NULL)); //in->ended = EINA_TRUE; @@ -91,9 +91,8 @@ static void _write_cb(pa_stream *stream, size_t len, void *data) } } -static Eina_Bool _update_samplerate_cb(void *data, Eo *eo_obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) +static Eina_Bool _update_samplerate_cb(void *data EINA_UNUSED, Eo *eo_obj, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) { - Eo *out = data; pa_stream *stream; int samplerate; double speed; @@ -101,9 +100,11 @@ static Eina_Bool _update_samplerate_cb(void *data, Eo *eo_obj, const Eo_Event_De eo_do(eo_obj, ecore_audio_obj_in_samplerate_get(&samplerate)); eo_do(eo_obj, ecore_audio_obj_in_speed_get(&speed)); - eo_do(eo_obj, eo_base_data_get("pulse_data", &stream)); + eo_do(eo_obj, eo_base_data_get("pulse_data", (void **)&stream)); pa_operation_unref(pa_stream_update_sample_rate(stream, samplerate * speed, NULL, NULL)); + + return EINA_TRUE; } static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in) @@ -116,9 +117,9 @@ static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in) Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS); ss.format = PA_SAMPLE_FLOAT32LE; - eo_do(in, ecore_audio_obj_in_samplerate_get(&ss.rate)); + eo_do(in, ecore_audio_obj_in_samplerate_get((int *)&ss.rate)); eo_do(in, ecore_audio_obj_in_speed_get(&speed)); - eo_do(in, ecore_audio_obj_in_channels_get(&ss.channels)); + eo_do(in, ecore_audio_obj_in_channels_get((int *)&ss.channels)); eo_do(in, ecore_audio_obj_name_get(&name)); ss.rate = ss.rate * speed; @@ -135,11 +136,13 @@ static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in) eo_do(in, eo_base_data_set("pulse_data", stream, NULL)); - //FIXME: Handle paused state pa_stream_set_write_callback(stream, _write_cb, in); pa_stream_connect_playback(stream, NULL, NULL, PA_STREAM_VARIABLE_RATE, NULL, NULL); + if (ea_obj->paused) + pa_operation_unref(pa_stream_cork(stream, 1, NULL, NULL)); + return ret; } diff --git a/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c b/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c index 4a04f2a..99e89d1 100644 --- a/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c +++ b/src/lib/ecore_audio/ecore_audio_obj_out_sndfile.c @@ -160,10 +160,8 @@ static void _format_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list) *ret = obj->format; } -static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED) +static void _constructor(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED) { - Ecore_Audio_Sndfile *obj = _pd; - eo_do_super(eo_obj, MY_CLASS, eo_constructor()); eo_do(eo_obj, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_OGG)); -- 2.7.4