More adjustments for eo2 calls.

This commit is contained in:
Tom Hacohen 2014-04-02 14:21:57 +01:00
parent d36ca8f949
commit 96fe5bd941
5 changed files with 51 additions and 51 deletions

View File

@ -27,7 +27,7 @@ _ecore_audio_in_speed_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj, double
obj->speed = speed;
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, NULL));
}
EOLIAN static double
@ -41,7 +41,7 @@ _ecore_audio_in_samplerate_set(Eo *eo_obj EINA_UNUSED, Ecore_Audio_Input *obj, i
{
obj->samplerate = samplerate;
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_SAMPLERATE_CHANGED, NULL));
}
EOLIAN static int
@ -88,8 +88,8 @@ _ecore_audio_in_remaining_get(Eo *eo_obj, Ecore_Audio_Input *obj)
{
if (!obj->seekable) return -1;
else {
double ret;
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_CUR, &ret));
double ret = 0.0;
eo_do(eo_obj, ret = ecore_audio_obj_in_seek(0, SEEK_CUR));
return obj->length - ret;
}
}
@ -104,14 +104,14 @@ _ecore_audio_in_read(Eo *eo_obj, Ecore_Audio_Input *obj, void *buf, size_t len)
memset(buf, 0, len);
len_read = len;
} else {
eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
eo_do(eo_obj, len_read = ecore_audio_obj_in_read_internal(buf, len));
if (len_read == 0) {
if (!obj->looped || !obj->seekable) {
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_STOPPED, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_STOPPED, NULL));
} else {
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_SET, NULL));
eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_LOOPED, NULL, NULL));
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_SET));
eo_do(eo_obj, len_read = ecore_audio_obj_in_read_internal(buf, len));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_IN_EVENT_IN_LOOPED, NULL));
}
}
@ -182,7 +182,7 @@ EOLIAN static void
_ecore_audio_in_eo_base_destructor(Eo *eo_obj, Ecore_Audio_Input *obj)
{
if(obj->output)
eo_do(obj->output, ecore_audio_obj_out_input_detach(eo_obj, NULL));
eo_do(obj->output, ecore_audio_obj_out_input_detach(eo_obj));
eo_do_super(eo_obj, MY_CLASS, eo_destructor());
}

View File

