forked from enlightenment/efl
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>
This commit is contained in:
parent
bd948a81a4
commit
845aeb5c63
|
@ -9,7 +9,8 @@ dist_installed_ecoreaudiomainheaders_DATA = \
|
|||
lib/ecore_audio/Ecore_Audio.h \
|
||||
lib/ecore_audio/ecore_audio_obj.h \
|
||||
lib/ecore_audio/ecore_audio_obj_in.h \
|
||||
lib/ecore_audio/ecore_audio_obj_out.h
|
||||
lib/ecore_audio/ecore_audio_obj_out.h \
|
||||
lib/ecore_audio/ecore_audio_protected.h
|
||||
|
||||
|
||||
lib_ecore_audio_libecore_audio_la_SOURCES = \
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
|
||||
EAPI Eo_Op ECORE_AUDIO_OBJ_IN_BASE_ID = EO_NOOP;
|
||||
|
||||
EAPI const Eo_Event_Description _ECORE_AUDIO_EV_IN_LOOPED =
|
||||
EO_EVENT_DESCRIPTION("in,looped", "Called when an input has looped.");
|
||||
EAPI const Eo_Event_Description _ECORE_AUDIO_EV_IN_STOPPED =
|
||||
EO_EVENT_DESCRIPTION("in,stopped", "Called when an input has stopped playing.");
|
||||
|
||||
#define MY_CLASS ECORE_AUDIO_OBJ_IN_CLASS
|
||||
#define MY_CLASS_NAME "ecore_audio_obj_in"
|
||||
|
||||
|
@ -122,9 +127,17 @@ static void _read(Eo *eo_obj, void *_pd, va_list *list)
|
|||
memset(buf, 0, len);
|
||||
len_read = len;
|
||||
} else {
|
||||
/* FIXME: Module read func */
|
||||
len_read = 0;
|
||||
/* FIXME: Signals for loop/EOF */
|
||||
eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
|
||||
if (len_read == 0) {
|
||||
if (!obj->looped) {
|
||||
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));
|
||||
eo_do(eo_obj, ecore_audio_obj_in_read_internal(buf, len, &len_read));
|
||||
eo_do(eo_obj, eo_event_callback_call(ECORE_AUDIO_EV_IN_LOOPED, NULL, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (ret)
|
||||
|
@ -226,6 +239,7 @@ static const Eo_Op_Description op_desc[] = {
|
|||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET, S(looped)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET, G(looped)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ, "Read from the input"),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL, "Internal implementation for the read"),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK, "Seek within the input"),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET, G(output)),
|
||||
EO_OP_DESCRIPTION(ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET, G(length)),
|
||||
|
@ -233,12 +247,18 @@ static const Eo_Op_Description op_desc[] = {
|
|||
EO_OP_DESCRIPTION_SENTINEL
|
||||
};
|
||||
|
||||
static const Eo_Event_Description *event_desc[] = {
|
||||
ECORE_AUDIO_EV_IN_LOOPED,
|
||||
ECORE_AUDIO_EV_IN_STOPPED,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const Eo_Class_Description class_desc = {
|
||||
EO_VERSION,
|
||||
MY_CLASS_NAME,
|
||||
EO_CLASS_TYPE_REGULAR,
|
||||
EO_CLASS_DESCRIPTION_OPS(&ECORE_AUDIO_OBJ_IN_BASE_ID, op_desc, ECORE_AUDIO_OBJ_IN_SUB_ID_LAST),
|
||||
NULL,
|
||||
event_desc,
|
||||
sizeof(Ecore_Audio_Input),
|
||||
_class_constructor,
|
||||
NULL
|
||||
|
|
|
@ -52,6 +52,7 @@ enum Ecore_Audio_Obj_In_Sub_Ids
|
|||
ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_SET,
|
||||
ECORE_AUDIO_OBJ_IN_SUB_ID_LOOPED_GET,
|
||||
ECORE_AUDIO_OBJ_IN_SUB_ID_READ,
|
||||
ECORE_AUDIO_OBJ_IN_SUB_ID_READ_INTERNAL,
|
||||
ECORE_AUDIO_OBJ_IN_SUB_ID_SEEK,
|
||||
ECORE_AUDIO_OBJ_IN_SUB_ID_OUTPUT_GET,
|
||||
ECORE_AUDIO_OBJ_IN_SUB_ID_LENGTH_GET,
|
||||
|
@ -108,7 +109,11 @@ enum Ecore_Audio_Obj_In_Sub_Ids
|
|||
|
||||
#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)
|
||||
|
||||
extern const Eo_Event_Description _ECORE_AUDIO_EV_IN_LOOPED;
|
||||
#define ECORE_AUDIO_EV_IN_LOOPED (&(_ECORE_AUDIO_EV_IN_LOOPED))
|
||||
|
||||
extern const Eo_Event_Description _ECORE_AUDIO_EV_IN_STOPPED;
|
||||
#define ECORE_AUDIO_EV_IN_STOPPED (&(_ECORE_AUDIO_EV_IN_STOPPED))
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "ecore_private.h"
|
||||
|
||||
#include "Ecore_Audio.h"
|
||||
#include "ecore_audio_protected.h"
|
||||
|
||||
extern int _ecore_audio_log_dom;
|
||||
|
||||
|
@ -61,7 +62,6 @@ extern int _ecore_audio_log_dom;
|
|||
#endif
|
||||
#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_audio_log_dom, __VA_ARGS__)
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Audio_Module_API_Group Ecore_Audio_Module_API - API for modules
|
||||
* @ingroup Ecore_Audio_Group
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef ECORE_AUDIO_PROTECTED_H_
|
||||
#define ECORE_AUDIO_PROTECTED_H_
|
||||
|
||||
#include "Eo.h"
|
||||
#include "Ecore.h"
|
||||
#include "Ecore_Audio.h"
|
||||
|
||||
#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)
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue