Skip to content

Commit

Permalink
ucm: Moved ucm to src/ucm subdirectory
Browse files Browse the repository at this point in the history
- separate code to more files
- use standard lists to represent structures
- use alsa-lib configuration parser

Signed-off-by: Jaroslav Kysela <[email protected]>
  • Loading branch information
perexg committed Sep 15, 2010
1 parent fcc9adb commit 1c79fad
Show file tree
Hide file tree
Showing 11 changed files with 2,888 additions and 3,526 deletions.
6 changes: 5 additions & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,9 @@ AC_ARG_ENABLE(hwdep,
AC_ARG_ENABLE(seq,
AS_HELP_STRING([--disable-seq], [disable the sequencer component]),
[build_seq="$enableval"], [build_seq="yes"])
AC_ARG_ENABLE(ucm,
AS_HELP_STRING([--disable-ucm], [disable the use-case-manager component]),
[build_ucm="$enableval"], [build_ucm="yes"])
AC_ARG_ENABLE(alisp,
AS_HELP_STRING([--disable-alisp], [disable the alisp component]),
[build_alisp="$enableval"], [build_alisp="yes"])
Expand Down Expand Up @@ -414,6 +417,7 @@ AM_CONDITIONAL(BUILD_PCM, test x$build_pcm = xyes)
AM_CONDITIONAL(BUILD_RAWMIDI, test x$build_rawmidi = xyes)
AM_CONDITIONAL(BUILD_HWDEP, test x$build_hwdep = xyes)
AM_CONDITIONAL(BUILD_SEQ, test x$build_seq = xyes)
AM_CONDITIONAL(BUILD_UCM, test x$build_ucm = xyes)
AM_CONDITIONAL(BUILD_ALISP, test x$build_alisp = xyes)
AM_CONDITIONAL(BUILD_PYTHON, test x$build_python = xyes)

Expand Down Expand Up @@ -598,7 +602,7 @@ AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile doc/doxygen.cfg \
src/control/Makefile src/mixer/Makefile \
src/pcm/Makefile src/pcm/scopes/Makefile \
src/rawmidi/Makefile src/timer/Makefile \
src/hwdep/Makefile src/seq/Makefile \
src/hwdep/Makefile src/seq/Makefile src/ucm/Makefile \
src/compat/Makefile src/alisp/Makefile src/conf/Makefile \
src/conf/cards/Makefile \
src/conf/pcm/Makefile \
Expand Down
6 changes: 4 additions & 2 deletions doc/doxygen.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ INPUT = @top_srcdir@/doc/index.doxygen \
@top_srcdir@/src/rawmidi \
@top_srcdir@/src/timer \
@top_srcdir@/src/hwdep \
@top_srcdir@/src/seq
@top_srcdir@/src/seq \
@top_srcdir@/src/ucm
EXCLUDE = @top_srcdir@/src/control/control_local.h \
@top_srcdir@/src/pcm/atomic.h \
@top_srcdir@/src/pcm/interval.h \
Expand All @@ -92,7 +93,8 @@ EXCLUDE = @top_srcdir@/src/control/control_local.h \
@top_srcdir@/src/hwdep/hwdep_local.h \
@top_srcdir@/src/mixer/mixer_local.h \
@top_srcdir@/src/rawmidi/rawmidi_local.h \
@top_srcdir@/src/seq/seq_local.h
@top_srcdir@/src/seq/seq_local.h \
@top_srcdir@/src/seq/ucm_local.h
RECURSIVE = YES
FILE_PATTERNS = *.c *.h
EXAMPLE_PATH = @top_srcdir@/test
Expand Down
8 changes: 8 additions & 0 deletions include/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,13 @@ static __inline__ void list_splice(struct list_head *list, struct list_head *hea
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))

/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
* @type: the type of the struct this is embedded in.
* @offset: offset of entry inside a struct
*/
#define list_entry_offset(ptr, type, offset) \
((type *)((char *)(ptr)-(offset)))

#endif /* _LIST_H */
22 changes: 15 additions & 7 deletions include/use-case.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,18 @@ typedef struct snd_use_case_mgr snd_use_case_mgr_t;
*/
char *snd_use_case_identifier(const char *fmt, ...);

/**
* \brief Free a string list
* \param list The string list to free
* \return Zero if success, otherwise a negative error code
*/
int snd_use_case_free_list(const char *list[]);

/**
* \brief Obtain a list of entries
* \param uc_mgr Use case manager
* \param identifier (may be NULL)
* \param list Returned list
* \param uc_mgr Use case manager (may be NULL - card list)
* \param identifier (may be NULL - card list)
* \param list Returned allocated list
* \return Number of list entries if success, otherwise a negative error code
*
* Defined identifiers:
Expand Down Expand Up @@ -215,6 +222,8 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
* Known identifiers:
* NULL - return current card
* _verb - return current verb
* _tq - return current Tone Quality
* _tq/<modifier> - return Tone Quality for given modifier
* _pcm_/_pdevice[/<modifier>] - full PCM playback device name
* _pcm_/_cdevice[/<modifier>] - full PCM capture device name
* _ctl_/_pctl_[/<modifier>] - playback control device name
Expand All @@ -241,8 +250,6 @@ int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
* Known identifiers:
* _devstatus/<device> - return status for given device
* _modstatus/<modifier> - return status for given modifier
* _tq - return current Tone Quality
* _tq/<modifier> - return Tone Quality for given modifier
*/
int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
const char *identifier);
Expand Down Expand Up @@ -275,10 +282,11 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,

/**
* \brief Open and initialise use case core for sound card
* \param uc_mgr Returned use case manager pointer
* \param card_name Sound card name.
* \return Use case handle if success, otherwise NULL
* \return zero if success, otherwise a negative error code
*/
snd_use_case_mgr_t *snd_use_case_mgr_open(const char *card_name);
int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr, const char *card_name);


/**
Expand Down
6 changes: 5 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ SYMFUNCS =
endif

lib_LTLIBRARIES = libasound.la
libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c shmarea.c userfile.c names.c use-case.c
libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc.c socket.c shmarea.c userfile.c names.c

SUBDIRS=control
libasound_la_LIBADD = control/libcontrol.la
Expand All @@ -38,6 +38,10 @@ if BUILD_SEQ
SUBDIRS += seq
libasound_la_LIBADD += seq/libseq.la
endif
if BUILD_UCM
SUBDIRS += ucm
libasound_la_LIBADD += ucm/libucm.la
endif
if BUILD_ALISP
SUBDIRS += alisp
libasound_la_LIBADD += alisp/libalisp.la
Expand Down
10 changes: 10 additions & 0 deletions src/ucm/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
EXTRA_LTLIBRARIES = libucm.la

libucm_la_SOURCES = utils.c parser.c main.c

noinst_HEADERS = ucm_local.h

all: libucm.la


INCLUDES=-I$(top_srcdir)/include
Loading

0 comments on commit 1c79fad

Please sign in to comment.