@ -83,7 +83,7 @@ _ecore_audio_in_tone_ecore_audio_in_length_set(Eo *eo_obj, Ecore_Audio_In_Tone_D
}
EOLIAN static void
_ecore_audio_in_tone_eo_key_data_set(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj, const char *key, const void *val, eo_key_data_free_func func)
_ecore_audio_in_tone_eo_base_key_data_set(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj, const char *key, const void *val, eo_key_data_free_func func)
{
if (!key) return;
@ -96,13 +96,13 @@ _ecore_audio_in_tone_eo_key_data_set(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj,
}
EOLIAN static void*
_ecore_audio_in_tone_eo_key_data_get(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj, const char *key)
_ecore_audio_in_tone_eo_base_key_data_get(Eo *eo_obj, Ecore_Audio_In_Tone_Data *obj, const char *key)
{
if (!strcmp(key, ECORE_AUDIO_ATTR_TONE_FREQ)) {
return (void *) (intptr_t) obj->freq;
} else {
void *ret = NULL;
eo_do_super(eo_obj, MY_CLASS, eo_key_data_get(key, &ret));
eo_do_super(eo_obj, MY_CLASS, ret = eo_key_data_get(key));
return ret;
}
}

View File

@ -25,7 +25,7 @@ static Eina_Bool _write_cb(void *data)
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);
ssize_t written, bread;
ssize_t written, bread = 0;
float buf[1024];
if (!ea_obj->vio || !ea_obj->vio->vio->write)
@ -34,7 +34,7 @@ static Eina_Bool _write_cb(void *data)
/* FIXME: Multiple inputs */
in = eina_list_data_get(out_obj->inputs);
eo_do(in, ecore_audio_obj_in_read(buf, 4*1024, &bread));
eo_do(in, bread = ecore_audio_obj_in_read(buf, 4*1024));
if (bread == 0) {
ea_obj->paused = EINA_TRUE;
@ -61,7 +61,7 @@ _ecore_audio_out_input_attach(Eo *eo_obj, Ecore_Audio_Output *obj, Eo *input)
if (in->output == eo_obj)
return EINA_FALSE;
if (in->output) eo_do(in->output, ecore_audio_obj_out_input_detach(input, NULL));
if (in->output) eo_do(in->output, ecore_audio_obj_out_input_detach(input));
in->output = eo_obj;
/* TODO: Send event */
@ -144,7 +144,7 @@ _ecore_audio_out_eo_base_destructor(Eo *eo_obj, Ecore_Audio_Output *obj)
Eo *in;
EINA_LIST_FOREACH_SAFE(obj->inputs, cur, tmp, in) {
eo_do(eo_obj, ecore_audio_obj_out_input_detach(in, NULL));
eo_do(eo_obj, ecore_audio_obj_out_input_detach(in));
}
eo_do_super(eo_obj, MY_CLASS, eo_destructor());

View File

@ -46,7 +46,7 @@ EOLIAN static void
_ecore_audio_out_pulse_ecore_audio_volume_set(Eo *eo_obj, Ecore_Audio_Out_Pulse_Data *_pd EINA_UNUSED, double volume)
{
Eo *in;
pa_stream *stream;
pa_stream *stream = NULL;
Eina_List *input;
uint32_t idx;
pa_cvolume pa_volume;
@ -60,7 +60,7 @@ _ecore_audio_out_pulse_ecore_audio_volume_set(Eo *eo_obj, Ecore_Audio_Out_Pulse_
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_volume_set(volume));
EINA_LIST_FOREACH(out_obj->inputs, input, in) {
eo_do(in, eo_key_data_get("pulse_data", (void **)&stream));
eo_do(in, stream = eo_key_data_get("pulse_data"));
idx = pa_stream_get_index(stream);
pa_operation_unref(pa_context_set_sink_input_volume(class_vars.context, idx, &pa_volume, NULL, NULL));
}
@ -72,12 +72,12 @@ static void _write_cb(pa_stream *stream, size_t len, void *data)
Eo *in = data;
void *buf;
ssize_t bread;
ssize_t bread = 0;
size_t wlen = len;
pa_stream_begin_write(stream, &buf, &wlen);
eo_do(in, ecore_audio_obj_in_read(buf, wlen, &bread));
eo_do(in, bread = ecore_audio_obj_in_read(buf, wlen));
pa_stream_write(stream, buf, bread, NULL, 0, PA_SEEK_RELATIVE);
if (bread < (int)len)
@ -88,14 +88,14 @@ static void _write_cb(pa_stream *stream, size_t len, void *data)
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)
{
pa_stream *stream;
int samplerate;
double speed;
pa_stream *stream = NULL;
int samplerate = 0;
double speed = 0;
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, samplerate = ecore_audio_obj_in_samplerate_get());
eo_do(eo_obj, speed = ecore_audio_obj_in_speed_get());
eo_do(eo_obj, eo_key_data_get("pulse_data", (void **)&stream));
eo_do(eo_obj, stream = eo_key_data_get("pulse_data"));
pa_operation_unref(pa_stream_update_sample_rate(stream, samplerate * speed, NULL, NULL));
@ -104,29 +104,29 @@ static Eina_Bool _update_samplerate_cb(void *data EINA_UNUSED, Eo *eo_obj, const
static Eina_Bool _input_attach_internal(Eo *eo_obj, Eo *in)
{
const char *name;
const char *name = NULL;
pa_sample_spec ss;
double speed;
double speed = 0;
pa_stream *stream;
Eina_Bool ret;
Eina_Bool ret = EINA_FALSE;
Ecore_Audio_Object *ea_obj = eo_data_scope_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, &ret));
eo_do_super(eo_obj, MY_CLASS, ret = ecore_audio_obj_out_input_attach(in));
if (!ret)
return EINA_FALSE;
ss.format = PA_SAMPLE_FLOAT32LE;
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((int *)&ss.channels));
eo_do(in, ecore_audio_obj_name_get(&name));
eo_do(in, ss.rate = ecore_audio_obj_in_samplerate_get());
eo_do(in, speed = ecore_audio_obj_in_speed_get());
eo_do(in, ss.channels = ecore_audio_obj_in_channels_get());
eo_do(in, name = ecore_audio_obj_name_get());
ss.rate = ss.rate * speed;
stream = pa_stream_new(class_vars.context, name, &ss, NULL);
if (!stream) {
ERR("Could not create stream");
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));
return EINA_FALSE;
}
@ -178,14 +178,14 @@ static void _drain_cb(pa_stream *stream, int success EINA_UNUSED, void *data EIN
EOLIAN static Eina_Bool
_ecore_audio_out_pulse_ecore_audio_out_input_detach(Eo *eo_obj, Ecore_Audio_Out_Pulse_Data *_pd EINA_UNUSED, Eo *in)
{
pa_stream *stream;
Eina_Bool ret2;
pa_stream *stream = NULL;
Eina_Bool ret2 = EINA_FALSE;
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_detach(in, &ret2));
eo_do_super(eo_obj, MY_CLASS, ret2 = ecore_audio_obj_out_input_detach(in));
if (!ret2)
return EINA_FALSE;
eo_do(in, eo_key_data_get("pulse_data", (void **)&stream));
eo_do(in, stream = eo_key_data_get("pulse_data"));
pa_stream_set_write_callback(stream, NULL, NULL);
pa_operation_unref(pa_stream_drain(stream, _drain_cb, NULL));
@ -210,12 +210,12 @@ static void _state_cb(pa_context *context, void *data EINA_UNUSED)
if (state == PA_CONTEXT_READY) {
DBG("PA context ready.");
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_READY, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_READY, NULL));
}
} else if ((state == PA_CONTEXT_FAILED) || (state == PA_CONTEXT_TERMINATED)) {
DBG("PA context fail.");
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL));
}
} else {
DBG("Connection state %i", state);
@ -241,7 +241,7 @@ static void _state_job(void *data EINA_UNUSED)
}
// the callback here can delete things in the list..
EINA_LIST_FOREACH(class_vars.outputs, out, eo_obj) {
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL, NULL));
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_OUT_PULSE_EVENT_CONTEXT_FAIL, NULL));
}
// now unref everything safely
EINA_LIST_FOREACH_SAFE(class_vars.outputs, out, tmp, eo_obj) {

View File

@ -37,13 +37,13 @@ static Eina_Bool _write_cb(void *data)
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);
ssize_t written, bread;
ssize_t written, bread = 0;
float buf[1024];
/* TODO: Support mixing of multiple inputs */
in = eina_list_data_get(out_obj->inputs);
eo_do(in, ecore_audio_obj_in_read(buf, 4*1024, &bread));
eo_do(in, bread = ecore_audio_obj_in_read(buf, 4*1024));
if (bread == 0) {
sf_write_sync(obj->handle);
@ -64,21 +64,21 @@ _ecore_audio_out_sndfile_ecore_audio_out_input_attach(Eo *eo_obj, Ecore_Audio_Ou
{
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);
Eina_Bool ret2;
Eina_Bool ret2 = EINA_FALSE;
eo_do_super(eo_obj, MY_CLASS, ecore_audio_obj_out_input_attach(in, &ret2));
eo_do_super(eo_obj, MY_CLASS, ret2 = ecore_audio_obj_out_input_attach(in));
if (!ret2)
return EINA_FALSE;
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, obj->sfinfo.samplerate = ecore_audio_obj_in_samplerate_get());
eo_do(in, obj->sfinfo.channels = ecore_audio_obj_in_channels_get());
obj->handle = sf_open(ea_obj->source, SFM_WRITE, &obj->sfinfo);
if (!obj->handle) {
eina_stringshare_del(ea_obj->source);
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));
return EINA_FALSE;
}
@ -165,7 +165,7 @@ _ecore_audio_out_sndfile_eo_base_constructor(Eo *eo_obj, Ecore_Audio_Out_Sndfile
eo_do_super(eo_obj, MY_CLASS, eo_constructor());
eo_do(eo_obj, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_OGG, NULL));
eo_do(eo_obj, ecore_audio_obj_format_set(ECORE_AUDIO_FORMAT_OGG));
// FIXME: Use writer from output
out_obj->need_writer = EINA_FALSE;