summaryrefslogtreecommitdiff
path: root/src/lib/ecore_audio
diff options
context:
space:
mode:
authorDaniel Willmann <d.willmann@samsung.com>2013-04-12 17:40:31 +0100
committerDaniel Willmann <d.willmann@samsung.com>2013-04-18 19:12:17 +0100
commit845aeb5c63fb309041bde94f61a648ceb0504dc4 (patch)
tree20fb8bbf441a5d19c47fe8ae19ade2959110e045 /src/lib/ecore_audio
parentbd948a81a49b300363ea41adc954f2c0605bbfcf (diff)
ecore_audio_obj_in: Implemented read and event sending
A protected read function must now be implemented by the child class to perform the actual reading. Signals on playback loop and end are sent. Signed-off-by: Daniel Willmann <d.willmann@samsung.com>
Diffstat (limited to 'src/lib/ecore_audio')
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in.c28
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_in.h5
-rw-r--r--src/lib/ecore_audio/ecore_audio_private.h2
-rw-r--r--src/lib/ecore_audio/ecore_audio_protected.h10
4 files changed, 40 insertions, 5 deletions
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in.c b/src/lib/ecore_audio/ecore_audio_obj_in.c
index bd3a08849c..d5bb9a3607 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_in.c
@@ -16,6 +16,11 @@
16 16
17EAPI Eo_Op ECORE_AUDIO_OBJ_IN_BASE_ID = EO_NOOP; 17EAPI Eo_Op ECORE_AUDIO_OBJ_IN_BASE_ID = EO_NOOP;
18 18
19EAPI const Eo_Event_Description _ECORE_AUDIO_EV_IN_LOOPED =
20 EO_EVENT_DESCRIPTION("in,looped", "Called when an input has looped.");
21EAPI const Eo_Event_Description _ECORE_AUDIO_EV_IN_STOPPED =
22 EO_EVENT_DESCRIPTION("in,stopped", "Called when an input has stopped playing.");
23
19#define MY_CLASS ECORE_AUDIO_OBJ_IN_CLASS 24#define MY_CLASS ECORE_AUDIO_OBJ_IN_CLASS
20#define MY_CLASS_NAME "ecore_audio_obj_in" 25#define MY_CLASS_NAME "ecore_audio_obj_in"
21 26
@@ -122,9 +127,17 @@ static void _read(Eo *eo_obj, void *_pd, va_list *list)
122 memset(buf, 0, len); 127 memset(buf, 0, len);
123 len_read = len; 128 len_read = len;
124 } else { 129 } else {
125 /* FIXME: Module read func */ 130 eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
126 len_read = 0; 131 if (len_read == 0) {
127 /* FIXME: Signals for loop/EOF */ 132 if (!obj->looped) {
133 eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_STOPPED, NULL, NULL));
134 } else {
135 eo_do(eo_obj, ecore_audio_obj_in_seek(0, SEEK_SET, NULL));
136 eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
137 eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_LOOPED, NULL, NULL));
138 }
139 }
140
128 } 141 }
129 142
130 if (ret) 143 if (ret)
@@ -226,6 +239,7 @@ static const Eo_Op_Description op_desc[] = {
226 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET, S(looped)), 239 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET, S(looped)),
227 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET, G(looped)), 240 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET, G(looped)),
228 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ, "Read from the input"), 241 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ, "Read from the input"),
242 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL, "Internal implementation for the read"),
229 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK, "Seek within the input"), 243 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK, "Seek within the input"),
230 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET, G(output)), 244 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET, G(output)),
231 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET, G(length)), 245 EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET, G(length)),
@@ -233,12 +247,18 @@ static const Eo_Op_Description op_desc[] = {
233 EO_OP_DESCRIPTION_SENTINEL 247 EO_OP_DESCRIPTION_SENTINEL
234}; 248};
235 249
250static const Eo_Event_Description *event_desc[] = {
251 ECORE_AUDIO_EV_IN_LOOPED,
252 ECORE_AUDIO_EV_IN_STOPPED,
253 NULL
254};
255
236static const Eo_Class_Description class_desc = { 256static const Eo_Class_Description class_desc = {
237 EO_VERSION, 257 EO_VERSION,
238 MY_CLASS_NAME, 258 MY_CLASS_NAME,
239 EO_CLASS_TYPE_REGULAR, 259 EO_CLASS_TYPE_REGULAR,
240 EO_CLASS_DESCRIPTION_OPS(&ECORE_AUDIO_OBJ_IN_BASE_ID, op_desc, ECORE_AUDIO_OBJ_IN_SUB_ID_LAST), 260 EO_CLASS_DESCRIPTION_OPS(&ECORE_AUDIO_OBJ_IN_BASE_ID, op_desc, ECORE_AUDIO_OBJ_IN_SUB_ID_LAST),
241 NULL, 261 event_desc,
242 sizeof(Ecore_Audio_Input), 262 sizeof(Ecore_Audio_Input),
243 _class_constructor, 263 _class_constructor,
244 NULL 264 NULL
diff --git a/src/lib/ecore_audio/ecore_audio_obj_in.h b/src/lib/ecore_audio/ecore_audio_obj_in.h
index 57832b8a7c..10becd0169 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_in.h
+++ b/src/lib/ecore_audio/ecore_audio_obj_in.h
@@ -52,6 +52,7 @@ enum Ecore_Audio_Obj_In_Sub_Ids
52 ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET, 52 ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET,
53 ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET, 53 ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET,
54 ECORE_AUDIO_OBJ_IN_SUB_ID_READ, 54 ECORE_AUDIO_OBJ_IN_SUB_ID_READ,
55 ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL,
55 ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK, 56 ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK,
56 ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET, 57 ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET,
57 ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET, 58 ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET,
@@ -108,7 +109,11 @@ enum Ecore_Audio_Obj_In_Sub_Ids
108 109
109#define ecore_audio_obj_in_remaining_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET), EO_TYPECHECK(double *, ret) 110#define ecore_audio_obj_in_remaining_get(ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_REMAINING_GET), EO_TYPECHECK(double *, ret)
110 111
112extern const Eo_Event_Description _ECORE_AUDIO_EV_IN_LOOPED;
113#define ECORE_AUDIO_EV_IN_LOOPED (&(_ECORE_AUDIO_EV_IN_LOOPED))
111 114
115extern const Eo_Event_Description _ECORE_AUDIO_EV_IN_STOPPED;
116#define ECORE_AUDIO_EV_IN_STOPPED (&(_ECORE_AUDIO_EV_IN_STOPPED))
112 117
113/** 118/**
114 * @} 119 * @}
diff --git a/src/lib/ecore_audio/ecore_audio_private.h b/src/lib/ecore_audio/ecore_audio_private.h
index 3d6999f5bc..7d74215a19 100644
--- a/src/lib/ecore_audio/ecore_audio_private.h
+++ b/src/lib/ecore_audio/ecore_audio_private.h
@@ -28,6 +28,7 @@
28#include "ecore_private.h" 28#include "ecore_private.h"
29 29
30#include "Ecore_Audio.h" 30#include "Ecore_Audio.h"
31#include "ecore_audio_protected.h"
31 32
32extern int _ecore_audio_log_dom; 33extern int _ecore_audio_log_dom;
33 34
@@ -61,7 +62,6 @@ extern int _ecore_audio_log_dom;
61#endif 62#endif
62#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_audio_log_dom, __VA_ARGS__) 63#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_audio_log_dom, __VA_ARGS__)
63 64
64
65/** 65/**
66 * @defgroup Ecore_Audio_Module_API_Group Ecore_Audio_Module_API - API for modules 66 * @defgroup Ecore_Audio_Module_API_Group Ecore_Audio_Module_API - API for modules
67 * @ingroup Ecore_Audio_Group 67 * @ingroup Ecore_Audio_Group
diff --git a/src/lib/ecore_audio/ecore_audio_protected.h b/src/lib/ecore_audio/ecore_audio_protected.h
new file mode 100644
index 0000000000..0e962cea17
--- /dev/null
+++ b/src/lib/ecore_audio/ecore_audio_protected.h
@@ -0,0 +1,10 @@
1#ifndef ECORE_AUDIO_PROTECTED_H_
2#define ECORE_AUDIO_PROTECTED_H_
3
4#include "Eo.h"
5#include "Ecore.h"
6#include "Ecore_Audio.h"
7
8#define ecore_audio_obj_in_read_internal(buf, len, ret) ECORE_AUDIO_OBJ_IN_ID(ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL), EO_TYPECHECK(char *, buf), EO_TYPECHECK(int, len), EO_TYPECHECK(int *, ret)
9
10#endif