summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-04-19 15:28:00 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-04-19 15:28:00 +0100
commit1c0107afd8989a48841fd5bd94bfc0bd322b8030 (patch)
tree8f6eeb37d0540e866bd36ac05f677dc1b5a97b21
parentde265a994ac7e32f4b543df28798a793a7be1bef (diff)
downloadefl-1c0107afd8989a48841fd5bd94bfc0bd322b8030.tar.gz
ecore_audio: Fix seeking in tone input
Also make seekable be a property of the input as this doesn't make sense for the output. Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in.c10
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c8
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in_tone.c2
-rw-r--r--src/lib/ecore_audio/ecore_audio_private.h2
4 files changed, 12 insertions, 10 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in.c b/src/lib/ecore_audio/ecore_audio_obj_in.c
index 72a0a23e8e..1264939f8a 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in.c
@@ -128,11 +128,10 @@ static void _length_get(Eo *eo_obj EINA_UNUSED, void *_pd, va_list *list)
static void _remaining_get(Eo *eo_obj, void *_pd, va_list *list)
{
const Ecore_Audio_Input *obj = _pd;
- Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
double *ret = va_arg(*list, double *);
- if (!ea_obj->seekable && ret) {
+ if (!obj->seekable && ret) {
*ret = -1;
} else if (ret) {
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_CUR, ret));
@@ -156,7 +155,7 @@ static void _read(Eo *eo_obj, void *_pd, va_list *list)
} else {
eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
if (len_read == 0) {
- if (!obj->looped || !ea_obj->seekable) {
+ if (!obj->looped || !obj->seekable) {
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_STOPPED, NULL, NULL));
} else {
eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_SET, NULL));
@@ -207,8 +206,9 @@ static void _free_vio(Ecore_Audio_Object *ea_obj)
ea_obj->vio = NULL;
}
-static void _vio_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
+static void _vio_set(Eo *eo_obj, void *_pd, va_list *list)
{
+ Ecore_Audio_Input *obj = _pd;
Ecore_Audio_Object *ea_obj = eo_data_get(eo_obj, ECORE_AUDIO_OBJ_CLASS);
Ecore_Audio_Vio *vio = va_arg(*list, Ecore_Audio_Vio *);
@@ -226,7 +226,7 @@ static void _vio_set(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
ea_obj->vio->data = data;
ea_obj->vio->free_func = free_func;
//FIXME: Save previous value
- ea_obj->seekable = (vio->seek != NULL);
+ obj->seekable = (vio->seek != NULL);
}
static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
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 08ff50955d..6dcc9fb591 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in_sndfile.c
@@ -156,7 +156,7 @@ static void _source_set(Eo *eo_obj, void *_pd, va_list *list)
return;
}
- ea_obj->seekable = EINA_TRUE;
+ in_obj->seekable = EINA_TRUE;
in_obj->length = (double)obj->sfinfo.frames / obj->sfinfo.samplerate;
in_obj->samplerate = obj->sfinfo.samplerate;
@@ -254,7 +254,7 @@ static void _vio_set(Eo *eo_obj, void *_pd, va_list *list)
if (ea_obj->vio)
_free_vio(ea_obj);
- ea_obj->seekable = EINA_FALSE;
+ in_obj->seekable = EINA_FALSE;
if (!vio)
return;
@@ -263,7 +263,7 @@ static void _vio_set(Eo *eo_obj, void *_pd, va_list *list)
ea_obj->vio->vio = vio;
ea_obj->vio->data = data;
ea_obj->vio->free_func = free_func;
- ea_obj->seekable = (vio->seek != NULL);
+ in_obj->seekable = (vio->seek != NULL);
obj->handle = sf_open_virtual(&vio_wrapper, SFM_READ, &obj->sfinfo, eo_obj);
@@ -273,7 +273,7 @@ static void _vio_set(Eo *eo_obj, void *_pd, va_list *list)
return;
}
- ea_obj->seekable = EINA_TRUE;
+ in_obj->seekable = EINA_TRUE;
in_obj->length = (double)obj->sfinfo.frames / obj->sfinfo.samplerate;
in_obj->samplerate = obj->sfinfo.samplerate;
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 f00d5d4830..11627f16d3 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in_tone.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in_tone.c
@@ -85,6 +85,7 @@ static void _seek(Eo *eo_obj, void *_pd, va_list *list)
if (ret)
*ret = (double)obj->phase / in_obj->samplerate;
+ return;
err:
if (ret)
*ret = -1.0;
@@ -196,6 +197,7 @@ static void _constructor(Eo *eo_obj, void *_pd, va_list *list EINA_UNUSED)
in_obj->channels = 1;
in_obj->samplerate = 44100;
in_obj->length = 1;
+ in_obj->seekable = EINA_TRUE;
obj->freq = 1000;
}
diff --git a/src/lib/ecore_audio/ecore_audio_private.h b/src/lib/ecore_audio/ecore_audio_private.h
index e899a04254..0b0bfec28b 100644
--- a/src/lib/ecore_audio/ecore_audio_private.h
+++ b/src/lib/ecore_audio/ecore_audio_private.h
@@ -106,7 +106,6 @@ struct _Ecore_Audio_Object
const char *name;
const char *source;
- Eina_Bool seekable;
Eina_Bool paused;
double volume;
Ecore_Audio_Format format;
@@ -129,6 +128,7 @@ struct _Ecore_Audio_Output
struct _Ecore_Audio_Input
{
Eina_Bool paused; /**< Is the input paused? */
+ Eina_Bool seekable;
Eo *output; /**< The output this input is connected to */