mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-04-09 08:20:59 -04:00
Merge branch 'master' into update-upstream
This commit is contained in:
commit
00b5d9d8c0
183 changed files with 4482 additions and 3930 deletions
|
|
@ -1056,7 +1056,7 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
}
|
||||
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for server %s definition", srvname);
|
||||
snd_error(ASERVER, "Invalid type for server %s definition", srvname);
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_config_for_each(i, next, conf) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.59)
|
||||
AC_INIT(alsa-lib, 1.2.14)
|
||||
AC_INIT(alsa-lib, 1.2.15pre1)
|
||||
|
||||
AC_CONFIG_SRCDIR([src/control/control.c])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ INPUT = @top_srcdir@/doc/index.doxygen \
|
|||
@top_srcdir@/include/conf.h \
|
||||
@top_srcdir@/include/control.h \
|
||||
@top_srcdir@/include/pcm.h \
|
||||
@top_srcdir@/include/pcm_plugin.h \
|
||||
@top_srcdir@/include/rawmidi.h \
|
||||
@top_srcdir@/include/ump.h \
|
||||
@top_srcdir@/include/ump_msg.h \
|
||||
|
|
@ -127,7 +128,7 @@ INHERIT_DOCS = YES
|
|||
ENABLED_SECTIONS = ""
|
||||
MACRO_EXPANSION = YES
|
||||
EXPAND_ONLY_PREDEF = YES
|
||||
PREDEFINED = DOXYGEN PIC "DOC_HIDDEN" \
|
||||
PREDEFINED = DOXYGEN PIC "DOC_HIDDEN" "ALSA_LIBRARY_BUILD" \
|
||||
"ATTRIBUTE_UNUSED=" \
|
||||
ALSA_PCM_NEW_HW_PARAMS_API \
|
||||
_POSIX_C_SOURCE \
|
||||
|
|
@ -140,5 +141,3 @@ TYPEDEF_HIDES_STRUCT = YES # needed in doxygen >= 1.5.4
|
|||
|
||||
#INPUT_FILTER = inputfilter
|
||||
#FILTER_SOURCE_FILES = YES
|
||||
|
||||
HTML_TIMESTAMP = NO
|
||||
|
|
|
|||
|
|
@ -56,8 +56,8 @@
|
|||
#define use_symbol_version(real, name, version) /* nothing */
|
||||
#if defined(__alpha__) || defined(__mips__)
|
||||
#define use_default_symbol_version(real, name, version) \
|
||||
__asm__ (".weak " ASM_NAME(#name)); \
|
||||
__asm__ (ASM_NAME(#name) " = " ASM_NAME(#real))
|
||||
__asm__ (".weak " ASM_NAME(#name)); \
|
||||
__asm__ (ASM_NAME(#name) " = " ASM_NAME(#real))
|
||||
#else
|
||||
#define use_default_symbol_version(real, name, version) \
|
||||
__asm__ (".weak " ASM_NAME(#name)); \
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_ASOUNDEF_H
|
||||
#define __ALSA_ASOUNDEF_H
|
||||
#define __ALSA_ASOUNDEF_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_CONF_H
|
||||
#define __ALSA_CONF_H
|
||||
#define __ALSA_CONF_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -52,15 +52,15 @@ extern "C" {
|
|||
/** \brief Configuration node type. */
|
||||
typedef enum _snd_config_type {
|
||||
/** Integer number. */
|
||||
SND_CONFIG_TYPE_INTEGER,
|
||||
SND_CONFIG_TYPE_INTEGER,
|
||||
/** 64-bit integer number. */
|
||||
SND_CONFIG_TYPE_INTEGER64,
|
||||
SND_CONFIG_TYPE_INTEGER64,
|
||||
/** Real number. */
|
||||
SND_CONFIG_TYPE_REAL,
|
||||
SND_CONFIG_TYPE_REAL,
|
||||
/** Character string. */
|
||||
SND_CONFIG_TYPE_STRING,
|
||||
/** Pointer (runtime only, cannot be saved). */
|
||||
SND_CONFIG_TYPE_POINTER,
|
||||
SND_CONFIG_TYPE_STRING,
|
||||
/** Pointer (runtime only, cannot be saved). */
|
||||
SND_CONFIG_TYPE_POINTER,
|
||||
/** Compound node. */
|
||||
SND_CONFIG_TYPE_COMPOUND = 1024
|
||||
} snd_config_type_t;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_CONTROL_H
|
||||
#define __ALSA_CONTROL_H
|
||||
#define __ALSA_CONTROL_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_ERROR_H
|
||||
#define __ALSA_ERROR_H
|
||||
#define __ALSA_ERROR_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -49,42 +49,108 @@ extern "C" {
|
|||
|
||||
const char *snd_strerror(int errnum);
|
||||
|
||||
#define SND_LOG_ERROR 1 /**< error priority level */
|
||||
#define SND_LOG_WARN 2 /**< warning priority level */
|
||||
#define SND_LOG_INFO 3 /**< info priority level */
|
||||
#define SND_LOG_DEBUG 4 /**< debug priority level */
|
||||
#define SND_LOG_TRACE 5 /**< trace priority level */
|
||||
#define SND_LOG_LAST SND_LOG_TRACE /**< last known value for priority level */
|
||||
|
||||
#define SND_ILOG_CORE 1 /**< core library code */
|
||||
#define SND_ILOG_CONFIG 2 /**< configuration parsing and operations */
|
||||
#define SND_ILOG_CONTROL 3 /**< control API */
|
||||
#define SND_ILOG_HWDEP 4 /**< hwdep API */
|
||||
#define SND_ILOG_TIMER 5 /**< timer API */
|
||||
#define SND_ILOG_RAWMIDI 6 /**< RawMidi API */
|
||||
#define SND_ILOG_PCM 7 /**< PCM API */
|
||||
#define SND_ILOG_MIXER 8 /**< mixer API */
|
||||
#define SND_ILOG_SEQUENCER 9 /**< sequencer API */
|
||||
#define SND_ILOG_UCM 10 /**< UCM API */
|
||||
#define SND_ILOG_TOPOLOGY 11 /**< topology API */
|
||||
#define SND_ILOG_ASERVER 12 /**< aserver */
|
||||
#define SND_ILOG_LAST SND_ILOG_ASERVER /**< last known value for interface */
|
||||
|
||||
/**
|
||||
* \brief Error handler callback.
|
||||
* \brief Log handler callback.
|
||||
* \param prio Priority (SND_LOG_* defines).
|
||||
* \param interface Interface (SND_ILOG_* defines).
|
||||
* \param file Source file name.
|
||||
* \param line Line number.
|
||||
* \param function Function name.
|
||||
* \param err Value of \c errno, or 0 if not relevant.
|
||||
* \param errcode Value of \c errno, or 0 if not relevant.
|
||||
* \param fmt \c printf(3) format.
|
||||
* \param ... \c printf(3) arguments.
|
||||
*
|
||||
* A function of this type is called by the ALSA library when an error occurs.
|
||||
* This function usually shows the message on the screen, and/or logs it.
|
||||
*/
|
||||
typedef void (*snd_lib_error_handler_t)(const char *file, int line, const char *function, int err, const char *fmt, ...) /* __attribute__ ((format (printf, 5, 6))) */;
|
||||
extern snd_lib_error_handler_t snd_lib_error;
|
||||
extern int snd_lib_error_set_handler(snd_lib_error_handler_t handler);
|
||||
typedef void (*snd_lib_log_handler_t)(int prio, int interface, const char *file, int line, const char *function, int errcode, const char *fmt, va_list arg);
|
||||
extern snd_lib_log_handler_t snd_lib_vlog;
|
||||
int snd_lib_log_filter(int prio, int interface, const char *configstr);
|
||||
void snd_lib_log(int prio, int interface, const char *file, int line, const char *function, int errcode, const char *fmt, ...) /* __attribute__ ((format (printf, 7, 8))) */;
|
||||
void snd_lib_check(int interface, const char *file, int line, const char *function, int errcode, const char *fmt, ...);
|
||||
snd_lib_log_handler_t snd_lib_log_set_handler(snd_lib_log_handler_t handler);
|
||||
snd_lib_log_handler_t snd_lib_log_set_local(snd_lib_log_handler_t handler);
|
||||
const char *snd_lib_log_priority(int prio);
|
||||
const char *snd_lib_log_interface(int interface);
|
||||
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
|
||||
#define SNDERR(...) snd_lib_error(__FILE__, __LINE__, __func__, 0, __VA_ARGS__) /**< Shows a sound error message. */
|
||||
#define SYSERR(...) snd_lib_error(__FILE__, __LINE__, __func__, errno, __VA_ARGS__) /**< Shows a system error message (related to \c errno). */
|
||||
#define snd_error(interface, ...) snd_lib_log(SND_LOG_ERROR, SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, __VA_ARGS__) /**< Shows an error log message. */
|
||||
#define snd_errornum(interface, ...) snd_lib_log(SND_LOG_ERROR, SND_ILOG_##interface, __FILE__, __LINE__, __func__, errno, __VA_ARGS__) /**< Shows a system error log message (related to \c errno). */
|
||||
#define snd_warn(interface, ...) snd_lib_log(SND_LOG_WARN, SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, __VA_ARGS__) /**< Shows an error log message. */
|
||||
#define snd_info(interface, ...) snd_lib_log(SND_LOG_INFO, SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, __VA_ARGS__) /**< Shows an informational log message. */
|
||||
#define snd_debug(interface, ...) snd_lib_log(SND_LOG_DEBUG, SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, __VA_ARGS__) /**< Shows an debug log message. */
|
||||
#define snd_trace(interface, ...) snd_lib_log(SND_LOG_TRACE, SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, __VA_ARGS__) /**< Shows an trace log message. */
|
||||
#define snd_check(interface, ...) snd_lib_check(SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, __VA_ARGS__) /**< Shows an check log message. */
|
||||
#define snd_checknum(interface, ...) snd_lib_check(SND_ILOG_##interface, __FILE__, __LINE__, __func__, errno, __VA_ARGS__) /**< Shows an check log message (related to \c errno). */
|
||||
#else
|
||||
#define SNDERR(args...) snd_lib_error(__FILE__, __LINE__, __func__, 0, ##args) /**< Shows a sound error message. */
|
||||
#define SYSERR(args...) snd_lib_error(__FILE__, __LINE__, __func__, errno, ##args) /**< Shows a system error message (related to \c errno). */
|
||||
#define snd_error(interface, args...) snd_lib_log(SND_LOG_ERROR, SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, ##args) /**< Shows an error log message. */
|
||||
#define snd_errornum(interface, args...) snd_lib_log(SND_LOG_ERROR, SND_ILOG_##interface, __FILE__, __LINE__, __func__, errno, ##args) /**< Shows a system error log message (related to \c errno). */
|
||||
#define snd_warn(interface, args...) snd_lib_log(SND_LOG_WARN, SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, ##args) /**< Shows an error log message. */
|
||||
#define snd_info(interface, args...) snd_lib_log(SND_LOG_INFO, SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, ##args) /**< Shows an error log message. */
|
||||
#define snd_debug(interface, args...) snd_lib_log(SND_LOG_DEBUG, SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, ##args) /**< Shows an error log message. */
|
||||
#define snd_trace(interface, args...) snd_lib_log(SND_LOG_TRACE, SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, ##args) /**< Shows an trace log message. */
|
||||
#define snd_check(interface, args...) snd_lib_check(SND_ILOG_##interface, __FILE__, __LINE__, __func__, 0, ##args) /**< Shows an check log message. */
|
||||
#define snd_check(interface, args...) snd_lib_check(SND_ILOG_##interface, __FILE__, __LINE__, __func__, errno, ##args) /**< Shows an check log message (related to \c errno). */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Error handler callback.
|
||||
* \param file Source file name.
|
||||
* \param line Line number.
|
||||
* \param function Function name.
|
||||
* \param errcode Value of \c errno, or 0 if not relevant.
|
||||
* \param fmt \c printf(3) format.
|
||||
* \param ... \c printf(3) arguments.
|
||||
* \deprecated Since 1.2.15
|
||||
*
|
||||
* A function of this type is called by the ALSA library when an error occurs.
|
||||
* This function usually shows the message on the screen, and/or logs it.
|
||||
*/
|
||||
typedef void (*snd_lib_error_handler_t)(const char *file, int line, const char *function, int errcode, const char *fmt, ...) /* __attribute__ ((format (printf, 5, 6))) */;
|
||||
extern snd_lib_error_handler_t snd_lib_error;
|
||||
int snd_lib_error_set_handler(snd_lib_error_handler_t handler);
|
||||
|
||||
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
|
||||
#define SNDERR(...) snd_lib_log(SND_LOG_ERROR, 0, __FILE__, __LINE__, __func__, 0, __VA_ARGS__) /**< Shows a sound error message. */
|
||||
#define SYSERR(...) snd_lib_log(SND_LOG_ERROR, 0, __FILE__, __LINE__, __func__, errno, __VA_ARGS__) /**< Shows a system error message (related to \c errno). */
|
||||
#else
|
||||
#define SNDERR(args...) snd_lib_log(SND_LOG_ERROR, 0, __FILE__, __LINE__, __func__, 0, ##args) /**< Shows a sound error message. */
|
||||
#define SYSERR(args...) snd_lib_log(SND_LOG_ERROR, 0, __FILE__, __LINE__, __func__, errno, ##args) /**< Shows a system error message (related to \c errno). */
|
||||
#endif
|
||||
|
||||
/** Local error handler function type */
|
||||
typedef void (*snd_local_error_handler_t)(const char *file, int line,
|
||||
const char *func, int errcode,
|
||||
const char *fmt, va_list arg);
|
||||
snd_local_error_handler_t snd_lib_error_set_local(snd_local_error_handler_t func);
|
||||
|
||||
/** \} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Local error handler function type */
|
||||
typedef void (*snd_local_error_handler_t)(const char *file, int line,
|
||||
const char *func, int err,
|
||||
const char *fmt, va_list arg);
|
||||
|
||||
snd_local_error_handler_t snd_lib_error_set_local(snd_local_error_handler_t func);
|
||||
|
||||
#endif /* __ALSA_ERROR_H */
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_GLOBAL_H_
|
||||
#define __ALSA_GLOBAL_H_
|
||||
#define __ALSA_GLOBAL_H_ /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_HWDEP_H
|
||||
#define __ALSA_HWDEP_H
|
||||
#define __ALSA_HWDEP_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -274,13 +274,8 @@ size_t snd_strlcat(char *dst, const char *src, size_t size);
|
|||
*/
|
||||
#ifndef NDEBUG
|
||||
#define CHECK_SANITY(x) x
|
||||
extern snd_lib_error_handler_t snd_err_msg;
|
||||
#define SNDMSG(args...) snd_err_msg(__FILE__, __LINE__, __func__, 0, ##args)
|
||||
#define SYSMSG(args...) snd_err_msg(__FILE__, __LINE__, __func__, errno, ##args)
|
||||
#else
|
||||
#define CHECK_SANITY(x) 0 /* not evaluated */
|
||||
#define SNDMSG(args...) /* nop */
|
||||
#define SYSMSG(args...) /* nop */
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -386,7 +381,7 @@ int snd_config_check_hop(snd_config_t *conf);
|
|||
#define SND_CONF_MAX_HOPS 64
|
||||
|
||||
int snd_config_search_alias_hooks(snd_config_t *config,
|
||||
const char *base, const char *key,
|
||||
const char *base, const char *key,
|
||||
snd_config_t **result);
|
||||
|
||||
int _snd_conf_generic_id(const char *id);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_MIXER_H
|
||||
#define __ALSA_MIXER_H
|
||||
#define __ALSA_MIXER_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_PCM_H
|
||||
#define __ALSA_PCM_H
|
||||
#define __ALSA_PCM_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -679,15 +679,15 @@ snd_pcm_chmap_t *snd_pcm_chmap_parse_string(const char *str);
|
|||
|
||||
int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent);
|
||||
int snd_pcm_set_params(snd_pcm_t *pcm,
|
||||
snd_pcm_format_t format,
|
||||
snd_pcm_access_t access,
|
||||
unsigned int channels,
|
||||
unsigned int rate,
|
||||
int soft_resample,
|
||||
unsigned int latency);
|
||||
snd_pcm_format_t format,
|
||||
snd_pcm_access_t access,
|
||||
unsigned int channels,
|
||||
unsigned int rate,
|
||||
int soft_resample,
|
||||
unsigned int latency);
|
||||
int snd_pcm_get_params(snd_pcm_t *pcm,
|
||||
snd_pcm_uframes_t *buffer_size,
|
||||
snd_pcm_uframes_t *period_size);
|
||||
snd_pcm_uframes_t *buffer_size,
|
||||
snd_pcm_uframes_t *period_size);
|
||||
|
||||
/** \} */
|
||||
|
||||
|
|
@ -1326,7 +1326,7 @@ int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope,
|
|||
/** Simple PCM latency type */
|
||||
typedef enum _snd_spcm_latency {
|
||||
/** standard latency - for standard playback or capture
|
||||
(estimated latency in one direction 350ms) */
|
||||
(estimated latency in one direction 350ms) */
|
||||
SND_SPCM_LATENCY_STANDARD = 0,
|
||||
/** medium latency - software phones etc.
|
||||
(estimated latency in one direction maximally 25ms */
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_PCM_EXTPLUG_H
|
||||
#define __ALSA_PCM_EXTPLUG_H
|
||||
#define __ALSA_PCM_EXTPLUG_H /**< header include loop protection */
|
||||
|
||||
/**
|
||||
* \defgroup PCM_ExtPlug External Filter plugin SDK
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_PCM_IOPLUG_H
|
||||
#define __ALSA_PCM_IOPLUG_H
|
||||
#define __ALSA_PCM_IOPLUG_H /**< header include loop protection */
|
||||
|
||||
/**
|
||||
* \defgroup PCM_IOPlug External I/O plugin SDK
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_t *slave, int close_slave);
|
||||
int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Linear conversion plugin
|
||||
|
|
@ -111,7 +111,7 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
|
|||
int close_slave);
|
||||
int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/*
|
||||
* Linear<->a-Law conversion plugin
|
||||
|
|
@ -202,13 +202,37 @@ int _snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
|
|||
/*
|
||||
* Jack plugin
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Creates a new Jack PCM
|
||||
* \param pcmp Returns created PCM handle
|
||||
* \param name Name of PCM
|
||||
* \param playback_conf Playback configuration
|
||||
* \param capture_conf Capture configuration
|
||||
* \param stream Stream direction
|
||||
* \param mode PCM open mode
|
||||
* \retval zero on success otherwise a negative error code
|
||||
* \warning alsa-lib must be compiled against the JACK library for this plugin to be available
|
||||
*/
|
||||
int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *playback_conf,
|
||||
snd_config_t *capture_conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
/**
|
||||
* \brief Creates a new Jack PCM (internal)
|
||||
* \param pcmp Returns created PCM handle
|
||||
* \param name Name of PCM
|
||||
* \param root Root configuration node
|
||||
* \param conf Configuration for this PCM
|
||||
* \param stream Stream direction
|
||||
* \param mode PCM open mode
|
||||
* \retval zero on success otherwise a negative error code
|
||||
* \warning alsa-lib must be compiled against the JACK library for this plugin to be available
|
||||
*/
|
||||
int _snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode);
|
||||
|
||||
|
||||
/** \} */
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_RAWMIDI_H
|
||||
#define __ALSA_RAWMIDI_H
|
||||
#define __ALSA_RAWMIDI_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -101,7 +101,10 @@ typedef enum _snd_rawmidi_read_mode {
|
|||
|
||||
/** rawmidi info bit flags */
|
||||
#define SND_RAWMIDI_INFO_UMP 0x00000008 /**< rawmidi is UMP */
|
||||
#define SNDRV_RAWMIDI_INFO_STREAM_INACTIVE 0x00000010 /**< the selected substream is inactive */
|
||||
#define SND_RAWMIDI_INFO_STREAM_INACTIVE 0x00000010 /**< the selected substream is inactive */
|
||||
#ifndef SNDRV_RAWMIDI_INFO_STREAM_INACTIVE
|
||||
#define SNDRV_RAWMIDI_INFO_STREAM_INACTIVE SND_RAWMIDI_INFO_STREAM_INACTIVE /**< compatibility alias for SND_RAWMIDI_INFO_STREAM_INACTIVE */
|
||||
#endif
|
||||
|
||||
int snd_rawmidi_open(snd_rawmidi_t **in_rmidi, snd_rawmidi_t **out_rmidi,
|
||||
const char *name, int mode);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_SEQ_H
|
||||
#define __ALSA_SEQ_H
|
||||
#define __ALSA_SEQ_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_SEQ_EVENT_H
|
||||
#define __ALSA_SEQ_EVENT_H
|
||||
#define __ALSA_SEQ_EVENT_H /**< header include loop protection */
|
||||
|
||||
/**
|
||||
* \defgroup SeqEvents Sequencer Event Definitions
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_SEQMID_H
|
||||
#define __ALSA_SEQMID_H
|
||||
#define __ALSA_SEQMID_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ struct snd_pcm_hw_params {
|
|||
SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
|
||||
struct snd_mask mres[5]; /* reserved masks */
|
||||
struct snd_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
|
||||
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
|
||||
SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
|
||||
struct snd_interval ires[9]; /* reserved intervals */
|
||||
unsigned int rmask; /* W: requested masks */
|
||||
unsigned int cmask; /* R: changed masks */
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_TIMER_H
|
||||
#define __ALSA_TIMER_H
|
||||
#define __ALSA_TIMER_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -105,7 +105,7 @@ typedef enum _snd_timer_event {
|
|||
/** timer read structure */
|
||||
typedef struct _snd_timer_read {
|
||||
unsigned int resolution; /**< tick resolution in nanoseconds */
|
||||
unsigned int ticks; /**< count of happened ticks */
|
||||
unsigned int ticks; /**< count of happened ticks */
|
||||
} snd_timer_read_t;
|
||||
|
||||
/** timer tstamp + event read structure */
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef __ALSA_UMP_H
|
||||
#define __ALSA_UMP_H
|
||||
#define __ALSA_UMP_H /**< header include loop protection */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -239,8 +239,8 @@ int snd_use_case_free_list(const char *list[], int items);
|
|||
*
|
||||
*/
|
||||
int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
||||
const char *identifier,
|
||||
const char **list[]);
|
||||
const char *identifier,
|
||||
const char **list[]);
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -410,8 +410,8 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
|||
* increase latency.
|
||||
*/
|
||||
int snd_use_case_get(snd_use_case_mgr_t *uc_mgr,
|
||||
const char *identifier,
|
||||
const char **value);
|
||||
const char *identifier,
|
||||
const char **value);
|
||||
|
||||
/**
|
||||
* \brief Get current - integer
|
||||
|
|
@ -456,8 +456,8 @@ int snd_use_case_geti(snd_use_case_mgr_t *uc_mgr,
|
|||
* - check transmit sequence firstly
|
||||
*/
|
||||
int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
|
||||
const char *identifier,
|
||||
const char *value);
|
||||
const char *identifier,
|
||||
const char *value);
|
||||
|
||||
/**
|
||||
* \brief Open and initialise use case core for sound card
|
||||
|
|
@ -482,7 +482,7 @@ int snd_use_case_set(snd_use_case_mgr_t *uc_mgr,
|
|||
* only one ALSA sound card in this case.
|
||||
*/
|
||||
int snd_use_case_mgr_open(snd_use_case_mgr_t **uc_mgr,
|
||||
const char *card_name);
|
||||
const char *card_name);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -68,24 +68,24 @@ static PyInterpreterState *main_interpreter;
|
|||
static inline int get_long(PyObject *o, long *val)
|
||||
{
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
if (PyInt_Check(o)) {
|
||||
*val = PyInt_AsLong(o);
|
||||
return 0;
|
||||
}
|
||||
if (PyInt_Check(o)) {
|
||||
*val = PyInt_AsLong(o);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
if (PyLong_Check(o)) {
|
||||
*val = PyLong_AsLong(o);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
if (PyLong_Check(o)) {
|
||||
*val = PyLong_AsLong(o);
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline PyObject *InternFromString(const char *name)
|
||||
{
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
return PyString_InternFromString(name);
|
||||
return PyString_InternFromString(name);
|
||||
#else
|
||||
return PyUnicode_InternFromString(name);
|
||||
return PyUnicode_InternFromString(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -191,7 +191,7 @@ static int is_ops(snd_mixer_elem_t *elem, int dir, int cmd, int val)
|
|||
}
|
||||
|
||||
static int get_x_range_ops(snd_mixer_elem_t *elem, int dir,
|
||||
long *min, long *max, const char *attr)
|
||||
long *min, long *max, const char *attr)
|
||||
{
|
||||
PyObject *obj1, *t1, *t2, *res;
|
||||
struct pymelem *pymelem = melem_to_pymelem(elem);
|
||||
|
|
@ -225,13 +225,13 @@ static int get_x_range_ops(snd_mixer_elem_t *elem, int dir,
|
|||
}
|
||||
|
||||
static int get_range_ops(snd_mixer_elem_t *elem, int dir,
|
||||
long *min, long *max)
|
||||
long *min, long *max)
|
||||
{
|
||||
return get_x_range_ops(elem, dir, min, max, "opsGetRange");
|
||||
}
|
||||
|
||||
static int set_range_ops(snd_mixer_elem_t *elem, int dir,
|
||||
long min, long max)
|
||||
long min, long max)
|
||||
{
|
||||
PyObject *obj1;
|
||||
struct pymelem *pymelem = melem_to_pymelem(elem);
|
||||
|
|
@ -244,8 +244,8 @@ static int set_range_ops(snd_mixer_elem_t *elem, int dir,
|
|||
}
|
||||
|
||||
static int get_x_ops(snd_mixer_elem_t *elem, int dir,
|
||||
long channel, long *value,
|
||||
const char *attr)
|
||||
long channel, long *value,
|
||||
const char *attr)
|
||||
{
|
||||
PyObject *obj1, *t1, *res;
|
||||
struct pymelem *pymelem = melem_to_pymelem(elem);
|
||||
|
|
@ -283,7 +283,7 @@ static int get_volume_ops(snd_mixer_elem_t *elem, int dir,
|
|||
}
|
||||
|
||||
static int get_switch_ops(snd_mixer_elem_t *elem, int dir,
|
||||
snd_mixer_selem_channel_id_t channel, int *value)
|
||||
snd_mixer_selem_channel_id_t channel, int *value)
|
||||
{
|
||||
long value1;
|
||||
int res;
|
||||
|
|
@ -337,21 +337,21 @@ static int ask_dB_vol_ops(snd_mixer_elem_t *elem,
|
|||
}
|
||||
|
||||
static int get_dB_ops(snd_mixer_elem_t *elem,
|
||||
int dir,
|
||||
snd_mixer_selem_channel_id_t channel,
|
||||
long *value)
|
||||
int dir,
|
||||
snd_mixer_selem_channel_id_t channel,
|
||||
long *value)
|
||||
{
|
||||
return get_x_ops(elem, dir, channel, value, "opsGetDB");
|
||||
}
|
||||
|
||||
static int get_dB_range_ops(snd_mixer_elem_t *elem, int dir,
|
||||
long *min, long *max)
|
||||
long *min, long *max)
|
||||
{
|
||||
return get_x_range_ops(elem, dir, min, max, "opsGetDBRange");
|
||||
}
|
||||
|
||||
static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
|
||||
snd_mixer_selem_channel_id_t channel, long value)
|
||||
snd_mixer_selem_channel_id_t channel, long value)
|
||||
{
|
||||
PyObject *obj1;
|
||||
struct pymelem *pymelem = melem_to_pymelem(elem);
|
||||
|
|
@ -364,7 +364,7 @@ static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
|
|||
}
|
||||
|
||||
static int set_switch_ops(snd_mixer_elem_t *elem, int dir,
|
||||
snd_mixer_selem_channel_id_t channel, int value)
|
||||
snd_mixer_selem_channel_id_t channel, int value)
|
||||
{
|
||||
PyObject *obj1;
|
||||
struct pymelem *pymelem = melem_to_pymelem(elem);
|
||||
|
|
@ -377,8 +377,8 @@ static int set_switch_ops(snd_mixer_elem_t *elem, int dir,
|
|||
}
|
||||
|
||||
static int set_dB_ops(snd_mixer_elem_t *elem, int dir,
|
||||
snd_mixer_selem_channel_id_t channel,
|
||||
long db_gain, int xdir)
|
||||
snd_mixer_selem_channel_id_t channel,
|
||||
long db_gain, int xdir)
|
||||
{
|
||||
PyObject *obj1;
|
||||
struct pymelem *pymelem = melem_to_pymelem(elem);
|
||||
|
|
@ -392,8 +392,8 @@ static int set_dB_ops(snd_mixer_elem_t *elem, int dir,
|
|||
}
|
||||
|
||||
static int enum_item_name_ops(snd_mixer_elem_t *elem,
|
||||
unsigned int item,
|
||||
size_t maxlen, char *buf)
|
||||
unsigned int item,
|
||||
size_t maxlen, char *buf)
|
||||
{
|
||||
PyObject *obj1, *obj2, *t1, *res;
|
||||
struct pymelem *pymelem = melem_to_pymelem(elem);
|
||||
|
|
@ -441,8 +441,8 @@ errlbl:
|
|||
}
|
||||
|
||||
static int get_enum_item_ops(snd_mixer_elem_t *elem,
|
||||
snd_mixer_selem_channel_id_t channel,
|
||||
unsigned int *itemp)
|
||||
snd_mixer_selem_channel_id_t channel,
|
||||
unsigned int *itemp)
|
||||
{
|
||||
PyObject *obj1, *t1, *res;
|
||||
struct pymelem *pymelem = melem_to_pymelem(elem);
|
||||
|
|
@ -473,8 +473,8 @@ static int get_enum_item_ops(snd_mixer_elem_t *elem,
|
|||
}
|
||||
|
||||
static int set_enum_item_ops(snd_mixer_elem_t *elem,
|
||||
snd_mixer_selem_channel_id_t channel,
|
||||
unsigned int item)
|
||||
snd_mixer_selem_channel_id_t channel,
|
||||
unsigned int item)
|
||||
{
|
||||
PyObject *obj1;
|
||||
struct pymelem *pymelem = melem_to_pymelem(elem);
|
||||
|
|
@ -486,21 +486,21 @@ static int set_enum_item_ops(snd_mixer_elem_t *elem,
|
|||
}
|
||||
|
||||
static struct sm_elem_ops simple_python_ops = {
|
||||
.is = is_ops,
|
||||
.get_range = get_range_ops,
|
||||
.get_dB_range = get_dB_range_ops,
|
||||
.set_range = set_range_ops,
|
||||
.ask_vol_dB = ask_vol_dB_ops,
|
||||
.ask_dB_vol = ask_dB_vol_ops,
|
||||
.get_volume = get_volume_ops,
|
||||
.get_dB = get_dB_ops,
|
||||
.set_volume = set_volume_ops,
|
||||
.set_dB = set_dB_ops,
|
||||
.get_switch = get_switch_ops,
|
||||
.set_switch = set_switch_ops,
|
||||
.enum_item_name = enum_item_name_ops,
|
||||
.get_enum_item = get_enum_item_ops,
|
||||
.set_enum_item = set_enum_item_ops
|
||||
.is = is_ops,
|
||||
.get_range = get_range_ops,
|
||||
.get_dB_range = get_dB_range_ops,
|
||||
.set_range = set_range_ops,
|
||||
.ask_vol_dB = ask_vol_dB_ops,
|
||||
.ask_dB_vol = ask_dB_vol_ops,
|
||||
.get_volume = get_volume_ops,
|
||||
.get_dB = get_dB_ops,
|
||||
.set_volume = set_volume_ops,
|
||||
.set_dB = set_dB_ops,
|
||||
.get_switch = get_switch_ops,
|
||||
.set_switch = set_switch_ops,
|
||||
.enum_item_name = enum_item_name_ops,
|
||||
.get_enum_item = get_enum_item_ops,
|
||||
.set_enum_item = set_enum_item_ops
|
||||
};
|
||||
|
||||
static void selem_free(snd_mixer_elem_t *elem)
|
||||
|
|
@ -703,18 +703,18 @@ static PyMethodDef pymelem_methods[] = {
|
|||
};
|
||||
|
||||
static PyTypeObject pymelem_type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
tp_name: "smixer_python.InternalMElement",
|
||||
tp_basicsize: sizeof(struct pymelem),
|
||||
tp_dealloc: (destructor)pymelem_dealloc,
|
||||
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
tp_doc: NULL /* mixerinit__doc__ */,
|
||||
tp_getset: pymelem_getseters,
|
||||
tp_init: (initproc)pymelem_init,
|
||||
tp_alloc: PyType_GenericAlloc,
|
||||
tp_new: PyType_GenericNew,
|
||||
tp_free: PyObject_Del,
|
||||
tp_methods: pymelem_methods,
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
tp_name: "smixer_python.InternalMElement",
|
||||
tp_basicsize: sizeof(struct pymelem),
|
||||
tp_dealloc: (destructor)pymelem_dealloc,
|
||||
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
tp_doc: NULL /* mixerinit__doc__ */,
|
||||
tp_getset: pymelem_getseters,
|
||||
tp_init: (initproc)pymelem_init,
|
||||
tp_alloc: PyType_GenericAlloc,
|
||||
tp_new: PyType_GenericNew,
|
||||
tp_free: PyObject_Del,
|
||||
tp_methods: pymelem_methods,
|
||||
};
|
||||
|
||||
static PyObject *
|
||||
|
|
@ -884,18 +884,18 @@ static PyMethodDef pymixer_methods[] = {
|
|||
};
|
||||
|
||||
static PyTypeObject pymixer_type = {
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
tp_name: "smixer_python.InternalMixer",
|
||||
tp_basicsize: sizeof(struct pymixer),
|
||||
tp_dealloc: (destructor)pymixer_dealloc,
|
||||
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
tp_doc: NULL /* mixerinit__doc__ */,
|
||||
tp_getset: pymixer_getseters,
|
||||
tp_init: (initproc)pymixer_init,
|
||||
tp_alloc: PyType_GenericAlloc,
|
||||
tp_new: PyType_GenericNew,
|
||||
tp_free: PyObject_Del,
|
||||
tp_methods: pymixer_methods,
|
||||
PyVarObject_HEAD_INIT(NULL, 0)
|
||||
tp_name: "smixer_python.InternalMixer",
|
||||
tp_basicsize: sizeof(struct pymixer),
|
||||
tp_dealloc: (destructor)pymixer_dealloc,
|
||||
tp_flags: Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
|
||||
tp_doc: NULL /* mixerinit__doc__ */,
|
||||
tp_getset: pymixer_getseters,
|
||||
tp_init: (initproc)pymixer_init,
|
||||
tp_alloc: PyType_GenericAlloc,
|
||||
tp_new: PyType_GenericNew,
|
||||
tp_free: PyObject_Del,
|
||||
tp_methods: pymixer_methods,
|
||||
};
|
||||
|
||||
static PyMethodDef python_methods[] = {
|
||||
|
|
@ -931,7 +931,7 @@ static PyObject *new_helem(struct python_priv *priv, snd_hctl_elem_t *helem)
|
|||
}
|
||||
Py_XDECREF(obj1);
|
||||
} else {
|
||||
SNDERR("Unable to create InternalMixer object");
|
||||
snd_error(MIXER, "Unable to create InternalMixer object");
|
||||
return NULL;
|
||||
}
|
||||
if (obj2) {
|
||||
|
|
@ -985,19 +985,19 @@ int alsa_mixer_simple_event(snd_mixer_class_t *class, unsigned int mask,
|
|||
tstate = PyThreadState_New(main_interpreter);
|
||||
PyThreadState_Swap(tstate);
|
||||
|
||||
t = PyTuple_New(3);
|
||||
if (t) {
|
||||
PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask));
|
||||
o = find_helem(priv, helem);
|
||||
if (mask & SND_CTL_EVENT_MASK_ADD) {
|
||||
if (o == NULL)
|
||||
o = new_helem(priv, helem);
|
||||
t = PyTuple_New(3);
|
||||
if (t) {
|
||||
PyTuple_SET_ITEM(t, 0, (PyObject *)PyInt_FromLong(mask));
|
||||
o = find_helem(priv, helem);
|
||||
if (mask & SND_CTL_EVENT_MASK_ADD) {
|
||||
if (o == NULL)
|
||||
o = new_helem(priv, helem);
|
||||
}
|
||||
if (o == NULL)
|
||||
return 0;
|
||||
if (o == NULL)
|
||||
return 0;
|
||||
PyTuple_SET_ITEM(t, 1, o);
|
||||
Py_INCREF(o);
|
||||
o = melem ? find_melem(priv, melem) : Py_None;
|
||||
o = melem ? find_melem(priv, melem) : Py_None;
|
||||
PyTuple_SET_ITEM(t, 2, o);
|
||||
Py_INCREF(o);
|
||||
r = PyObject_CallObject(priv->py_event_func, t);
|
||||
|
|
@ -1039,8 +1039,8 @@ static void alsa_mixer_simple_free(snd_mixer_class_t *class)
|
|||
}
|
||||
|
||||
static int alsa_mixer_simple_pyinit(struct python_priv *priv,
|
||||
PyObject *py_mod,
|
||||
FILE *fp,
|
||||
PyObject *py_mod,
|
||||
FILE *fp,
|
||||
const char *file,
|
||||
snd_mixer_class_t *class,
|
||||
snd_mixer_t *mixer,
|
||||
|
|
@ -1073,7 +1073,7 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv,
|
|||
PyDict_SetItemString(mdict, "mixer", obj2);
|
||||
priv->py_mixer = obj2;
|
||||
} else {
|
||||
SNDERR("Unable to create InternalMixer object");
|
||||
snd_error(MIXER, "Unable to create InternalMixer object");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
|
@ -1083,7 +1083,7 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv,
|
|||
Py_XDECREF(obj);
|
||||
priv->py_event_func = PyDict_GetItemString(mdict, "event");
|
||||
if (priv->py_event_func == NULL) {
|
||||
SNDERR("Unable to find python function 'event'");
|
||||
snd_error(MIXER, "Unable to find python function 'event'");
|
||||
return -EIO;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1091,15 +1091,15 @@ static int alsa_mixer_simple_pyinit(struct python_priv *priv,
|
|||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
static struct PyModuleDef smixer_python_module = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"smixer_python",
|
||||
NULL,
|
||||
0,
|
||||
python_methods,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"smixer_python",
|
||||
NULL,
|
||||
0,
|
||||
python_methods,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -1128,7 +1128,7 @@ int alsa_mixer_simple_finit(snd_mixer_class_t *class,
|
|||
|
||||
fp = fopen(file, "r");
|
||||
if (fp == NULL) {
|
||||
SNDERR("Unable to find python module '%s'", file);
|
||||
snd_error(MIXER, "Unable to find python module '%s'", file);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,10 +62,10 @@ static long to_user(struct selem_base *s, int dir, struct helem_base *c, long va
|
|||
|
||||
static long from_user(struct selem_base *s, int dir, struct helem_base *c, long value)
|
||||
{
|
||||
int64_t n;
|
||||
int64_t n;
|
||||
if (s->dir[dir].max == s->dir[dir].min)
|
||||
return c->min;
|
||||
n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min);
|
||||
n = (int64_t) (value - s->dir[dir].min) * (c->max - c->min);
|
||||
return c->min + (n + (s->dir[dir].max - s->dir[dir].min) / 2) / (s->dir[dir].max - s->dir[dir].min);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -374,7 +374,7 @@ static int simple_event_add1(snd_mixer_class_t *class,
|
|||
case PURPOSE_SWITCH:
|
||||
if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN) {
|
||||
__invalid_type:
|
||||
snd_mixer_selem_id_free(id);
|
||||
snd_mixer_selem_id_free(id);
|
||||
free(hsimple);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -446,9 +446,9 @@ static int simple_event_add1(snd_mixer_class_t *class,
|
|||
err = snd_mixer_elem_value(melem);
|
||||
return err;
|
||||
__error:
|
||||
if (new)
|
||||
snd_mixer_elem_free(melem);
|
||||
return -EINVAL;
|
||||
if (new)
|
||||
snd_mixer_elem_free(melem);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem)
|
||||
|
|
|
|||
|
|
@ -65,27 +65,27 @@ int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
|
|||
strcat(xlib, lib);
|
||||
h = snd_dlopen(xlib, RTLD_NOW, errbuf, sizeof(errbuf));
|
||||
if (h == NULL) {
|
||||
SNDERR("Unable to open library '%s': %s", xlib, errbuf);
|
||||
snd_error(MIXER, "Unable to open library '%s': %s", xlib, errbuf);
|
||||
goto __error;
|
||||
}
|
||||
initpriv = dlsym(h, "alsa_mixer_sbasic_initpriv");
|
||||
if (initpriv == NULL) {
|
||||
SNDERR("Symbol 'alsa_mixer_sbasic_initpriv' was not found in '%s'", xlib);
|
||||
snd_error(MIXER, "Symbol 'alsa_mixer_sbasic_initpriv' was not found in '%s'", xlib);
|
||||
goto __error;
|
||||
}
|
||||
priv->ops.event = dlsym(h, "alsa_mixer_sbasic_event");
|
||||
if (priv->ops.event == NULL) {
|
||||
SNDERR("Symbol 'alsa_mixer_sbasic_event' was not found in '%s'", xlib);
|
||||
snd_error(MIXER, "Symbol 'alsa_mixer_sbasic_event' was not found in '%s'", xlib);
|
||||
goto __error;
|
||||
}
|
||||
priv->ops.selreg = dlsym(h, "alsa_mixer_sbasic_selreg");
|
||||
if (priv->ops.selreg == NULL) {
|
||||
SNDERR("Symbol 'alsa_mixer_sbasic_selreg' was not found in '%s'", xlib);
|
||||
snd_error(MIXER, "Symbol 'alsa_mixer_sbasic_selreg' was not found in '%s'", xlib);
|
||||
goto __error;
|
||||
}
|
||||
priv->ops.sidreg = dlsym(h, "alsa_mixer_sbasic_sidreg");
|
||||
if (priv->ops.sidreg == NULL) {
|
||||
SNDERR("Symbol 'alsa_mixer_sbasic_sidreg' was not found in '%s'", xlib);
|
||||
snd_error(MIXER, "Symbol 'alsa_mixer_sbasic_sidreg' was not found in '%s'", xlib);
|
||||
goto __error;
|
||||
}
|
||||
free(xlib);
|
||||
|
|
@ -97,8 +97,8 @@ int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
|
|||
return 1;
|
||||
|
||||
__error:
|
||||
if (initflag)
|
||||
free(priv);
|
||||
if (initflag)
|
||||
free(priv);
|
||||
if (h)
|
||||
snd_dlclose(h);
|
||||
free(xlib);
|
||||
|
|
|
|||
|
|
@ -214,3 +214,17 @@ ALSA_1.2.13 {
|
|||
@SYMBOL_PREFIX@snd_ump_packet_length;
|
||||
#endif
|
||||
} ALSA_1.2.10;
|
||||
|
||||
|
||||
ALSA_1.2.15 {
|
||||
global:
|
||||
|
||||
@SYMBOL_PREFIX@snd_lib_vlog;
|
||||
@SYMBOL_PREFIX@snd_lib_log;
|
||||
@SYMBOL_PREFIX@snd_lib_log_set_handler;
|
||||
@SYMBOL_PREFIX@snd_lib_log_set_local;
|
||||
@SYMBOL_PREFIX@snd_lib_log_priority;
|
||||
@SYMBOL_PREFIX@snd_lib_log_interface;
|
||||
@SYMBOL_PREFIX@snd_lib_log_filter;
|
||||
@SYMBOL_PREFIX@snd_lib_check;
|
||||
} ALSA_1.2.13;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ void snd_async_init(void)
|
|||
{
|
||||
snd_async_signo = __libc_allocate_rtsig(0);
|
||||
if (snd_async_signo < 0) {
|
||||
SNDERR("Unable to find a RT signal to use for snd_async");
|
||||
snd_error(CORE, "Unable to find a RT signal to use for snd_async");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -135,7 +135,7 @@ int snd_async_add_handler(snd_async_handler_t **handler, int fd,
|
|||
assert(!previous_action.sa_sigaction);
|
||||
err = sigaction(snd_async_signo, &act, &previous_action);
|
||||
if (err < 0) {
|
||||
SYSERR("sigaction");
|
||||
snd_errornum(CORE, "sigaction");
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ int snd_async_del_handler(snd_async_handler_t *handler)
|
|||
if (!was_empty && list_empty(&snd_async_handlers)) {
|
||||
err = sigaction(snd_async_signo, &previous_action, NULL);
|
||||
if (err < 0) {
|
||||
SYSERR("sigaction");
|
||||
snd_errornum(CORE, "sigaction");
|
||||
return -errno;
|
||||
}
|
||||
memset(&previous_action, 0, sizeof(previous_action));
|
||||
|
|
|
|||
243
src/conf.c
243
src/conf.c
|
|
@ -255,8 +255,8 @@ name [=] value [,|;]
|
|||
|
||||
# Compound assignment (first style)
|
||||
name [=] {
|
||||
name1 [=] value [,|;]
|
||||
...
|
||||
name1 [=] value [,|;]
|
||||
...
|
||||
}
|
||||
|
||||
# Compound assignment (second style)
|
||||
|
|
@ -264,9 +264,9 @@ name.name1 [=] value [,|;]
|
|||
|
||||
# Array assignment (first style)
|
||||
name [
|
||||
value0 [,|;]
|
||||
value1 [,|;]
|
||||
...
|
||||
value0 [,|;]
|
||||
value1 [,|;]
|
||||
...
|
||||
]
|
||||
|
||||
# Array assignment (second style)
|
||||
|
|
@ -811,7 +811,7 @@ static int get_char_skip_comments(input_t *input)
|
|||
|
||||
dirp = opendir(str);
|
||||
if (!dirp) {
|
||||
SNDERR("Invalid search dir %s", str);
|
||||
snd_error(CONFIG, "Invalid search dir %s", str);
|
||||
free(str);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -819,7 +819,7 @@ static int get_char_skip_comments(input_t *input)
|
|||
|
||||
err = add_include_path(input->current, str);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot add search dir %s", str);
|
||||
snd_error(CORE, "Cannot add search dir %s", str);
|
||||
free(str);
|
||||
return err;
|
||||
}
|
||||
|
|
@ -840,7 +840,7 @@ static int get_char_skip_comments(input_t *input)
|
|||
}
|
||||
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot access file %s", str);
|
||||
snd_error(CORE, "Cannot access file %s", str);
|
||||
free(str);
|
||||
return err;
|
||||
}
|
||||
|
|
@ -1205,7 +1205,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input,
|
|||
free(s);
|
||||
if (n) {
|
||||
if (n->type != SND_CONFIG_TYPE_REAL) {
|
||||
SNDERR("%s is not a real", *id);
|
||||
snd_error(CORE, "%s is not a real", *id);
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1221,7 +1221,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input,
|
|||
free(s);
|
||||
if (n) {
|
||||
if (n->type != SND_CONFIG_TYPE_INTEGER && n->type != SND_CONFIG_TYPE_INTEGER64) {
|
||||
SNDERR("%s is not an integer", *id);
|
||||
snd_error(CORE, "%s is not an integer", *id);
|
||||
return -EINVAL;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1242,7 +1242,7 @@ static int parse_value(snd_config_t **_n, snd_config_t *parent, input_t *input,
|
|||
}
|
||||
if (n) {
|
||||
if (n->type != SND_CONFIG_TYPE_STRING) {
|
||||
SNDERR("%s is not a string", *id);
|
||||
snd_error(CORE, "%s is not a string", *id);
|
||||
free(s);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -1268,13 +1268,13 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
|
|||
snd_config_t *n = NULL;
|
||||
|
||||
if (!skip) {
|
||||
snd_config_t *g;
|
||||
char static_id[12];
|
||||
while (1) {
|
||||
snprintf(static_id, sizeof(static_id), "%i", *idx);
|
||||
if (_snd_config_search(parent, static_id, -1, &g) == 0) {
|
||||
if (_snd_config_search(parent, static_id, -1, &n) == 0) {
|
||||
if (override) {
|
||||
snd_config_delete(n);
|
||||
/* fallthrough to break */
|
||||
} else {
|
||||
/* merge */
|
||||
(*idx)++;
|
||||
|
|
@ -1283,6 +1283,7 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
|
|||
}
|
||||
break;
|
||||
}
|
||||
n = NULL;
|
||||
id = strdup(static_id);
|
||||
if (id == NULL)
|
||||
return -ENOMEM;
|
||||
|
|
@ -1300,7 +1301,7 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
|
|||
if (!skip) {
|
||||
if (n) {
|
||||
if (n->type != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("%s is not a compound", id);
|
||||
snd_error(CORE, "%s is not a compound", id);
|
||||
err = -EINVAL;
|
||||
goto __end;
|
||||
}
|
||||
|
|
@ -1340,7 +1341,7 @@ static int parse_array_def(snd_config_t *parent, input_t *input, int *idx, int s
|
|||
err = 0;
|
||||
__end:
|
||||
free(id);
|
||||
return err;
|
||||
return err;
|
||||
}
|
||||
|
||||
static int parse_array_defs(snd_config_t *parent, input_t *input, int skip, int override)
|
||||
|
|
@ -1407,7 +1408,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid
|
|||
}
|
||||
if (mode != OVERRIDE) {
|
||||
if (n->type != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("%s is not a compound", id);
|
||||
snd_error(CORE, "%s is not a compound", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
n->u.compound.join = true;
|
||||
|
|
@ -1418,7 +1419,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid
|
|||
snd_config_delete(n);
|
||||
}
|
||||
if (mode == MERGE) {
|
||||
SNDERR("%s does not exists", id);
|
||||
snd_error(CORE, "%s does not exists", id);
|
||||
err = -ENOENT;
|
||||
goto __end;
|
||||
}
|
||||
|
|
@ -1445,7 +1446,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid
|
|||
} else {
|
||||
n = NULL;
|
||||
if (mode == MERGE) {
|
||||
SNDERR("%s does not exists", id);
|
||||
snd_error(CORE, "%s does not exists", id);
|
||||
err = -ENOENT;
|
||||
goto __end;
|
||||
}
|
||||
|
|
@ -1459,7 +1460,7 @@ static int parse_def(snd_config_t *parent, input_t *input, int skip, int overrid
|
|||
if (!skip) {
|
||||
if (n) {
|
||||
if (n->type != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("%s is not a compound", id);
|
||||
snd_error(CORE, "%s is not a compound", id);
|
||||
err = -EINVAL;
|
||||
goto __end;
|
||||
}
|
||||
|
|
@ -1644,7 +1645,7 @@ int _snd_config_save_node_value(snd_config_t *n, snd_output_t *out,
|
|||
string_print(n->u.string, 0, out);
|
||||
break;
|
||||
case SND_CONFIG_TYPE_POINTER:
|
||||
SNDERR("cannot save runtime pointer type");
|
||||
snd_error(CORE, "cannot save runtime pointer type");
|
||||
return -EINVAL;
|
||||
case SND_CONFIG_TYPE_COMPOUND:
|
||||
array = snd_config_is_array(n);
|
||||
|
|
@ -2011,13 +2012,13 @@ int _snd_config_load_with_include(snd_config_t *config, snd_input_t *in,
|
|||
str = strerror(-err);
|
||||
break;
|
||||
}
|
||||
SNDERR("%s:%d:%d:%s", fd->name ? fd->name : "_toplevel_", fd->line, fd->column, str);
|
||||
snd_error(CORE, "%s:%d:%d:%s", fd->name ? fd->name : "_toplevel_", fd->line, fd->column, str);
|
||||
goto _end;
|
||||
}
|
||||
err = get_char(&input);
|
||||
fd = input.current;
|
||||
if (err != LOCAL_UNEXPECTED_EOF) {
|
||||
SNDERR("%s:%d:%d:Unexpected }", fd->name ? fd->name : "", fd->line, fd->column);
|
||||
snd_error(CORE, "%s:%d:%d:Unexpected }", fd->name ? fd->name : "", fd->line, fd->column);
|
||||
err = -EINVAL;
|
||||
goto _end;
|
||||
}
|
||||
|
|
@ -3564,9 +3565,9 @@ int snd_config_save(snd_config_t *config, snd_output_t *out)
|
|||
assert(key); \
|
||||
if (!first && (strcmp(key, old_key) == 0 || maxloop <= 0)) { \
|
||||
if (maxloop == 0) \
|
||||
SNDERR("maximum loop count reached (circular configuration?)"); \
|
||||
snd_error(CORE, "maximum loop count reached (circular configuration?)"); \
|
||||
else \
|
||||
SNDERR("key %s refers to itself", key); \
|
||||
snd_error(CORE, "key %s refers to itself", key); \
|
||||
err = -EINVAL; \
|
||||
res = NULL; \
|
||||
break; \
|
||||
|
|
@ -3970,12 +3971,12 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
|
||||
err = snd_config_search(config, "func", &c);
|
||||
if (err < 0) {
|
||||
SNDERR("Field func is missing");
|
||||
snd_error(CORE, "Field func is missing");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_string(c, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for field func");
|
||||
snd_error(CORE, "Invalid type for field func");
|
||||
return err;
|
||||
}
|
||||
assert(str);
|
||||
|
|
@ -3983,7 +3984,7 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
if (err >= 0) {
|
||||
snd_config_iterator_t i, next;
|
||||
if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for func %s definition", str);
|
||||
snd_error(CORE, "Invalid type for func %s definition", str);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -3995,7 +3996,7 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
if (strcmp(id, "lib") == 0) {
|
||||
err = snd_config_get_string(n, &lib);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CORE, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -4003,12 +4004,12 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
if (strcmp(id, "func") == 0) {
|
||||
err = snd_config_get_string(n, &func_name);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CORE, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CORE, "Unknown field %s", id);
|
||||
}
|
||||
}
|
||||
if (!func_name) {
|
||||
|
|
@ -4026,10 +4027,10 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
func = h ? snd_dlsym(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_HOOK)) : NULL;
|
||||
err = 0;
|
||||
if (!h) {
|
||||
SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
|
||||
snd_error(CORE, "Cannot open shared library %s (%s)", lib, errbuf);
|
||||
err = -ENOENT;
|
||||
} else if (!func) {
|
||||
SNDERR("symbol %s is not defined inside %s", func_name, lib);
|
||||
snd_error(CORE, "symbol %s is not defined inside %s", func_name, lib);
|
||||
snd_dlclose(h);
|
||||
err = -ENXIO;
|
||||
}
|
||||
|
|
@ -4040,7 +4041,7 @@ static int snd_config_hooks_call(snd_config_t *root, snd_config_t *config, snd_c
|
|||
snd_config_t *nroot;
|
||||
err = func(root, config, &nroot, private_data);
|
||||
if (err < 0)
|
||||
SNDERR("function %s returned error: %s", func_name, snd_strerror(err));
|
||||
snd_error(CORE, "function %s returned error: %s", func_name, snd_strerror(err));
|
||||
snd_dlclose(h);
|
||||
if (err >= 0 && nroot)
|
||||
err = snd_config_substitute(root, nroot);
|
||||
|
|
@ -4069,7 +4070,7 @@ static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data)
|
|||
long i;
|
||||
err = safe_strtol(id, &i);
|
||||
if (err < 0) {
|
||||
SNDERR("id of field %s is not and integer", id);
|
||||
snd_error(CORE, "id of field %s is not and integer", id);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -4108,24 +4109,27 @@ static int config_filename_filter(const struct dirent64 *dirent)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int config_file_open(snd_config_t *root, const char *filename)
|
||||
static int config_file_open(snd_config_t *root, const char *filename, int merge)
|
||||
{
|
||||
snd_input_t *in;
|
||||
int err;
|
||||
|
||||
err = snd_input_stdio_open(&in, filename, "r");
|
||||
if (err >= 0) {
|
||||
err = snd_config_load(root, in);
|
||||
if (merge)
|
||||
err = snd_config_load(root, in);
|
||||
else
|
||||
err = snd_config_load_override(root, in);
|
||||
snd_input_close(in);
|
||||
if (err < 0)
|
||||
SNDERR("%s may be old or corrupted: consider to remove or fix it", filename);
|
||||
snd_error(CORE, "%s may be old or corrupted: consider to remove or fix it", filename);
|
||||
} else
|
||||
SNDERR("cannot access file %s", filename);
|
||||
snd_error(CORE, "cannot access file %s", filename);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static int config_file_load(snd_config_t *root, const char *fn, int errors)
|
||||
static int config_file_load(snd_config_t *root, const char *fn, int errors, int merge)
|
||||
{
|
||||
struct stat64 st;
|
||||
struct dirent64 **namelist;
|
||||
|
|
@ -4134,13 +4138,20 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors)
|
|||
if (!errors && access(fn, R_OK) < 0)
|
||||
return 1;
|
||||
if (stat64(fn, &st) < 0) {
|
||||
SNDERR("cannot stat file/directory %s", fn);
|
||||
snd_error(CORE, "cannot stat file/directory %s", fn);
|
||||
return 1;
|
||||
}
|
||||
if (!S_ISDIR(st.st_mode))
|
||||
return config_file_open(root, fn);
|
||||
return config_file_open(root, fn, merge);
|
||||
#ifndef DOC_HIDDEN
|
||||
#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__DragonFly__) && !defined(__sun) && !defined(__ANDROID__)
|
||||
#if defined(_GNU_SOURCE) && \
|
||||
!defined(__NetBSD__) && \
|
||||
!defined(__FreeBSD__) && \
|
||||
!defined(__OpenBSD__) && \
|
||||
!defined(__DragonFly__) && \
|
||||
!defined(__sun) && \
|
||||
!defined(__ANDROID__) && \
|
||||
!defined(__OHOS__)
|
||||
#define SORTFUNC versionsort64
|
||||
#else
|
||||
#define SORTFUNC alphasort64
|
||||
|
|
@ -4157,7 +4168,7 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors)
|
|||
snprintf(filename, sl, "%s/%s", fn, namelist[j]->d_name);
|
||||
filename[sl-1] = '\0';
|
||||
|
||||
err = config_file_open(root, filename);
|
||||
err = config_file_open(root, filename, merge);
|
||||
free(filename);
|
||||
}
|
||||
free(namelist[j]);
|
||||
|
|
@ -4169,20 +4180,20 @@ static int config_file_load(snd_config_t *root, const char *fn, int errors)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int config_file_load_user(snd_config_t *root, const char *fn, int errors)
|
||||
static int config_file_load_user(snd_config_t *root, const char *fn, int errors, int merge)
|
||||
{
|
||||
char *fn2;
|
||||
int err;
|
||||
|
||||
err = snd_user_file(fn, &fn2);
|
||||
if (err < 0)
|
||||
return config_file_load(root, fn, errors);
|
||||
err = config_file_load(root, fn2, errors);
|
||||
return config_file_load(root, fn, errors, merge);
|
||||
err = config_file_load(root, fn2, errors, merge);
|
||||
free(fn2);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, int errors)
|
||||
static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, int errors, int merge)
|
||||
{
|
||||
snd_config_t *file = _file, *root = _root, *n;
|
||||
char *name, *name2, *remain, *rname = NULL;
|
||||
|
|
@ -4190,13 +4201,13 @@ static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, i
|
|||
|
||||
if (snd_config_get_type(_file) == SND_CONFIG_TYPE_COMPOUND) {
|
||||
if ((err = snd_config_search(_file, "file", &file)) < 0) {
|
||||
SNDERR("Field file not found");
|
||||
snd_error(CORE, "Field file not found");
|
||||
return err;
|
||||
}
|
||||
if ((err = snd_config_search(_file, "root", &root)) >= 0) {
|
||||
err = snd_config_get_ascii(root, &rname);
|
||||
if (err < 0) {
|
||||
SNDERR("Field root is bad");
|
||||
snd_error(CORE, "Field root is bad");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_make_compound(&root, rname, 0);
|
||||
|
|
@ -4213,7 +4224,7 @@ static int config_file_load_user_all(snd_config_t *_root, snd_config_t *_file, i
|
|||
*remain = '\0';
|
||||
remain += 3;
|
||||
}
|
||||
err = config_file_load_user(root, name2, errors);
|
||||
err = config_file_load_user(root, name2, errors, merge);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
if (err == 0) /* first hit wins */
|
||||
|
|
@ -4262,28 +4273,33 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
|
|||
{
|
||||
snd_config_t *n;
|
||||
snd_config_iterator_t i, next;
|
||||
int err, idx = 0, errors = 1, hit;
|
||||
int err, idx = 0, errors = 1, merge = 1, hit;
|
||||
|
||||
assert(root && dst);
|
||||
if ((err = snd_config_search(config, "errors", &n)) >= 0) {
|
||||
errors = snd_config_get_bool(n);
|
||||
if (errors < 0) {
|
||||
SNDERR("Invalid bool value in field errors");
|
||||
snd_error(CORE, "Invalid bool value in field errors");
|
||||
return errors;
|
||||
}
|
||||
}
|
||||
/* special case, we know the card number (may be multiple times) */
|
||||
if (private_data && snd_config_search(private_data, "integer", &n) >= 0) {
|
||||
merge = 0;
|
||||
}
|
||||
if ((err = snd_config_search(config, "files", &n)) < 0) {
|
||||
SNDERR("Unable to find field files in the pre-load section");
|
||||
snd_error(CORE, "Unable to find field files in the pre-load section");
|
||||
return -EINVAL;
|
||||
}
|
||||
if ((err = snd_config_expand(n, root, NULL, private_data, &n)) < 0) {
|
||||
SNDERR("Unable to expand filenames in the pre-load section");
|
||||
snd_error(CORE, "Unable to expand filenames in the pre-load section");
|
||||
return err;
|
||||
}
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for field filenames");
|
||||
snd_error(CORE, "Invalid type for field filenames");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
do {
|
||||
hit = 0;
|
||||
snd_config_for_each(i, next, n) {
|
||||
|
|
@ -4292,12 +4308,12 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t
|
|||
long i;
|
||||
err = safe_strtol(id, &i);
|
||||
if (err < 0) {
|
||||
SNDERR("id of field %s is not and integer", id);
|
||||
snd_error(CORE, "id of field %s is not and integer", id);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
if (i == idx) {
|
||||
err = config_file_load_user_all(root, n, errors);
|
||||
err = config_file_load_user_all(root, n, errors, merge);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
idx++;
|
||||
|
|
@ -4359,18 +4375,18 @@ static int _snd_config_hook_table(snd_config_t *root, snd_config_t *config, snd_
|
|||
if (snd_config_search(config, "table", &n) < 0)
|
||||
return 0;
|
||||
if ((err = snd_config_expand(n, root, NULL, private_data, &n)) < 0) {
|
||||
SNDERR("Unable to expand table compound");
|
||||
snd_error(CORE, "Unable to expand table compound");
|
||||
return err;
|
||||
}
|
||||
if (snd_config_search(n, "id", &tn) < 0 ||
|
||||
snd_config_get_string(tn, &id) < 0) {
|
||||
SNDERR("Unable to find field table.id");
|
||||
snd_error(CORE, "Unable to find field table.id");
|
||||
snd_config_delete(n);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (snd_config_search(n, "value", &tn) < 0 ||
|
||||
snd_config_get_type(tn) != SND_CONFIG_TYPE_STRING) {
|
||||
SNDERR("Unable to find field table.value");
|
||||
snd_error(CORE, "Unable to find field table.value");
|
||||
snd_config_delete(n);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -4406,23 +4422,18 @@ static int _snd_config_hook_table(snd_config_t *root, snd_config_t *config, snd_
|
|||
int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config, snd_config_t **dst, snd_config_t *private_data ATTRIBUTE_UNUSED)
|
||||
{
|
||||
int card = -1, err;
|
||||
snd_config_t *loaded; // trace loaded cards
|
||||
|
||||
err = snd_config_top(&loaded);
|
||||
if (err < 0)
|
||||
return err;
|
||||
do {
|
||||
err = snd_card_next(&card);
|
||||
if (err < 0)
|
||||
goto __fin_err;
|
||||
return err;
|
||||
if (card >= 0) {
|
||||
snd_config_t *n, *m, *private_data = NULL;
|
||||
snd_config_t *n, *private_data = NULL;
|
||||
const char *driver;
|
||||
char *fdriver = NULL;
|
||||
bool load;
|
||||
err = snd_determine_driver(card, &fdriver);
|
||||
if (err < 0)
|
||||
goto __fin_err;
|
||||
return err;
|
||||
if (snd_config_search(root, fdriver, &n) >= 0) {
|
||||
if (snd_config_get_string(n, &driver) < 0) {
|
||||
if (snd_config_get_type(n) == SND_CONFIG_TYPE_COMPOUND) {
|
||||
|
|
@ -4443,19 +4454,6 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config,
|
|||
driver = fdriver;
|
||||
}
|
||||
__std:
|
||||
load = true;
|
||||
err = snd_config_imake_integer(&m, driver, 1);
|
||||
if (err < 0)
|
||||
goto __err;
|
||||
err = snd_config_add(loaded, m);
|
||||
if (err < 0) {
|
||||
if (err == -EEXIST) {
|
||||
snd_config_delete(m);
|
||||
load = false;
|
||||
} else {
|
||||
goto __err;
|
||||
}
|
||||
}
|
||||
private_data = _snd_config_hook_private_data(card, driver);
|
||||
if (!private_data) {
|
||||
err = -ENOMEM;
|
||||
|
|
@ -4464,22 +4462,17 @@ int snd_config_hook_load_for_all_cards(snd_config_t *root, snd_config_t *config,
|
|||
err = _snd_config_hook_table(root, config, private_data);
|
||||
if (err < 0)
|
||||
goto __err;
|
||||
if (load)
|
||||
err = snd_config_hook_load(root, config, &n, private_data);
|
||||
err = snd_config_hook_load(root, config, &n, private_data);
|
||||
__err:
|
||||
if (private_data)
|
||||
snd_config_delete(private_data);
|
||||
free(fdriver);
|
||||
if (err < 0)
|
||||
goto __fin_err;
|
||||
return err;
|
||||
}
|
||||
} while (card >= 0);
|
||||
snd_config_delete(loaded);
|
||||
*dst = NULL;
|
||||
return 0;
|
||||
__fin_err:
|
||||
snd_config_delete(loaded);
|
||||
return err;
|
||||
}
|
||||
#ifndef DOC_HIDDEN
|
||||
SND_DLSYM_BUILD_VERSION(snd_config_hook_load_for_all_cards, SND_CONFIG_DLSYM_VERSION_HOOK);
|
||||
|
|
@ -4577,7 +4570,7 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
|
|||
lf->ino = st.st_ino;
|
||||
lf->mtime = st.st_mtime;
|
||||
} else {
|
||||
SNDERR("Cannot access file %s", lf->name);
|
||||
snd_error(CORE, "Cannot access file %s", lf->name);
|
||||
free(lf->name);
|
||||
memmove(&local->finfo[k], &local->finfo[k+1], sizeof(struct finfo) * (local->count - k - 1));
|
||||
k--;
|
||||
|
|
@ -4615,12 +4608,12 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
|
|||
return err;
|
||||
|
||||
_reread:
|
||||
*_top = NULL;
|
||||
*_update = NULL;
|
||||
if (update) {
|
||||
snd_config_update_free(update);
|
||||
update = NULL;
|
||||
}
|
||||
*_top = NULL;
|
||||
*_update = NULL;
|
||||
if (update) {
|
||||
snd_config_update_free(update);
|
||||
update = NULL;
|
||||
}
|
||||
if (top) {
|
||||
snd_config_delete(top);
|
||||
top = NULL;
|
||||
|
|
@ -4637,17 +4630,17 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
|
|||
err = snd_config_load(top, in);
|
||||
snd_input_close(in);
|
||||
if (err < 0) {
|
||||
SNDERR("%s may be old or corrupted: consider to remove or fix it", local->finfo[k].name);
|
||||
snd_error(CORE, "%s may be old or corrupted: consider to remove or fix it", local->finfo[k].name);
|
||||
goto _end;
|
||||
}
|
||||
} else {
|
||||
SNDERR("cannot access file %s", local->finfo[k].name);
|
||||
snd_error(CORE, "cannot access file %s", local->finfo[k].name);
|
||||
}
|
||||
}
|
||||
_skip:
|
||||
err = snd_config_hooks(top, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("hooks failed, removing configuration");
|
||||
snd_error(CORE, "hooks failed, removing configuration");
|
||||
goto _end;
|
||||
}
|
||||
*_top = top;
|
||||
|
|
@ -5134,7 +5127,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
return 1;
|
||||
err = snd_config_get_string(c, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for @func");
|
||||
snd_error(CORE, "Invalid type for @func");
|
||||
return err;
|
||||
}
|
||||
assert(str);
|
||||
|
|
@ -5142,7 +5135,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
if (err >= 0) {
|
||||
snd_config_iterator_t i, next;
|
||||
if (snd_config_get_type(func_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for func %s definition", str);
|
||||
snd_error(CORE, "Invalid type for func %s definition", str);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -5154,7 +5147,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
if (strcmp(id, "lib") == 0) {
|
||||
err = snd_config_get_string(n, &lib);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CORE, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -5162,12 +5155,12 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
if (strcmp(id, "func") == 0) {
|
||||
err = snd_config_get_string(n, &func_name);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CORE, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CORE, "Unknown field %s", id);
|
||||
}
|
||||
}
|
||||
if (!func_name) {
|
||||
|
|
@ -5186,11 +5179,11 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
func = snd_dlsym(h, func_name, SND_DLSYM_VERSION(SND_CONFIG_DLSYM_VERSION_EVALUATE));
|
||||
err = 0;
|
||||
if (!h) {
|
||||
SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
|
||||
snd_error(CORE, "Cannot open shared library %s (%s)", lib, errbuf);
|
||||
err = -ENOENT;
|
||||
goto _errbuf;
|
||||
} else if (!func) {
|
||||
SNDERR("symbol %s is not defined inside %s", func_name, lib);
|
||||
snd_error(CORE, "symbol %s is not defined inside %s", func_name, lib);
|
||||
snd_dlclose(h);
|
||||
err = -ENXIO;
|
||||
goto _errbuf;
|
||||
|
|
@ -5202,7 +5195,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
snd_config_t *eval;
|
||||
err = func(&eval, root, src, private_data);
|
||||
if (err < 0)
|
||||
SNDERR("function %s returned error: %s", func_name, snd_strerror(err));
|
||||
snd_error(CORE, "function %s returned error: %s", func_name, snd_strerror(err));
|
||||
snd_dlclose(h);
|
||||
if (err >= 0 && eval)
|
||||
err = snd_config_substitute(src, eval);
|
||||
|
|
@ -5228,7 +5221,7 @@ static int _snd_config_evaluate(snd_config_t *src,
|
|||
* replaces those nodes with the respective function results.
|
||||
*/
|
||||
int snd_config_evaluate(snd_config_t *config, snd_config_t *root,
|
||||
snd_config_t *private_data, snd_config_t **result)
|
||||
snd_config_t *private_data, snd_config_t **result)
|
||||
{
|
||||
/* FIXME: Only in place evaluation is currently implemented */
|
||||
assert(result == NULL);
|
||||
|
|
@ -5266,7 +5259,7 @@ static int load_defaults(snd_config_t *subs, snd_config_t *defs)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CORE, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
|
@ -5372,7 +5365,7 @@ static int parse_string(const char **ptr, char **val)
|
|||
int c = **ptr;
|
||||
switch (c) {
|
||||
case '\0':
|
||||
SNDERR("Unterminated string");
|
||||
snd_error(CORE, "Unterminated string");
|
||||
return -EINVAL;
|
||||
case '\\':
|
||||
c = parse_char(ptr);
|
||||
|
|
@ -5509,7 +5502,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
const char *id = n->id;
|
||||
err = snd_config_search(defs, id, &d);
|
||||
if (err < 0) {
|
||||
SNDERR("Unknown parameter %s", id);
|
||||
snd_error(CORE, "Unknown parameter %s", id);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -5538,11 +5531,11 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
}
|
||||
err = snd_config_search_alias(defs, NULL, var, &def);
|
||||
if (err < 0) {
|
||||
SNDERR("Unknown parameter %s", var);
|
||||
snd_error(CORE, "Unknown parameter %s", var);
|
||||
goto _err;
|
||||
}
|
||||
if (snd_config_get_type(def) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Parameter %s definition is not correct", var);
|
||||
snd_error(CORE, "Parameter %s definition is not correct", var);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -5554,7 +5547,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
err = snd_config_search(def, "type", &typ);
|
||||
if (err < 0) {
|
||||
_invalid_type:
|
||||
SNDERR("Parameter %s definition is missing a valid type info", var);
|
||||
snd_error(CORE, "Parameter %s definition is missing a valid type info", var);
|
||||
goto _err;
|
||||
}
|
||||
err = snd_config_get_string(typ, &tmp);
|
||||
|
|
@ -5567,7 +5560,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
goto _err;
|
||||
err = safe_strtol(val, &v);
|
||||
if (err < 0) {
|
||||
SNDERR("Parameter %s must be an integer", var);
|
||||
snd_error(CORE, "Parameter %s must be an integer", var);
|
||||
goto _err;
|
||||
}
|
||||
err = snd_config_set_integer(sub, v);
|
||||
|
|
@ -5580,7 +5573,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
goto _err;
|
||||
err = safe_strtoll(val, &v);
|
||||
if (err < 0) {
|
||||
SNDERR("Parameter %s must be an integer", var);
|
||||
snd_error(CORE, "Parameter %s must be an integer", var);
|
||||
goto _err;
|
||||
}
|
||||
err = snd_config_set_integer64(sub, v);
|
||||
|
|
@ -5593,7 +5586,7 @@ static int parse_args(snd_config_t *subs, const char *str, snd_config_t *defs)
|
|||
goto _err;
|
||||
err = safe_strtod(val, &v);
|
||||
if (err < 0) {
|
||||
SNDERR("Parameter %s must be a real", var);
|
||||
snd_error(CORE, "Parameter %s must be a real", var);
|
||||
goto _err;
|
||||
}
|
||||
err = snd_config_set_real(sub, v);
|
||||
|
|
@ -5660,7 +5653,7 @@ int snd_config_expand_custom(snd_config_t *config, snd_config_t *root,
|
|||
|
||||
err = snd_config_walk(config, root, &res, _snd_config_expand, fcn, private_data);
|
||||
if (err < 0) {
|
||||
SNDERR("Expand error (walk): %s", snd_strerror(err));
|
||||
snd_error(CORE, "Expand error (walk): %s", snd_strerror(err));
|
||||
return err;
|
||||
}
|
||||
*result = res;
|
||||
|
|
@ -5692,7 +5685,7 @@ int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args
|
|||
err = snd_config_search(config, "@args", &defs);
|
||||
if (err < 0) {
|
||||
if (args != NULL) {
|
||||
SNDERR("Unknown parameters %s", args);
|
||||
snd_error(CORE, "Unknown parameters %s", args);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_copy(&res, config);
|
||||
|
|
@ -5704,35 +5697,35 @@ int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args
|
|||
return err;
|
||||
err = load_defaults(subs, defs);
|
||||
if (err < 0) {
|
||||
SNDERR("Load defaults error: %s", snd_strerror(err));
|
||||
snd_error(CORE, "Load defaults error: %s", snd_strerror(err));
|
||||
goto _end;
|
||||
}
|
||||
err = parse_args(subs, args, defs);
|
||||
if (err < 0) {
|
||||
SNDERR("Parse arguments error: %s", snd_strerror(err));
|
||||
snd_error(CORE, "Parse arguments error: %s", snd_strerror(err));
|
||||
goto _end;
|
||||
}
|
||||
err = snd_config_evaluate(subs, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("Args evaluate error: %s", snd_strerror(err));
|
||||
snd_error(CORE, "Args evaluate error: %s", snd_strerror(err));
|
||||
goto _end;
|
||||
}
|
||||
err = snd_config_walk(config, root, &res, _snd_config_expand, _snd_config_expand_vars, subs);
|
||||
if (err < 0) {
|
||||
SNDERR("Expand error (walk): %s", snd_strerror(err));
|
||||
snd_error(CORE, "Expand error (walk): %s", snd_strerror(err));
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
err = snd_config_evaluate(res, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("Evaluate error: %s", snd_strerror(err));
|
||||
snd_error(CORE, "Evaluate error: %s", snd_strerror(err));
|
||||
snd_config_delete(res);
|
||||
goto _end;
|
||||
}
|
||||
*result = res;
|
||||
err = 1;
|
||||
_end:
|
||||
if (subs)
|
||||
if (subs)
|
||||
snd_config_delete(subs);
|
||||
return err;
|
||||
}
|
||||
|
|
@ -5807,7 +5800,7 @@ int snd_config_check_hop(snd_config_t *conf)
|
|||
{
|
||||
if (conf) {
|
||||
if (conf->hop >= SND_CONF_MAX_HOPS) {
|
||||
SYSERR("Too many definition levels (looped?)\n");
|
||||
snd_error(CORE, "Too many definition levels (looped?)\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
return conf->hop;
|
||||
|
|
|
|||
|
|
@ -55,4 +55,5 @@ pistachio-card.pcm.default{
|
|||
type hw
|
||||
card $CARD
|
||||
device $DEVICE
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
|
|||
if (c == '\0')
|
||||
break;
|
||||
if (pos == END) {
|
||||
SNDERR("unexpected expression tail '%s'", s);
|
||||
snd_error(CORE, "unexpected expression tail '%s'", s);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (pos == OP) {
|
||||
|
|
@ -160,7 +160,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
|
|||
case '|':
|
||||
case '&': op = c; break;
|
||||
default:
|
||||
SNDERR("unknown operation '%c'", c);
|
||||
snd_error(CORE, "unknown operation '%c'", c);
|
||||
return -EINVAL;
|
||||
}
|
||||
pos = RIGHT;
|
||||
|
|
@ -225,7 +225,7 @@ int _snd_eval_string(snd_config_t **dst, const char *s,
|
|||
pos = op == LEFT ? OP : END;
|
||||
}
|
||||
if (pos != OP && pos != END) {
|
||||
SNDERR("incomplete expression '%s'", save);
|
||||
snd_error(CORE, "incomplete expression '%s'", save);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +269,7 @@ int snd_config_evaluate_string(snd_config_t **dst, const char *s,
|
|||
if (s[1] == '[') {
|
||||
err = _snd_eval_string(dst, s, fcn, private_data);
|
||||
if (err < 0)
|
||||
SNDERR("wrong expression '%s'", s);
|
||||
snd_error(CORE, "wrong expression '%s'", s);
|
||||
} else {
|
||||
err = fcn(dst, s + 1, private_data);
|
||||
}
|
||||
|
|
|
|||
148
src/confmisc.c
148
src/confmisc.c
|
|
@ -127,14 +127,14 @@ int snd_config_get_bool(const snd_config_t *conf)
|
|||
if (err >= 0) {
|
||||
if (v < 0 || v > 1) {
|
||||
_invalid_value:
|
||||
SNDERR("Invalid value for %s", id);
|
||||
snd_error(CORE, "Invalid value for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
err = snd_config_get_string(conf, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CORE, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_get_bool_ascii(str);
|
||||
|
|
@ -157,12 +157,12 @@ int snd_config_get_card(const snd_config_t *conf)
|
|||
if (snd_config_get_integer(conf, &v) < 0) {
|
||||
if (snd_config_get_string(conf, &str)) {
|
||||
if (snd_config_get_id(conf, &id) >= 0)
|
||||
SNDERR("Invalid field %s", id);
|
||||
snd_error(CORE, "Invalid field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_card_get_index(str);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot get card index for %s", str);
|
||||
snd_error(CORE, "Cannot get card index for %s", str);
|
||||
return err;
|
||||
}
|
||||
v = err;
|
||||
|
|
@ -213,14 +213,14 @@ int snd_config_get_ctl_iface(const snd_config_t *conf)
|
|||
if (err >= 0) {
|
||||
if (v < 0 || v > SND_CTL_ELEM_IFACE_LAST) {
|
||||
_invalid_value:
|
||||
SNDERR("Invalid value for %s", id);
|
||||
snd_error(CORE, "Invalid value for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
err = snd_config_get_string(conf, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CORE, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_get_ctl_iface_ascii(str);
|
||||
|
|
@ -263,27 +263,27 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
|
||||
err = snd_config_search(src, "vars", &n);
|
||||
if (err < 0) {
|
||||
SNDERR("field vars not found");
|
||||
snd_error(CORE, "field vars not found");
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating vars");
|
||||
snd_error(CORE, "error evaluating vars");
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_search(src, "default", &d);
|
||||
if (err < 0) {
|
||||
SNDERR("field default not found");
|
||||
snd_error(CORE, "field default not found");
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_evaluate(d, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating default");
|
||||
snd_error(CORE, "error evaluating default");
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_get_ascii(d, &def);
|
||||
if (err < 0) {
|
||||
SNDERR("error getting field default");
|
||||
snd_error(CORE, "error getting field default");
|
||||
goto __error;
|
||||
}
|
||||
do {
|
||||
|
|
@ -295,13 +295,13 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
if (snd_config_get_id(n, &id) < 0)
|
||||
continue;
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_STRING) {
|
||||
SNDERR("field %s is not a string", id);
|
||||
snd_error(CORE, "field %s is not a string", id);
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
err = safe_strtol(id, &i);
|
||||
if (err < 0) {
|
||||
SNDERR("id of field %s is not an integer", id);
|
||||
snd_error(CORE, "id of field %s is not an integer", id);
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
|
|
@ -309,7 +309,7 @@ int snd_func_getenv(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
idx++;
|
||||
err = snd_config_get_string(n, &ptr);
|
||||
if (err < 0) {
|
||||
SNDERR("invalid string for id %s", id);
|
||||
snd_error(CORE, "invalid string for id %s", id);
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
|
|
@ -414,12 +414,12 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
|
||||
err = snd_config_search(src, "strings", &n);
|
||||
if (err < 0) {
|
||||
SNDERR("field strings not found");
|
||||
snd_error(CORE, "field strings not found");
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating strings");
|
||||
snd_error(CORE, "error evaluating strings");
|
||||
goto __error;
|
||||
}
|
||||
do {
|
||||
|
|
@ -433,7 +433,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
continue;
|
||||
err = safe_strtol(id, &i);
|
||||
if (err < 0) {
|
||||
SNDERR("id of field %s is not an integer", id);
|
||||
snd_error(CORE, "id of field %s is not an integer", id);
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
|
|
@ -441,7 +441,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
idx++;
|
||||
err = snd_config_get_ascii(n, &ptr);
|
||||
if (err < 0) {
|
||||
SNDERR("invalid ascii string for id %s", id);
|
||||
snd_error(CORE, "invalid ascii string for id %s", id);
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
|
|
@ -462,7 +462,7 @@ int snd_func_concat(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
}
|
||||
} while (hit);
|
||||
if (res == NULL) {
|
||||
SNDERR("empty string is not accepted");
|
||||
snd_error(CORE, "empty string is not accepted");
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
|
|
@ -493,12 +493,12 @@ static int snd_func_iops(snd_config_t **dst,
|
|||
|
||||
err = snd_config_search(src, "integers", &n);
|
||||
if (err < 0) {
|
||||
SNDERR("field integers not found");
|
||||
snd_error(CORE, "field integers not found");
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating integers");
|
||||
snd_error(CORE, "error evaluating integers");
|
||||
goto __error;
|
||||
}
|
||||
do {
|
||||
|
|
@ -511,7 +511,7 @@ static int snd_func_iops(snd_config_t **dst,
|
|||
continue;
|
||||
err = safe_strtol(id, &i);
|
||||
if (err < 0) {
|
||||
SNDERR("id of field %s is not an integer", id);
|
||||
snd_error(CORE, "id of field %s is not an integer", id);
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
|
|
@ -519,7 +519,7 @@ static int snd_func_iops(snd_config_t **dst,
|
|||
idx++;
|
||||
err = snd_config_get_integer(n, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("invalid integer for id %s", id);
|
||||
snd_error(CORE, "invalid integer for id %s", id);
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
|
|
@ -558,7 +558,7 @@ static int snd_func_iops(snd_config_t **dst,
|
|||
\endcode
|
||||
*/
|
||||
int snd_func_iadd(snd_config_t **dst, snd_config_t *root,
|
||||
snd_config_t *src, snd_config_t *private_data)
|
||||
snd_config_t *src, snd_config_t *private_data)
|
||||
{
|
||||
return snd_func_iops(dst, root, src, private_data, 0);
|
||||
}
|
||||
|
|
@ -660,7 +660,7 @@ static int _snd_func_private_data(snd_config_t **dst, snd_config_t *src,
|
|||
err = snd_config_test_id(*private_data, id);
|
||||
if (err) {
|
||||
notfound:
|
||||
SNDERR("field %s not found", id);
|
||||
snd_error(CORE, "field %s not found", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -695,7 +695,7 @@ int snd_func_private_string(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNU
|
|||
return err;
|
||||
err = snd_config_get_string(private_data, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("field string is not a string");
|
||||
snd_error(CORE, "field string is not a string");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_id(src, &id);
|
||||
|
|
@ -736,7 +736,7 @@ int snd_func_private_integer(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UN
|
|||
return err;
|
||||
err = snd_config_get_integer(private_data, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("field integer is not a string");
|
||||
snd_error(CORE, "field integer is not a string");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_id(src, &id);
|
||||
|
|
@ -759,12 +759,12 @@ int snd_determine_driver(int card, char **driver)
|
|||
assert(card >= 0 && card <= SND_MAX_CARDS);
|
||||
err = open_ctl(card, &ctl);
|
||||
if (err < 0) {
|
||||
SNDERR("could not open control for card %i", card);
|
||||
snd_error(CORE, "could not open control for card %i", card);
|
||||
goto __error;
|
||||
}
|
||||
err = snd_ctl_card_info(ctl, &info);
|
||||
if (err < 0) {
|
||||
SNDERR("snd_ctl_card_info error: %s", snd_strerror(err));
|
||||
snd_error(CORE, "snd_ctl_card_info error: %s", snd_strerror(err));
|
||||
goto __error;
|
||||
}
|
||||
res = strdup(snd_ctl_card_info_get_driver(&info));
|
||||
|
|
@ -808,12 +808,12 @@ int snd_func_private_card_driver(snd_config_t **dst, snd_config_t *root ATTRIBUT
|
|||
|
||||
err = snd_config_test_id(private_data, "card");
|
||||
if (err) {
|
||||
SNDERR("field card not found");
|
||||
snd_error(CORE, "field card not found");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_get_integer(private_data, &card);
|
||||
if (err < 0) {
|
||||
SNDERR("field card is not an integer");
|
||||
snd_error(CORE, "field card is not an integer");
|
||||
return err;
|
||||
}
|
||||
if ((err = snd_determine_driver(card, &driver)) < 0)
|
||||
|
|
@ -837,22 +837,22 @@ static int parse_card(snd_config_t *root, snd_config_t *src,
|
|||
|
||||
err = snd_config_search(src, "card", &n);
|
||||
if (err < 0) {
|
||||
SNDERR("field card not found");
|
||||
snd_error(CORE, "field card not found");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating card");
|
||||
snd_error(CORE, "error evaluating card");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_ascii(n, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("field card is not an integer or a string");
|
||||
snd_error(CORE, "field card is not an integer or a string");
|
||||
return err;
|
||||
}
|
||||
card = snd_card_get_index(str);
|
||||
if (card < 0)
|
||||
SNDERR("cannot find card '%s'", str);
|
||||
snd_error(CORE, "cannot find card '%s'", str);
|
||||
free(str);
|
||||
return card;
|
||||
}
|
||||
|
|
@ -959,12 +959,12 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
return card;
|
||||
err = open_ctl(card, &ctl);
|
||||
if (err < 0) {
|
||||
SNDERR("could not open control for card %i", card);
|
||||
snd_error(CORE, "could not open control for card %i", card);
|
||||
goto __error;
|
||||
}
|
||||
err = snd_ctl_card_info(ctl, &info);
|
||||
if (err < 0) {
|
||||
SNDERR("snd_ctl_card_info error: %s", snd_strerror(err));
|
||||
snd_error(CORE, "snd_ctl_card_info error: %s", snd_strerror(err));
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_get_id(src, &id);
|
||||
|
|
@ -972,8 +972,8 @@ int snd_func_card_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
err = snd_config_imake_string(dst, id,
|
||||
snd_ctl_card_info_get_id(&info));
|
||||
__error:
|
||||
if (ctl)
|
||||
snd_ctl_close(ctl);
|
||||
if (ctl)
|
||||
snd_ctl_close(ctl);
|
||||
return err;
|
||||
}
|
||||
#ifndef DOC_HIDDEN
|
||||
|
|
@ -1010,12 +1010,12 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
|
|||
return card;
|
||||
err = open_ctl(card, &ctl);
|
||||
if (err < 0) {
|
||||
SNDERR("could not open control for card %i", card);
|
||||
snd_error(CORE, "could not open control for card %i", card);
|
||||
goto __error;
|
||||
}
|
||||
err = snd_ctl_card_info(ctl, &info);
|
||||
if (err < 0) {
|
||||
SNDERR("snd_ctl_card_info error: %s", snd_strerror(err));
|
||||
snd_error(CORE, "snd_ctl_card_info error: %s", snd_strerror(err));
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_get_id(src, &id);
|
||||
|
|
@ -1023,8 +1023,8 @@ int snd_func_card_name(snd_config_t **dst, snd_config_t *root,
|
|||
err = snd_config_imake_safe_string(dst, id,
|
||||
snd_ctl_card_info_get_name(&info));
|
||||
__error:
|
||||
if (ctl)
|
||||
snd_ctl_close(ctl);
|
||||
if (ctl)
|
||||
snd_ctl_close(ctl);
|
||||
return err;
|
||||
}
|
||||
#ifndef DOC_HIDDEN
|
||||
|
|
@ -1075,41 +1075,41 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v
|
|||
return card;
|
||||
err = snd_config_search(src, "device", &n);
|
||||
if (err < 0) {
|
||||
SNDERR("field device not found");
|
||||
snd_error(CORE, "field device not found");
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating device");
|
||||
snd_error(CORE, "error evaluating device");
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_get_integer(n, &device);
|
||||
if (err < 0) {
|
||||
SNDERR("field device is not an integer");
|
||||
snd_error(CORE, "field device is not an integer");
|
||||
goto __error;
|
||||
}
|
||||
if (snd_config_search(src, "subdevice", &n) >= 0) {
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating subdevice");
|
||||
snd_error(CORE, "error evaluating subdevice");
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_get_integer(n, &subdevice);
|
||||
if (err < 0) {
|
||||
SNDERR("field subdevice is not an integer");
|
||||
snd_error(CORE, "field subdevice is not an integer");
|
||||
goto __error;
|
||||
}
|
||||
}
|
||||
err = open_ctl(card, &ctl);
|
||||
if (err < 0) {
|
||||
SNDERR("could not open control for card %li", card);
|
||||
snd_error(CORE, "could not open control for card %li", card);
|
||||
goto __error;
|
||||
}
|
||||
snd_pcm_info_set_device(&info, device);
|
||||
snd_pcm_info_set_subdevice(&info, subdevice);
|
||||
err = snd_ctl_pcm_info(ctl, &info);
|
||||
if (err < 0) {
|
||||
SNDERR("snd_ctl_pcm_info error: %s", snd_strerror(err));
|
||||
snd_error(CORE, "snd_ctl_pcm_info error: %s", snd_strerror(err));
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_get_id(src, &id);
|
||||
|
|
@ -1117,8 +1117,8 @@ int snd_func_pcm_id(snd_config_t **dst, snd_config_t *root, snd_config_t *src, v
|
|||
err = snd_config_imake_string(dst, id,
|
||||
snd_pcm_info_get_id(&info));
|
||||
__error:
|
||||
if (ctl)
|
||||
snd_ctl_close(ctl);
|
||||
if (ctl)
|
||||
snd_ctl_close(ctl);
|
||||
return err;
|
||||
}
|
||||
#ifndef DOC_HIDDEN
|
||||
|
|
@ -1158,53 +1158,53 @@ int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_confi
|
|||
|
||||
err = snd_config_search(src, "class", &n);
|
||||
if (err < 0) {
|
||||
SNDERR("field class not found");
|
||||
snd_error(CORE, "field class not found");
|
||||
goto __out;
|
||||
}
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating class");
|
||||
snd_error(CORE, "error evaluating class");
|
||||
goto __out;
|
||||
}
|
||||
err = snd_config_get_integer(n, &class);
|
||||
if (err < 0) {
|
||||
SNDERR("field class is not an integer");
|
||||
snd_error(CORE, "field class is not an integer");
|
||||
goto __out;
|
||||
}
|
||||
err = snd_config_search(src, "index", &n);
|
||||
if (err < 0) {
|
||||
SNDERR("field index not found");
|
||||
snd_error(CORE, "field index not found");
|
||||
goto __out;
|
||||
}
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating index");
|
||||
snd_error(CORE, "error evaluating index");
|
||||
goto __out;
|
||||
}
|
||||
err = snd_config_get_integer(n, &index);
|
||||
if (err < 0) {
|
||||
SNDERR("field index is not an integer");
|
||||
snd_error(CORE, "field index is not an integer");
|
||||
goto __out;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
err = snd_card_next(&card);
|
||||
if (err < 0) {
|
||||
SNDERR("could not get next card");
|
||||
snd_error(CORE, "could not get next card");
|
||||
goto __out;
|
||||
}
|
||||
if (card < 0)
|
||||
break;
|
||||
err = open_ctl(card, &ctl);
|
||||
if (err < 0) {
|
||||
SNDERR("could not open control for card %i", card);
|
||||
snd_error(CORE, "could not open control for card %i", card);
|
||||
goto __out;
|
||||
}
|
||||
dev = -1;
|
||||
while(1) {
|
||||
err = snd_ctl_pcm_next_device(ctl, &dev);
|
||||
if (err < 0) {
|
||||
SNDERR("could not get next pcm for card %i", card);
|
||||
snd_error(CORE, "could not get next pcm for card %i", card);
|
||||
goto __out;
|
||||
}
|
||||
if (dev < 0)
|
||||
|
|
@ -1217,14 +1217,14 @@ int snd_func_pcm_args_by_class(snd_config_t **dst, snd_config_t *root, snd_confi
|
|||
index == idx++)
|
||||
goto __out;
|
||||
}
|
||||
snd_ctl_close(ctl);
|
||||
snd_ctl_close(ctl);
|
||||
ctl = NULL;
|
||||
}
|
||||
err = -ENODEV;
|
||||
|
||||
__out:
|
||||
if (ctl)
|
||||
snd_ctl_close(ctl);
|
||||
if (ctl)
|
||||
snd_ctl_close(ctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if((err = snd_config_get_id(src, &id)) >= 0) {
|
||||
|
|
@ -1268,18 +1268,18 @@ int snd_func_private_pcm_subdevice(snd_config_t **dst, snd_config_t *root ATTRIB
|
|||
return snd_config_copy(dst, src);
|
||||
err = snd_config_test_id(private_data, "pcm_handle");
|
||||
if (err) {
|
||||
SNDERR("field pcm_handle not found");
|
||||
snd_error(CORE, "field pcm_handle not found");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_get_pointer(private_data, &data);
|
||||
pcm = (snd_pcm_t *)data;
|
||||
if (err < 0) {
|
||||
SNDERR("field pcm_handle is not a pointer");
|
||||
snd_error(CORE, "field pcm_handle is not a pointer");
|
||||
return err;
|
||||
}
|
||||
err = snd_pcm_info(pcm, &info);
|
||||
if (err < 0) {
|
||||
SNDERR("snd_ctl_pcm_info error: %s", snd_strerror(err));
|
||||
snd_error(CORE, "snd_ctl_pcm_info error: %s", snd_strerror(err));
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_id(src, &id);
|
||||
|
|
@ -1326,12 +1326,12 @@ int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
if (err >= 0) {
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating file");
|
||||
snd_error(CORE, "error evaluating file");
|
||||
goto _end;
|
||||
}
|
||||
err = snd_config_get_string(n, &file);
|
||||
if (err < 0) {
|
||||
SNDERR("file is not a string");
|
||||
snd_error(CORE, "file is not a string");
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
|
|
@ -1339,25 +1339,25 @@ int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
if (err >= 0) {
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
if (err < 0) {
|
||||
SNDERR("error evaluating name");
|
||||
snd_error(CORE, "error evaluating name");
|
||||
goto _end;
|
||||
}
|
||||
err = snd_config_get_string(n, &name);
|
||||
if (err < 0) {
|
||||
SNDERR("name is not a string");
|
||||
snd_error(CORE, "name is not a string");
|
||||
goto _end;
|
||||
}
|
||||
}
|
||||
if (!name) {
|
||||
err = -EINVAL;
|
||||
SNDERR("name is not specified");
|
||||
snd_error(CORE, "name is not specified");
|
||||
goto _end;
|
||||
}
|
||||
if (file) {
|
||||
snd_input_t *input;
|
||||
err = snd_input_stdio_open(&input, file, "r");
|
||||
if (err < 0) {
|
||||
SNDERR("Unable to open file %s: %s", file, snd_strerror(err));
|
||||
snd_error(CORE, "Unable to open file %s: %s", file, snd_strerror(err));
|
||||
goto _end;
|
||||
}
|
||||
err = snd_config_load(root, input);
|
||||
|
|
@ -1374,7 +1374,7 @@ int snd_func_refer(snd_config_t **dst, snd_config_t *root, snd_config_t *src,
|
|||
} else {
|
||||
err = snd_config_search(src, "default", &n);
|
||||
if (err < 0)
|
||||
SNDERR("Unable to find definition '%s'", name);
|
||||
snd_error(CORE, "Unable to find definition '%s'", name);
|
||||
else {
|
||||
const char *id;
|
||||
err = snd_config_evaluate(n, root, private_data, NULL);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ file. The format is:
|
|||
|
||||
\verbatim
|
||||
index [ID ] Driver - name
|
||||
longname
|
||||
longname
|
||||
\endverbatim
|
||||
|
||||
Note that the mixername and components are not listed.
|
||||
|
|
@ -353,7 +353,7 @@ int snd_ctl_poll_descriptors_revents(snd_ctl_t *ctl, struct pollfd *pfds, unsign
|
|||
return ctl->ops->poll_revents(ctl, pfds, nfds, revents);
|
||||
if (nfds == 1) {
|
||||
*revents = pfds->revents;
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -1039,7 +1039,7 @@ int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *data)
|
|||
|
||||
static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag,
|
||||
const snd_ctl_elem_id_t *id,
|
||||
unsigned int *tlv, unsigned int tlv_size)
|
||||
unsigned int *tlv, unsigned int tlv_size)
|
||||
{
|
||||
snd_ctl_elem_info_t *info = NULL;
|
||||
int err;
|
||||
|
|
@ -1060,8 +1060,8 @@ static int snd_ctl_tlv_do(snd_ctl_t *ctl, int op_flag,
|
|||
}
|
||||
err = ctl->ops->element_tlv(ctl, op_flag, id->numid, tlv, tlv_size);
|
||||
__err:
|
||||
if (info)
|
||||
free(info);
|
||||
if (info)
|
||||
free(info);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -1367,7 +1367,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
|
|||
|
||||
npfds = snd_ctl_poll_descriptors_count(ctl);
|
||||
if (npfds <= 0 || npfds >= 16) {
|
||||
SNDERR("Invalid poll_fds %d", npfds);
|
||||
snd_error(CONTROL, "Invalid poll_fds %d", npfds);
|
||||
return -EIO;
|
||||
}
|
||||
pfd = alloca(sizeof(*pfd) * npfds);
|
||||
|
|
@ -1375,7 +1375,7 @@ int snd_ctl_wait(snd_ctl_t *ctl, int timeout)
|
|||
if (err < 0)
|
||||
return err;
|
||||
if (err != npfds) {
|
||||
SNDMSG("invalid poll descriptors %d", err);
|
||||
snd_check(CONTROL, "invalid poll descriptors %d", err);
|
||||
return -EIO;
|
||||
}
|
||||
for (;;) {
|
||||
|
|
@ -1458,30 +1458,30 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
|
|||
#endif
|
||||
if (snd_config_get_type(ctl_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
if (name)
|
||||
SNDERR("Invalid type for CTL %s definition", name);
|
||||
snd_error(CONTROL, "Invalid type for CTL %s definition", name);
|
||||
else
|
||||
SNDERR("Invalid type for CTL definition");
|
||||
snd_error(CONTROL, "Invalid type for CTL definition");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_search(ctl_conf, "type", &conf);
|
||||
if (err < 0) {
|
||||
SNDERR("type is not defined");
|
||||
snd_error(CONTROL, "type is not defined");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_id(conf, &id);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to get id");
|
||||
snd_error(CONTROL, "unable to get id");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_string(conf, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CONTROL, "Invalid type for %s", id);
|
||||
return err;
|
||||
}
|
||||
err = snd_config_search_definition(ctl_root, "ctl_type", str, &type_conf);
|
||||
if (err >= 0) {
|
||||
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for CTL type %s definition", str);
|
||||
snd_error(CONTROL, "Invalid type for CTL type %s definition", str);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -1495,7 +1495,7 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
|
|||
if (strcmp(id, "lib") == 0) {
|
||||
err = snd_config_get_string(n, &lib);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CONTROL, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1503,12 +1503,12 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
|
|||
if (strcmp(id, "open") == 0) {
|
||||
err = snd_config_get_string(n, &open_name);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CONTROL, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CONTROL, "Unknown field %s", id);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -1572,7 +1572,7 @@ static int snd_ctl_open_noupdate(snd_ctl_t **ctlp, snd_config_t *root,
|
|||
|
||||
err = snd_config_search_definition(root, "ctl", name, &ctl_conf);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid CTL %s", name);
|
||||
snd_error(CONTROL, "Invalid CTL %s", name);
|
||||
return err;
|
||||
}
|
||||
if (snd_config_get_string(ctl_conf, &str) >= 0)
|
||||
|
|
|
|||
|
|
@ -87,11 +87,11 @@ int _snd_ctl_empty_open(snd_ctl_t **handlep, const char *name ATTRIBUTE_UNUSED,
|
|||
child = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CONTROL, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!child) {
|
||||
SNDERR("child is not defined");
|
||||
snd_error(CONTROL, "child is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
return _snd_ctl_open_named_child(handlep, name, root, child, mode, conf);
|
||||
|
|
|
|||
|
|
@ -458,7 +458,7 @@ static int snd_ctl_ext_poll_revents(snd_ctl_t *handle, struct pollfd *pfds, unsi
|
|||
return ext->callback->poll_revents(ext, pfds, nfds, revents);
|
||||
if (nfds == 1) {
|
||||
*revents = pfds->revents;
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -560,7 +560,7 @@ SND_CTL_PLUGIN_DEFINE_FUNC(myctl)
|
|||
....
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CONTROL, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -712,7 +712,7 @@ int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode)
|
|||
|
||||
if (ext->version < SNDRV_PROTOCOL_VERSION(1, 0, 0) ||
|
||||
ext->version > SND_CTL_EXT_VERSION) {
|
||||
SNDERR("ctl_ext: Plugin version mismatch");
|
||||
snd_error(CONTROL, "ctl_ext: Plugin version mismatch");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ static int snd_ctl_hw_nonblock(snd_ctl_t *handle, int nonblock)
|
|||
long flags;
|
||||
int fd = hw->fd;
|
||||
if ((flags = fcntl(fd, F_GETFL)) < 0) {
|
||||
SYSERR("F_GETFL failed");
|
||||
snd_errornum(CONTROL, "F_GETFL failed");
|
||||
return -errno;
|
||||
}
|
||||
if (nonblock)
|
||||
|
|
@ -79,7 +79,7 @@ static int snd_ctl_hw_nonblock(snd_ctl_t *handle, int nonblock)
|
|||
else
|
||||
flags &= ~O_NONBLOCK;
|
||||
if (fcntl(fd, F_SETFL, flags) < 0) {
|
||||
SYSERR("F_SETFL for O_NONBLOCK failed");
|
||||
snd_errornum(CONTROL, "F_SETFL for O_NONBLOCK failed");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -92,7 +92,7 @@ static int snd_ctl_hw_async(snd_ctl_t *ctl, int sig, pid_t pid)
|
|||
int fd = hw->fd;
|
||||
|
||||
if ((flags = fcntl(fd, F_GETFL)) < 0) {
|
||||
SYSERR("F_GETFL failed");
|
||||
snd_errornum(CONTROL, "F_GETFL failed");
|
||||
return -errno;
|
||||
}
|
||||
if (sig >= 0)
|
||||
|
|
@ -100,17 +100,17 @@ static int snd_ctl_hw_async(snd_ctl_t *ctl, int sig, pid_t pid)
|
|||
else
|
||||
flags &= ~O_ASYNC;
|
||||
if (fcntl(fd, F_SETFL, flags) < 0) {
|
||||
SYSERR("F_SETFL for O_ASYNC failed");
|
||||
snd_errornum(CONTROL, "F_SETFL for O_ASYNC failed");
|
||||
return -errno;
|
||||
}
|
||||
if (sig < 0)
|
||||
return 0;
|
||||
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
|
||||
SYSERR("F_SETSIG failed");
|
||||
snd_errornum(CONTROL, "F_SETSIG failed");
|
||||
return -errno;
|
||||
}
|
||||
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
|
||||
SYSERR("F_SETOWN failed");
|
||||
snd_errornum(CONTROL, "F_SETOWN failed");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -120,7 +120,7 @@ static int snd_ctl_hw_subscribe_events(snd_ctl_t *handle, int subscribe)
|
|||
{
|
||||
snd_ctl_hw_t *hw = handle->private_data;
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS, &subscribe) < 0) {
|
||||
SYSERR("SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS failed");
|
||||
snd_errornum(CONTROL, "SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS failed");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -130,7 +130,7 @@ static int snd_ctl_hw_card_info(snd_ctl_t *handle, snd_ctl_card_info_t *info)
|
|||
{
|
||||
snd_ctl_hw_t *hw = handle->private_data;
|
||||
if (ioctl(hw->fd, SNDRV_CTL_IOCTL_CARD_INFO, info) < 0) {
|
||||
SYSERR("SNDRV_CTL_IOCTL_CARD_INFO failed");
|
||||
snd_errornum(CONTROL, "SNDRV_CTL_IOCTL_CARD_INFO failed");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -232,7 +232,7 @@ static int snd_ctl_hw_elem_tlv(snd_ctl_t *handle, int op_flag,
|
|||
|
||||
switch (op_flag) {
|
||||
case -1: inum = SNDRV_CTL_IOCTL_TLV_COMMAND; break;
|
||||
case 0: inum = SNDRV_CTL_IOCTL_TLV_READ; break;
|
||||
case 0: inum = SNDRV_CTL_IOCTL_TLV_READ; break;
|
||||
case 1: inum = SNDRV_CTL_IOCTL_TLV_WRITE; break;
|
||||
default: return -EINVAL;
|
||||
}
|
||||
|
|
@ -375,8 +375,9 @@ static int snd_ctl_hw_read(snd_ctl_t *handle, snd_ctl_event_t *event)
|
|||
if (res <= 0)
|
||||
return -errno;
|
||||
if (CHECK_SANITY(res != sizeof(*event))) {
|
||||
SNDMSG("snd_ctl_hw_read: read size error (req:%d, got:%d)",
|
||||
sizeof(*event), res);
|
||||
snd_check(CONTROL, "snd_ctl_hw_read: read size error (req:%d, got:%d)",
|
||||
sizeof(*event), res);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
return 1;
|
||||
|
|
@ -437,7 +438,7 @@ int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode)
|
|||
*handle = NULL;
|
||||
|
||||
if (CHECK_SANITY(card < 0 || card >= SND_MAX_CARDS)) {
|
||||
SNDMSG("Invalid card index %d", card);
|
||||
snd_check(CONTROL, "Invalid card index %d", card);
|
||||
return -EINVAL;
|
||||
}
|
||||
sprintf(filename, SNDRV_FILE_CONTROL, card);
|
||||
|
|
|
|||
|
|
@ -1242,27 +1242,27 @@ static int parse_remap(snd_ctl_remap_t *priv, snd_config_t *conf)
|
|||
if (snd_config_get_id(n, &id) < 0)
|
||||
continue;
|
||||
if (snd_config_get_string(n, &str) < 0) {
|
||||
SNDERR("expected string with the target control id!");
|
||||
snd_error(CONTROL, "expected string with the target control id!");
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_ctl_elem_id_clear(&app);
|
||||
err = snd_ctl_ascii_elem_id_parse(&app, str);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to parse target id '%s'!", str);
|
||||
snd_error(CONTROL, "unable to parse target id '%s'!", str);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (remap_find_id_app(priv, &app)) {
|
||||
SNDERR("duplicate target id '%s'!", id);
|
||||
snd_error(CONTROL, "duplicate target id '%s'!", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_ctl_elem_id_clear(&child);
|
||||
err = snd_ctl_ascii_elem_id_parse(&child, id);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to parse source id '%s'!", id);
|
||||
snd_error(CONTROL, "unable to parse source id '%s'!", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (remap_find_id_child(priv, &app)) {
|
||||
SNDERR("duplicate source id '%s'!", id);
|
||||
snd_error(CONTROL, "duplicate source id '%s'!", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = add_to_remap(priv, &child, &app);
|
||||
|
|
@ -1321,7 +1321,7 @@ static int add_chn_to_map(struct snd_ctl_map_ctl *mctl, long idx, long src_idx,
|
|||
long *map;
|
||||
|
||||
if (src_idx >= mctl->src_channels) {
|
||||
SNDERR("Wrong channel mapping (extra source channel?)");
|
||||
snd_error(CONTROL, "Wrong channel mapping (extra source channel?)");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (mctl->channel_map_alloc <= (size_t)idx) {
|
||||
|
|
@ -1350,7 +1350,7 @@ static int add_chn_to_map_array(struct snd_ctl_map_ctl *mctl, const char *dst_id
|
|||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
long idx = -1, chn = -1;
|
||||
if (safe_strtol(dst_id, &idx) || snd_config_get_integer(n, &chn)) {
|
||||
SNDERR("Wrong channel mapping (%ld -> %ld)", idx, chn);
|
||||
snd_error(CONTROL, "Wrong channel mapping (%ld -> %ld)", idx, chn);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = add_chn_to_map(mctl, idx, src_idx, chn);
|
||||
|
|
@ -1383,7 +1383,7 @@ static int parse_map_vindex(struct snd_ctl_map_ctl *mctl, snd_config_t *conf)
|
|||
err = add_chn_to_map_array(mctl, id, n);
|
||||
} else {
|
||||
if (safe_strtol(id, &idx) || snd_config_get_integer(n, &chn)) {
|
||||
SNDERR("Wrong channel mapping (%ld -> %ld)", idx, chn);
|
||||
snd_error(CONTROL, "Wrong channel mapping (%ld -> %ld)", idx, chn);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = add_chn_to_map(mctl, idx, 0, chn);
|
||||
|
|
@ -1430,7 +1430,7 @@ static int parse_map1(snd_ctl_map_t *map, snd_config_t *conf)
|
|||
snd_ctl_elem_id_clear(&cid);
|
||||
err = snd_ctl_ascii_elem_id_parse(&cid, id);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to parse control id '%s'!", id);
|
||||
snd_error(CONTROL, "unable to parse control id '%s'!", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = add_ctl_to_map(map, &mctl, &cid);
|
||||
|
|
@ -1461,7 +1461,7 @@ static int parse_map(snd_ctl_remap_t *priv, snd_config_t *conf)
|
|||
snd_ctl_elem_id_clear(&eid);
|
||||
err = snd_ctl_ascii_elem_id_parse(&eid, id);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to parse id '%s'!", id);
|
||||
snd_error(CONTROL, "unable to parse id '%s'!", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = new_map(priv, &map, &eid);
|
||||
|
|
@ -1508,14 +1508,14 @@ static int parse_sync1(snd_ctl_remap_t *priv, unsigned int count, snd_config_t *
|
|||
snd_config_for_each(i, next, conf) {
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
if (snd_config_get_string(n, &str) < 0) {
|
||||
SNDERR("strings are expected in sync array");
|
||||
snd_error(CONTROL, "strings are expected in sync array");
|
||||
return -EINVAL;
|
||||
}
|
||||
eid = &sync->control_ids[index];
|
||||
snd_ctl_elem_id_clear(eid);
|
||||
err = snd_ctl_ascii_elem_id_parse(eid, str);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to parse control id '%s'!", str);
|
||||
snd_error(CONTROL, "unable to parse control id '%s'!", str);
|
||||
return -EINVAL;
|
||||
}
|
||||
sync->control_items++;
|
||||
|
|
@ -1542,12 +1542,12 @@ static int parse_sync_compound(snd_ctl_remap_t *priv, snd_config_t *conf)
|
|||
continue;
|
||||
if (strcmp(id, "switch") == 0) {
|
||||
if (snd_config_get_string(n, &str) < 0) {
|
||||
SNDERR("String is expected for switch");
|
||||
snd_error(CONTROL, "String is expected for switch");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_ctl_ascii_elem_id_parse(&eid, str);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to parse id '%s'!", str);
|
||||
snd_error(CONTROL, "unable to parse id '%s'!", str);
|
||||
return -EINVAL;
|
||||
}
|
||||
eid_found = true;
|
||||
|
|
@ -1555,7 +1555,7 @@ static int parse_sync_compound(snd_ctl_remap_t *priv, snd_config_t *conf)
|
|||
if (strcmp(id, "controls") == 0) {
|
||||
count = snd_config_is_array(n);
|
||||
if (count <= 0) {
|
||||
SNDERR("Array is expected for sync!");
|
||||
snd_error(CONTROL, "Array is expected for sync!");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = parse_sync1(priv, count, n);
|
||||
|
|
@ -1591,7 +1591,7 @@ static int parse_sync(snd_ctl_remap_t *priv, snd_config_t *conf)
|
|||
} else {
|
||||
count = snd_config_is_array(n);
|
||||
if (count <= 0) {
|
||||
SNDERR("Array is expected for sync!");
|
||||
snd_error(CONTROL, "Array is expected for sync!");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = parse_sync1(priv, count, n);
|
||||
|
|
@ -1817,11 +1817,11 @@ int _snd_ctl_remap_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd
|
|||
child = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CONTROL, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!child) {
|
||||
SNDERR("child is not defined");
|
||||
snd_error(CONTROL, "child is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = _snd_ctl_open_child(&cctl, root, child, mode, conf);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ static int snd_ctl_shm_action(snd_ctl_t *ctl)
|
|||
if (err != 1)
|
||||
return -EBADFD;
|
||||
if (ctrl->cmd) {
|
||||
SNDERR("Server has not done the cmd");
|
||||
snd_error(CONTROL, "Server has not done the cmd");
|
||||
return -EBADFD;
|
||||
}
|
||||
return ctrl->result;
|
||||
|
|
@ -79,7 +79,7 @@ static int snd_ctl_shm_action_fd(snd_ctl_t *ctl, int *fd)
|
|||
if (err != 1)
|
||||
return -EBADFD;
|
||||
if (ctrl->cmd) {
|
||||
SNDERR("Server has not done the cmd");
|
||||
snd_error(CONTROL, "Server has not done the cmd");
|
||||
return -EBADFD;
|
||||
}
|
||||
return ctrl->result;
|
||||
|
|
@ -448,7 +448,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
|
|||
|
||||
result = make_local_socket(sockname);
|
||||
if (result < 0) {
|
||||
SNDERR("server for socket %s is not running", sockname);
|
||||
snd_error(CONTROL, "server for socket %s is not running", sockname);
|
||||
goto _err;
|
||||
}
|
||||
sock = result;
|
||||
|
|
@ -463,23 +463,23 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname
|
|||
req->namelen = snamelen;
|
||||
err = write(sock, req, reqlen);
|
||||
if (err < 0) {
|
||||
SNDERR("write error");
|
||||
snd_error(CONTROL, "write error");
|
||||
result = -errno;
|
||||
goto _err;
|
||||
}
|
||||
if ((size_t) err != reqlen) {
|
||||
SNDERR("write size error");
|
||||
snd_error(CONTROL, "write size error");
|
||||
result = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
err = read(sock, &ans, sizeof(ans));
|
||||
if (err < 0) {
|
||||
SNDERR("read error");
|
||||
snd_error(CONTROL, "read error");
|
||||
result = -errno;
|
||||
goto _err;
|
||||
}
|
||||
if (err != sizeof(ans)) {
|
||||
SNDERR("read size error");
|
||||
snd_error(CONTROL, "read size error");
|
||||
result = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -546,7 +546,7 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c
|
|||
if (strcmp(id, "server") == 0) {
|
||||
err = snd_config_get_string(n, &server);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CONTROL, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -554,29 +554,29 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c
|
|||
if (strcmp(id, "ctl") == 0) {
|
||||
err = snd_config_get_string(n, &ctl_name);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CONTROL, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CONTROL, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!ctl_name) {
|
||||
SNDERR("ctl is not defined");
|
||||
snd_error(CONTROL, "ctl is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!server) {
|
||||
SNDERR("server is not defined");
|
||||
snd_error(CONTROL, "server is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_search_definition(root, "server", server, &sconfig);
|
||||
if (err < 0) {
|
||||
SNDERR("Unknown server %s", server);
|
||||
snd_error(CONTROL, "Unknown server %s", server);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (snd_config_get_type(sconfig) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for server %s definition", server);
|
||||
snd_error(CONTROL, "Invalid type for server %s definition", server);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -592,7 +592,7 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c
|
|||
if (strcmp(id, "socket") == 0) {
|
||||
err = snd_config_get_string(n, &sockname);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CONTROL, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -600,18 +600,18 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *root, snd_c
|
|||
if (strcmp(id, "port") == 0) {
|
||||
err = snd_config_get_integer(n, &port);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(CONTROL, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CONTROL, "Unknown field %s", id);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
if (!sockname) {
|
||||
SNDERR("socket is not defined");
|
||||
snd_error(CONTROL, "socket is not defined");
|
||||
goto _err;
|
||||
}
|
||||
err = snd_ctl_shm_open(handlep, name, sockname, ctl_name, mode);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
|
|||
|
||||
ret = snd_ctl_hw_open(&ctl, NULL, info->card, 0);
|
||||
if (ret < 0) {
|
||||
SYSMSG("Cannot open the associated CTL");
|
||||
snd_checknum(CONTROL, "Cannot open the associated CTL");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
|
|||
if (ret == -ENOENT || cinfo.type != SND_CTL_ELEM_TYPE_BYTES || cinfo.count == 0)
|
||||
return 0;
|
||||
if (ret < 0) {
|
||||
SYSMSG("Cannot read ELD");
|
||||
snd_checknum(CONTROL, "Cannot read ELD");
|
||||
return ret;
|
||||
}
|
||||
/* decode connected HDMI device name */
|
||||
|
|
@ -78,7 +78,7 @@ int __snd_pcm_info_eld_fixup(snd_pcm_info_t * info)
|
|||
/* no monitor name detected */
|
||||
goto __present;
|
||||
if (l > 16 || 20 + l > cinfo.count) {
|
||||
SNDERR("ELD decode failed, using old HDMI output names");
|
||||
snd_error(CONTROL, "ELD decode failed, using old HDMI output names");
|
||||
return 0;
|
||||
}
|
||||
s = alloca(l + 1);
|
||||
|
|
|
|||
|
|
@ -680,7 +680,7 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
|
|||
|
||||
npfds = snd_hctl_poll_descriptors_count(hctl);
|
||||
if (npfds <= 0 || npfds >= 16) {
|
||||
SNDERR("Invalid poll_fds %d", npfds);
|
||||
snd_error(CONTROL, "Invalid poll_fds %d", npfds);
|
||||
return -EIO;
|
||||
}
|
||||
pfd = alloca(sizeof(*pfd) * npfds);
|
||||
|
|
@ -689,7 +689,7 @@ int snd_hctl_wait(snd_hctl_t *hctl, int timeout)
|
|||
if (err < 0)
|
||||
return err;
|
||||
if (err != npfds) {
|
||||
SNDMSG("invalid poll descriptors %d", err);
|
||||
snd_check(CONTROL, "invalid poll descriptors %d", err);
|
||||
return -EIO;
|
||||
}
|
||||
do {
|
||||
|
|
|
|||
|
|
@ -104,7 +104,9 @@ static int hint_list_add_custom(struct hint_list *list,
|
|||
return err;
|
||||
}
|
||||
|
||||
static void zero_handler(const char *file ATTRIBUTE_UNUSED,
|
||||
static void zero_handler(int prio ATTRIBUTE_UNUSED,
|
||||
int interface ATTRIBUTE_UNUSED,
|
||||
const char *file ATTRIBUTE_UNUSED,
|
||||
int line ATTRIBUTE_UNUSED,
|
||||
const char *function ATTRIBUTE_UNUSED,
|
||||
int err ATTRIBUTE_UNUSED,
|
||||
|
|
@ -239,7 +241,7 @@ static int try_config(snd_config_t *config,
|
|||
const char *base,
|
||||
const char *name)
|
||||
{
|
||||
snd_local_error_handler_t eh;
|
||||
snd_lib_log_handler_t eh;
|
||||
snd_config_t *res = NULL, *cfg, *cfg1, *n;
|
||||
snd_config_iterator_t i, next;
|
||||
char *buf, *buf1 = NULL, *buf2;
|
||||
|
|
@ -259,16 +261,16 @@ static int try_config(snd_config_t *config,
|
|||
snd_config_get_string(cfg, &str) >= 0 &&
|
||||
((strncmp(base, str, strlen(base)) == 0 &&
|
||||
str[strlen(base)] == '.') || strchr(str, '.') == NULL))
|
||||
goto __skip_add;
|
||||
goto __skip_add;
|
||||
if (list->card >= 0 && list->device >= 0)
|
||||
sprintf(buf, "%s:CARD=%s,DEV=%i", name, snd_ctl_card_info_get_id(list->info), list->device);
|
||||
else if (list->card >= 0)
|
||||
sprintf(buf, "%s:CARD=%s", name, snd_ctl_card_info_get_id(list->info));
|
||||
else
|
||||
strcpy(buf, name);
|
||||
eh = snd_lib_error_set_local(&zero_handler);
|
||||
eh = snd_lib_log_set_local(&zero_handler);
|
||||
err = snd_config_search_definition(config, base, buf, &res);
|
||||
snd_lib_error_set_local(eh);
|
||||
snd_lib_log_set_local(eh);
|
||||
if (err < 0)
|
||||
goto __skip_add;
|
||||
cleanup_res = 1;
|
||||
|
|
@ -292,13 +294,13 @@ static int try_config(snd_config_t *config,
|
|||
cfg1 = res;
|
||||
level = 0;
|
||||
__hint:
|
||||
level++;
|
||||
level++;
|
||||
if (snd_config_search(cfg1, "type", &cfg) >= 0 &&
|
||||
snd_config_get_string(cfg, &str) >= 0 &&
|
||||
strcmp(str, "hw") == 0) {
|
||||
if (snd_config_search(cfg1, "device", &cfg) >= 0) {
|
||||
if (snd_config_get_integer(cfg, &dev) < 0) {
|
||||
SNDERR("(%s) device must be an integer", buf);
|
||||
snd_error(CONTROL, "(%s) device must be an integer", buf);
|
||||
err = -EINVAL;
|
||||
goto __cleanup;
|
||||
}
|
||||
|
|
@ -307,7 +309,7 @@ static int try_config(snd_config_t *config,
|
|||
|
||||
if (snd_config_search(cfg1, "hint", &cfg) >= 0) {
|
||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("hint (%s) must be a compound", buf);
|
||||
snd_error(CONTROL, "hint (%s) must be a compound", buf);
|
||||
err = -EINVAL;
|
||||
goto __cleanup;
|
||||
}
|
||||
|
|
@ -330,7 +332,7 @@ static int try_config(snd_config_t *config,
|
|||
}
|
||||
if (snd_config_search(cfg, "device", &n) >= 0) {
|
||||
if (snd_config_get_integer(n, &dev) < 0) {
|
||||
SNDERR("(%s) device must be an integer", buf);
|
||||
snd_error(CONTROL, "(%s) device must be an integer", buf);
|
||||
err = -EINVAL;
|
||||
goto __cleanup;
|
||||
}
|
||||
|
|
@ -339,7 +341,7 @@ static int try_config(snd_config_t *config,
|
|||
}
|
||||
if (snd_config_search(cfg, "device_input", &n) >= 0) {
|
||||
if (snd_config_get_integer(n, &list->device_input) < 0) {
|
||||
SNDERR("(%s) device_input must be an integer", buf);
|
||||
snd_error(CONTROL, "(%s) device_input must be an integer", buf);
|
||||
err = -EINVAL;
|
||||
goto __cleanup;
|
||||
}
|
||||
|
|
@ -349,7 +351,7 @@ static int try_config(snd_config_t *config,
|
|||
}
|
||||
if (snd_config_search(cfg, "device_output", &n) >= 0) {
|
||||
if (snd_config_get_integer(n, &list->device_output) < 0) {
|
||||
SNDERR("(%s) device_output must be an integer", buf);
|
||||
snd_error(CONTROL, "(%s) device_output must be an integer", buf);
|
||||
err = -EINVAL;
|
||||
goto __cleanup;
|
||||
}
|
||||
|
|
@ -361,7 +363,7 @@ static int try_config(snd_config_t *config,
|
|||
goto __skip_add;
|
||||
if (snd_config_search(cfg1, "slave", &cfg) >= 0 &&
|
||||
snd_config_search(cfg, base, &cfg1) >= 0)
|
||||
goto __hint;
|
||||
goto __hint;
|
||||
snd_config_delete(res);
|
||||
res = NULL;
|
||||
cleanup_res = 0;
|
||||
|
|
@ -369,9 +371,9 @@ static int try_config(snd_config_t *config,
|
|||
goto __ok;
|
||||
/* find, if all parameters have a default, */
|
||||
/* otherwise filter this definition */
|
||||
eh = snd_lib_error_set_local(&zero_handler);
|
||||
eh = snd_lib_log_set_local(&zero_handler);
|
||||
err = snd_config_search_alias_hooks(config, base, buf, &res);
|
||||
snd_lib_error_set_local(eh);
|
||||
snd_lib_log_set_local(eh);
|
||||
if (err < 0)
|
||||
goto __cleanup;
|
||||
if (snd_config_search(res, "@args", &cfg) >= 0) {
|
||||
|
|
@ -393,38 +395,38 @@ static int try_config(snd_config_t *config,
|
|||
__ok:
|
||||
err = 0;
|
||||
__cleanup:
|
||||
if (err >= 0) {
|
||||
list->device = dev;
|
||||
str = list->card >= 0 ? get_dev_name(list) : NULL;
|
||||
if (str != NULL) {
|
||||
level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str);
|
||||
buf2 = realloc((char *)str, level + 1);
|
||||
if (buf2 != NULL) {
|
||||
if (buf1 != NULL) {
|
||||
str = strchr(buf2, '|');
|
||||
if (str != NULL)
|
||||
if (err >= 0) {
|
||||
list->device = dev;
|
||||
str = list->card >= 0 ? get_dev_name(list) : NULL;
|
||||
if (str != NULL) {
|
||||
level = (buf1 == NULL ? 0 : strlen(buf1)) + 1 + strlen(str);
|
||||
buf2 = realloc((char *)str, level + 1);
|
||||
if (buf2 != NULL) {
|
||||
if (buf1 != NULL) {
|
||||
str = strchr(buf2, '|');
|
||||
if (str != NULL)
|
||||
memmove(buf2 + (level - strlen(str)), str, strlen(str));
|
||||
else
|
||||
str = buf2 + strlen(buf2);
|
||||
*(char *)str++ = '\n';
|
||||
memcpy((char *)str, buf1, strlen(buf1));
|
||||
buf2[level] = '\0';
|
||||
*(char *)str++ = '\n';
|
||||
memcpy((char *)str, buf1, strlen(buf1));
|
||||
buf2[level] = '\0';
|
||||
free(buf1);
|
||||
}
|
||||
buf1 = buf2;
|
||||
} else {
|
||||
free((char *)str);
|
||||
}
|
||||
} else if (list->device >= 0)
|
||||
goto __skip_add;
|
||||
err = hint_list_add(list, buf, buf1);
|
||||
} else if (list->device >= 0)
|
||||
goto __skip_add;
|
||||
err = hint_list_add(list, buf, buf1);
|
||||
}
|
||||
__skip_add:
|
||||
if (res && cleanup_res)
|
||||
snd_config_delete(res);
|
||||
snd_config_delete(res);
|
||||
if (buf1)
|
||||
free(buf1);
|
||||
free(buf);
|
||||
free(buf);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -508,7 +510,7 @@ static int add_card(snd_config_t *config, snd_config_t *rw_config, struct hint_l
|
|||
}
|
||||
err = 0;
|
||||
__error:
|
||||
snd_ctl_close(list->ctl);
|
||||
snd_ctl_close(list->ctl);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -663,9 +665,9 @@ int snd_device_name_hint(int card, const char *iface, void ***hints)
|
|||
if (!err && !list.list)
|
||||
err = hint_list_add(&list, NULL, NULL);
|
||||
if (err < 0)
|
||||
snd_device_name_free_hint((void **)list.list);
|
||||
snd_device_name_free_hint((void **)list.list);
|
||||
else
|
||||
*hints = (void **)list.list;
|
||||
*hints = (void **)list.list;
|
||||
free(list.cardname);
|
||||
if (local_config_rw)
|
||||
snd_config_delete(local_config_rw);
|
||||
|
|
|
|||
|
|
@ -93,13 +93,13 @@ int snd_sctl_install(snd_sctl_t *h)
|
|||
if (elem->lock) {
|
||||
err = snd_ctl_elem_lock(h->ctl, elem->id);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot lock ctl elem");
|
||||
snd_error(CONTROL, "Cannot lock ctl elem");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
err = snd_ctl_elem_read(h->ctl, elem->old);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot read ctl elem");
|
||||
snd_error(CONTROL, "Cannot read ctl elem");
|
||||
return err;
|
||||
}
|
||||
count = snd_ctl_elem_info_get_count(elem->info);
|
||||
|
|
@ -166,7 +166,7 @@ int snd_sctl_install(snd_sctl_t *h)
|
|||
}
|
||||
err = snd_ctl_elem_write(h->ctl, elem->val);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot write ctl elem");
|
||||
snd_error(CONTROL, "Cannot write ctl elem");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ int snd_sctl_remove(snd_sctl_t *h)
|
|||
if (elem->lock) {
|
||||
err = snd_ctl_elem_unlock(h->ctl, elem->id);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot unlock ctl elem");
|
||||
snd_error(CONTROL, "Cannot unlock ctl elem");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -205,7 +205,7 @@ int snd_sctl_remove(snd_sctl_t *h)
|
|||
if (elem->preserve && snd_ctl_elem_value_compare(elem->val, elem->old)) {
|
||||
err = snd_ctl_elem_write(h->ctl, elem->old);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot restore ctl elem");
|
||||
snd_error(CONTROL, "Cannot restore ctl elem");
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ static int snd_config_get_ctl_elem_enumerated(snd_config_t *n, snd_ctl_t *ctl,
|
|||
snd_ctl_elem_info_set_item(info, idx);
|
||||
err = snd_ctl_elem_info(ctl, info);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot obtain info for CTL elem");
|
||||
snd_error(CONTROL, "Cannot obtain info for CTL elem");
|
||||
return err;
|
||||
}
|
||||
if (strcmp(str, snd_ctl_elem_info_get_item_name(info)) == 0)
|
||||
|
|
@ -293,7 +293,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
|
|||
case SND_CTL_ELEM_TYPE_IEC958:
|
||||
break;
|
||||
default:
|
||||
SNDERR("Unknown control type: %d", type);
|
||||
snd_error(CONTROL, "Unknown control type: %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
|
@ -311,7 +311,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
|
|||
unsigned int idx = 0;
|
||||
if (len % 2 != 0 || len > count * 2) {
|
||||
_bad_content:
|
||||
SNDERR("bad value content");
|
||||
snd_error(CONTROL, "bad value content");
|
||||
return -EINVAL;
|
||||
}
|
||||
while (*buf) {
|
||||
|
|
@ -340,7 +340,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
|
|||
break;
|
||||
}
|
||||
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("bad value type");
|
||||
snd_error(CONTROL, "bad value type");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ static int snd_config_get_ctl_elem_value(snd_config_t *conf,
|
|||
continue;
|
||||
err = safe_strtol(id, &idx);
|
||||
if (err < 0 || idx < 0 || (unsigned int) idx >= count) {
|
||||
SNDERR("bad value index");
|
||||
snd_error(CONTROL, "bad value index");
|
||||
return -EINVAL;
|
||||
}
|
||||
switch (type) {
|
||||
|
|
@ -424,11 +424,11 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
|
|||
if (strcmp(id, "iface") == 0 || strcmp(id, "interface") == 0) {
|
||||
const char *ptr;
|
||||
if ((err = snd_config_get_string(n, &ptr)) < 0) {
|
||||
SNDERR("field %s is not a string", id);
|
||||
snd_error(CONTROL, "field %s is not a string", id);
|
||||
goto _err;
|
||||
}
|
||||
if ((err = snd_config_get_ctl_iface_ascii(ptr)) < 0) {
|
||||
SNDERR("Invalid value for '%s'", id);
|
||||
snd_error(CONTROL, "Invalid value for '%s'", id);
|
||||
goto _err;
|
||||
}
|
||||
iface = err;
|
||||
|
|
@ -436,28 +436,28 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
|
|||
}
|
||||
if (strcmp(id, "name") == 0) {
|
||||
if ((err = snd_config_get_string(n, &name)) < 0) {
|
||||
SNDERR("field %s is not a string", id);
|
||||
snd_error(CONTROL, "field %s is not a string", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "index") == 0) {
|
||||
if ((err = snd_config_get_integer(n, &index)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(CONTROL, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "device") == 0) {
|
||||
if ((err = snd_config_get_integer(n, &device)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(CONTROL, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "subdevice") == 0) {
|
||||
if ((err = snd_config_get_integer(n, &subdevice)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(CONTROL, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -498,16 +498,16 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
|
|||
skip_rest = err;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(CONTROL, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (name == NULL) {
|
||||
SNDERR("Missing control name");
|
||||
snd_error(CONTROL, "Missing control name");
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
if (value == NULL) {
|
||||
SNDERR("Missing control value");
|
||||
snd_error(CONTROL, "Missing control value");
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -544,7 +544,7 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
|
|||
err = snd_ctl_elem_info(h->ctl, elem->info);
|
||||
if (err < 0) {
|
||||
if (! optional)
|
||||
SNDERR("Cannot obtain info for CTL elem (%s,'%s',%li,%li,%li): %s", snd_ctl_elem_iface_name(iface), name, index, device, subdevice, snd_strerror(err));
|
||||
snd_error(CONTROL, "Cannot obtain info for CTL elem (%s,'%s',%li,%li,%li): %s", snd_ctl_elem_iface_name(iface), name, index, device, subdevice, snd_strerror(err));
|
||||
goto _err;
|
||||
} else {
|
||||
if (skip_rest)
|
||||
|
|
@ -571,7 +571,7 @@ static int add_elem(snd_sctl_t *h, snd_config_t *_conf, snd_config_t *private_da
|
|||
list_add_tail(&elem->list, &h->elems);
|
||||
|
||||
_err:
|
||||
if (err < 0 && elem) {
|
||||
if (err < 0 && elem) {
|
||||
if (elem->id)
|
||||
snd_ctl_elem_id_free(elem->id);
|
||||
if (elem->info)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
|
|||
/* Validate that it is possible to read the type and size
|
||||
* without reading past the end of the buffer. */
|
||||
if (tlv_size < MIN_TLV_STREAM_LEN) {
|
||||
SNDERR("TLV stream too short");
|
||||
snd_error(CONTROL, "TLV stream too short");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
|
|||
size = tlv[SNDRV_CTL_TLVO_LEN];
|
||||
tlv_size -= 2 * sizeof(int);
|
||||
if (size > tlv_size) {
|
||||
SNDERR("TLV size error");
|
||||
snd_error(CONTROL, "TLV size error");
|
||||
return -EINVAL;
|
||||
}
|
||||
switch (type) {
|
||||
|
|
@ -110,11 +110,11 @@ int snd_tlv_parse_dB_info(unsigned int *tlv,
|
|||
else
|
||||
minsize = 2 * sizeof(int);
|
||||
if (size < minsize) {
|
||||
SNDERR("Invalid dB_scale TLV size");
|
||||
snd_error(CONTROL, "Invalid dB_scale TLV size");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (size > MAX_TLV_RANGE_SIZE) {
|
||||
SNDERR("Too big dB_scale TLV size: %d", size);
|
||||
snd_error(CONTROL, "Too big dB_scale TLV size: %d", size);
|
||||
return -EINVAL;
|
||||
}
|
||||
*db_tlvp = tlv;
|
||||
|
|
@ -246,16 +246,17 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
|
|||
int mindb, maxdb;
|
||||
mindb = tlv[SNDRV_CTL_TLVO_DB_MINMAX_MIN];
|
||||
maxdb = tlv[SNDRV_CTL_TLVO_DB_MINMAX_MAX];
|
||||
if (volume <= rangemin || rangemax <= rangemin) {
|
||||
if (type == SND_CTL_TLVT_DB_MINMAX_MUTE)
|
||||
*db_gain = SND_CTL_TLV_DB_GAIN_MUTE;
|
||||
else
|
||||
*db_gain = mindb;
|
||||
} else if (volume >= rangemax)
|
||||
*db_gain = maxdb;
|
||||
if (rangemax <= rangemin)
|
||||
*db_gain = mindb;
|
||||
else
|
||||
*db_gain = (maxdb - mindb) * (volume - rangemin) /
|
||||
(rangemax - rangemin) + mindb;
|
||||
if (*db_gain < mindb)
|
||||
*db_gain = mindb;
|
||||
if (*db_gain > maxdb)
|
||||
*db_gain = maxdb;
|
||||
if (type == SND_CTL_TLVT_DB_MINMAX_MUTE && *db_gain == mindb)
|
||||
*db_gain = SND_CTL_TLV_DB_GAIN_MUTE;
|
||||
return 0;
|
||||
}
|
||||
#ifndef HAVE_SOFT_FLOAT
|
||||
|
|
|
|||
19
src/dlmisc.c
19
src/dlmisc.c
|
|
@ -223,7 +223,7 @@ static int snd_dlsym_verify(void *handle, const char *name, const char *version)
|
|||
res = dlsym(handle, vname) == NULL ? -ENOENT : 0;
|
||||
// printf("dlsym verify: %i, vname = '%s'\n", res, vname);
|
||||
if (res < 0)
|
||||
SNDERR("unable to verify version for symbol %s", name);
|
||||
snd_error(CORE, "unable to verify version for symbol %s", name);
|
||||
return res;
|
||||
#else
|
||||
return 0;
|
||||
|
|
@ -332,21 +332,24 @@ snd_dlobj_cache_get0(const char *lib, const char *name,
|
|||
|
||||
errbuf[0] = '\0';
|
||||
dlobj = INTERNAL(snd_dlopen)(lib, RTLD_NOW,
|
||||
verbose ? errbuf : 0,
|
||||
verbose ? sizeof(errbuf) : 0);
|
||||
verbose ? errbuf : 0,
|
||||
verbose ? sizeof(errbuf) : 0);
|
||||
if (dlobj == NULL) {
|
||||
if (verbose)
|
||||
SNDERR("Cannot open shared library %s (%s)",
|
||||
lib ? lib : "[builtin]",
|
||||
errbuf);
|
||||
snd_error(CORE, "Cannot open shared library %s (%s)",
|
||||
lib ? lib : "[builtin]",
|
||||
|
||||
errbuf);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
func = snd_dlsym(dlobj, name, version);
|
||||
if (func == NULL) {
|
||||
if (verbose)
|
||||
SNDERR("symbol %s is not defined inside %s",
|
||||
name, lib ? lib : "[builtin]");
|
||||
snd_error(CORE, "symbol %s is not defined inside %s",
|
||||
name, lib ? lib : "[builtin]");
|
||||
|
||||
goto __err;
|
||||
}
|
||||
c = malloc(sizeof(*c));
|
||||
|
|
|
|||
413
src/error.c
413
src/error.c
|
|
@ -68,47 +68,319 @@ const char *snd_strerror(int errnum)
|
|||
#endif
|
||||
#endif
|
||||
|
||||
static TLS_PFX snd_lib_log_handler_t local_log = NULL;
|
||||
static TLS_PFX snd_local_error_handler_t local_error = NULL;
|
||||
|
||||
/**
|
||||
* \brief Install local error handler
|
||||
* \param func The local error handler function
|
||||
* \retval Previous local error handler function
|
||||
* \brief Install local log handler
|
||||
* \param func The local log handler function
|
||||
* \retval Previous local log handler function
|
||||
*/
|
||||
snd_local_error_handler_t snd_lib_error_set_local(snd_local_error_handler_t func)
|
||||
snd_lib_log_handler_t snd_lib_log_set_local(snd_lib_log_handler_t func)
|
||||
{
|
||||
snd_local_error_handler_t old = local_error;
|
||||
local_error = func;
|
||||
snd_lib_log_handler_t old = local_log;
|
||||
local_log = func;
|
||||
return old;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief The default error handler function.
|
||||
* Array of log priority level names.
|
||||
*/
|
||||
static const char *snd_log_prio_names[SND_LOG_LAST + 1] = {
|
||||
[0] = NULL,
|
||||
[SND_LOG_ERROR] = "error",
|
||||
[SND_LOG_WARN] = "warning",
|
||||
[SND_LOG_INFO] = "info",
|
||||
[SND_LOG_DEBUG] = "debug",
|
||||
[SND_LOG_TRACE] = "trace",
|
||||
};
|
||||
|
||||
/**
|
||||
* Array of interface names.
|
||||
*/
|
||||
static const char *snd_ilog_interface_names[SND_ILOG_LAST + 1] = {
|
||||
[0] = NULL,
|
||||
[SND_ILOG_CORE] = "core",
|
||||
[SND_ILOG_CONFIG] = "config",
|
||||
[SND_ILOG_CONTROL] = "control",
|
||||
[SND_ILOG_HWDEP] = "hwdep",
|
||||
[SND_ILOG_TIMER] = "timer",
|
||||
[SND_ILOG_RAWMIDI] = "rawmidi",
|
||||
[SND_ILOG_PCM] = "pcm",
|
||||
[SND_ILOG_MIXER] = "mixer",
|
||||
[SND_ILOG_SEQUENCER] = "sequencer",
|
||||
[SND_ILOG_UCM] = "ucm",
|
||||
[SND_ILOG_TOPOLOGY] = "topology",
|
||||
[SND_ILOG_ASERVER] = "aserver",
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Function to convert log priority level to text.
|
||||
* \param prio Priority value (SND_LOG_*).
|
||||
* \return The textual representation of the priority level, or NULL if invalid.
|
||||
*/
|
||||
const char *snd_lib_log_priority(int prio)
|
||||
{
|
||||
if (prio >= 0 && prio <= SND_LOG_TRACE)
|
||||
return snd_log_prio_names[prio];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Function to convert interface code to text.
|
||||
* \param interface Interface (SND_ILOG_*).
|
||||
* \return The textual representation of the interface code, or NULL if invalid.
|
||||
*/
|
||||
const char *snd_lib_log_interface(int interface)
|
||||
{
|
||||
if (interface >= 0 && interface <= SND_ILOG_TOPOLOGY)
|
||||
return snd_ilog_interface_names[interface];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Structure to hold parsed debug configuration.
|
||||
*/
|
||||
static struct {
|
||||
const char *configstr;
|
||||
int global_level;
|
||||
int interface_levels[SND_ILOG_LAST + 1];
|
||||
int parsed;
|
||||
} debug_config;
|
||||
|
||||
/**
|
||||
* \brief Parse the LIBASOUND_DEBUG environment variable.
|
||||
*
|
||||
* Format: [<level>][,<interface1>:<level1>][,<interface2>:<level2>,...]
|
||||
*
|
||||
* Examples:
|
||||
* "debug" - Set global level to debug
|
||||
* "3" - Set global level to 3 (info)
|
||||
* "info,pcm:debug" - Set global to info, pcm to debug
|
||||
* "error,mixer:5,pcm:4" - Set global to error, mixer to 5 (trace), pcm to 4 (debug)
|
||||
*/
|
||||
static void parse_libasound_debug(const char *configstr)
|
||||
{
|
||||
const char *env;
|
||||
char *str, *token, *saveptr;
|
||||
int i;
|
||||
|
||||
if (debug_config.parsed && debug_config.configstr == configstr)
|
||||
return;
|
||||
|
||||
debug_config.parsed = 1;
|
||||
debug_config.global_level = 0;
|
||||
debug_config.configstr = configstr;
|
||||
for (i = 0; i <= SND_ILOG_LAST; i++)
|
||||
debug_config.interface_levels[i] = 0;
|
||||
|
||||
if (configstr == NULL) {
|
||||
env = getenv("LIBASOUND_DEBUG");
|
||||
if (!env || !*env)
|
||||
return;
|
||||
} else {
|
||||
env = configstr;
|
||||
}
|
||||
|
||||
str = strdup(env);
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
token = strtok_r(str, ",", &saveptr);
|
||||
while (token) {
|
||||
char *colon = strchr(token, ':');
|
||||
if (colon) {
|
||||
/* interface:level format */
|
||||
*colon = '\0';
|
||||
const char *interface_name = token;
|
||||
const char *level_str = colon + 1;
|
||||
int interface_num = -1;
|
||||
int level = -1;
|
||||
|
||||
/* Try to find interface by name */
|
||||
for (i = 1; i <= SND_ILOG_LAST; i++) {
|
||||
if (snd_ilog_interface_names[i] &&
|
||||
strcmp(snd_ilog_interface_names[i], interface_name) == 0) {
|
||||
interface_num = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If not found by name, try direct number */
|
||||
if (interface_num < 0) {
|
||||
char *endptr;
|
||||
long val = strtol(interface_name, &endptr, 10);
|
||||
if (*endptr == '\0' && val >= 0 && val <= SND_ILOG_LAST)
|
||||
interface_num = val;
|
||||
}
|
||||
|
||||
/* Parse level */
|
||||
for (i = 1; i <= SND_LOG_LAST; i++) {
|
||||
if (snd_log_prio_names[i] &&
|
||||
strcmp(snd_log_prio_names[i], level_str) == 0) {
|
||||
level = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If not found by name, try direct number */
|
||||
if (level < 0) {
|
||||
char *endptr;
|
||||
long val = strtol(level_str, &endptr, 10);
|
||||
if (*endptr == '\0' && val >= 0 && val <= SND_LOG_LAST)
|
||||
level = val;
|
||||
}
|
||||
|
||||
/* Store the interface-specific level */
|
||||
if (interface_num > 0 && level > 0)
|
||||
debug_config.interface_levels[interface_num] = level;
|
||||
} else {
|
||||
/* Global level only */
|
||||
int level = -1;
|
||||
|
||||
/* Try to find level by name */
|
||||
for (i = 1; i <= SND_LOG_LAST; i++) {
|
||||
if (snd_log_prio_names[i] &&
|
||||
strcmp(snd_log_prio_names[i], token) == 0) {
|
||||
level = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If not found by name, try direct number */
|
||||
if (level < 0) {
|
||||
char *endptr;
|
||||
long val = strtol(token, &endptr, 10);
|
||||
if (*endptr == '\0' && val >= 0 && val <= SND_LOG_LAST)
|
||||
level = val;
|
||||
}
|
||||
|
||||
if (level > 0)
|
||||
debug_config.global_level = level;
|
||||
}
|
||||
|
||||
token = strtok_r(NULL, ",", &saveptr);
|
||||
}
|
||||
|
||||
free(str);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check if a log message should be shown based on LIBASOUND_DEBUG.
|
||||
* \param prio Priority value (SND_LOG_*).
|
||||
* \param interface Interface (SND_ILOG_*).
|
||||
* \param configstr Configuration string (usually LIBASOUND_DEBUG environment variable)
|
||||
* \return 1 if the message should be shown, 0 otherwise.
|
||||
*/
|
||||
int snd_lib_log_filter(int prio, int interface, const char *configstr)
|
||||
{
|
||||
unsigned int level;
|
||||
|
||||
parse_libasound_debug(configstr);
|
||||
|
||||
if (interface > 0 && interface <= SND_ILOG_LAST && debug_config.interface_levels[interface] > 0) {
|
||||
level = debug_config.interface_levels[interface];
|
||||
} else {
|
||||
level = debug_config.global_level; }
|
||||
|
||||
if (level == 0)
|
||||
level = SND_LOG_ERROR;
|
||||
|
||||
/* Show message if its priority is less than or equal to the configured level */
|
||||
return prio <= (int)level;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief The default log handler function.
|
||||
* \param prio Priority value (SND_LOG_*).
|
||||
* \param interface Interface (SND_ILOG_*).
|
||||
* \param file The filename where the error was hit.
|
||||
* \param line The line number.
|
||||
* \param function The function name.
|
||||
* \param err The error code.
|
||||
* \param errcode The error code.
|
||||
* \param fmt The message (including the format characters).
|
||||
* \param ... Optional arguments.
|
||||
*
|
||||
* If a local error function has been installed for the current thread by
|
||||
* \ref snd_lib_error_set_local, it is called. Otherwise, prints the error
|
||||
* \ref snd_lib_log_set_local, it is called. Otherwise, prints the error
|
||||
* message including location to \c stderr.
|
||||
*/
|
||||
static void snd_lib_error_default(const char *file, int line, const char *function, int err, const char *fmt, ...)
|
||||
static void snd_lib_vlog_default(int prio, int interface, const char *file, int line, const char *function, int errcode, const char *fmt, va_list arg)
|
||||
{
|
||||
const char *text1, *text2;
|
||||
|
||||
if (local_log) {
|
||||
local_log(prio, interface, file, line, function, errcode, fmt, arg);
|
||||
return;
|
||||
}
|
||||
if (local_error && prio == SND_LOG_ERROR) {
|
||||
local_error(file, line, function, errcode, fmt, arg);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!snd_lib_log_filter(prio, interface, NULL))
|
||||
return;
|
||||
|
||||
fprintf(stderr, "ALSA lib %s:%i:(%s) ", file, line, function);
|
||||
|
||||
text1 = snd_lib_log_priority(prio);
|
||||
text2 = snd_lib_log_interface(interface);
|
||||
if (text1 || text2)
|
||||
fprintf(stderr, "[%s.%s] ", text1 ? text1 : "", text2 ? text2 : "");
|
||||
|
||||
vfprintf(stderr, fmt, arg);
|
||||
if (errcode)
|
||||
fprintf(stderr, ": %s", snd_strerror(errcode));
|
||||
putc('\n', stderr);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Root log handler function.
|
||||
* \param prio Priority value (SND_LOG_*).
|
||||
* \param interface Interface (SND_ILOG_*).
|
||||
* \param file The filename where the error was hit.
|
||||
* \param line The line number.
|
||||
* \param function The function name.
|
||||
* \param errcode The error code.
|
||||
* \param fmt The message (including the format characters).
|
||||
* \param ... Optional arguments.
|
||||
*/
|
||||
void snd_lib_log(int prio, int interface, const char *file, int line, const char *function, int errcode, const char *fmt, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, fmt);
|
||||
if (local_error) {
|
||||
local_error(file, line, function, err, fmt, arg);
|
||||
va_end(arg);
|
||||
return;
|
||||
}
|
||||
fprintf(stderr, "ALSA lib %s:%i:(%s) ", file, line, function);
|
||||
vfprintf(stderr, fmt, arg);
|
||||
if (err)
|
||||
fprintf(stderr, ": %s", snd_strerror(err));
|
||||
putc('\n', stderr);
|
||||
snd_lib_vlog(prio, interface, file, line, function, errcode, fmt, arg);
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief The check point function.
|
||||
* \param interface Interface (SND_ILOG_*).
|
||||
* \param file The filename where the error was hit.
|
||||
* \param line The line number.
|
||||
* \param function The function name.
|
||||
* \param errcode The error code.
|
||||
* \param fmt The message (including the format characters).
|
||||
* \param ... Optional arguments.
|
||||
*
|
||||
* The error message is passed with error priority level to snd_lib_vlog handler.
|
||||
*/
|
||||
void snd_lib_check(int interface, const char *file, int line, const char *function, int errcode, const char *fmt, ...)
|
||||
{
|
||||
const char *verbose;
|
||||
|
||||
va_list arg;
|
||||
va_start(arg, fmt);
|
||||
verbose = getenv("LIBASOUND_DEBUG");
|
||||
if (! verbose || ! *verbose)
|
||||
goto finish;
|
||||
snd_lib_vlog(SND_LOG_ERROR, interface, file, line, function, errcode, fmt, arg);
|
||||
#ifdef ALSA_DEBUG_ASSERT
|
||||
verbose = getenv("LIBASOUND_DEBUG_ASSERT");
|
||||
if (verbose && *verbose)
|
||||
assert(0);
|
||||
#endif
|
||||
finish:
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
|
|
@ -117,11 +389,75 @@ static void snd_lib_error_default(const char *file, int line, const char *functi
|
|||
* Pointer to the error handler function.
|
||||
* For internal use only.
|
||||
*/
|
||||
snd_lib_log_handler_t snd_lib_vlog = snd_lib_vlog_default;
|
||||
|
||||
/**
|
||||
* \brief Sets the log handler.
|
||||
* \param handler The pointer to the new log handler function.
|
||||
* \retval Previous log handler function
|
||||
*
|
||||
* This function sets a new log handler, or (if \c handler is \c NULL)
|
||||
* the default one which prints the error messages to \c stderr.
|
||||
*/
|
||||
snd_lib_log_handler_t snd_lib_log_set_handler(snd_lib_log_handler_t handler)
|
||||
{
|
||||
snd_lib_log_handler_t old = snd_lib_vlog;
|
||||
snd_lib_vlog = handler == NULL ? snd_lib_vlog_default : handler;
|
||||
return old;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Install local error handler
|
||||
* \param func The local error handler function
|
||||
* \retval Previous local error handler function
|
||||
* \deprecated Since 1.2.15
|
||||
*/
|
||||
snd_local_error_handler_t snd_lib_error_set_local(snd_local_error_handler_t func)
|
||||
{
|
||||
snd_local_error_handler_t old = local_error;
|
||||
local_error = func;
|
||||
return old;
|
||||
}
|
||||
#ifndef DOC_HIDDEN
|
||||
link_warning(snd_lib_error_set_local, "Warning: snd_lib_error_set_local is deprecated, use snd_lib_log_set_local");
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief The default error handler function.
|
||||
* \param file The filename where the error was hit.
|
||||
* \param line The line number.
|
||||
* \param function The function name.
|
||||
* \param errcode The error code.
|
||||
* \param fmt The message (including the format characters).
|
||||
* \param ... Optional arguments.
|
||||
* \deprecated Since 1.2.15
|
||||
*
|
||||
* Use snd_lib_vlog handler to print error message for anonymous interface.
|
||||
*/
|
||||
static void snd_lib_error_default(const char *file, int line, const char *function, int errcode, const char *fmt, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, fmt);
|
||||
snd_lib_vlog(SND_LOG_ERROR, 0, file, line, function, errcode, fmt, arg);
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup Error
|
||||
* \deprecated Since 1.2.15
|
||||
* Pointer to the error handler function.
|
||||
* For internal use only.
|
||||
*/
|
||||
snd_lib_error_handler_t snd_lib_error = snd_lib_error_default;
|
||||
#ifndef DOC_HIDDEN
|
||||
link_warning(snd_lib_error, "Warning: snd_lib_error is deprecated, use snd_log interface");
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Sets the error handler.
|
||||
* \param handler The pointer to the new error handler function.
|
||||
* \deprecated Since 1.2.15
|
||||
*
|
||||
* This function sets a new error handler, or (if \c handler is \c NULL)
|
||||
* the default one which prints the error messages to \c stderr.
|
||||
|
|
@ -129,10 +465,6 @@ snd_lib_error_handler_t snd_lib_error = snd_lib_error_default;
|
|||
int snd_lib_error_set_handler(snd_lib_error_handler_t handler)
|
||||
{
|
||||
snd_lib_error = handler == NULL ? snd_lib_error_default : handler;
|
||||
#ifndef NDEBUG
|
||||
if (snd_lib_error != snd_lib_error_default)
|
||||
snd_err_msg = snd_lib_error;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -145,39 +477,6 @@ const char *snd_asoundlib_version(void)
|
|||
return SND_LIB_VERSION_STR;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
/*
|
||||
* internal error handling
|
||||
*/
|
||||
static void snd_err_msg_default(const char *file, int line, const char *function, int err, const char *fmt, ...)
|
||||
{
|
||||
va_list arg;
|
||||
const char *verbose;
|
||||
|
||||
verbose = getenv("LIBASOUND_DEBUG");
|
||||
if (! verbose || ! *verbose)
|
||||
return;
|
||||
va_start(arg, fmt);
|
||||
fprintf(stderr, "ALSA lib %s:%i:(%s) ", file, line, function);
|
||||
vfprintf(stderr, fmt, arg);
|
||||
if (err)
|
||||
fprintf(stderr, ": %s", snd_strerror(err));
|
||||
putc('\n', stderr);
|
||||
va_end(arg);
|
||||
#ifdef ALSA_DEBUG_ASSERT
|
||||
verbose = getenv("LIBASOUND_DEBUG_ASSERT");
|
||||
if (verbose && *verbose)
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* The ALSA error message handler
|
||||
*/
|
||||
snd_lib_error_handler_t snd_err_msg = snd_err_msg_default;
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Copy a C-string into a sized buffer
|
||||
* \param dst Where to copy the string to
|
||||
|
|
|
|||
|
|
@ -54,30 +54,30 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
|
|||
void *h = NULL;
|
||||
if (snd_config_get_type(hwdep_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
if (name)
|
||||
SNDERR("Invalid type for HWDEP %s definition", name);
|
||||
snd_error(HWDEP, "Invalid type for HWDEP %s definition", name);
|
||||
else
|
||||
SNDERR("Invalid type for HWDEP definition");
|
||||
snd_error(HWDEP, "Invalid type for HWDEP definition");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_search(hwdep_conf, "type", &conf);
|
||||
if (err < 0) {
|
||||
SNDERR("type is not defined");
|
||||
snd_error(HWDEP, "type is not defined");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_id(conf, &id);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to get id");
|
||||
snd_error(HWDEP, "unable to get id");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_string(conf, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(HWDEP, "Invalid type for %s", id);
|
||||
return err;
|
||||
}
|
||||
err = snd_config_search_definition(hwdep_root, "hwdep_type", str, &type_conf);
|
||||
if (err >= 0) {
|
||||
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for HWDEP type %s definition", str);
|
||||
snd_error(HWDEP, "Invalid type for HWDEP type %s definition", str);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
|
|||
if (strcmp(id, "lib") == 0) {
|
||||
err = snd_config_get_string(n, &lib);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(HWDEP, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -99,12 +99,12 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
|
|||
if (strcmp(id, "open") == 0) {
|
||||
err = snd_config_get_string(n, &open_name);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(HWDEP, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(HWDEP, "Unknown field %s", id);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -121,10 +121,10 @@ static int snd_hwdep_open_conf(snd_hwdep_t **hwdep,
|
|||
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_HWDEP_DLSYM_VERSION));
|
||||
err = 0;
|
||||
if (!h) {
|
||||
SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
|
||||
snd_error(HWDEP, "Cannot open shared library %s (%s)", lib, errbuf);
|
||||
err = -ENOENT;
|
||||
} else if (!open_func) {
|
||||
SNDERR("symbol %s is not defined inside %s", open_name, lib);
|
||||
snd_error(HWDEP, "symbol %s is not defined inside %s", open_name, lib);
|
||||
snd_dlclose(h);
|
||||
err = -ENXIO;
|
||||
}
|
||||
|
|
@ -148,7 +148,7 @@ static int snd_hwdep_open_noupdate(snd_hwdep_t **hwdep, snd_config_t *root, cons
|
|||
snd_config_t *hwdep_conf;
|
||||
err = snd_config_search_definition(root, "hwdep", name, &hwdep_conf);
|
||||
if (err < 0) {
|
||||
SNDERR("Unknown HwDep %s", name);
|
||||
snd_error(HWDEP, "Unknown HwDep %s", name);
|
||||
return err;
|
||||
}
|
||||
err = snd_hwdep_open_conf(hwdep, name, root, hwdep_conf, mode);
|
||||
|
|
@ -209,7 +209,7 @@ int snd_hwdep_open_lconf(snd_hwdep_t **hwdep, const char *name,
|
|||
int snd_hwdep_close(snd_hwdep_t *hwdep)
|
||||
{
|
||||
int err;
|
||||
assert(hwdep);
|
||||
assert(hwdep);
|
||||
err = hwdep->ops->close(hwdep);
|
||||
if (hwdep->dl_handle)
|
||||
snd_dlclose(hwdep->dl_handle);
|
||||
|
|
@ -296,12 +296,12 @@ int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned
|
|||
*/
|
||||
int snd_hwdep_poll_descriptors_revents(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
|
||||
{
|
||||
assert(hwdep && pfds && revents);
|
||||
if (nfds == 1) {
|
||||
*revents = pfds->revents;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
assert(hwdep && pfds && revents);
|
||||
if (nfds == 1) {
|
||||
*revents = pfds->revents;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ int _snd_hwdep_hw_open(snd_hwdep_t **hwdep, char *name,
|
|||
return err;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unexpected field %s", id);
|
||||
snd_error(HWDEP, "Unexpected field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (card < 0)
|
||||
|
|
|
|||
|
|
@ -752,7 +752,7 @@ int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds,
|
|||
{
|
||||
unsigned int idx;
|
||||
unsigned short res;
|
||||
assert(mixer && pfds && revents);
|
||||
assert(mixer && pfds && revents);
|
||||
if (nfds == 0)
|
||||
return -EINVAL;
|
||||
res = 0;
|
||||
|
|
|
|||
|
|
@ -82,20 +82,20 @@ static int try_open(snd_mixer_class_t *class, const char *lib)
|
|||
strcat(xlib, lib);
|
||||
h = INTERNAL(snd_dlopen)(xlib, RTLD_NOW, errbuf, sizeof(errbuf));
|
||||
if (h == NULL) {
|
||||
SNDERR("Unable to open library '%s' (%s)", xlib, errbuf);
|
||||
snd_error(MIXER, "Unable to open library '%s' (%s)", xlib, errbuf);
|
||||
free(xlib);
|
||||
return -ENXIO;
|
||||
}
|
||||
priv->dlhandle = h;
|
||||
event_func = snd_dlsym(h, "alsa_mixer_simple_event", NULL);
|
||||
if (event_func == NULL) {
|
||||
SNDERR("Symbol 'alsa_mixer_simple_event' was not found in '%s'", xlib);
|
||||
snd_error(MIXER, "Symbol 'alsa_mixer_simple_event' was not found in '%s'", xlib);
|
||||
err = -ENXIO;
|
||||
}
|
||||
if (err == 0) {
|
||||
init_func = snd_dlsym(h, "alsa_mixer_simple_init", NULL);
|
||||
if (init_func == NULL) {
|
||||
SNDERR("Symbol 'alsa_mixer_simple_init' was not found in '%s'", xlib);
|
||||
snd_error(MIXER, "Symbol 'alsa_mixer_simple_init' was not found in '%s'", xlib);
|
||||
err = -ENXIO;
|
||||
}
|
||||
}
|
||||
|
|
@ -129,20 +129,20 @@ static int try_open_full(snd_mixer_class_t *class, snd_mixer_t *mixer,
|
|||
/* note python modules requires RTLD_GLOBAL */
|
||||
h = INTERNAL(snd_dlopen)(xlib, RTLD_NOW|RTLD_GLOBAL, errbuf, sizeof(errbuf));
|
||||
if (h == NULL) {
|
||||
SNDERR("Unable to open library '%s'", xlib);
|
||||
snd_error(MIXER, "Unable to open library '%s'", xlib);
|
||||
free(xlib);
|
||||
return -ENXIO;
|
||||
}
|
||||
priv->dlhandle = h;
|
||||
event_func = snd_dlsym(h, "alsa_mixer_simple_event", NULL);
|
||||
if (event_func == NULL) {
|
||||
SNDERR("Symbol 'alsa_mixer_simple_event' was not found in '%s'", xlib);
|
||||
snd_error(MIXER, "Symbol 'alsa_mixer_simple_event' was not found in '%s'", xlib);
|
||||
err = -ENXIO;
|
||||
}
|
||||
if (err == 0) {
|
||||
init_func = snd_dlsym(h, "alsa_mixer_simple_finit", NULL);
|
||||
if (init_func == NULL) {
|
||||
SNDERR("Symbol 'alsa_mixer_simple_finit' was not found in '%s'", xlib);
|
||||
snd_error(MIXER, "Symbol 'alsa_mixer_simple_finit' was not found in '%s'", xlib);
|
||||
err = -ENXIO;
|
||||
}
|
||||
}
|
||||
|
|
@ -308,13 +308,13 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
|
|||
if (err >= 0) {
|
||||
err = snd_input_stdio_open(&input, file, "r");
|
||||
if (err < 0) {
|
||||
SNDERR("unable to open simple mixer configuration file '%s'", file);
|
||||
snd_error(MIXER, "unable to open simple mixer configuration file '%s'", file);
|
||||
goto __error;
|
||||
}
|
||||
err = snd_config_load(top, input);
|
||||
snd_input_close(input);
|
||||
if (err < 0) {
|
||||
SNDERR("%s may be old or corrupted: consider to remove or fix it", file);
|
||||
snd_error(MIXER, "%s may be old or corrupted: consider to remove or fix it", file);
|
||||
goto __error;
|
||||
}
|
||||
err = find_full(class, mixer, top, priv->device);
|
||||
|
|
@ -324,7 +324,7 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
|
|||
if (err >= 0) {
|
||||
err = snd_ctl_open(&priv->ctl, priv->device, 0);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to open control device '%s': %s", priv->device, snd_strerror(err));
|
||||
snd_error(MIXER, "unable to open control device '%s': %s", priv->device, snd_strerror(err));
|
||||
goto __error;
|
||||
}
|
||||
err = snd_hctl_open_ctl(&priv->hctl, priv->ctl);
|
||||
|
|
@ -350,7 +350,7 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
|
|||
__error:
|
||||
if (top)
|
||||
snd_config_delete(top);
|
||||
if (class)
|
||||
if (class)
|
||||
snd_mixer_class_free(class);
|
||||
return err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1215,9 +1215,9 @@ static int ask_vol_dB_ops(snd_mixer_elem_t *elem,
|
|||
}
|
||||
|
||||
static int get_dB_ops(snd_mixer_elem_t *elem,
|
||||
int dir,
|
||||
snd_mixer_selem_channel_id_t channel,
|
||||
long *value)
|
||||
int dir,
|
||||
snd_mixer_selem_channel_id_t channel,
|
||||
long *value)
|
||||
{
|
||||
selem_none_t *s = snd_mixer_elem_get_private(elem);
|
||||
selem_ctl_t *c;
|
||||
|
|
@ -1264,7 +1264,7 @@ static int set_volume_ops(snd_mixer_elem_t *elem, int dir,
|
|||
}
|
||||
|
||||
static int ask_dB_vol_ops(snd_mixer_elem_t *elem, int dir,
|
||||
long dbValue, long *value, int xdir)
|
||||
long dbValue, long *value, int xdir)
|
||||
{
|
||||
selem_none_t *s = snd_mixer_elem_get_private(elem);
|
||||
selem_ctl_t *c;
|
||||
|
|
@ -1446,7 +1446,7 @@ static int simple_add1(snd_mixer_class_t *class, const char *name,
|
|||
if (ctype == SND_CTL_ELEM_TYPE_ENUMERATED)
|
||||
type = CTL_GLOBAL_ENUM;
|
||||
else if (ctype != SND_CTL_ELEM_TYPE_BOOLEAN &&
|
||||
ctype != SND_CTL_ELEM_TYPE_INTEGER)
|
||||
ctype != SND_CTL_ELEM_TYPE_INTEGER)
|
||||
return 0;
|
||||
break;
|
||||
case CTL_GLOBAL_ROUTE:
|
||||
|
|
@ -1552,9 +1552,11 @@ static int simple_add1(snd_mixer_class_t *class, const char *name,
|
|||
snd_mixer_selem_id_free(id);
|
||||
}
|
||||
if (simple->ctls[type].elem) {
|
||||
SNDERR("helem (%s,'%s',%u,%u,%u) appears twice or more",
|
||||
snd_ctl_elem_iface_name(
|
||||
snd_hctl_elem_get_interface(helem)),
|
||||
snd_error(MIXER, "helem (%s,'%s',%u,%u,%u) appears twice or more",
|
||||
snd_ctl_elem_iface_name(
|
||||
|
||||
snd_hctl_elem_get_interface(helem)),
|
||||
|
||||
snd_hctl_elem_get_name(helem),
|
||||
snd_hctl_elem_get_index(helem),
|
||||
snd_hctl_elem_get_device(helem),
|
||||
|
|
|
|||
|
|
@ -316,23 +316,23 @@ typedef int LADSPA_PortRangeHintDescriptor;
|
|||
|
||||
#define LADSPA_IS_HINT_HAS_DEFAULT(x) ((x) & LADSPA_HINT_DEFAULT_MASK)
|
||||
#define LADSPA_IS_HINT_DEFAULT_MINIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
|
||||
== LADSPA_HINT_DEFAULT_MINIMUM)
|
||||
== LADSPA_HINT_DEFAULT_MINIMUM)
|
||||
#define LADSPA_IS_HINT_DEFAULT_LOW(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
|
||||
== LADSPA_HINT_DEFAULT_LOW)
|
||||
== LADSPA_HINT_DEFAULT_LOW)
|
||||
#define LADSPA_IS_HINT_DEFAULT_MIDDLE(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
|
||||
== LADSPA_HINT_DEFAULT_MIDDLE)
|
||||
== LADSPA_HINT_DEFAULT_MIDDLE)
|
||||
#define LADSPA_IS_HINT_DEFAULT_HIGH(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
|
||||
== LADSPA_HINT_DEFAULT_HIGH)
|
||||
== LADSPA_HINT_DEFAULT_HIGH)
|
||||
#define LADSPA_IS_HINT_DEFAULT_MAXIMUM(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
|
||||
== LADSPA_HINT_DEFAULT_MAXIMUM)
|
||||
== LADSPA_HINT_DEFAULT_MAXIMUM)
|
||||
#define LADSPA_IS_HINT_DEFAULT_0(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
|
||||
== LADSPA_HINT_DEFAULT_0)
|
||||
== LADSPA_HINT_DEFAULT_0)
|
||||
#define LADSPA_IS_HINT_DEFAULT_1(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
|
||||
== LADSPA_HINT_DEFAULT_1)
|
||||
== LADSPA_HINT_DEFAULT_1)
|
||||
#define LADSPA_IS_HINT_DEFAULT_100(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
|
||||
== LADSPA_HINT_DEFAULT_100)
|
||||
== LADSPA_HINT_DEFAULT_100)
|
||||
#define LADSPA_IS_HINT_DEFAULT_440(x) (((x) & LADSPA_HINT_DEFAULT_MASK) \
|
||||
== LADSPA_HINT_DEFAULT_440)
|
||||
== LADSPA_HINT_DEFAULT_440)
|
||||
|
||||
typedef struct _LADSPA_PortRangeHint {
|
||||
|
||||
|
|
@ -435,7 +435,7 @@ typedef struct _LADSPA_Descriptor {
|
|||
Note that instance initialisation should generally occur in
|
||||
activate() rather than here. */
|
||||
LADSPA_Handle (*instantiate)(const struct _LADSPA_Descriptor * Descriptor,
|
||||
unsigned long SampleRate);
|
||||
unsigned long SampleRate);
|
||||
|
||||
/* This member is a function pointer that connects a port on an
|
||||
instantiated plugin to a memory location at which a block of data
|
||||
|
|
@ -464,8 +464,8 @@ typedef struct _LADSPA_Descriptor {
|
|||
However, overlapped buffers or use of a single buffer for both
|
||||
audio and control data may result in unexpected behaviour. */
|
||||
void (*connect_port)(LADSPA_Handle Instance,
|
||||
unsigned long Port,
|
||||
LADSPA_Data * DataLocation);
|
||||
unsigned long Port,
|
||||
LADSPA_Data * DataLocation);
|
||||
|
||||
/* This member is a function pointer that initialises a plugin
|
||||
instance and activates it for use. This is separated from
|
||||
|
|
@ -503,7 +503,7 @@ typedef struct _LADSPA_Descriptor {
|
|||
then there are various things that the plugin should not do
|
||||
within the run() or run_adding() functions (see above). */
|
||||
void (*run)(LADSPA_Handle Instance,
|
||||
unsigned long SampleCount);
|
||||
unsigned long SampleCount);
|
||||
|
||||
/* This method is a function pointer that runs an instance of a
|
||||
plugin for a block. This has identical behaviour to run() except
|
||||
|
|
@ -519,7 +519,7 @@ typedef struct _LADSPA_Descriptor {
|
|||
this function pointer must be set to NULL. When it is provided,
|
||||
the function set_run_adding_gain() must be provided also. */
|
||||
void (*run_adding)(LADSPA_Handle Instance,
|
||||
unsigned long SampleCount);
|
||||
unsigned long SampleCount);
|
||||
|
||||
/* This method is a function pointer that sets the output gain for
|
||||
use when run_adding() is called (see above). If this function is
|
||||
|
|
@ -531,7 +531,7 @@ typedef struct _LADSPA_Descriptor {
|
|||
run_adding() function is provided. When it is absent this
|
||||
function pointer must be set to NULL. */
|
||||
void (*set_run_adding_gain)(LADSPA_Handle Instance,
|
||||
LADSPA_Data Gain);
|
||||
LADSPA_Data Gain);
|
||||
|
||||
/* This is the counterpart to activate() (see above). If there is
|
||||
nothing for deactivate() to do then the plugin writer may provide
|
||||
|
|
|
|||
|
|
@ -32,36 +32,36 @@
|
|||
|
||||
MASK_INLINE unsigned int ld2(uint32_t v)
|
||||
{
|
||||
unsigned r = 0;
|
||||
unsigned r = 0;
|
||||
|
||||
if (v >= 0x10000) {
|
||||
v >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (v >= 0x100) {
|
||||
v >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (v >= 0x10) {
|
||||
v >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (v >= 4) {
|
||||
v >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (v >= 2)
|
||||
r++;
|
||||
return r;
|
||||
if (v >= 0x10000) {
|
||||
v >>= 16;
|
||||
r += 16;
|
||||
}
|
||||
if (v >= 0x100) {
|
||||
v >>= 8;
|
||||
r += 8;
|
||||
}
|
||||
if (v >= 0x10) {
|
||||
v >>= 4;
|
||||
r += 4;
|
||||
}
|
||||
if (v >= 4) {
|
||||
v >>= 2;
|
||||
r += 2;
|
||||
}
|
||||
if (v >= 2)
|
||||
r++;
|
||||
return r;
|
||||
}
|
||||
|
||||
MASK_INLINE unsigned int hweight32(uint32_t v)
|
||||
{
|
||||
v = (v & 0x55555555) + ((v >> 1) & 0x55555555);
|
||||
v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
|
||||
v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F);
|
||||
v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF);
|
||||
return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF);
|
||||
v = (v & 0x55555555) + ((v >> 1) & 0x55555555);
|
||||
v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
|
||||
v = (v & 0x0F0F0F0F) + ((v >> 4) & 0x0F0F0F0F);
|
||||
v = (v & 0x00FF00FF) + ((v >> 8) & 0x00FF00FF);
|
||||
return (v & 0x0000FFFF) + ((v >> 16) & 0x0000FFFF);
|
||||
}
|
||||
|
||||
MASK_INLINE size_t snd_mask_sizeof(void)
|
||||
|
|
|
|||
424
src/pcm/pcm.c
424
src/pcm/pcm.c
File diff suppressed because it is too large
Load diff
|
|
@ -596,15 +596,15 @@ format and rate must match for both of them.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type adpcm # Ima-ADPCM conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
format STR # Slave format
|
||||
}
|
||||
type adpcm # Ima-ADPCM conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
format STR # Slave format
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -650,11 +650,11 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
slave = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
|
||||
|
|
@ -663,8 +663,8 @@ int _snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
return err;
|
||||
if (snd_pcm_format_linear(sformat) != 1 &&
|
||||
sformat != SND_PCM_FORMAT_IMA_ADPCM) {
|
||||
snd_config_delete(sconf);
|
||||
SNDERR("invalid slave format");
|
||||
snd_config_delete(sconf);
|
||||
snd_error(PCM, "invalid slave format");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
|
||||
|
|
|
|||
|
|
@ -471,15 +471,15 @@ format and rate must match for both of them.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type alaw # A-Law conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
format STR # Slave format
|
||||
}
|
||||
type alaw # A-Law conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
format STR # Slave format
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -525,11 +525,11 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
|
|||
slave = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
|
||||
|
|
@ -538,8 +538,8 @@ int _snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name,
|
|||
return err;
|
||||
if (snd_pcm_format_linear(sformat) != 1 &&
|
||||
sformat != SND_PCM_FORMAT_A_LAW) {
|
||||
snd_config_delete(sconf);
|
||||
SNDERR("invalid slave format");
|
||||
snd_config_delete(sconf);
|
||||
snd_error(PCM, "invalid slave format");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
|
||||
|
|
|
|||
|
|
@ -22,21 +22,21 @@ Slave PCMs can be defined asymmetrically for both directions.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type asym # Asym PCM
|
||||
playback STR # Playback slave name
|
||||
# or
|
||||
playback { # Playback slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
capture STR # Capture slave name
|
||||
# or
|
||||
capture { # Capture slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
type asym # Asym PCM
|
||||
playback STR # Playback slave name
|
||||
# or
|
||||
playback { # Playback slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
capture STR # Capture slave name
|
||||
# or
|
||||
capture { # Capture slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -98,12 +98,13 @@ int _snd_pcm_asym_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
|
|||
slave = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (! slave) {
|
||||
SNDERR("%s slave is not defined",
|
||||
stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
|
||||
snd_error(PCM, "%s slave is not defined",
|
||||
stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
|
||||
|
|
|
|||
|
|
@ -278,11 +278,11 @@ int _snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name,
|
|||
slave = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ retryget:
|
|||
if ((tmpid = shmget(dmix->ipc_key, 0, dmix->ipc_perm)) != -1)
|
||||
if (!shmctl(tmpid, IPC_STAT, &buf))
|
||||
if (!buf.shm_nattch)
|
||||
/* no users so destroy the segment */
|
||||
/* no users so destroy the segment */
|
||||
if (!shmctl(tmpid, IPC_RMID, NULL))
|
||||
goto retryget;
|
||||
return err;
|
||||
|
|
@ -212,7 +212,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
|
|||
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
int result = -errno;
|
||||
SYSERR("socket failed");
|
||||
snd_errornum(PCM, "socket failed");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -225,13 +225,13 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
|
|||
if (server) {
|
||||
if (bind(sock, (struct sockaddr *) addr, size) < 0) {
|
||||
int result = -errno;
|
||||
SYSERR("bind failed: %s", filename);
|
||||
snd_errornum(PCM, "bind failed: %s", filename);
|
||||
close(sock);
|
||||
return result;
|
||||
} else {
|
||||
if (chmod(filename, ipc_perm) < 0) {
|
||||
int result = -errno;
|
||||
SYSERR("chmod failed: %s", filename);
|
||||
snd_errornum(PCM, "chmod failed: %s", filename);
|
||||
close(sock);
|
||||
unlink(filename);
|
||||
return result;
|
||||
|
|
@ -239,7 +239,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
|
|||
if (chown(filename, -1, ipc_gid) < 0) {
|
||||
#if 0 /* it's not fatal */
|
||||
int result = -errno;
|
||||
SYSERR("chown failed: %s", filename);
|
||||
snd_errornum(PCM, "chown failed: %s", filename);
|
||||
close(sock);
|
||||
unlink(filename);
|
||||
return result;
|
||||
|
|
@ -249,7 +249,7 @@ static int make_local_socket(const char *filename, int server, mode_t ipc_perm,
|
|||
} else {
|
||||
if (connect(sock, (struct sockaddr *) addr, size) < 0) {
|
||||
int result = -errno;
|
||||
SYSERR("connect failed: %s", filename);
|
||||
snd_errornum(PCM, "connect failed: %s", filename);
|
||||
close(sock);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -309,7 +309,7 @@ static int _snd_send_fd(int sock, void *data, size_t len, int fd)
|
|||
msghdr.msg_name = NULL;
|
||||
msghdr.msg_namelen = 0;
|
||||
msghdr.msg_iov = &vec;
|
||||
msghdr.msg_iovlen = 1;
|
||||
msghdr.msg_iovlen = 1;
|
||||
msghdr.msg_control = cmsg;
|
||||
msghdr.msg_controllen = cmsg_len;
|
||||
msghdr.msg_flags = 0;
|
||||
|
|
@ -585,7 +585,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
|
|||
semerr = snd_pcm_direct_semaphore_down(direct,
|
||||
DIRECT_IPC_SEM_CLIENT);
|
||||
if (semerr < 0) {
|
||||
SNDERR("SEMDOWN FAILED with err %d", semerr);
|
||||
snd_error(PCM, "SEMDOWN FAILED with err %d", semerr);
|
||||
return semerr;
|
||||
}
|
||||
|
||||
|
|
@ -595,7 +595,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
|
|||
semerr = snd_pcm_direct_semaphore_up(direct,
|
||||
DIRECT_IPC_SEM_CLIENT);
|
||||
if (semerr < 0) {
|
||||
SNDERR("SEMUP FAILED with err %d", semerr);
|
||||
snd_error(PCM, "SEMUP FAILED with err %d", semerr);
|
||||
return semerr;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -621,11 +621,11 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
|
|||
|
||||
ret = snd_pcm_prepare(direct->spcm);
|
||||
if (ret < 0) {
|
||||
SNDERR("recover: unable to prepare slave");
|
||||
snd_error(PCM, "recover: unable to prepare slave");
|
||||
semerr = snd_pcm_direct_semaphore_up(direct,
|
||||
DIRECT_IPC_SEM_CLIENT);
|
||||
if (semerr < 0) {
|
||||
SNDERR("SEMUP FAILED with err %d", semerr);
|
||||
snd_error(PCM, "SEMUP FAILED with err %d", semerr);
|
||||
return semerr;
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -641,11 +641,11 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
|
|||
|
||||
ret = snd_pcm_start(direct->spcm);
|
||||
if (ret < 0) {
|
||||
SNDERR("recover: unable to start slave");
|
||||
snd_error(PCM, "recover: unable to start slave");
|
||||
semerr = snd_pcm_direct_semaphore_up(direct,
|
||||
DIRECT_IPC_SEM_CLIENT);
|
||||
if (semerr < 0) {
|
||||
SNDERR("SEMUP FAILED with err %d", semerr);
|
||||
snd_error(PCM, "SEMUP FAILED with err %d", semerr);
|
||||
return semerr;
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -653,7 +653,7 @@ int snd_pcm_direct_slave_recover(snd_pcm_direct_t *direct)
|
|||
semerr = snd_pcm_direct_semaphore_up(direct,
|
||||
DIRECT_IPC_SEM_CLIENT);
|
||||
if (semerr < 0) {
|
||||
SNDERR("SEMUP FAILED with err %d", semerr);
|
||||
snd_error(PCM, "SEMUP FAILED with err %d", semerr);
|
||||
return semerr;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -727,7 +727,7 @@ int snd_pcm_direct_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds,
|
|||
unsigned int space)
|
||||
{
|
||||
if (pcm->poll_fd < 0) {
|
||||
SNDMSG("poll_fd < 0");
|
||||
snd_check(PCM, "poll_fd < 0");
|
||||
return -EIO;
|
||||
}
|
||||
if (space >= 1 && pfds) {
|
||||
|
|
@ -845,7 +845,7 @@ static int hw_param_interval_refine_one(snd_pcm_hw_params_t *params,
|
|||
return 0;
|
||||
i = hw_param_interval(params, var);
|
||||
if (snd_interval_empty(i)) {
|
||||
SNDERR("dshare interval %i empty?", (int)var);
|
||||
snd_error(PCM, "dshare interval %i empty?", (int)var);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (snd_interval_refine(i, src))
|
||||
|
|
@ -910,7 +910,7 @@ int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
#endif
|
||||
if (params->rmask & (1<<SND_PCM_HW_PARAM_ACCESS)) {
|
||||
if (snd_mask_empty(hw_param_mask(params, SND_PCM_HW_PARAM_ACCESS))) {
|
||||
SNDERR("dshare access mask empty?");
|
||||
snd_error(PCM, "dshare access mask empty?");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (snd_mask_refine(hw_param_mask(params, SND_PCM_HW_PARAM_ACCESS), &access))
|
||||
|
|
@ -918,7 +918,7 @@ int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
}
|
||||
if (params->rmask & (1<<SND_PCM_HW_PARAM_FORMAT)) {
|
||||
if (snd_mask_empty(hw_param_mask(params, SND_PCM_HW_PARAM_FORMAT))) {
|
||||
SNDERR("dshare format mask empty?");
|
||||
snd_error(PCM, "dshare format mask empty?");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (snd_mask_refine_set(hw_param_mask(params, SND_PCM_HW_PARAM_FORMAT),
|
||||
|
|
@ -928,7 +928,7 @@ int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
//snd_mask_none(hw_param_mask(params, SND_PCM_HW_PARAM_SUBFORMAT));
|
||||
if (params->rmask & (1<<SND_PCM_HW_PARAM_CHANNELS)) {
|
||||
if (snd_interval_empty(hw_param_interval(params, SND_PCM_HW_PARAM_CHANNELS))) {
|
||||
SNDERR("dshare channels mask empty?");
|
||||
snd_error(PCM, "dshare channels mask empty?");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_interval_refine_set(hw_param_interval(params, SND_PCM_HW_PARAM_CHANNELS), dshare->channels);
|
||||
|
|
@ -1057,7 +1057,7 @@ int snd_pcm_direct_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
|||
|
||||
int snd_pcm_direct_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info)
|
||||
{
|
||||
return snd_pcm_channel_info_shm(pcm, info, -1);
|
||||
return snd_pcm_channel_info_shm(pcm, info, -1);
|
||||
}
|
||||
|
||||
int snd_pcm_direct_mmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
||||
|
|
@ -1202,13 +1202,13 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
int loops = 10;
|
||||
|
||||
__again:
|
||||
if (loops-- <= 0) {
|
||||
SNDERR("unable to find a valid configuration for slave");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (loops-- <= 0) {
|
||||
snd_error(PCM, "unable to find a valid configuration for slave");
|
||||
return -EINVAL;
|
||||
}
|
||||
ret = snd_pcm_hw_params_any(spcm, &hw_params);
|
||||
if (ret < 0) {
|
||||
SNDERR("snd_pcm_hw_params_any failed");
|
||||
snd_error(PCM, "snd_pcm_hw_params_any failed");
|
||||
return ret;
|
||||
}
|
||||
ret = snd_pcm_hw_params_set_access(spcm, &hw_params,
|
||||
|
|
@ -1217,7 +1217,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
ret = snd_pcm_hw_params_set_access(spcm, &hw_params,
|
||||
SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
|
||||
if (ret < 0) {
|
||||
SNDERR("slave plugin does not support mmap interleaved or mmap noninterleaved access");
|
||||
snd_error(PCM, "slave plugin does not support mmap interleaved or mmap noninterleaved access");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -1254,7 +1254,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
&hw_params, &format);
|
||||
}
|
||||
if (ret < 0) {
|
||||
SNDERR("requested or auto-format is not available");
|
||||
snd_error(PCM, "requested or auto-format is not available");
|
||||
return ret;
|
||||
}
|
||||
params->format = format;
|
||||
|
|
@ -1262,13 +1262,13 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
ret = INTERNAL(snd_pcm_hw_params_set_channels_near)(spcm, &hw_params,
|
||||
(unsigned int *)¶ms->channels);
|
||||
if (ret < 0) {
|
||||
SNDERR("requested count of channels is not available");
|
||||
snd_error(PCM, "requested count of channels is not available");
|
||||
return ret;
|
||||
}
|
||||
ret = INTERNAL(snd_pcm_hw_params_set_rate_near)(spcm, &hw_params,
|
||||
(unsigned int *)¶ms->rate, 0);
|
||||
if (ret < 0) {
|
||||
SNDERR("requested rate is not available");
|
||||
snd_error(PCM, "requested rate is not available");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1277,14 +1277,14 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
ret = INTERNAL(snd_pcm_hw_params_set_buffer_time_near)(spcm,
|
||||
&hw_params, (unsigned int *)¶ms->buffer_time, 0);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set buffer time");
|
||||
snd_error(PCM, "unable to set buffer time");
|
||||
return ret;
|
||||
}
|
||||
} else if (params->buffer_size > 0) {
|
||||
ret = INTERNAL(snd_pcm_hw_params_set_buffer_size_near)(spcm,
|
||||
&hw_params, (snd_pcm_uframes_t *)¶ms->buffer_size);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set buffer size");
|
||||
snd_error(PCM, "unable to set buffer size");
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1295,7 +1295,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
ret = INTERNAL(snd_pcm_hw_params_set_period_time_near)(spcm,
|
||||
&hw_params, (unsigned int *)¶ms->period_time, 0);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set period_time");
|
||||
snd_error(PCM, "unable to set period_time");
|
||||
return ret;
|
||||
}
|
||||
} else if (params->period_size > 0) {
|
||||
|
|
@ -1303,7 +1303,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
&hw_params, (snd_pcm_uframes_t *)¶ms->period_size,
|
||||
0);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set period_size");
|
||||
snd_error(PCM, "unable to set period_size");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -1313,7 +1313,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
ret = INTERNAL(snd_pcm_hw_params_set_periods_near)(spcm,
|
||||
&hw_params, ¶ms->periods, 0);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set requested periods");
|
||||
snd_error(PCM, "unable to set requested periods");
|
||||
return ret;
|
||||
}
|
||||
if (params->periods == 1) {
|
||||
|
|
@ -1325,14 +1325,14 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
params->period_size /= 2;
|
||||
goto __again;
|
||||
}
|
||||
SNDERR("unable to use stream with periods == 1");
|
||||
snd_error(PCM, "unable to use stream with periods == 1");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
ret = snd_pcm_hw_params(spcm, &hw_params);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to install hw params");
|
||||
snd_error(PCM, "unable to install hw params");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1356,18 +1356,18 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
|
||||
ret = snd_pcm_sw_params_current(spcm, &sw_params);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to get current sw_params");
|
||||
snd_error(PCM, "unable to get current sw_params");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = snd_pcm_sw_params_get_boundary(&sw_params, &boundary);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to get boundary");
|
||||
snd_error(PCM, "unable to get boundary");
|
||||
return ret;
|
||||
}
|
||||
ret = snd_pcm_sw_params_set_stop_threshold(spcm, &sw_params, boundary);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set stop threshold");
|
||||
snd_error(PCM, "unable to set stop threshold");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1378,7 +1378,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
ret = snd_pcm_sw_params_set_tstamp_mode(spcm, &sw_params,
|
||||
SND_PCM_TSTAMP_ENABLE);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to tstamp mode MMAP");
|
||||
snd_error(PCM, "unable to tstamp mode MMAP");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1386,7 +1386,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
ret = snd_pcm_sw_params_set_tstamp_type(spcm, &sw_params,
|
||||
dmix->tstamp_type);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set tstamp type");
|
||||
snd_error(PCM, "unable to set tstamp type");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -1397,12 +1397,12 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
|
||||
ret = snd_pcm_sw_params_set_silence_threshold(spcm, &sw_params, 0);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set silence threshold");
|
||||
snd_error(PCM, "unable to set silence threshold");
|
||||
return ret;
|
||||
}
|
||||
ret = snd_pcm_sw_params_set_silence_size(spcm, &sw_params, boundary);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set silence threshold (please upgrade to 0.9.0rc8+ driver)");
|
||||
snd_error(PCM, "unable to set silence threshold (please upgrade to 0.9.0rc8+ driver)");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1410,7 +1410,7 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
|
||||
ret = snd_pcm_sw_params(spcm, &sw_params);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to install sw params (please upgrade to 0.9.0rc8+ driver)");
|
||||
snd_error(PCM, "unable to install sw params (please upgrade to 0.9.0rc8+ driver)");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1423,12 +1423,12 @@ int snd_pcm_direct_initialize_slave(snd_pcm_direct_t *dmix, snd_pcm_t *spcm, str
|
|||
|
||||
ret = snd_pcm_start(spcm);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to start PCM stream");
|
||||
snd_error(PCM, "unable to start PCM stream");
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (snd_pcm_poll_descriptors_count(spcm) != 1) {
|
||||
SNDERR("unable to use hardware pcm with fd more than one!!!");
|
||||
snd_error(PCM, "unable to use hardware pcm with fd more than one!!!");
|
||||
return ret;
|
||||
}
|
||||
snd_pcm_poll_descriptors(spcm, &fd, 1);
|
||||
|
|
@ -1476,7 +1476,7 @@ int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix)
|
|||
dmix->timer_ticks = 1;
|
||||
ret = snd_pcm_info(dmix->spcm, &info);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to info for slave pcm");
|
||||
snd_error(PCM, "unable to info for slave pcm");
|
||||
return ret;
|
||||
}
|
||||
sprintf(name, "hw:CLASS=%i,SCLASS=0,CARD=%i,DEV=%i,SUBDEV=%i",
|
||||
|
|
@ -1491,13 +1491,13 @@ int snd_pcm_direct_initialize_poll_fd(snd_pcm_direct_t *dmix)
|
|||
ret = snd_timer_open(&dmix->timer, name,
|
||||
SND_TIMER_OPEN_NONBLOCK);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to open timer '%s'", name);
|
||||
snd_error(PCM, "unable to open timer '%s'", name);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if (snd_timer_poll_descriptors_count(dmix->timer) != 1) {
|
||||
SNDERR("unable to use timer '%s' with more than one fd!", name);
|
||||
snd_error(PCM, "unable to use timer '%s' with more than one fd!", name);
|
||||
return ret;
|
||||
}
|
||||
snd_timer_poll_descriptors(dmix->timer, &dmix->timer_fd, 1);
|
||||
|
|
@ -1598,7 +1598,7 @@ int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dm
|
|||
|
||||
ret = snd_pcm_hw_open_fd(spcmp, client_name, dmix->hw_fd, 0);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to open hardware");
|
||||
snd_error(PCM, "unable to open hardware");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1616,7 +1616,7 @@ int snd_pcm_direct_open_secondary_client(snd_pcm_t **spcmp, snd_pcm_direct_t *dm
|
|||
|
||||
ret = snd_pcm_mmap(spcm);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to mmap channels");
|
||||
snd_error(PCM, "unable to mmap channels");
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1643,7 +1643,7 @@ int snd_pcm_direct_initialize_secondary_slave(snd_pcm_direct_t *dmix,
|
|||
|
||||
ret = snd_pcm_mmap(spcm);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to mmap channels");
|
||||
snd_error(PCM, "unable to mmap channels");
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1666,7 +1666,7 @@ int snd_pcm_direct_set_timer_params(snd_pcm_direct_t *dmix)
|
|||
}
|
||||
ret = snd_timer_params(dmix->timer, ¶ms);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to set timer parameters");
|
||||
snd_error(PCM, "unable to set timer parameters");
|
||||
return ret;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1729,7 +1729,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
|
|||
if (cfg == NULL)
|
||||
return 0;
|
||||
if (snd_config_get_type(cfg) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("invalid type for bindings");
|
||||
snd_error(PCM, "invalid type for bindings");
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_config_for_each(i, next, cfg) {
|
||||
|
|
@ -1740,7 +1740,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
|
|||
continue;
|
||||
err = safe_strtol(id, &cchannel);
|
||||
if (err < 0 || cchannel < 0) {
|
||||
SNDERR("invalid client channel in binding: %s", id);
|
||||
snd_error(PCM, "invalid client channel in binding: %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if ((unsigned)cchannel >= count)
|
||||
|
|
@ -1749,7 +1749,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
|
|||
if (count == 0)
|
||||
return 0;
|
||||
if (count > 1024) {
|
||||
SNDERR("client channel out of range");
|
||||
snd_error(PCM, "client channel out of range");
|
||||
return -EINVAL;
|
||||
}
|
||||
bindings = malloc(count * sizeof(unsigned int));
|
||||
|
|
@ -1765,13 +1765,14 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
|
|||
continue;
|
||||
safe_strtol(id, &cchannel);
|
||||
if (snd_config_get_integer(n, &schannel) < 0) {
|
||||
SNDERR("unable to get slave channel (should be integer type) in binding: %s", id);
|
||||
snd_error(PCM, "unable to get slave channel (should be integer type) in binding: %s", id);
|
||||
free(bindings);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (schannel < 0 || schannel >= params->channels) {
|
||||
SNDERR("invalid slave channel number %ld in binding to %ld",
|
||||
schannel, cchannel);
|
||||
snd_error(PCM, "invalid slave channel number %ld in binding to %ld",
|
||||
schannel, cchannel);
|
||||
|
||||
free(bindings);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -1785,7 +1786,7 @@ int snd_pcm_direct_parse_bindings(snd_pcm_direct_t *dmix,
|
|||
if (chn == chn1)
|
||||
continue;
|
||||
if (bindings[chn] == dmix->bindings[chn1]) {
|
||||
SNDERR("unable to route channels %d,%d to same destination %d", chn, chn1, bindings[chn]);
|
||||
snd_error(PCM, "unable to route channels %d,%d to same destination %d", chn, chn1, bindings[chn]);
|
||||
free(bindings);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -1814,12 +1815,12 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
|
|||
|
||||
if (snd_config_get_string(sconf, &str) >= 0) {
|
||||
if (hop > SND_CONF_MAX_HOPS) {
|
||||
SNDERR("Too many definition levels (looped?)");
|
||||
snd_error(PCM, "Too many definition levels (looped?)");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_search_definition(root, "pcm", str, &pcm_conf);
|
||||
if (err < 0) {
|
||||
SNDERR("Unknown slave PCM %s", str);
|
||||
snd_error(PCM, "Unknown slave PCM %s", str);
|
||||
return err;
|
||||
}
|
||||
err = _snd_pcm_direct_get_slave_ipc_offset(root, pcm_conf,
|
||||
|
|
@ -1869,11 +1870,11 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
|
|||
if (strcmp(id, "type") == 0) {
|
||||
err = snd_config_get_string(n, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid value for PCM type definition");
|
||||
snd_error(PCM, "Invalid value for PCM type definition");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (strcmp(str, "hw")) {
|
||||
SNDERR("Invalid type '%s' for slave PCM", str);
|
||||
snd_error(PCM, "Invalid type '%s' for slave PCM", str);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1888,7 +1889,7 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
|
|||
if (strcmp(id, "device") == 0) {
|
||||
err = snd_config_get_integer(n, &device);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1896,7 +1897,7 @@ static int _snd_pcm_direct_get_slave_ipc_offset(snd_config_t *root,
|
|||
if (strcmp(id, "subdevice") == 0) {
|
||||
err = snd_config_get_integer(n, &subdevice);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1959,7 +1960,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
long key;
|
||||
err = snd_config_get_integer(n, &key);
|
||||
if (err < 0) {
|
||||
SNDERR("The field ipc_key must be an integer type");
|
||||
snd_error(PCM, "The field ipc_key must be an integer type");
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
@ -1970,11 +1971,11 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
long perm;
|
||||
err = snd_config_get_integer(n, &perm);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return err;
|
||||
}
|
||||
if ((perm & ~0777) != 0) {
|
||||
SNDERR("The field ipc_perm must be a valid file permission");
|
||||
snd_error(PCM, "The field ipc_perm must be a valid file permission");
|
||||
return -EINVAL;
|
||||
}
|
||||
rec->ipc_perm = perm;
|
||||
|
|
@ -1984,7 +1985,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
const char *str;
|
||||
err = snd_config_get_string(n, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (strcmp(str, "no") == 0 || strcmp(str, "off") == 0)
|
||||
|
|
@ -1996,7 +1997,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
else if (strcmp(str, "auto") == 0)
|
||||
rec->hw_ptr_alignment = SND_PCM_HW_PTR_ALIGNMENT_AUTO;
|
||||
else {
|
||||
SNDERR("The field hw_ptr_alignment is invalid : %s", str);
|
||||
snd_error(PCM, "The field hw_ptr_alignment is invalid : %s", str);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -2006,7 +2007,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
const char *str;
|
||||
err = snd_config_get_string(n, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (strcmp(str, "default") == 0)
|
||||
|
|
@ -2018,7 +2019,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
else if (strcmp(str, "monotonic_raw") == 0)
|
||||
rec->tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW;
|
||||
else {
|
||||
SNDERR("The field tstamp_type is invalid : %s", str);
|
||||
snd_error(PCM, "The field tstamp_type is invalid : %s", str);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -2028,7 +2029,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
char *endp;
|
||||
err = snd_config_get_ascii(n, &group);
|
||||
if (err < 0) {
|
||||
SNDERR("The field ipc_gid must be a valid group");
|
||||
snd_error(PCM, "The field ipc_gid must be a valid group");
|
||||
return err;
|
||||
}
|
||||
if (! *group) {
|
||||
|
|
@ -2045,7 +2046,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
return -ENOMEM;
|
||||
int st = getgrnam_r(group, &grp, buffer, len, &pgrp);
|
||||
if (st != 0 || !pgrp) {
|
||||
SNDERR("The field ipc_gid must be a valid group (create group %s)", group);
|
||||
snd_error(PCM, "The field ipc_gid must be a valid group (create group %s)", group);
|
||||
free(buffer);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -2059,7 +2060,7 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
}
|
||||
if (strcmp(id, "ipc_key_add_uid") == 0) {
|
||||
if ((err = snd_config_get_bool(n)) < 0) {
|
||||
SNDERR("The field ipc_key_add_uid must be a boolean type");
|
||||
snd_error(PCM, "The field ipc_key_add_uid must be a boolean type");
|
||||
return err;
|
||||
}
|
||||
ipc_key_add_uid = err;
|
||||
|
|
@ -2102,15 +2103,15 @@ int snd_pcm_direct_parse_open_conf(snd_config_t *root, snd_config_t *conf,
|
|||
rec->direct_memory_access = err;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!rec->slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!rec->ipc_key) {
|
||||
SNDERR("Unique IPC key is not defined");
|
||||
snd_error(PCM, "Unique IPC key is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ipc_key_add_uid)
|
||||
|
|
@ -2175,7 +2176,7 @@ int _snd_pcm_direct_new(snd_pcm_t **pcmp, snd_pcm_direct_t **_dmix, int type,
|
|||
while (1) {
|
||||
ret = snd_pcm_direct_semaphore_create_or_connect(dmix);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to create IPC semaphore");
|
||||
snd_error(PCM, "unable to create IPC semaphore");
|
||||
goto _err_nosem_free;
|
||||
}
|
||||
ret = snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
|
||||
|
|
@ -2190,7 +2191,7 @@ int _snd_pcm_direct_new(snd_pcm_t **pcmp, snd_pcm_direct_t **_dmix, int type,
|
|||
|
||||
ret = snd_pcm_direct_shm_create_or_connect(dmix);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to create IPC shm instance");
|
||||
snd_error(PCM, "unable to create IPC shm instance");
|
||||
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
|
||||
goto _err_nosem_free;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ static inline int snd_pcm_direct_semaphore_up(snd_pcm_direct_t *dmix, int sem_nu
|
|||
static inline int snd_pcm_direct_semaphore_final(snd_pcm_direct_t *dmix, int sem_num)
|
||||
{
|
||||
if (dmix->locked[sem_num] != 1) {
|
||||
SNDMSG("invalid semaphore count to finalize %d: %d", sem_num, dmix->locked[sem_num]);
|
||||
snd_check(PCM, "invalid semaphore count to finalize %d: %d", sem_num, dmix->locked[sem_num]);
|
||||
return -EBUSY;
|
||||
}
|
||||
return snd_pcm_direct_semaphore_up(dmix, sem_num);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ retryshm:
|
|||
if (errno == EINVAL)
|
||||
if ((tmpid = shmget(dmix->ipc_key + 1, 0, dmix->ipc_perm)) != -1)
|
||||
if (!shmctl(tmpid, IPC_STAT, &buf))
|
||||
if (!buf.shm_nattch)
|
||||
if (!buf.shm_nattch)
|
||||
/* no users so destroy the segment */
|
||||
if (!shmctl(tmpid, IPC_RMID, NULL))
|
||||
goto retryshm;
|
||||
|
|
@ -784,11 +784,11 @@ static int snd_pcm_dmix_close(snd_pcm_t *pcm)
|
|||
snd_timer_close(dmix->timer);
|
||||
snd_pcm_direct_semaphore_down(dmix, DIRECT_IPC_SEM_CLIENT);
|
||||
snd_pcm_close(dmix->spcm);
|
||||
if (dmix->server)
|
||||
snd_pcm_direct_server_discard(dmix);
|
||||
if (dmix->client)
|
||||
snd_pcm_direct_client_discard(dmix);
|
||||
shm_sum_discard(dmix);
|
||||
if (dmix->server)
|
||||
snd_pcm_direct_server_discard(dmix);
|
||||
if (dmix->client)
|
||||
snd_pcm_direct_client_discard(dmix);
|
||||
shm_sum_discard(dmix);
|
||||
if (snd_pcm_direct_shm_discard(dmix)) {
|
||||
if (snd_pcm_direct_semaphore_discard(dmix))
|
||||
snd_pcm_direct_semaphore_final(dmix, DIRECT_IPC_SEM_CLIENT);
|
||||
|
|
@ -970,7 +970,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
assert(pcmp);
|
||||
|
||||
if (stream != SND_PCM_STREAM_PLAYBACK) {
|
||||
SNDERR("The dmix plugin supports only playback stream");
|
||||
snd_error(PCM, "The dmix plugin supports only playback stream");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -997,19 +997,19 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
|
||||
mode | SND_PCM_NONBLOCK, NULL);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to open slave");
|
||||
snd_error(PCM, "unable to open slave");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
|
||||
SNDERR("dmix plugin can be only connected to hw plugin");
|
||||
snd_error(PCM, "dmix plugin can be only connected to hw plugin");
|
||||
ret = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
ret = snd_pcm_direct_initialize_slave(dmix, spcm, params);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to initialize slave");
|
||||
snd_error(PCM, "unable to initialize slave");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
@ -1020,7 +1020,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
ret = snd_pcm_direct_server_create(dmix);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to create server");
|
||||
snd_error(PCM, "unable to create server");
|
||||
goto _err;
|
||||
}
|
||||
}
|
||||
|
|
@ -1032,7 +1032,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
|
||||
ret = snd_pcm_direct_client_connect(dmix);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to connect client");
|
||||
snd_error(PCM, "unable to connect client");
|
||||
goto _err_nosem;
|
||||
}
|
||||
|
||||
|
|
@ -1054,18 +1054,18 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
first_instance = 1;
|
||||
goto retry;
|
||||
}
|
||||
SNDERR("unable to open slave");
|
||||
snd_error(PCM, "unable to open slave");
|
||||
goto _err;
|
||||
}
|
||||
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
|
||||
SNDERR("dmix plugin can be only connected to hw plugin");
|
||||
snd_error(PCM, "dmix plugin can be only connected to hw plugin");
|
||||
ret = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
ret = snd_pcm_direct_initialize_secondary_slave(dmix, spcm, params);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to initialize slave");
|
||||
snd_error(PCM, "unable to initialize slave");
|
||||
goto _err;
|
||||
}
|
||||
}
|
||||
|
|
@ -1075,13 +1075,13 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
ret = shm_sum_create_or_connect(dmix);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to initialize sum ring buffer");
|
||||
snd_error(PCM, "unable to initialize sum ring buffer");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
ret = snd_pcm_direct_initialize_poll_fd(dmix);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to initialize poll_fd");
|
||||
snd_error(PCM, "unable to initialize poll_fd");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
@ -1325,7 +1325,7 @@ int _snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
|||
params.format = SND_PCM_FORMAT_UNKNOWN;
|
||||
else if (!(dmix_supported_format & (1ULL << params.format))) {
|
||||
/* sorry, limited features */
|
||||
SNDERR("Unsupported format");
|
||||
snd_error(PCM, "Unsupported format");
|
||||
snd_config_delete(sconf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,12 +289,12 @@ static void generic_mix_areas_16_swap(unsigned int size,
|
|||
}
|
||||
|
||||
static void generic_remix_areas_16_swap(unsigned int size,
|
||||
volatile signed short *dst,
|
||||
signed short *src,
|
||||
volatile signed int *sum,
|
||||
size_t dst_step,
|
||||
size_t src_step,
|
||||
size_t sum_step)
|
||||
volatile signed short *dst,
|
||||
signed short *src,
|
||||
volatile signed int *sum,
|
||||
size_t dst_step,
|
||||
size_t src_step,
|
||||
size_t sum_step)
|
||||
{
|
||||
register signed int sample;
|
||||
|
||||
|
|
@ -354,12 +354,12 @@ static void generic_mix_areas_32_swap(unsigned int size,
|
|||
}
|
||||
|
||||
static void generic_remix_areas_32_swap(unsigned int size,
|
||||
volatile signed int *dst,
|
||||
signed int *src,
|
||||
volatile signed int *sum,
|
||||
size_t dst_step,
|
||||
size_t src_step,
|
||||
size_t sum_step)
|
||||
volatile signed int *dst,
|
||||
signed int *src,
|
||||
volatile signed int *sum,
|
||||
size_t dst_step,
|
||||
size_t src_step,
|
||||
size_t sum_step)
|
||||
{
|
||||
register signed int sample;
|
||||
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ static void MIX_AREAS_16_MMX(unsigned int size,
|
|||
"\tdecl %[size]\n"
|
||||
"\tjnz 1b\n"
|
||||
"\temms\n"
|
||||
"5:"
|
||||
"5:"
|
||||
#ifdef BOUNDED_EBX
|
||||
"\tmovl %[old_ebx], %%ebx\n" /* ebx is GOT pointer (-fPIC) */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ static void MIX_AREAS_16(unsigned int size,
|
|||
#ifdef BOUNDED_RBX
|
||||
, [old_rbx] "=m" (old_rbx)
|
||||
#endif
|
||||
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
|
||||
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
|
||||
[dst_step] "im" (dst_step), [src_step] "im" (src_step),
|
||||
[sum_step] "im" (sum_step)
|
||||
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
|
||||
|
|
@ -279,7 +279,7 @@ static void MIX_AREAS_32(unsigned int size,
|
|||
#ifdef BOUNDED_RBX
|
||||
, [old_rbx] "=m" (old_rbx)
|
||||
#endif
|
||||
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
|
||||
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
|
||||
[dst_step] "im" (dst_step), [src_step] "im" (src_step),
|
||||
[sum_step] "im" (sum_step)
|
||||
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
|
||||
|
|
@ -403,7 +403,7 @@ static void MIX_AREAS_24(unsigned int size,
|
|||
#ifdef BOUNDED_RBX
|
||||
, [old_rbx] "=m" (old_rbx)
|
||||
#endif
|
||||
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
|
||||
: [dst] "m" (dst), [src] "m" (src), [sum] "m" (sum),
|
||||
[dst_step] "im" (dst_step), [src_step] "im" (src_step),
|
||||
[sum_step] "im" (sum_step)
|
||||
: "rsi", "rdi", "edx", "ecx", "eax", "memory", "cc"
|
||||
|
|
|
|||
|
|
@ -484,10 +484,10 @@ static int snd_pcm_dshare_close(snd_pcm_t *pcm)
|
|||
snd_pcm_direct_semaphore_down(dshare, DIRECT_IPC_SEM_CLIENT);
|
||||
dshare->shmptr->u.dshare.chn_mask &= ~dshare->u.dshare.chn_mask;
|
||||
snd_pcm_close(dshare->spcm);
|
||||
if (dshare->server)
|
||||
snd_pcm_direct_server_discard(dshare);
|
||||
if (dshare->client)
|
||||
snd_pcm_direct_client_discard(dshare);
|
||||
if (dshare->server)
|
||||
snd_pcm_direct_server_discard(dshare);
|
||||
if (dshare->client)
|
||||
snd_pcm_direct_client_discard(dshare);
|
||||
if (snd_pcm_direct_shm_discard(dshare)) {
|
||||
if (snd_pcm_direct_semaphore_discard(dshare))
|
||||
snd_pcm_direct_semaphore_final(dshare, DIRECT_IPC_SEM_CLIENT);
|
||||
|
|
@ -667,7 +667,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
assert(pcmp);
|
||||
|
||||
if (stream != SND_PCM_STREAM_PLAYBACK) {
|
||||
SNDERR("The dshare plugin supports only playback stream");
|
||||
snd_error(PCM, "The dshare plugin supports only playback stream");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -698,18 +698,18 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
|
||||
mode | SND_PCM_NONBLOCK, NULL);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to open slave");
|
||||
snd_error(PCM, "unable to open slave");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
|
||||
SNDERR("dshare plugin can be only connected to hw plugin");
|
||||
snd_error(PCM, "dshare plugin can be only connected to hw plugin");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
ret = snd_pcm_direct_initialize_slave(dshare, spcm, params);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to initialize slave");
|
||||
snd_error(PCM, "unable to initialize slave");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
@ -718,7 +718,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (dshare->shmptr->use_server) {
|
||||
ret = snd_pcm_direct_server_create(dshare);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to create server");
|
||||
snd_error(PCM, "unable to create server");
|
||||
goto _err;
|
||||
}
|
||||
}
|
||||
|
|
@ -730,7 +730,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
|
||||
ret = snd_pcm_direct_client_connect(dshare);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to connect client");
|
||||
snd_error(PCM, "unable to connect client");
|
||||
goto _err_nosem;
|
||||
}
|
||||
|
||||
|
|
@ -753,18 +753,18 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
first_instance = 1;
|
||||
goto retry;
|
||||
}
|
||||
SNDERR("unable to open slave");
|
||||
snd_error(PCM, "unable to open slave");
|
||||
goto _err;
|
||||
}
|
||||
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
|
||||
SNDERR("dshare plugin can be only connected to hw plugin");
|
||||
snd_error(PCM, "dshare plugin can be only connected to hw plugin");
|
||||
ret = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
ret = snd_pcm_direct_initialize_secondary_slave(dshare, spcm, params);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to initialize slave");
|
||||
snd_error(PCM, "unable to initialize slave");
|
||||
goto _err;
|
||||
}
|
||||
}
|
||||
|
|
@ -778,7 +778,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
dshare->u.dshare.chn_mask |= (1ULL << dchn);
|
||||
}
|
||||
if (dshare->shmptr->u.dshare.chn_mask & dshare->u.dshare.chn_mask) {
|
||||
SNDERR("destination channel specified in bindings is already used");
|
||||
snd_error(PCM, "destination channel specified in bindings is already used");
|
||||
dshare->u.dshare.chn_mask = 0;
|
||||
ret = -EINVAL;
|
||||
goto _err;
|
||||
|
|
@ -787,7 +787,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
ret = snd_pcm_direct_initialize_poll_fd(dshare);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to initialize poll_fd");
|
||||
snd_error(PCM, "unable to initialize poll_fd");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ static void snd_pcm_dsnoop_sync_area(snd_pcm_t *pcm, snd_pcm_uframes_t slave_hw_
|
|||
size -= transfer;
|
||||
snoop_areas(dsnoop, src_areas, dst_areas, slave_hw_ptr, hw_ptr, transfer);
|
||||
slave_hw_ptr += transfer;
|
||||
slave_hw_ptr %= dsnoop->slave_buffer_size;
|
||||
slave_hw_ptr %= dsnoop->slave_buffer_size;
|
||||
hw_ptr += transfer;
|
||||
hw_ptr %= pcm->buffer_size;
|
||||
}
|
||||
|
|
@ -373,10 +373,10 @@ static int snd_pcm_dsnoop_close(snd_pcm_t *pcm)
|
|||
snd_timer_close(dsnoop->timer);
|
||||
snd_pcm_direct_semaphore_down(dsnoop, DIRECT_IPC_SEM_CLIENT);
|
||||
snd_pcm_close(dsnoop->spcm);
|
||||
if (dsnoop->server)
|
||||
snd_pcm_direct_server_discard(dsnoop);
|
||||
if (dsnoop->client)
|
||||
snd_pcm_direct_client_discard(dsnoop);
|
||||
if (dsnoop->server)
|
||||
snd_pcm_direct_server_discard(dsnoop);
|
||||
if (dsnoop->client)
|
||||
snd_pcm_direct_client_discard(dsnoop);
|
||||
if (snd_pcm_direct_shm_discard(dsnoop)) {
|
||||
if (snd_pcm_direct_semaphore_discard(dsnoop))
|
||||
snd_pcm_direct_semaphore_final(dsnoop, DIRECT_IPC_SEM_CLIENT);
|
||||
|
|
@ -538,7 +538,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
assert(pcmp);
|
||||
|
||||
if (stream != SND_PCM_STREAM_CAPTURE) {
|
||||
SNDERR("The dsnoop plugin supports only capture stream");
|
||||
snd_error(PCM, "The dsnoop plugin supports only capture stream");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -564,18 +564,18 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
ret = snd_pcm_open_slave(&spcm, root, sconf, stream,
|
||||
mode | SND_PCM_NONBLOCK, NULL);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to open slave");
|
||||
snd_error(PCM, "unable to open slave");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
|
||||
SNDERR("dsnoop plugin can be only connected to hw plugin");
|
||||
snd_error(PCM, "dsnoop plugin can be only connected to hw plugin");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
ret = snd_pcm_direct_initialize_slave(dsnoop, spcm, params);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to initialize slave");
|
||||
snd_error(PCM, "unable to initialize slave");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
@ -584,7 +584,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (dsnoop->shmptr->use_server) {
|
||||
ret = snd_pcm_direct_server_create(dsnoop);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to create server");
|
||||
snd_error(PCM, "unable to create server");
|
||||
goto _err;
|
||||
}
|
||||
}
|
||||
|
|
@ -596,7 +596,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_direct_semaphore_up(dsnoop, DIRECT_IPC_SEM_CLIENT);
|
||||
ret = snd_pcm_direct_client_connect(dsnoop);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to connect client");
|
||||
snd_error(PCM, "unable to connect client");
|
||||
goto _err_nosem;
|
||||
}
|
||||
|
||||
|
|
@ -619,18 +619,18 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
first_instance = 1;
|
||||
goto retry;
|
||||
}
|
||||
SNDERR("unable to open slave");
|
||||
snd_error(PCM, "unable to open slave");
|
||||
goto _err;
|
||||
}
|
||||
if (snd_pcm_type(spcm) != SND_PCM_TYPE_HW) {
|
||||
SNDERR("dsnoop plugin can be only connected to hw plugin");
|
||||
snd_error(PCM, "dsnoop plugin can be only connected to hw plugin");
|
||||
ret = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
||||
ret = snd_pcm_direct_initialize_secondary_slave(dsnoop, spcm, params);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to initialize slave");
|
||||
snd_error(PCM, "unable to initialize slave");
|
||||
goto _err;
|
||||
}
|
||||
}
|
||||
|
|
@ -640,7 +640,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
ret = snd_pcm_direct_initialize_poll_fd(dsnoop);
|
||||
if (ret < 0) {
|
||||
SNDERR("unable to initialize poll_fd");
|
||||
snd_error(PCM, "unable to initialize poll_fd");
|
||||
goto _err;
|
||||
}
|
||||
|
||||
|
|
@ -660,7 +660,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
|||
return 0;
|
||||
|
||||
_err:
|
||||
if (dsnoop->timer)
|
||||
if (dsnoop->timer)
|
||||
snd_timer_close(dsnoop->timer);
|
||||
if (dsnoop->server)
|
||||
snd_pcm_direct_server_discard(dsnoop);
|
||||
|
|
|
|||
|
|
@ -77,8 +77,8 @@ pcm.name {
|
|||
* changed in future.
|
||||
*/
|
||||
int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
snd_config_t *root, snd_config_t *conf,
|
||||
snd_pcm_stream_t stream, int mode)
|
||||
{
|
||||
snd_config_t *slave = NULL, *sconf;
|
||||
snd_config_iterator_t i, next;
|
||||
|
|
@ -95,11 +95,11 @@ int _snd_pcm_empty_open(snd_pcm_t **pcmp, const char *name ATTRIBUTE_UNUSED,
|
|||
slave = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
|
||||
|
|
|
|||
|
|
@ -547,12 +547,12 @@ SND_PCM_PLUGIN_DEFINE_FUNC(myplug)
|
|||
....
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (! slave) {
|
||||
SNDERR("No slave defined for myplug");
|
||||
snd_error(PCM, "No slave defined for myplug");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -690,8 +690,9 @@ int snd_pcm_extplug_create(snd_pcm_extplug_t *extplug, const char *name,
|
|||
/* We support 1.0.0 to current */
|
||||
if (extplug->version < 0x010000 ||
|
||||
extplug->version > SND_PCM_EXTPLUG_VERSION) {
|
||||
SNDERR("extplug: Plugin version mismatch: 0x%x",
|
||||
extplug->version);
|
||||
snd_error(PCM, "extplug: Plugin version mismatch: 0x%x",
|
||||
extplug->version);
|
||||
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
|
|
@ -781,7 +782,7 @@ int snd_pcm_extplug_set_slave_param_list(snd_pcm_extplug_t *extplug, int type, u
|
|||
{
|
||||
extplug_priv_t *ext = extplug->pcm->private_data;
|
||||
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
|
||||
SNDERR("EXTPLUG: invalid parameter type %d", type);
|
||||
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
return snd_ext_parm_set_list(&ext->sparams[type], num_list, list);
|
||||
|
|
@ -803,11 +804,11 @@ int snd_pcm_extplug_set_slave_param_minmax(snd_pcm_extplug_t *extplug, int type,
|
|||
{
|
||||
extplug_priv_t *ext = extplug->pcm->private_data;
|
||||
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
|
||||
SNDERR("EXTPLUG: invalid parameter type %d", type);
|
||||
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (is_mask_type(type)) {
|
||||
SNDERR("EXTPLUG: invalid parameter type %d", type);
|
||||
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
return snd_ext_parm_set_minmax(&ext->sparams[type], min, max);
|
||||
|
|
@ -829,7 +830,7 @@ int snd_pcm_extplug_set_param_list(snd_pcm_extplug_t *extplug, int type, unsigne
|
|||
{
|
||||
extplug_priv_t *ext = extplug->pcm->private_data;
|
||||
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
|
||||
SNDERR("EXTPLUG: invalid parameter type %d", type);
|
||||
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
return snd_ext_parm_set_list(&ext->params[type], num_list, list);
|
||||
|
|
@ -851,11 +852,11 @@ int snd_pcm_extplug_set_param_minmax(snd_pcm_extplug_t *extplug, int type, unsig
|
|||
{
|
||||
extplug_priv_t *ext = extplug->pcm->private_data;
|
||||
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
|
||||
SNDERR("EXTPLUG: invalid parameter type %d", type);
|
||||
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (is_mask_type(type)) {
|
||||
SNDERR("EXTPLUG: invalid parameter type %d", type);
|
||||
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
return snd_ext_parm_set_minmax(&ext->params[type], min, max);
|
||||
|
|
@ -877,7 +878,7 @@ int snd_pcm_extplug_set_param_link(snd_pcm_extplug_t *extplug, int type,
|
|||
extplug_priv_t *ext = extplug->pcm->private_data;
|
||||
|
||||
if (type < 0 || type >= SND_PCM_EXTPLUG_HW_PARAMS) {
|
||||
SNDERR("EXTPLUG: invalid parameter type %d", type);
|
||||
snd_error(PCM, "EXTPLUG: invalid parameter type %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
ext->params[type].keep_link = keep_link ? 1 : 0;
|
||||
|
|
|
|||
|
|
@ -239,8 +239,9 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file)
|
|||
/* clearing */
|
||||
pipe = popen(file->final_fname + 1, "w");
|
||||
if (!pipe) {
|
||||
SYSERR("running %s for writing failed",
|
||||
file->final_fname);
|
||||
snd_errornum(PCM, "running %s for writing failed",
|
||||
file->final_fname);
|
||||
|
||||
return -errno;
|
||||
}
|
||||
fd = fileno(pipe);
|
||||
|
|
@ -274,8 +275,9 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file)
|
|||
}
|
||||
}
|
||||
if (fd < 0) {
|
||||
SYSERR("open %s for writing failed",
|
||||
file->final_fname);
|
||||
snd_errornum(PCM, "open %s for writing failed",
|
||||
file->final_fname);
|
||||
|
||||
free(tmpfname);
|
||||
return -errno;
|
||||
}
|
||||
|
|
@ -303,7 +305,7 @@ static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm,
|
|||
return -ENOMEM;
|
||||
|
||||
if (file->rbuf_size < frames) {
|
||||
SYSERR("requested more frames than pcm buffer");
|
||||
snd_errornum(PCM, "requested more frames than pcm buffer");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +314,7 @@ static int snd_pcm_file_areas_read_infile(snd_pcm_t *pcm,
|
|||
return bytes;
|
||||
bytes = read(file->ifd, file->rbuf, bytes);
|
||||
if (bytes < 0) {
|
||||
SYSERR("read from file failed, error: %d", bytes);
|
||||
snd_errornum(PCM, "read from file failed, error: %d", bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
|
@ -376,9 +378,9 @@ write_error:
|
|||
* be used to signal XRUN on playback device
|
||||
*/
|
||||
if (res < 0)
|
||||
SYSERR("%s write header failed, file data may be corrupt", file->fname);
|
||||
snd_errornum(PCM, "%s write header failed, file data may be corrupt", file->fname);
|
||||
else
|
||||
SNDERR("%s write header incomplete, file data may be corrupt", file->fname);
|
||||
snd_error(PCM, "%s write header incomplete, file data may be corrupt", file->fname);
|
||||
|
||||
memset(&file->wav_header, 0, sizeof(struct wav_fmt));
|
||||
|
||||
|
|
@ -440,7 +442,7 @@ static int snd_pcm_file_write_bytes(snd_pcm_t *pcm, size_t bytes)
|
|||
if (err < 0) {
|
||||
file->wbuf_used_bytes = 0;
|
||||
file->file_ptr_bytes = 0;
|
||||
SYSERR("%s write failed, file data may be corrupt", file->fname);
|
||||
snd_errornum(PCM, "%s write failed, file data may be corrupt", file->fname);
|
||||
return err;
|
||||
}
|
||||
bytes -= err;
|
||||
|
|
@ -688,7 +690,7 @@ static snd_pcm_sframes_t snd_pcm_file_readn(snd_pcm_t *pcm, void **bufs, snd_pcm
|
|||
}
|
||||
|
||||
static snd_pcm_sframes_t snd_pcm_file_mmap_commit(snd_pcm_t *pcm,
|
||||
snd_pcm_uframes_t offset,
|
||||
snd_pcm_uframes_t offset,
|
||||
snd_pcm_uframes_t size)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private_data;
|
||||
|
|
@ -791,7 +793,7 @@ static int snd_pcm_file_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
if (file->fd < 0) {
|
||||
err = snd_pcm_file_open_output_file(file);
|
||||
if (err < 0) {
|
||||
SYSERR("failed opening output file %s", file->fname);
|
||||
snd_errornum(PCM, "failed opening output file %s", file->fname);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -914,7 +916,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
else if (!strcmp(fmt, "wav"))
|
||||
format = SND_PCM_FILE_FORMAT_WAV;
|
||||
else {
|
||||
SNDERR("file format %s is unknown", fmt);
|
||||
snd_error(PCM, "file format %s is unknown", fmt);
|
||||
return -EINVAL;
|
||||
}
|
||||
file = calloc(1, sizeof(snd_pcm_file_t));
|
||||
|
|
@ -932,7 +934,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (ifname && (stream == SND_PCM_STREAM_CAPTURE)) {
|
||||
ifd = open(ifname, O_RDONLY); /* TODO: mind blocking mode */
|
||||
if (ifd < 0) {
|
||||
SYSERR("open %s for reading failed", ifname);
|
||||
snd_errornum(PCM, "open %s for reading failed", ifname);
|
||||
free(file->fname);
|
||||
free(file);
|
||||
return -errno;
|
||||
|
|
@ -980,14 +982,14 @@ to a command, and optionally uses an existing file as an input data source
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type file # File PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
type file # File PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
file STR # Output filename (or shell command the stream
|
||||
# will be piped to if STR starts with the pipe
|
||||
# char).
|
||||
|
|
@ -1057,7 +1059,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "format") == 0) {
|
||||
err = snd_config_get_string(n, &format);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1067,7 +1069,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (err < 0) {
|
||||
err = snd_config_get_integer(n, &fd);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
|
@ -1078,7 +1080,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (err < 0) {
|
||||
err = snd_config_get_integer(n, &ifd);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
|
@ -1087,11 +1089,11 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "perm") == 0) {
|
||||
err = snd_config_get_integer(n, &perm);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return err;
|
||||
}
|
||||
if ((perm & ~0777) != 0) {
|
||||
SNDERR("The field perm must be a valid file permission");
|
||||
snd_error(PCM, "The field perm must be a valid file permission");
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1103,7 +1105,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
trunc = err;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!format) {
|
||||
|
|
@ -1112,13 +1114,13 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (snd_config_search(root, "defaults.pcm.file_format", &n) >= 0) {
|
||||
err = snd_config_get_string(n, &format);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid file format");
|
||||
snd_error(PCM, "Invalid file format");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
|
||||
|
|
@ -1126,7 +1128,7 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
return err;
|
||||
if ((!fname || strlen(fname) == 0) && fd < 0) {
|
||||
snd_config_delete(sconf);
|
||||
SNDERR("file is not defined");
|
||||
snd_error(PCM, "file is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
|
||||
|
|
|
|||
|
|
@ -283,9 +283,9 @@ pcm.NAME {
|
|||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
hooks {
|
||||
ID STR # Hook name (see pcm_hook)
|
||||
|
|
@ -350,7 +350,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
void *h = NULL;
|
||||
|
||||
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid hook definition");
|
||||
snd_error(PCM, "Invalid hook definition");
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_config_for_each(i, next, conf) {
|
||||
|
|
@ -368,27 +368,27 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
args = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!type) {
|
||||
SNDERR("type is not defined");
|
||||
snd_error(PCM, "type is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_get_id(type, &id);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to get id");
|
||||
snd_error(PCM, "unable to get id");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_string(type, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return err;
|
||||
}
|
||||
err = snd_config_search_definition(root, "pcm_hook_type", str, &type);
|
||||
if (err >= 0) {
|
||||
if (snd_config_get_type(type) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for PCM type %s definition", str);
|
||||
snd_error(PCM, "Invalid type for PCM type %s definition", str);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -402,7 +402,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
if (strcmp(id, "lib") == 0) {
|
||||
err = snd_config_get_string(n, &lib);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -410,12 +410,12 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
if (strcmp(id, "install") == 0) {
|
||||
err = snd_config_get_string(n, &install);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -428,12 +428,14 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
install_func = h ? snd_dlsym(h, install, SND_DLSYM_VERSION(SND_PCM_DLSYM_VERSION)) : NULL;
|
||||
err = 0;
|
||||
if (!h) {
|
||||
SNDERR("Cannot open shared library %s (%s)",
|
||||
lib ? lib : "[builtin]", errbuf);
|
||||
snd_error(PCM, "Cannot open shared library %s (%s)",
|
||||
lib ? lib : "[builtin]", errbuf);
|
||||
|
||||
err = -ENOENT;
|
||||
} else if (!install_func) {
|
||||
SNDERR("symbol %s is not defined inside %s", install,
|
||||
lib ? lib : "[builtin]");
|
||||
snd_error(PCM, "symbol %s is not defined inside %s", install,
|
||||
lib ? lib : "[builtin]");
|
||||
|
||||
snd_dlclose(h);
|
||||
err = -ENXIO;
|
||||
}
|
||||
|
|
@ -446,7 +448,7 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
|
|||
if (args && snd_config_get_string(args, &str) >= 0) {
|
||||
err = snd_config_search_definition(root, "hook_args", str, &args);
|
||||
if (err < 0)
|
||||
SNDERR("unknown hook_args %s", str);
|
||||
snd_error(PCM, "unknown hook_args %s", str);
|
||||
else
|
||||
err = install_func(pcm, args);
|
||||
snd_config_delete(args);
|
||||
|
|
@ -499,17 +501,17 @@ int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
if (strcmp(id, "hooks") == 0) {
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
hooks = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
|
||||
|
|
@ -532,7 +534,7 @@ int _snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (snd_config_get_string(n, &str) >= 0) {
|
||||
err = snd_config_search_definition(root, "pcm_hook", str, &n);
|
||||
if (err < 0) {
|
||||
SNDERR("unknown pcm_hook %s", str);
|
||||
snd_error(PCM, "unknown pcm_hook %s", str);
|
||||
} else {
|
||||
err = snd_pcm_hook_add_conf(rpcm, root, n);
|
||||
snd_config_delete(n);
|
||||
|
|
@ -681,13 +683,13 @@ int _snd_pcm_hook_ctl_elems_install(snd_pcm_t *pcm, snd_config_t *conf)
|
|||
return err;
|
||||
card = snd_pcm_info_get_card(&info);
|
||||
if (card < 0) {
|
||||
SNDERR("No card for this PCM");
|
||||
snd_error(PCM, "No card for this PCM");
|
||||
return -EINVAL;
|
||||
}
|
||||
sprintf(ctl_name, "hw:%d", card);
|
||||
err = snd_ctl_open(&ctl, ctl_name, 0);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot open CTL %s", ctl_name);
|
||||
snd_error(PCM, "Cannot open CTL %s", ctl_name);
|
||||
return err;
|
||||
}
|
||||
err = snd_config_imake_pointer(&pcm_conf, "pcm_handle", pcm);
|
||||
|
|
|
|||
162
src/pcm/pcm_hw.c
162
src/pcm/pcm_hw.c
|
|
@ -145,7 +145,7 @@ static int sync_ptr1(snd_pcm_hw_t *hw, unsigned int flags)
|
|||
hw->sync_ptr->flags = flags;
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SYNC_PTR, hw->sync_ptr) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_SYNC_PTR failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_SYNC_PTR failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -268,7 +268,7 @@ static int snd_pcm_hw_nonblock(snd_pcm_t *pcm, int nonblock)
|
|||
|
||||
if ((flags = fcntl(fd, F_GETFL)) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("F_GETFL failed (%i)", err);
|
||||
snd_checknum(PCM, "F_GETFL failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
if (nonblock)
|
||||
|
|
@ -277,7 +277,7 @@ static int snd_pcm_hw_nonblock(snd_pcm_t *pcm, int nonblock)
|
|||
flags &= ~O_NONBLOCK;
|
||||
if (fcntl(fd, F_SETFL, flags) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("F_SETFL for O_NONBLOCK failed (%i)", err);
|
||||
snd_checknum(PCM, "F_SETFL for O_NONBLOCK failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -291,7 +291,7 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
|||
|
||||
if ((flags = fcntl(fd, F_GETFL)) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("F_GETFL failed (%i)", err);
|
||||
snd_checknum(PCM, "F_GETFL failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
if (sig >= 0)
|
||||
|
|
@ -300,19 +300,19 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
|||
flags &= ~O_ASYNC;
|
||||
if (fcntl(fd, F_SETFL, flags) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("F_SETFL for O_ASYNC failed (%i)", err);
|
||||
snd_checknum(PCM, "F_SETFL for O_ASYNC failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
if (sig < 0)
|
||||
return 0;
|
||||
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("F_SETSIG failed (%i)", err);
|
||||
snd_checknum(PCM, "F_SETSIG failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("F_SETOWN failed (%i)", err);
|
||||
snd_checknum(PCM, "F_SETOWN failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -324,7 +324,7 @@ static int snd_pcm_hw_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
|||
int fd = hw->fd, err;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, info) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_INFO failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_INFO failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
/* may be configurable (optional) */
|
||||
|
|
@ -379,8 +379,10 @@ static int snd_pcm_hw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef DOC_HIDDEN
|
||||
#define hw_param_mask(params,var) \
|
||||
&((params)->masks[(var) - SND_PCM_HW_PARAM_FIRST_MASK])
|
||||
#endif
|
||||
|
||||
static int hw_params_call(snd_pcm_hw_t *pcm_hw, snd_pcm_hw_params_t *params)
|
||||
{
|
||||
|
|
@ -409,7 +411,7 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
int err;
|
||||
if (hw_params_call(hw, params) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_HW_PARAMS failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_HW_PARAMS failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
params->info &= ~0xf0000000;
|
||||
|
|
@ -456,7 +458,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
|
|||
return -EINVAL;
|
||||
}
|
||||
hw->period_timer_pfd.events = POLLIN;
|
||||
hw->period_timer_pfd.revents = 0;
|
||||
hw->period_timer_pfd.revents = 0;
|
||||
snd_timer_poll_descriptors(hw->period_timer,
|
||||
&hw->period_timer_pfd, 1);
|
||||
hw->period_timer_need_poll = 0;
|
||||
|
|
@ -473,7 +475,7 @@ static int snd_pcm_hw_change_timer(snd_pcm_t *pcm, int enable)
|
|||
* In older versions, check via poll before read() is
|
||||
* needed because of the confliction between
|
||||
* TIMER_START and FIONBIO ioctls.
|
||||
*/
|
||||
*/
|
||||
if (ver < SNDRV_PROTOCOL_VERSION(2, 0, 4))
|
||||
hw->period_timer_need_poll = 1;
|
||||
/*
|
||||
|
|
@ -515,7 +517,7 @@ static int snd_pcm_hw_hw_free(snd_pcm_t *pcm)
|
|||
snd_pcm_hw_change_timer(pcm, 0);
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_HW_FREE) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_HW_FREE failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_HW_FREE failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -541,19 +543,19 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
|||
}
|
||||
if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW &&
|
||||
hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) {
|
||||
SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW");
|
||||
snd_checknum(PCM, "Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW");
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC &&
|
||||
hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 5)) {
|
||||
SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC");
|
||||
snd_checknum(PCM, "Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC");
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_SW_PARAMS, params) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
|
||||
goto out;
|
||||
}
|
||||
hw->prepare_reset_sw_params = false;
|
||||
|
|
@ -563,7 +565,7 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
|||
SND_PCM_TSTAMP_TYPE_MONOTONIC;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
|
||||
err = -errno;
|
||||
SNDMSG("TSTAMP failed");
|
||||
snd_check(PCM, "TSTAMP failed");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
|
@ -589,7 +591,7 @@ static int snd_pcm_hw_channel_info(snd_pcm_t *pcm, snd_pcm_channel_info_t * info
|
|||
i.channel = info->channel;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_CHANNEL_INFO, &i) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_CHANNEL_INFO failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_CHANNEL_INFO failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
info->channel = i.channel;
|
||||
|
|
@ -609,13 +611,13 @@ static int snd_pcm_hw_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|||
if (SNDRV_PROTOCOL_VERSION(2, 0, 13) > hw->version) {
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_STATUS, status) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_STATUS failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_STATUS failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_STATUS_EXT, status) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_STATUS_EXT failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_STATUS_EXT failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -642,7 +644,7 @@ static int snd_pcm_hw_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
|
|||
int fd = hw->fd, err;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_DELAY, delayp) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_DELAY failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_DELAY failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -660,7 +662,7 @@ static int snd_pcm_hw_hwsync(snd_pcm_t *pcm)
|
|||
} else {
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_HWSYNC) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_HWSYNC failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_HWSYNC failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -690,14 +692,14 @@ static int snd_pcm_hw_prepare(snd_pcm_t *pcm)
|
|||
snd_pcm_sw_params_current_no_lock(pcm, &sw_params);
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sw_params) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
hw->prepare_reset_sw_params = false;
|
||||
}
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_PREPARE) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_PREPARE failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_PREPARE failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
return query_status_and_control_data(hw);
|
||||
|
|
@ -709,7 +711,7 @@ static int snd_pcm_hw_reset(snd_pcm_t *pcm)
|
|||
int fd = hw->fd, err;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_RESET) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_RESET failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_RESET failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
return query_status_and_control_data(hw);
|
||||
|
|
@ -726,10 +728,10 @@ static int snd_pcm_hw_start(snd_pcm_t *pcm)
|
|||
issue_applptr(hw);
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_START) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_START failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_START failed (%i)", err);
|
||||
#if 0
|
||||
if (err == -EBADFD)
|
||||
SNDERR("PCM state = %s", snd_pcm_state_name(snd_pcm_hw_state(pcm)));
|
||||
snd_error(PCM, "PCM state = %s", snd_pcm_state_name(snd_pcm_hw_state(pcm)));
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
|
@ -742,7 +744,7 @@ static int snd_pcm_hw_drop(snd_pcm_t *pcm)
|
|||
int err;
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_DROP) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_DROP failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_DROP failed (%i)", err);
|
||||
return err;
|
||||
} else {
|
||||
}
|
||||
|
|
@ -792,7 +794,7 @@ __manual_silence:
|
|||
sw_params.silence_size = silence_size;
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sw_params) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
hw->prepare_reset_sw_params = true;
|
||||
|
|
@ -800,7 +802,7 @@ __manual_silence:
|
|||
__skip_silence:
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_DRAIN) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_DRAIN failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_DRAIN failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -812,7 +814,7 @@ static int snd_pcm_hw_pause(snd_pcm_t *pcm, int enable)
|
|||
int err;
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_PAUSE, enable) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_PAUSE failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_PAUSE failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -829,7 +831,7 @@ static snd_pcm_sframes_t snd_pcm_hw_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t fra
|
|||
int err;
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_REWIND, &frames) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_REWIND failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_REWIND failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
err = query_status_and_control_data(hw);
|
||||
|
|
@ -850,7 +852,7 @@ static snd_pcm_sframes_t snd_pcm_hw_forward(snd_pcm_t *pcm, snd_pcm_uframes_t fr
|
|||
if (SNDRV_PROTOCOL_VERSION(2, 0, 4) <= hw->version) {
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_FORWARD, &frames) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_FORWARD failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_FORWARD failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
err = query_status_and_control_data(hw);
|
||||
|
|
@ -887,7 +889,7 @@ static int snd_pcm_hw_resume(snd_pcm_t *pcm)
|
|||
int fd = hw->fd, err;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_RESUME) < 0) {
|
||||
err = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_RESUME failed (%i)", err);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_RESUME failed (%i)", err);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -898,7 +900,7 @@ static int hw_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
|
|||
snd_pcm_hw_t *hw1 = pcm1->private_data;
|
||||
snd_pcm_hw_t *hw2 = pcm2->private_data;
|
||||
if (ioctl(hw1->fd, SNDRV_PCM_IOCTL_LINK, hw2->fd) < 0) {
|
||||
SYSMSG("SNDRV_PCM_IOCTL_LINK failed (%i)", -errno);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_LINK failed (%i)", -errno);
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -907,7 +909,7 @@ static int hw_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2)
|
|||
static int snd_pcm_hw_link_slaves(snd_pcm_t *pcm, snd_pcm_t *master)
|
||||
{
|
||||
if (master->type != SND_PCM_TYPE_HW) {
|
||||
SYSMSG("Invalid type for SNDRV_PCM_IOCTL_LINK (%i)", master->type);
|
||||
snd_checknum(PCM, "Invalid type for SNDRV_PCM_IOCTL_LINK (%i)", master->type);
|
||||
return -EINVAL;
|
||||
}
|
||||
return hw_link(master, pcm);
|
||||
|
|
@ -928,7 +930,7 @@ static int snd_pcm_hw_unlink(snd_pcm_t *pcm)
|
|||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
|
||||
if (ioctl(hw->fd, SNDRV_PCM_IOCTL_UNLINK) < 0) {
|
||||
SYSMSG("SNDRV_PCM_IOCTL_UNLINK failed (%i)", -errno);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_UNLINK failed (%i)", -errno);
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1128,7 +1130,7 @@ static void unmap_status_data(snd_pcm_hw_t *hw)
|
|||
if (!hw->mmap_status_fallbacked) {
|
||||
if (munmap((void *)hw->mmap_status,
|
||||
page_align(sizeof(*hw->mmap_status))) < 0)
|
||||
SYSMSG("status munmap failed (%u)", errno);
|
||||
snd_checknum(PCM, "status munmap failed (%u)", errno);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1137,7 +1139,7 @@ static void unmap_control_data(snd_pcm_hw_t *hw)
|
|||
if (!hw->mmap_control_fallbacked) {
|
||||
if (munmap((void *)hw->mmap_control,
|
||||
page_align(sizeof(*hw->mmap_control))) < 0)
|
||||
SYSMSG("control munmap failed (%u)", errno);
|
||||
snd_checknum(PCM, "control munmap failed (%u)", errno);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1172,7 +1174,7 @@ static int snd_pcm_hw_close(snd_pcm_t *pcm)
|
|||
int err = 0;
|
||||
if (close(hw->fd)) {
|
||||
err = -errno;
|
||||
SYSMSG("close failed (%i)", err);
|
||||
snd_checknum(PCM, "close failed (%i)", err);
|
||||
}
|
||||
|
||||
unmap_status_and_control_data(hw);
|
||||
|
|
@ -1295,7 +1297,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
|
|||
|
||||
ret = snd_ctl_hw_open(&ctl, NULL, card, 0);
|
||||
if (ret < 0) {
|
||||
SYSMSG("Cannot open the associated CTL");
|
||||
snd_checknum(PCM, "Cannot open the associated CTL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1303,7 +1305,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
|
|||
ret = snd_ctl_elem_tlv_read(ctl, &id, tlv, sizeof(tlv));
|
||||
snd_ctl_close(ctl);
|
||||
if (ret < 0) {
|
||||
SYSMSG("Cannot read Channel Map TLV");
|
||||
snd_checknum(PCM, "Cannot read Channel Map TLV");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -1317,7 +1319,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
|
|||
type = tlv[SNDRV_CTL_TLVO_TYPE];
|
||||
if (type != SND_CTL_TLVT_CONTAINER) {
|
||||
if (!is_chmap_type(type)) {
|
||||
SYSMSG("Invalid TLV type %d", type);
|
||||
snd_checknum(PCM, "Invalid TLV type %d", type);
|
||||
return NULL;
|
||||
}
|
||||
start = tlv;
|
||||
|
|
@ -1330,7 +1332,7 @@ snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev,
|
|||
nums = 0;
|
||||
for (p = start; size > 0; ) {
|
||||
if (!is_chmap_type(p[0])) {
|
||||
SYSMSG("Invalid TLV type %d", p[0]);
|
||||
snd_checknum(PCM, "Invalid TLV type %d", p[0]);
|
||||
return NULL;
|
||||
}
|
||||
nums++;
|
||||
|
|
@ -1421,8 +1423,9 @@ static snd_pcm_chmap_t *snd_pcm_hw_get_chmap(snd_pcm_t *pcm)
|
|||
case SNDRV_PCM_STATE_SUSPENDED:
|
||||
break;
|
||||
default:
|
||||
SYSMSG("Invalid PCM state for chmap_get: %s",
|
||||
snd_pcm_state_name(FAST_PCM_STATE(hw)));
|
||||
snd_checknum(PCM, "Invalid PCM state for chmap_get: %s",
|
||||
snd_pcm_state_name(FAST_PCM_STATE(hw)));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
map = malloc(pcm->channels * sizeof(map->pos[0]) + sizeof(*map));
|
||||
|
|
@ -1432,7 +1435,7 @@ static snd_pcm_chmap_t *snd_pcm_hw_get_chmap(snd_pcm_t *pcm)
|
|||
ret = snd_ctl_hw_open(&ctl, NULL, hw->card, 0);
|
||||
if (ret < 0) {
|
||||
free(map);
|
||||
SYSMSG("Cannot open the associated CTL");
|
||||
snd_checknum(PCM, "Cannot open the associated CTL");
|
||||
chmap_caps_set_error(hw, CHMAP_CTL_GET);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1442,7 +1445,7 @@ static snd_pcm_chmap_t *snd_pcm_hw_get_chmap(snd_pcm_t *pcm)
|
|||
snd_ctl_close(ctl);
|
||||
if (ret < 0) {
|
||||
free(map);
|
||||
SYSMSG("Cannot read Channel Map ctl");
|
||||
snd_checknum(PCM, "Cannot read Channel Map ctl");
|
||||
chmap_caps_set_error(hw, CHMAP_CTL_GET);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1468,17 +1471,18 @@ static int snd_pcm_hw_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
|
|||
return -ENXIO;
|
||||
|
||||
if (map->channels > 128) {
|
||||
SYSMSG("Invalid number of channels %d", map->channels);
|
||||
snd_checknum(PCM, "Invalid number of channels %d", map->channels);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (FAST_PCM_STATE(hw) != SNDRV_PCM_STATE_PREPARED) {
|
||||
SYSMSG("Invalid PCM state for chmap_set: %s",
|
||||
snd_pcm_state_name(FAST_PCM_STATE(hw)));
|
||||
snd_checknum(PCM, "Invalid PCM state for chmap_set: %s",
|
||||
snd_pcm_state_name(FAST_PCM_STATE(hw)));
|
||||
|
||||
return -EBADFD;
|
||||
}
|
||||
ret = snd_ctl_hw_open(&ctl, NULL, hw->card, 0);
|
||||
if (ret < 0) {
|
||||
SYSMSG("Cannot open the associated CTL");
|
||||
snd_checknum(PCM, "Cannot open the associated CTL");
|
||||
chmap_caps_set_error(hw, CHMAP_CTL_SET);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1496,7 +1500,7 @@ static int snd_pcm_hw_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
|
|||
ret = -ENXIO;
|
||||
}
|
||||
if (ret < 0)
|
||||
SYSMSG("Cannot write Channel Map ctl");
|
||||
snd_checknum(PCM, "Cannot write Channel Map ctl");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1506,7 +1510,7 @@ static void snd_pcm_hw_dump(snd_pcm_t *pcm, snd_output_t *out)
|
|||
char *name;
|
||||
int err = snd_card_get_name(hw->card, &name);
|
||||
if (err < 0) {
|
||||
SNDERR("cannot get card name");
|
||||
snd_error(PCM, "cannot get card name");
|
||||
return;
|
||||
}
|
||||
snd_output_printf(out, "Hardware PCM card %d '%s' device %d subdevice %d\n",
|
||||
|
|
@ -1627,7 +1631,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
|
|||
memset(&info, 0, sizeof(info));
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, &info) < 0) {
|
||||
ret = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
|
||||
close(fd);
|
||||
return ret;
|
||||
|
||||
|
|
@ -1648,7 +1652,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
|
|||
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_PVERSION, &ver) < 0) {
|
||||
ret = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_PVERSION failed (%i)", ret);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_PVERSION failed (%i)", ret);
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1660,7 +1664,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
|
|||
unsigned int user_ver = SNDRV_PCM_VERSION;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_USER_PVERSION, &user_ver) < 0) {
|
||||
ret = -errno;
|
||||
SNDMSG("USER_PVERSION failed");
|
||||
snd_check(PCM, "USER_PVERSION failed");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -1673,7 +1677,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
|
|||
int on = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_TTSTAMP, &on) < 0) {
|
||||
ret = -errno;
|
||||
SNDMSG("TTSTAMP failed");
|
||||
snd_check(PCM, "TTSTAMP failed");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -1685,7 +1689,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, int fd,
|
|||
int on = 1;
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
|
||||
ret = -errno;
|
||||
SNDMSG("TSTAMP failed");
|
||||
snd_check(PCM, "TSTAMP failed");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -1777,13 +1781,13 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
filefmt = SNDRV_FILE_PCM_STREAM_CAPTURE;
|
||||
break;
|
||||
default:
|
||||
SNDERR("invalid stream %d", stream);
|
||||
snd_error(PCM, "invalid stream %d", stream);
|
||||
return -EINVAL;
|
||||
}
|
||||
sprintf(filename, filefmt, card, device);
|
||||
|
||||
__again:
|
||||
if (attempt++ > 3) {
|
||||
if (attempt++ > 3) {
|
||||
ret = -EBUSY;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -1800,14 +1804,14 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
fd = snd_open_device(filename, fmode);
|
||||
if (fd < 0) {
|
||||
ret = -errno;
|
||||
SYSMSG("open '%s' failed (%i)", filename, ret);
|
||||
snd_checknum(PCM, "open '%s' failed (%i)", filename, ret);
|
||||
goto _err;
|
||||
}
|
||||
if (subdevice >= 0) {
|
||||
memset(&info, 0, sizeof(info));
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, &info) < 0) {
|
||||
ret = -errno;
|
||||
SYSMSG("SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
|
||||
snd_checknum(PCM, "SNDRV_PCM_IOCTL_INFO failed (%i)", ret);
|
||||
goto _err;
|
||||
}
|
||||
if (info.subdevice != (unsigned int) subdevice) {
|
||||
|
|
@ -1915,7 +1919,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "device") == 0) {
|
||||
err = snd_config_get_integer(n, &device);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto fail;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1923,7 +1927,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "subdevice") == 0) {
|
||||
err = snd_config_get_integer(n, &subdevice);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto fail;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1949,12 +1953,12 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_config_t *m;
|
||||
err = snd_config_search(n, "0", &m);
|
||||
if (err < 0) {
|
||||
SNDERR("array expected for rate compound");
|
||||
snd_error(PCM, "array expected for rate compound");
|
||||
goto fail;
|
||||
}
|
||||
err = snd_config_get_integer(m, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for rate.0");
|
||||
snd_error(PCM, "Invalid type for rate.0");
|
||||
goto fail;
|
||||
}
|
||||
min_rate = max_rate = val;
|
||||
|
|
@ -1962,7 +1966,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (err >= 0) {
|
||||
err = snd_config_get_integer(m, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for rate.0");
|
||||
snd_error(PCM, "Invalid type for rate.0");
|
||||
goto fail;
|
||||
}
|
||||
max_rate = val;
|
||||
|
|
@ -1970,7 +1974,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
} else {
|
||||
err = snd_config_get_integer(n, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto fail;
|
||||
}
|
||||
min_rate = max_rate = val;
|
||||
|
|
@ -1981,7 +1985,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
long val;
|
||||
err = snd_config_get_integer(n, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto fail;
|
||||
}
|
||||
min_rate = val;
|
||||
|
|
@ -1991,7 +1995,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
long val;
|
||||
err = snd_config_get_integer(n, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto fail;
|
||||
}
|
||||
max_rate = val;
|
||||
|
|
@ -2000,7 +2004,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "format") == 0) {
|
||||
err = snd_config_get_string(n, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("invalid type for %s", id);
|
||||
snd_error(PCM, "invalid type for %s", id);
|
||||
goto fail;
|
||||
}
|
||||
format = snd_pcm_format_value(str);
|
||||
|
|
@ -2010,7 +2014,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
long val;
|
||||
err = snd_config_get_integer(n, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto fail;
|
||||
}
|
||||
channels = val;
|
||||
|
|
@ -2020,7 +2024,7 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_free_chmaps(chmap);
|
||||
chmap = _snd_pcm_parse_config_chmaps(n);
|
||||
if (!chmap) {
|
||||
SNDERR("Invalid channel map for %s", id);
|
||||
snd_error(PCM, "Invalid channel map for %s", id);
|
||||
err = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -2030,23 +2034,23 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
long val;
|
||||
err = snd_config_get_integer(n, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto fail;
|
||||
}
|
||||
drain_silence = val;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
err = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
if (card < 0) {
|
||||
SNDERR("card is not defined");
|
||||
snd_error(PCM, "card is not defined");
|
||||
err = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
if ((min_rate < 0) || (max_rate < min_rate)) {
|
||||
SNDERR("min_rate - max_rate configuration invalid");
|
||||
snd_error(PCM, "min_rate - max_rate configuration invalid");
|
||||
err = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -2083,8 +2087,8 @@ int _snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name,
|
|||
return 0;
|
||||
|
||||
fail:
|
||||
snd_pcm_free_chmaps(chmap);
|
||||
return err;
|
||||
snd_pcm_free_chmaps(chmap);
|
||||
return err;
|
||||
}
|
||||
|
||||
#ifndef DOC_HIDDEN
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo
|
|||
snd_pcm_t *slave, int close_slave,
|
||||
const unsigned char *status_bits,
|
||||
const unsigned char *preamble_vals,
|
||||
int hdmi_mode)
|
||||
int hdmi_mode)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
snd_pcm_iec958_t *iec;
|
||||
|
|
@ -638,14 +638,14 @@ This plugin converts 32bit IEC958 subframe samples to linear, or linear to
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type iec958 # IEC958 subframe conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
type iec958 # IEC958 subframe conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
[status status-bytes] # IEC958 status bits (given in byte array)
|
||||
# IEC958 preamble bits definitions
|
||||
# B/M/W or Z/X/Y, B = block start, M = even subframe, W = odd subframe
|
||||
|
|
@ -712,7 +712,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
if (strcmp(id, "status") == 0) {
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
status = n;
|
||||
|
|
@ -720,7 +720,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
if (strcmp(id, "preamble") == 0) {
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
preamble = n;
|
||||
|
|
@ -733,7 +733,7 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
hdmi_mode = err;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
memset(status_bits, 0, sizeof(status_bits));
|
||||
|
|
@ -744,12 +744,12 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
long val;
|
||||
snd_config_t *n = snd_config_iterator_entry(i);
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_INTEGER) {
|
||||
SNDERR("invalid IEC958 status bits");
|
||||
snd_error(PCM, "invalid IEC958 status bits");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_get_integer(n, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("invalid IEC958 status bits");
|
||||
snd_error(PCM, "invalid IEC958 status bits");
|
||||
return err;
|
||||
}
|
||||
status_bits[bytes] = val;
|
||||
|
|
@ -775,19 +775,19 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
else if (strcmp(id, "w") == 0 || strcmp(id, "y") == 0)
|
||||
idx = PREAMBLE_Y;
|
||||
else {
|
||||
SNDERR("invalid IEC958 preamble type %s", id);
|
||||
snd_error(PCM, "invalid IEC958 preamble type %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_get_integer(n, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("invalid IEC958 preamble value");
|
||||
snd_error(PCM, "invalid IEC958 preamble value");
|
||||
return err;
|
||||
}
|
||||
preamble_vals[idx] = val;
|
||||
}
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
|
||||
|
|
@ -797,8 +797,8 @@ int _snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (snd_pcm_format_linear(sformat) != 1 &&
|
||||
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_LE &&
|
||||
sformat != SND_PCM_FORMAT_IEC958_SUBFRAME_BE) {
|
||||
snd_config_delete(sconf);
|
||||
SNDERR("invalid slave format");
|
||||
snd_config_delete(sconf);
|
||||
snd_error(PCM, "invalid slave format");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
|
||||
|
|
|
|||
|
|
@ -1086,8 +1086,9 @@ int snd_pcm_ioplug_create(snd_pcm_ioplug_t *ioplug, const char *name,
|
|||
/* We support 1.0.0 to current */
|
||||
if (ioplug->version < 0x010000 ||
|
||||
ioplug->version > SND_PCM_IOPLUG_VERSION) {
|
||||
SNDERR("ioplug: Plugin version mismatch: 0x%x",
|
||||
ioplug->version);
|
||||
snd_error(PCM, "ioplug: Plugin version mismatch: 0x%x",
|
||||
ioplug->version);
|
||||
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
|
|
@ -1156,7 +1157,7 @@ int snd_pcm_ioplug_set_param_list(snd_pcm_ioplug_t *ioplug, int type, unsigned i
|
|||
{
|
||||
ioplug_priv_t *io = ioplug->pcm->private_data;
|
||||
if (type < 0 || type >= SND_PCM_IOPLUG_HW_PARAMS) {
|
||||
SNDERR("IOPLUG: invalid parameter type %d", type);
|
||||
snd_error(PCM, "IOPLUG: invalid parameter type %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (type == SND_PCM_IOPLUG_HW_PERIODS)
|
||||
|
|
@ -1180,11 +1181,11 @@ int snd_pcm_ioplug_set_param_minmax(snd_pcm_ioplug_t *ioplug, int type, unsigned
|
|||
{
|
||||
ioplug_priv_t *io = ioplug->pcm->private_data;
|
||||
if (type < 0 || type >= SND_PCM_IOPLUG_HW_PARAMS) {
|
||||
SNDERR("IOPLUG: invalid parameter type %d", type);
|
||||
snd_error(PCM, "IOPLUG: invalid parameter type %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (type == SND_PCM_IOPLUG_HW_ACCESS || type == SND_PCM_IOPLUG_HW_FORMAT) {
|
||||
SNDERR("IOPLUG: invalid parameter type %d", type);
|
||||
snd_error(PCM, "IOPLUG: invalid parameter type %d", type);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (type == SND_PCM_IOPLUG_HW_PERIODS)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -429,15 +429,15 @@ match for both of them.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type lfloat # Linear<->Float conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
format STR # Slave format
|
||||
}
|
||||
type lfloat # Linear<->Float conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
format STR # Slave format
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -483,11 +483,11 @@ int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
|
|||
slave = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
|
||||
|
|
@ -497,7 +497,7 @@ int _snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (snd_pcm_format_linear(sformat) != 1 &&
|
||||
snd_pcm_format_float(sformat) != 1) {
|
||||
snd_config_delete(sconf);
|
||||
SNDERR("slave format is not linear integer or linear float");
|
||||
snd_error(PCM, "slave format is not linear integer or linear float");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
|
||||
|
|
@ -521,7 +521,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
|
|||
snd_pcm_t *slave ATTRIBUTE_UNUSED,
|
||||
int close_slave ATTRIBUTE_UNUSED)
|
||||
{
|
||||
SNDERR("please, upgrade your GCC to use lfloat plugin");
|
||||
snd_error(PCM, "please, upgrade your GCC to use lfloat plugin");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -532,7 +532,7 @@ int _snd_pcm_lfloat_open(snd_pcm_t **pcmp ATTRIBUTE_UNUSED,
|
|||
snd_pcm_stream_t stream ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
SNDERR("please, upgrade your GCC to use lfloat plugin");
|
||||
snd_error(PCM, "please, upgrade your GCC to use lfloat plugin");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -472,15 +472,15 @@ slave PCM. The channel count, format and rate must match for both of them.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type linear # Linear conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
format STR # Slave format
|
||||
}
|
||||
type linear # Linear conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
format STR # Slave format
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -526,11 +526,11 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
|
|||
slave = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
|
||||
|
|
@ -539,7 +539,7 @@ int _snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name,
|
|||
return err;
|
||||
if (snd_pcm_format_linear(sformat) != 1) {
|
||||
snd_config_delete(sconf);
|
||||
SNDERR("slave format is not linear");
|
||||
snd_error(PCM, "slave format is not linear");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
|
||||
|
|
|
|||
|
|
@ -606,13 +606,13 @@ static inline const snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm)
|
|||
|
||||
static inline snd_pcm_uframes_t snd_pcm_mmap_offset(snd_pcm_t *pcm)
|
||||
{
|
||||
assert(pcm);
|
||||
assert(pcm);
|
||||
return *pcm->appl.ptr % pcm->buffer_size;
|
||||
}
|
||||
|
||||
static inline snd_pcm_uframes_t snd_pcm_mmap_hw_offset(snd_pcm_t *pcm)
|
||||
{
|
||||
assert(pcm);
|
||||
assert(pcm);
|
||||
return *pcm->hw.ptr % pcm->buffer_size;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -259,7 +259,7 @@ static void *snd_pcm_meter_thread(void *data)
|
|||
if (scope->enabled)
|
||||
scope->ops->update(scope);
|
||||
}
|
||||
nanosleep(&meter->delay, NULL);
|
||||
nanosleep(&meter->delay, NULL);
|
||||
}
|
||||
list_for_each(pos, &meter->scopes) {
|
||||
scope = list_entry(pos, snd_pcm_scope_t, list);
|
||||
|
|
@ -621,23 +621,23 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
int err;
|
||||
|
||||
if (snd_config_get_type(conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for scope %s", str);
|
||||
snd_error(PCM, "Invalid type for scope %s", str);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
err = snd_config_search(conf, "type", &c);
|
||||
if (err < 0) {
|
||||
SNDERR("type is not defined");
|
||||
snd_error(PCM, "type is not defined");
|
||||
goto _err;
|
||||
}
|
||||
err = snd_config_get_id(c, &id);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to get id");
|
||||
snd_error(PCM, "unable to get id");
|
||||
goto _err;
|
||||
}
|
||||
err = snd_config_get_string(c, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
err = snd_config_search_definition(root, "pcm_scope_type", str, &type_conf);
|
||||
|
|
@ -652,7 +652,7 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
if (strcmp(id, "lib") == 0) {
|
||||
err = snd_config_get_string(n, &lib);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -660,12 +660,12 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
if (strcmp(id, "open") == 0) {
|
||||
err = snd_config_get_string(n, &open_name);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -678,10 +678,10 @@ static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
open_func = h ? dlsym(h, open_name) : NULL;
|
||||
err = 0;
|
||||
if (!h) {
|
||||
SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
|
||||
snd_error(PCM, "Cannot open shared library %s (%s)", lib, errbuf);
|
||||
err = -ENOENT;
|
||||
} else if (!open_func) {
|
||||
SNDERR("symbol %s is not defined inside %s", open_name, lib);
|
||||
snd_error(PCM, "symbol %s is not defined inside %s", open_name, lib);
|
||||
snd_dlclose(h);
|
||||
err = -ENXIO;
|
||||
}
|
||||
|
|
@ -716,14 +716,14 @@ pcm_scope.name {
|
|||
}
|
||||
|
||||
pcm.name {
|
||||
type meter # Meter PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
type meter # Meter PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
}
|
||||
[frequency INT] # Updates per second
|
||||
scopes {
|
||||
ID STR # Scope name (see pcm_scope)
|
||||
|
|
@ -779,24 +779,24 @@ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "frequency") == 0) {
|
||||
err = snd_config_get_integer(n, &frequency);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "scopes") == 0) {
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
scopes = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
|
||||
|
|
@ -821,7 +821,7 @@ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (snd_config_get_string(n, &str) >= 0) {
|
||||
err = snd_config_search_definition(root, "pcm_scope", str, &n);
|
||||
if (err < 0) {
|
||||
SNDERR("unknown pcm_scope %s", str);
|
||||
snd_error(PCM, "unknown pcm_scope %s", str);
|
||||
} else {
|
||||
err = snd_pcm_meter_add_scope_conf(*pcmp, id, root, n);
|
||||
snd_config_delete(n);
|
||||
|
|
|
|||
|
|
@ -803,11 +803,11 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
|
|||
if (strcmp(id, "iface") == 0 || strcmp(id, "interface") == 0) {
|
||||
const char *ptr;
|
||||
if ((err = snd_config_get_string(n, &ptr)) < 0) {
|
||||
SNDERR("field %s is not a string", id);
|
||||
snd_error(PCM, "field %s is not a string", id);
|
||||
goto _err;
|
||||
}
|
||||
if ((err = snd_config_get_ctl_iface_ascii(ptr)) < 0) {
|
||||
SNDERR("Invalid value for '%s'", id);
|
||||
snd_error(PCM, "Invalid value for '%s'", id);
|
||||
goto _err;
|
||||
}
|
||||
iface = err;
|
||||
|
|
@ -815,28 +815,28 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
|
|||
}
|
||||
if (strcmp(id, "name") == 0) {
|
||||
if ((err = snd_config_get_string(n, &name)) < 0) {
|
||||
SNDERR("field %s is not a string", id);
|
||||
snd_error(PCM, "field %s is not a string", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "index") == 0) {
|
||||
if ((err = snd_config_get_integer(n, &index)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(PCM, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "device") == 0) {
|
||||
if ((err = snd_config_get_integer(n, &device)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(PCM, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "subdevice") == 0) {
|
||||
if ((err = snd_config_get_integer(n, &subdevice)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(PCM, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -844,11 +844,11 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
|
|||
if (cchannelsp && strcmp(id, "count") == 0) {
|
||||
long v;
|
||||
if ((err = snd_config_get_integer(n, &v)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(PCM, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
if (v < 1 || v > 2) {
|
||||
SNDERR("Invalid count %ld", v);
|
||||
snd_error(PCM, "Invalid count %ld", v);
|
||||
goto _err;
|
||||
}
|
||||
*cchannelsp = v;
|
||||
|
|
@ -856,17 +856,17 @@ int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int
|
|||
}
|
||||
if (hwctlp && strcmp(id, "hwctl") == 0) {
|
||||
if ((err = snd_config_get_bool(n)) < 0) {
|
||||
SNDERR("The field %s must be a boolean type", id);
|
||||
snd_error(PCM, "The field %s must be a boolean type", id);
|
||||
return err;
|
||||
}
|
||||
*hwctlp = err;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (name == NULL) {
|
||||
SNDERR("Missing control name");
|
||||
snd_error(PCM, "Missing control name");
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ static snd_pcm_sframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t xfer = 0;
|
||||
|
||||
if (snd_pcm_mmap_playback_avail(pcm) < size) {
|
||||
SNDMSG("too short avail %ld to size %ld", snd_pcm_mmap_playback_avail(pcm), size);
|
||||
snd_check(PCM, "too short avail %ld to size %ld", snd_pcm_mmap_playback_avail(pcm), size);
|
||||
return -EPIPE;
|
||||
}
|
||||
while (size > 0) {
|
||||
|
|
@ -106,7 +106,7 @@ static snd_pcm_sframes_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm,
|
|||
snd_pcm_uframes_t xfer = 0;
|
||||
|
||||
if (snd_pcm_mmap_capture_avail(pcm) < size) {
|
||||
SNDMSG("too short avail %ld to size %ld", snd_pcm_mmap_capture_avail(pcm), size);
|
||||
snd_check(PCM, "too short avail %ld to size %ld", snd_pcm_mmap_capture_avail(pcm), size);
|
||||
return -EPIPE;
|
||||
}
|
||||
while (size > 0) {
|
||||
|
|
@ -244,7 +244,7 @@ int snd_pcm_channel_info_shm(snd_pcm_t *pcm, snd_pcm_channel_info_t *info, int s
|
|||
info->step = pcm->sample_bits;
|
||||
break;
|
||||
default:
|
||||
SNDMSG("invalid access type %d", pcm->access);
|
||||
snd_check(PCM, "invalid access type %d", pcm->access);
|
||||
return -EINVAL;
|
||||
}
|
||||
info->addr = 0;
|
||||
|
|
@ -263,11 +263,11 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
unsigned int c;
|
||||
assert(pcm);
|
||||
if (CHECK_SANITY(! pcm->setup)) {
|
||||
SNDMSG("PCM not set up");
|
||||
snd_check(PCM, "PCM not set up");
|
||||
return -EIO;
|
||||
}
|
||||
if (CHECK_SANITY(pcm->mmap_channels || pcm->running_areas)) {
|
||||
SNDMSG("Already mmapped");
|
||||
snd_check(PCM, "Already mmapped");
|
||||
return -EBUSY;
|
||||
}
|
||||
if (pcm->ops->mmap)
|
||||
|
|
@ -306,12 +306,12 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
size_t size;
|
||||
unsigned int c1;
|
||||
if (i->addr) {
|
||||
a->addr = i->addr;
|
||||
a->first = i->first;
|
||||
a->step = i->step;
|
||||
continue;
|
||||
}
|
||||
size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits;
|
||||
a->addr = i->addr;
|
||||
a->first = i->first;
|
||||
a->step = i->step;
|
||||
continue;
|
||||
}
|
||||
size = i->first + i->step * (pcm->buffer_size - 1) + pcm->sample_bits;
|
||||
for (c1 = c + 1; c1 < pcm->channels; ++c1) {
|
||||
snd_pcm_channel_info_t *i1 = &pcm->mmap_channels[c1];
|
||||
size_t s;
|
||||
|
|
@ -342,7 +342,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
case SND_PCM_AREA_MMAP:
|
||||
ptr = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, i->u.mmap.fd, i->u.mmap.offset);
|
||||
if (ptr == MAP_FAILED) {
|
||||
SYSERR("mmap failed");
|
||||
snd_errornum(PCM, "mmap failed");
|
||||
return -errno;
|
||||
}
|
||||
i->addr = ptr;
|
||||
|
|
@ -354,23 +354,23 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
/* FIXME: safer permission? */
|
||||
id = shmget(IPC_PRIVATE, size, 0666);
|
||||
if (id < 0) {
|
||||
SYSERR("shmget failed");
|
||||
snd_errornum(PCM, "shmget failed");
|
||||
return -errno;
|
||||
}
|
||||
i->u.shm.shmid = id;
|
||||
ptr = shmat(i->u.shm.shmid, 0, 0);
|
||||
if (ptr == (void *) -1) {
|
||||
SYSERR("shmat failed");
|
||||
snd_errornum(PCM, "shmat failed");
|
||||
return -errno;
|
||||
}
|
||||
/* automatically remove segment if not used */
|
||||
if (shmctl(id, IPC_RMID, NULL) < 0){
|
||||
SYSERR("shmctl mark remove failed");
|
||||
snd_errornum(PCM, "shmctl mark remove failed");
|
||||
return -errno;
|
||||
}
|
||||
i->u.shm.area = snd_shm_area_create(id, ptr);
|
||||
if (i->u.shm.area == NULL) {
|
||||
SYSERR("snd_shm_area_create failed");
|
||||
snd_errornum(PCM, "snd_shm_area_create failed");
|
||||
return -ENOMEM;
|
||||
}
|
||||
if (pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
|
||||
|
|
@ -387,20 +387,20 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
} else {
|
||||
ptr = shmat(i->u.shm.shmid, 0, 0);
|
||||
if (ptr == (void*) -1) {
|
||||
SYSERR("shmat failed");
|
||||
snd_errornum(PCM, "shmat failed");
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
i->addr = ptr;
|
||||
break;
|
||||
#else
|
||||
SYSERR("shm support not available");
|
||||
snd_errornum(PCM, "shm support not available");
|
||||
return -ENOSYS;
|
||||
#endif
|
||||
case SND_PCM_AREA_LOCAL:
|
||||
ptr = malloc(size);
|
||||
if (ptr == NULL) {
|
||||
SYSERR("malloc failed");
|
||||
snd_errornum(PCM, "malloc failed");
|
||||
return -errno;
|
||||
}
|
||||
i->addr = ptr;
|
||||
|
|
@ -415,7 +415,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
switch (i1->type) {
|
||||
case SND_PCM_AREA_MMAP:
|
||||
if (i1->u.mmap.fd != i->u.mmap.fd ||
|
||||
i1->u.mmap.offset != i->u.mmap.offset)
|
||||
i1->u.mmap.offset != i->u.mmap.offset)
|
||||
continue;
|
||||
break;
|
||||
case SND_PCM_AREA_SHM:
|
||||
|
|
@ -425,7 +425,7 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
|
|||
case SND_PCM_AREA_LOCAL:
|
||||
if (pcm->access != SND_PCM_ACCESS_MMAP_INTERLEAVED &&
|
||||
pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED)
|
||||
continue;
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
|
|
@ -445,7 +445,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
|
|||
unsigned int c;
|
||||
assert(pcm);
|
||||
if (CHECK_SANITY(! pcm->mmap_channels)) {
|
||||
SNDMSG("Not mmapped");
|
||||
snd_check(PCM, "Not mmapped");
|
||||
return -ENXIO;
|
||||
}
|
||||
if (pcm->mmap_shadow) {
|
||||
|
|
@ -476,7 +476,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
|
|||
case SND_PCM_AREA_MMAP:
|
||||
err = munmap(i->addr, size);
|
||||
if (err < 0) {
|
||||
SYSERR("mmap failed");
|
||||
snd_errornum(PCM, "mmap failed");
|
||||
return -errno;
|
||||
}
|
||||
errno = 0;
|
||||
|
|
@ -500,7 +500,7 @@ int snd_pcm_munmap(snd_pcm_t *pcm)
|
|||
}
|
||||
break;
|
||||
#else
|
||||
SYSERR("shm support not available");
|
||||
snd_errornum(PCM, "shm support not available");
|
||||
return -ENOSYS;
|
||||
#endif
|
||||
case SND_PCM_AREA_LOCAL:
|
||||
|
|
@ -567,7 +567,7 @@ snd_pcm_sframes_t snd_pcm_write_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
|
|||
break;
|
||||
}
|
||||
default:
|
||||
SNDMSG("invalid access type %d", pcm->access);
|
||||
snd_check(PCM, "invalid access type %d", pcm->access);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (err < 0)
|
||||
|
|
@ -623,7 +623,7 @@ snd_pcm_sframes_t snd_pcm_read_mmap(snd_pcm_t *pcm, snd_pcm_uframes_t offset,
|
|||
break;
|
||||
}
|
||||
default:
|
||||
SNDMSG("invalid access type %d", pcm->access);
|
||||
snd_check(PCM, "invalid access type %d", pcm->access);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (err < 0)
|
||||
|
|
|
|||
|
|
@ -489,11 +489,11 @@ int _snd_pcm_mmap_emul_open(snd_pcm_t **pcmp, const char *name,
|
|||
slave = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 0);
|
||||
|
|
|
|||
|
|
@ -484,15 +484,15 @@ format and rate must match for both of them.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type mulaw # Mu-Law conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
format STR # Slave format
|
||||
}
|
||||
type mulaw # Mu-Law conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
format STR # Slave format
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -538,11 +538,11 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
|
|||
slave = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 1,
|
||||
|
|
@ -552,7 +552,7 @@ int _snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (snd_pcm_format_linear(sformat) != 1 &&
|
||||
sformat != SND_PCM_FORMAT_MU_LAW) {
|
||||
snd_config_delete(sconf);
|
||||
SNDERR("invalid slave format");
|
||||
snd_error(PCM, "invalid slave format");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ static int snd_pcm_multi_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
for (k = 0; k < multi->slaves_count; ++k) {
|
||||
err = snd_pcm_multi_hw_refine_sprepare(pcm, k, &sparams[k]);
|
||||
if (err < 0) {
|
||||
SNDERR("Slave PCM #%d not usable", k);
|
||||
snd_error(PCM, "Slave PCM #%d not usable", k);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -1160,8 +1160,8 @@ This plugin converts multiple streams to one.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type multi # Multiple streams conversion PCM
|
||||
slaves { # Slaves definition
|
||||
type multi # Multiple streams conversion PCM
|
||||
slaves { # Slaves definition
|
||||
ID STR # Slave PCM name
|
||||
# or
|
||||
ID {
|
||||
|
|
@ -1170,7 +1170,7 @@ pcm.name {
|
|||
pcm { } # Slave PCM definition
|
||||
channels INT # Slave channels
|
||||
}
|
||||
}
|
||||
}
|
||||
bindings { # Bindings table
|
||||
N {
|
||||
slave STR # Slave key
|
||||
|
|
@ -1267,7 +1267,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
continue;
|
||||
if (strcmp(id, "slaves") == 0) {
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
slaves = n;
|
||||
|
|
@ -1275,7 +1275,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
if (strcmp(id, "bindings") == 0) {
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
bindings = n;
|
||||
|
|
@ -1283,27 +1283,27 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
if (strcmp(id, "master") == 0) {
|
||||
if (snd_config_get_integer(n, &master_slave) < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slaves) {
|
||||
SNDERR("slaves is not defined");
|
||||
snd_error(PCM, "slaves is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!bindings) {
|
||||
SNDERR("bindings is not defined");
|
||||
snd_error(PCM, "bindings is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_config_for_each(i, inext, slaves) {
|
||||
++slaves_count;
|
||||
}
|
||||
if (master_slave < 0 || master_slave >= (long)slaves_count) {
|
||||
SNDERR("Master slave is out of range (0-%u)", slaves_count-1);
|
||||
snd_error(PCM, "Master slave is out of range (0-%u)", slaves_count-1);
|
||||
return -EINVAL;
|
||||
}
|
||||
snd_config_for_each(i, inext, bindings) {
|
||||
|
|
@ -1314,14 +1314,14 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
continue;
|
||||
err = safe_strtol(id, &cchannel);
|
||||
if (err < 0 || cchannel < 0) {
|
||||
SNDERR("Invalid channel number: %s", id);
|
||||
snd_error(PCM, "Invalid channel number: %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if ((unsigned long)cchannel >= channels_count)
|
||||
channels_count = cchannel + 1;
|
||||
}
|
||||
if (channels_count == 0) {
|
||||
SNDERR("No channels defined");
|
||||
snd_error(PCM, "No channels defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
slaves_id = calloc(slaves_count, sizeof(*slaves_id));
|
||||
|
|
@ -1365,7 +1365,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
continue;
|
||||
err = safe_strtol(id, &cchannel);
|
||||
if (err < 0 || cchannel < 0) {
|
||||
SNDERR("Invalid channel number: %s", id);
|
||||
snd_error(PCM, "Invalid channel number: %s", id);
|
||||
err = -EINVAL;
|
||||
goto _free;
|
||||
}
|
||||
|
|
@ -1383,7 +1383,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (err < 0) {
|
||||
err = snd_config_get_integer(n, &val);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid value for %s", id);
|
||||
snd_error(PCM, "Invalid value for %s", id);
|
||||
goto _free;
|
||||
}
|
||||
sprintf(buf, "%ld", val);
|
||||
|
|
@ -1398,23 +1398,23 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "channel") == 0) {
|
||||
err = snd_config_get_integer(n, &schannel);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto _free;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
err = -EINVAL;
|
||||
goto _free;
|
||||
}
|
||||
if (slave < 0 || (unsigned int)slave >= slaves_count) {
|
||||
SNDERR("Invalid or missing sidx for channel %s", id);
|
||||
snd_error(PCM, "Invalid or missing sidx for channel %s", id);
|
||||
err = -EINVAL;
|
||||
goto _free;
|
||||
}
|
||||
if (schannel < 0 ||
|
||||
(unsigned int) schannel >= slaves_channels[slave]) {
|
||||
SNDERR("Invalid or missing schannel for channel %s", id);
|
||||
snd_error(PCM, "Invalid or missing schannel for channel %s", id);
|
||||
err = -EINVAL;
|
||||
goto _free;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,11 +82,11 @@ static int snd_pcm_null_info(snd_pcm_t *pcm, snd_pcm_info_t * info)
|
|||
static snd_pcm_sframes_t snd_pcm_null_avail_update(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_null_t *null = pcm->private_data;
|
||||
if (null->state == SND_PCM_STATE_PREPARED) {
|
||||
/* it is required to return the correct avail count for */
|
||||
/* the prepared stream, otherwise the start is not called */
|
||||
return snd_pcm_mmap_avail(pcm);
|
||||
}
|
||||
if (null->state == SND_PCM_STATE_PREPARED) {
|
||||
/* it is required to return the correct avail count for */
|
||||
/* the prepared stream, otherwise the start is not called */
|
||||
return snd_pcm_mmap_avail(pcm);
|
||||
}
|
||||
return pcm->buffer_size;
|
||||
}
|
||||
|
||||
|
|
@ -386,13 +386,13 @@ int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t strea
|
|||
if (stream == SND_PCM_STREAM_PLAYBACK) {
|
||||
fd = open("/dev/null", O_WRONLY);
|
||||
if (fd < 0) {
|
||||
SYSERR("Cannot open /dev/null");
|
||||
snd_errornum(PCM, "Cannot open /dev/null");
|
||||
return -errno;
|
||||
}
|
||||
} else {
|
||||
fd = open("/dev/full", O_RDONLY);
|
||||
if (fd < 0) {
|
||||
SYSERR("Cannot open /dev/full");
|
||||
snd_errornum(PCM, "Cannot open /dev/full");
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
|
@ -434,7 +434,7 @@ and /dev/full (capture, must be readable).
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type null # Null PCM
|
||||
type null # Null PCM
|
||||
[chmap MAP] # Provide channel maps; MAP is a string array
|
||||
}
|
||||
\endcode
|
||||
|
|
@ -481,12 +481,12 @@ int _snd_pcm_null_open(snd_pcm_t **pcmp, const char *name,
|
|||
snd_pcm_free_chmaps(chmap);
|
||||
chmap = _snd_pcm_parse_config_chmaps(n);
|
||||
if (!chmap) {
|
||||
SNDERR("Invalid channel map for %s", id);
|
||||
snd_error(PCM, "Invalid channel map for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
snd_pcm_free_chmaps(chmap);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1110,7 +1110,7 @@ static int snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
if (err >= 0)
|
||||
err = snd_pcm_hw_param_get_max(params, SND_PCM_HW_PARAM_PERIOD_TIME, &max, &dir);
|
||||
if (err >= 0 && (long)min < pcm->minperiodtime &&
|
||||
(long)max > pcm->minperiodtime) {
|
||||
(long)max > pcm->minperiodtime) {
|
||||
min = pcm->minperiodtime; dir = 1;
|
||||
snd_pcm_hw_param_set_min(pcm, params, SND_CHANGE, SND_PCM_HW_PARAM_PERIOD_TIME, &min, &dir);
|
||||
}
|
||||
|
|
@ -2232,7 +2232,7 @@ int snd_pcm_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
|||
return err;
|
||||
err = sprepare(pcm, &sparams);
|
||||
if (err < 0) {
|
||||
SNDERR("Slave PCM not usable");
|
||||
snd_error(PCM, "Slave PCM not usable");
|
||||
return err;
|
||||
}
|
||||
#ifdef RULES_DEBUG
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm
|
|||
ttable[c * tt_ssize + c] = SND_PCM_PLUGIN_ROUTE_FULL;
|
||||
break;
|
||||
default:
|
||||
SNDERR("Invalid route policy");
|
||||
snd_error(PCM, "Invalid route policy");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -861,16 +861,16 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
|
|||
}
|
||||
|
||||
if (snd_pcm_format_mask_empty(&sfmt_mask)) {
|
||||
SNDERR("Unable to find an usable slave format for '%s'", pcm->name);
|
||||
snd_error(PCM, "Unable to find an usable slave format for '%s'", pcm->name);
|
||||
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
|
||||
if (!snd_pcm_format_mask_test(format_mask, format))
|
||||
continue;
|
||||
SNDERR("Format: %s", snd_pcm_format_name(format));
|
||||
snd_error(PCM, "Format: %s", snd_pcm_format_name(format));
|
||||
}
|
||||
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
|
||||
if (!snd_pcm_format_mask_test(sformat_mask, format))
|
||||
continue;
|
||||
SNDERR("Slave format: %s", snd_pcm_format_name(format));
|
||||
snd_error(PCM, "Slave format: %s", snd_pcm_format_name(format));
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -883,8 +883,9 @@ static int snd_pcm_plug_hw_refine_schange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
|
|||
if (snd_pcm_hw_param_never_eq(params, SND_PCM_HW_PARAM_ACCESS, sparams)) {
|
||||
err = check_access_change(params, sparams);
|
||||
if (err < 0) {
|
||||
SNDERR("Unable to find an usable access for '%s'",
|
||||
pcm->name);
|
||||
snd_error(PCM, "Unable to find an usable access for '%s'",
|
||||
pcm->name);
|
||||
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -950,16 +951,16 @@ static int snd_pcm_plug_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
|
|||
}
|
||||
|
||||
if (snd_pcm_format_mask_empty(&fmt_mask)) {
|
||||
SNDERR("Unable to find an usable client format");
|
||||
snd_error(PCM, "Unable to find an usable client format");
|
||||
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
|
||||
if (!snd_pcm_format_mask_test(format_mask, format))
|
||||
continue;
|
||||
SNDERR("Format: %s", snd_pcm_format_name(format));
|
||||
snd_error(PCM, "Format: %s", snd_pcm_format_name(format));
|
||||
}
|
||||
for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) {
|
||||
if (!snd_pcm_format_mask_test(sformat_mask, format))
|
||||
continue;
|
||||
SNDERR("Slave format: %s", snd_pcm_format_name(format));
|
||||
snd_error(PCM, "Slave format: %s", snd_pcm_format_name(format));
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -1209,17 +1210,17 @@ This plugin converts channels, rate and format on request.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type plug # Automatic conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
type plug # Automatic conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
[format STR] # Slave format (default nearest) or "unchanged"
|
||||
[channels INT] # Slave channels (default nearest) or "unchanged"
|
||||
[rate INT] # Slave rate (default nearest) or "unchanged"
|
||||
}
|
||||
}
|
||||
route_policy STR # route policy for automatic ttable generation
|
||||
# STR can be 'default', 'average', 'copy', 'duplicate'
|
||||
# average: result is average of input channels
|
||||
|
|
@ -1293,7 +1294,7 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "ttable") == 0) {
|
||||
route_policy = PLUG_ROUTE_POLICY_NONE;
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
tt = n;
|
||||
|
|
@ -1302,11 +1303,11 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "route_policy") == 0) {
|
||||
const char *str;
|
||||
if ((err = snd_config_get_string(n, &str)) < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (tt != NULL)
|
||||
SNDERR("Table is defined, route policy is ignored");
|
||||
snd_error(PCM, "Table is defined, route policy is ignored");
|
||||
if (!strcmp(str, "default"))
|
||||
route_policy = PLUG_ROUTE_POLICY_DEFAULT;
|
||||
else if (!strcmp(str, "average"))
|
||||
|
|
@ -1324,11 +1325,11 @@ int _snd_pcm_plug_open(snd_pcm_t **pcmp, const char *name,
|
|||
continue;
|
||||
}
|
||||
#endif
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 3,
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames
|
|||
if (frames == 0)
|
||||
return 0;
|
||||
|
||||
sframes = frames;
|
||||
sframes = frames;
|
||||
sframes = snd_pcm_rewind(plugin->gen.slave, sframes);
|
||||
if (sframes < 0)
|
||||
return sframes;
|
||||
|
|
@ -222,7 +222,7 @@ snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frame
|
|||
if (frames == 0)
|
||||
return 0;
|
||||
|
||||
sframes = frames;
|
||||
sframes = frames;
|
||||
sframes = INTERNAL(snd_pcm_forward)(plugin->gen.slave, sframes);
|
||||
if (sframes < 0)
|
||||
return sframes;
|
||||
|
|
@ -257,8 +257,9 @@ static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
|
|||
frames = plugin->write(pcm, areas, offset, frames,
|
||||
slave_areas, slave_offset, &slave_frames);
|
||||
if (CHECK_SANITY(slave_frames > snd_pcm_mmap_playback_avail(slave))) {
|
||||
SNDMSG("write overflow %ld > %ld", slave_frames,
|
||||
snd_pcm_mmap_playback_avail(slave));
|
||||
snd_check(PCM, "write overflow %ld > %ld", slave_frames,
|
||||
snd_pcm_mmap_playback_avail(slave));
|
||||
|
||||
err = -EPIPE;
|
||||
goto error;
|
||||
}
|
||||
|
|
@ -314,8 +315,9 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
|
|||
frames = (plugin->read)(pcm, areas, offset, frames,
|
||||
slave_areas, slave_offset, &slave_frames);
|
||||
if (CHECK_SANITY(slave_frames > snd_pcm_mmap_capture_avail(slave))) {
|
||||
SNDMSG("read overflow %ld > %ld", slave_frames,
|
||||
snd_pcm_mmap_playback_avail(slave));
|
||||
snd_check(PCM, "read overflow %ld > %ld", slave_frames,
|
||||
snd_pcm_mmap_playback_avail(slave));
|
||||
|
||||
err = -EPIPE;
|
||||
goto error;
|
||||
}
|
||||
|
|
@ -447,7 +449,7 @@ snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm,
|
|||
xfer += frames;
|
||||
}
|
||||
if (CHECK_SANITY(size)) {
|
||||
SNDMSG("short commit: %ld", size);
|
||||
snd_check(PCM, "short commit: %ld", size);
|
||||
return -EPIPE;
|
||||
}
|
||||
return xfer;
|
||||
|
|
@ -530,8 +532,8 @@ static snd_pcm_sframes_t snd_pcm_plugin_sync_hw_ptr(snd_pcm_t *pcm,
|
|||
pcm->access != SND_PCM_ACCESS_RW_INTERLEAVED &&
|
||||
pcm->access != SND_PCM_ACCESS_RW_NONINTERLEAVED)
|
||||
return snd_pcm_plugin_sync_hw_ptr_capture(pcm, slave_size);
|
||||
*pcm->hw.ptr = slave_hw_ptr;
|
||||
return slave_size;
|
||||
*pcm->hw.ptr = slave_hw_ptr;
|
||||
return slave_size;
|
||||
}
|
||||
|
||||
static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
|
||||
|
|
|
|||
|
|
@ -237,10 +237,10 @@ static int snd_pcm_rate_hw_refine_cchange(snd_pcm_t *pcm, snd_pcm_hw_params_t *p
|
|||
period_size->openmin && period_size->openmax &&
|
||||
period_size->min + 1 == period_size->max) {
|
||||
if (period_size->min > 0 && (buffer_size->min / period_size->min) * period_size->min == buffer_size->min) {
|
||||
snd_interval_set_value(period_size, period_size->min);
|
||||
} else if ((buffer_size->max / period_size->max) * period_size->max == buffer_size->max) {
|
||||
snd_interval_set_value(period_size, period_size->max);
|
||||
}
|
||||
snd_interval_set_value(period_size, period_size->min);
|
||||
} else if ((buffer_size->max / period_size->max) * period_size->max == buffer_size->max) {
|
||||
snd_interval_set_value(period_size, period_size->max);
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_REFINE
|
||||
|
|
@ -396,7 +396,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
sinfo->period_size = slave->period_size;
|
||||
|
||||
if (CHECK_SANITY(rate->pareas)) {
|
||||
SNDMSG("rate plugin already in use");
|
||||
snd_check(PCM, "rate plugin already in use");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ static int snd_pcm_rate_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
|||
rate->orig_in_format = rate->info.in.format;
|
||||
rate->orig_out_format = rate->info.out.format;
|
||||
if (choose_preferred_format(rate) < 0) {
|
||||
SNDERR("No matching format in rate plugin");
|
||||
snd_error(PCM, "No matching format in rate plugin");
|
||||
err = -EINVAL;
|
||||
goto error_pareas;
|
||||
}
|
||||
|
|
@ -756,15 +756,15 @@ static snd_pcm_sframes_t snd_pcm_rate_forwardable(snd_pcm_t *pcm ATTRIBUTE_UNUSE
|
|||
}
|
||||
|
||||
static snd_pcm_sframes_t snd_pcm_rate_rewind(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
|
||||
snd_pcm_uframes_t frames ATTRIBUTE_UNUSED)
|
||||
snd_pcm_uframes_t frames ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static snd_pcm_sframes_t snd_pcm_rate_forward(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
|
||||
snd_pcm_uframes_t frames ATTRIBUTE_UNUSED)
|
||||
snd_pcm_uframes_t frames ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
|
||||
|
|
@ -854,7 +854,7 @@ static int snd_pcm_rate_commit_area(snd_pcm_t *pcm, snd_pcm_rate_t *rate,
|
|||
return result;
|
||||
#if 0
|
||||
if (slave_offset) {
|
||||
SNDERR("non-zero slave_offset %ld", slave_offset);
|
||||
snd_error(PCM, "non-zero slave_offset %ld", slave_offset);
|
||||
return -EIO;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -953,12 +953,12 @@ static int snd_pcm_rate_grab_next_period(snd_pcm_t *pcm, snd_pcm_uframes_t hw_of
|
|||
return result;
|
||||
#if 0
|
||||
if (slave_offset) {
|
||||
SNDERR("non-zero slave_offset %ld", slave_offset);
|
||||
snd_error(PCM, "non-zero slave_offset %ld", slave_offset);
|
||||
return -EIO;
|
||||
}
|
||||
#endif
|
||||
snd_pcm_areas_copy(rate->sareas, xfer,
|
||||
slave_areas, slave_offset,
|
||||
slave_areas, slave_offset,
|
||||
pcm->channels, cont,
|
||||
rate->gen.slave->format);
|
||||
result = snd_pcm_mmap_commit(rate->gen.slave, slave_offset, cont);
|
||||
|
|
@ -1565,20 +1565,20 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
|||
break;
|
||||
}
|
||||
if (!type) {
|
||||
SNDERR("No name given for rate converter");
|
||||
snd_error(PCM, "No name given for rate converter");
|
||||
snd_pcm_free(pcm);
|
||||
free(rate);
|
||||
return -EINVAL;
|
||||
}
|
||||
err = rate_open_func(rate, type, converter, 1);
|
||||
} else {
|
||||
SNDERR("Invalid type for rate converter");
|
||||
snd_error(PCM, "Invalid type for rate converter");
|
||||
snd_pcm_free(pcm);
|
||||
free(rate);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot find rate converter");
|
||||
snd_error(PCM, "Cannot find rate converter");
|
||||
snd_pcm_free(pcm);
|
||||
free(rate);
|
||||
return -ENOENT;
|
||||
|
|
@ -1596,7 +1596,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
if (! rate->ops.init || ! (rate->ops.convert || rate->ops.convert_s16) ||
|
||||
! rate->ops.input_frames || ! rate->ops.output_frames) {
|
||||
SNDERR("Inproper rate plugin %s initialization", type);
|
||||
snd_error(PCM, "Inproper rate plugin %s initialization", type);
|
||||
snd_pcm_free(pcm);
|
||||
free(rate);
|
||||
return err;
|
||||
|
|
@ -1627,15 +1627,15 @@ This plugin converts a stream rate. The input and output formats must be linear.
|
|||
\code
|
||||
pcm.name {
|
||||
type rate # Rate PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
rate INT # Slave rate
|
||||
[format STR] # Slave format
|
||||
}
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
rate INT # Slave rate
|
||||
[format STR] # Slave format
|
||||
}
|
||||
converter STR # optional
|
||||
# or
|
||||
converter [ STR1 STR2 ... ] # optional
|
||||
|
|
@ -1698,11 +1698,11 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
|||
converter = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -1713,8 +1713,8 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
|||
return err;
|
||||
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
|
||||
snd_pcm_format_linear(sformat) != 1) {
|
||||
snd_config_delete(sconf);
|
||||
SNDERR("slave format is not linear");
|
||||
snd_config_delete(sconf);
|
||||
snd_error(PCM, "slave format is not linear");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_open_slave(&spcm, root, sconf, stream, mode, conf);
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ static void linear_shrink(struct rate_linear *rate,
|
|||
dst += dst_step;
|
||||
dst_frames1++;
|
||||
if (CHECK_SANITY(dst_frames1 > dst_frames)) {
|
||||
SNDERR("dst_frames overflow");
|
||||
snd_error(PCM, "dst_frames overflow");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -298,7 +298,7 @@ static void linear_shrink_s16(struct rate_linear *rate,
|
|||
dst += dst_step;
|
||||
dst_frames1++;
|
||||
if (CHECK_SANITY(dst_frames1 > dst_frames)) {
|
||||
SNDERR("dst_frames overflow");
|
||||
snd_error(PCM, "dst_frames overflow");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -375,8 +375,9 @@ static int linear_adjust_pitch(void *obj, snd_pcm_rate_info_t *info)
|
|||
cframes_new = input_frames(rate, info->out.period_size);
|
||||
if ((cframes > info->in.period_size && cframes_new < info->in.period_size) ||
|
||||
(cframes < info->in.period_size && cframes_new > info->in.period_size)) {
|
||||
SNDERR("invalid pcm period_size %ld -> %ld",
|
||||
info->in.period_size, info->out.period_size);
|
||||
snd_error(PCM, "invalid pcm period_size %ld -> %ld",
|
||||
info->in.period_size, info->out.period_size);
|
||||
|
||||
return -EIO;
|
||||
}
|
||||
cframes = cframes_new;
|
||||
|
|
|
|||
|
|
@ -325,7 +325,12 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
|||
#endif
|
||||
zero_end:
|
||||
for (srcidx = 0; srcidx < nsrcs; ++srcidx) {
|
||||
const char *src = srcs[srcidx];
|
||||
const char *src;
|
||||
#if defined(__GNUC__) && __GNUC__ >= 8
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
#endif
|
||||
src = srcs[srcidx];
|
||||
|
||||
/* Get sample */
|
||||
goto *get32;
|
||||
|
|
@ -333,6 +338,9 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
|||
#include "plugin_ops.h"
|
||||
#undef GET32_END
|
||||
after_get:
|
||||
#if defined(__GNUC__) && __GNUC__ >= 8
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
/* Sum */
|
||||
goto *add;
|
||||
|
|
@ -810,7 +818,7 @@ static int determine_chmap(snd_config_t *tt, snd_pcm_chmap_t **tt_chmap)
|
|||
continue;
|
||||
|
||||
if (chmap->channels >= MAX_CHMAP_CHANNELS) {
|
||||
SNDERR("Too many channels in ttable chmap");
|
||||
snd_error(PCM, "Too many channels in ttable chmap");
|
||||
goto err;
|
||||
}
|
||||
chmap->pos[chmap->channels++] = ch;
|
||||
|
|
@ -875,7 +883,7 @@ static int find_matching_chmap(snd_pcm_chmap_query_t **chmaps,
|
|||
}
|
||||
|
||||
if (*found_chmap == NULL) {
|
||||
SNDERR("Found no matching channel map");
|
||||
snd_error(PCM, "Found no matching channel map");
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1085,7 +1093,7 @@ static int _snd_pcm_route_determine_ttable(snd_config_t *tt,
|
|||
continue;
|
||||
err = safe_strtol(id, &cchannel);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid client channel: %s", id);
|
||||
snd_error(PCM, "Invalid client channel: %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (cchannel + 1 > csize)
|
||||
|
|
@ -1100,7 +1108,7 @@ static int _snd_pcm_route_determine_ttable(snd_config_t *tt,
|
|||
continue;
|
||||
err = strtochannel(id, chmap, &schannel, 1);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid slave channel: %s", id);
|
||||
snd_error(PCM, "Invalid slave channel: %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (schannel + 1 > ssize)
|
||||
|
|
@ -1108,7 +1116,7 @@ static int _snd_pcm_route_determine_ttable(snd_config_t *tt,
|
|||
}
|
||||
}
|
||||
if (csize == 0 || ssize == 0) {
|
||||
SNDERR("Invalid null ttable configuration");
|
||||
snd_error(PCM, "Invalid null ttable configuration");
|
||||
return -EINVAL;
|
||||
}
|
||||
*tt_csize = csize;
|
||||
|
|
@ -1168,7 +1176,7 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent
|
|||
err = safe_strtol(id, &cchannel);
|
||||
if (err < 0 ||
|
||||
cchannel < 0 || (unsigned int) cchannel > tt_csize) {
|
||||
SNDERR("Invalid client channel: %s", id);
|
||||
snd_error(PCM, "Invalid client channel: %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (snd_config_get_type(in) != SND_CONFIG_TYPE_COMPOUND)
|
||||
|
|
@ -1183,13 +1191,13 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent
|
|||
|
||||
ss = strtochannel(id, chmap, scha, tt_ssize);
|
||||
if (ss < 0) {
|
||||
SNDERR("Invalid slave channel: %s", id);
|
||||
snd_error(PCM, "Invalid slave channel: %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
err = snd_config_get_ireal(jnode, &value);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
@ -1197,7 +1205,7 @@ static int _snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_ent
|
|||
long schannel = scha[k];
|
||||
if (schannel < 0 || (unsigned int) schannel > tt_ssize ||
|
||||
(schannels > 0 && schannel >= schannels)) {
|
||||
SNDERR("Invalid slave channel: %s", id);
|
||||
snd_error(PCM, "Invalid slave channel: %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
ttable[cchannel * tt_ssize + schannel] = value;
|
||||
|
|
@ -1245,22 +1253,22 @@ If so, a matching channel map will be selected for the slave.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type route # Route & Volume conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
[format STR] # Slave format
|
||||
[channels INT] # Slave channels
|
||||
}
|
||||
ttable { # Transfer table (bi-dimensional compound of cchannels * schannels numbers)
|
||||
CCHANNEL {
|
||||
SCHANNEL REAL # route value (0.0 - 1.0)
|
||||
}
|
||||
}
|
||||
[chmap MAP] # Override channel maps; MAP is a string array
|
||||
type route # Route & Volume conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
[format STR] # Slave format
|
||||
[channels INT] # Slave channels
|
||||
}
|
||||
ttable { # Transfer table (bi-dimensional compound of cchannels * schannels numbers)
|
||||
CCHANNEL {
|
||||
SCHANNEL REAL # route value (0.0 - 1.0)
|
||||
}
|
||||
}
|
||||
[chmap MAP] # Override channel maps; MAP is a string array
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -1315,7 +1323,7 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
if (strcmp(id, "ttable") == 0) {
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
snd_pcm_free_chmaps(chmaps);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -1325,21 +1333,21 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "chmap") == 0) {
|
||||
chmaps = _snd_pcm_parse_config_chmaps(n);
|
||||
if (!chmaps) {
|
||||
SNDERR("Invalid channel map for %s", id);
|
||||
snd_error(PCM, "Invalid channel map for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
snd_pcm_free_chmaps(chmaps);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!tt) {
|
||||
SNDERR("ttable is not defined");
|
||||
snd_error(PCM, "ttable is not defined");
|
||||
snd_pcm_free_chmaps(chmaps);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -1352,8 +1360,8 @@ int _snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
if (sformat != SND_PCM_FORMAT_UNKNOWN &&
|
||||
snd_pcm_format_linear(sformat) != 1) {
|
||||
snd_config_delete(sconf);
|
||||
SNDERR("slave format is not linear");
|
||||
snd_config_delete(sconf);
|
||||
snd_error(PCM, "slave format is not linear");
|
||||
snd_pcm_free_chmaps(chmaps);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ static snd_pcm_uframes_t snd_pcm_share_slave_avail(snd_pcm_share_slave_t *slave)
|
|||
{
|
||||
snd_pcm_sframes_t avail;
|
||||
snd_pcm_t *pcm = slave->pcm;
|
||||
avail = slave->hw_ptr - *pcm->appl.ptr;
|
||||
avail = slave->hw_ptr - *pcm->appl.ptr;
|
||||
if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
|
||||
avail += pcm->buffer_size;
|
||||
if (avail < 0)
|
||||
|
|
@ -238,11 +238,11 @@ static snd_pcm_uframes_t _snd_pcm_share_missing(snd_pcm_t *pcm)
|
|||
}
|
||||
err = snd_pcm_mmap_commit(spcm, snd_pcm_mmap_offset(spcm), frames);
|
||||
if (err < 0) {
|
||||
SYSMSG("snd_pcm_mmap_commit error");
|
||||
snd_checknum(PCM, "snd_pcm_mmap_commit error");
|
||||
return INT_MAX;
|
||||
}
|
||||
if (err != frames)
|
||||
SYSMSG("commit returns %ld for size %ld", err, frames);
|
||||
snd_checknum(PCM, "commit returns %ld for size %ld", err, frames);
|
||||
slave_avail -= err;
|
||||
} else {
|
||||
if (safety_missing == 0)
|
||||
|
|
@ -282,7 +282,7 @@ static snd_pcm_uframes_t _snd_pcm_share_missing(snd_pcm_t *pcm)
|
|||
running = 1;
|
||||
break;
|
||||
default:
|
||||
SNDERR("invalid shared PCM state %d", share->state);
|
||||
snd_error(PCM, "invalid shared PCM state %d", share->state);
|
||||
return INT_MAX;
|
||||
}
|
||||
|
||||
|
|
@ -370,13 +370,13 @@ static void *snd_pcm_share_thread(void *data)
|
|||
pfd[0].events = POLLIN;
|
||||
err = snd_pcm_poll_descriptors(spcm, &pfd[1], 1);
|
||||
if (err != 1) {
|
||||
SNDERR("invalid poll descriptors %d", err);
|
||||
snd_error(PCM, "invalid poll descriptors %d", err);
|
||||
return NULL;
|
||||
}
|
||||
Pthread_mutex_lock(&slave->mutex);
|
||||
err = pipe(slave->poll);
|
||||
if (err < 0) {
|
||||
SYSERR("can't create a pipe");
|
||||
snd_errornum(PCM, "can't create a pipe");
|
||||
Pthread_mutex_unlock(&slave->mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -403,7 +403,7 @@ static void *snd_pcm_share_thread(void *data)
|
|||
snd_pcm_sw_params_set_avail_min(spcm, &slave->sw_params, avail_min);
|
||||
err = snd_pcm_sw_params(spcm, &slave->sw_params);
|
||||
if (err < 0) {
|
||||
SYSERR("snd_pcm_sw_params error");
|
||||
snd_errornum(PCM, "snd_pcm_sw_params error");
|
||||
Pthread_mutex_unlock(&slave->mutex);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -457,7 +457,7 @@ static void _snd_pcm_share_update(snd_pcm_t *pcm)
|
|||
snd_pcm_sw_params_set_avail_min(spcm, &slave->sw_params, avail_min);
|
||||
err = snd_pcm_sw_params(spcm, &slave->sw_params);
|
||||
if (err < 0) {
|
||||
SYSERR("snd_pcm_sw_params error");
|
||||
snd_errornum(PCM, "snd_pcm_sw_params error");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -648,7 +648,7 @@ static int snd_pcm_share_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
spcm->buffer_size, 0);
|
||||
_err:
|
||||
if (err < 0) {
|
||||
SNDERR("slave is already running with incompatible setup");
|
||||
snd_error(PCM, "slave is already running with incompatible setup");
|
||||
err = -EBUSY;
|
||||
goto _end;
|
||||
}
|
||||
|
|
@ -852,11 +852,11 @@ static snd_pcm_sframes_t _snd_pcm_share_mmap_commit(snd_pcm_t *pcm,
|
|||
snd_pcm_sframes_t err;
|
||||
err = snd_pcm_mmap_commit(spcm, snd_pcm_mmap_offset(spcm), frames);
|
||||
if (err < 0) {
|
||||
SYSMSG("snd_pcm_mmap_commit error");
|
||||
snd_checknum(PCM, "snd_pcm_mmap_commit error");
|
||||
return err;
|
||||
}
|
||||
if (err != frames) {
|
||||
SYSMSG("commit returns %ld for size %ld", err, frames);
|
||||
snd_checknum(PCM, "commit returns %ld for size %ld", err, frames);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
@ -1399,11 +1399,11 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
|
|||
|
||||
for (k = 0; k < channels; ++k) {
|
||||
if (channels_map[k] >= sizeof(slave_map) / sizeof(slave_map[0])) {
|
||||
SNDERR("Invalid slave channel (%d) in binding", channels_map[k]);
|
||||
snd_error(PCM, "Invalid slave channel (%d) in binding", channels_map[k]);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (slave_map[channels_map[k]]) {
|
||||
SNDERR("Repeated slave channel (%d) in binding", channels_map[k]);
|
||||
snd_error(PCM, "Repeated slave channel (%d) in binding", channels_map[k]);
|
||||
return -EINVAL;
|
||||
}
|
||||
slave_map[channels_map[k]] = 1;
|
||||
|
|
@ -1516,7 +1516,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
|
|||
snd_pcm_share_t *sh = list_entry(i, snd_pcm_share_t, list);
|
||||
for (k = 0; k < sh->channels; ++k) {
|
||||
if (slave_map[sh->slave_channels[k]]) {
|
||||
SNDERR("Slave channel %d is already in use", sh->slave_channels[k]);
|
||||
snd_error(PCM, "Slave channel %d is already in use", sh->slave_channels[k]);
|
||||
Pthread_mutex_unlock(&slave->mutex);
|
||||
close(sd[0]);
|
||||
close(sd[1]);
|
||||
|
|
@ -1569,17 +1569,17 @@ doesn't need the explicit server but access to the shared buffer.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type share # Share PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
[format STR] # Slave format
|
||||
[channels INT] # Slave channels
|
||||
[rate INT] # Slave rate
|
||||
[period_time INT] # Slave period time in us
|
||||
[buffer_time INT] # Slave buffer time in us
|
||||
}
|
||||
type share # Share PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
[format STR] # Slave format
|
||||
[channels INT] # Slave channels
|
||||
[rate INT] # Slave rate
|
||||
[period_time INT] # Slave period time in us
|
||||
[buffer_time INT] # Slave buffer time in us
|
||||
}
|
||||
bindings {
|
||||
N INT # Slave channel INT for client channel N
|
||||
}
|
||||
|
|
@ -1638,17 +1638,17 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
|
|||
}
|
||||
if (strcmp(id, "bindings") == 0) {
|
||||
if (snd_config_get_type(n) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
bindings = n;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_pcm_slave_conf(root, slave, &sconf, 5,
|
||||
|
|
@ -1665,12 +1665,12 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
|
|||
sname = err >= 0 && sname ? strdup(sname) : NULL;
|
||||
snd_config_delete(sconf);
|
||||
if (sname == NULL) {
|
||||
SNDERR("slave.pcm is not a string");
|
||||
snd_error(PCM, "slave.pcm is not a string");
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!bindings) {
|
||||
SNDERR("bindings is not defined");
|
||||
snd_error(PCM, "bindings is not defined");
|
||||
err = -EINVAL;
|
||||
goto _free;
|
||||
}
|
||||
|
|
@ -1682,7 +1682,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
|
|||
continue;
|
||||
err = safe_strtol(id, &cchannel);
|
||||
if (err < 0 || cchannel < 0) {
|
||||
SNDERR("Invalid client channel in binding: %s", id);
|
||||
snd_error(PCM, "Invalid client channel in binding: %s", id);
|
||||
err = -EINVAL;
|
||||
goto _free;
|
||||
}
|
||||
|
|
@ -1690,7 +1690,7 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name,
|
|||
channels = cchannel + 1;
|
||||
}
|
||||
if (channels == 0) {
|
||||
SNDERR("No bindings defined");
|
||||
snd_error(PCM, "No bindings defined");
|
||||
err = -EINVAL;
|
||||
goto _free;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ static long snd_pcm_shm_action_fd0(snd_pcm_t *pcm, int *fd)
|
|||
if (err != 1)
|
||||
return -EBADFD;
|
||||
if (ctrl->cmd) {
|
||||
SNDERR("Server has not done the cmd");
|
||||
snd_error(PCM, "Server has not done the cmd");
|
||||
return -EBADFD;
|
||||
}
|
||||
return ctrl->result;
|
||||
|
|
@ -99,7 +99,7 @@ static int snd_pcm_shm_new_rbptr(snd_pcm_t *pcm, snd_pcm_shm_t *shm,
|
|||
mmap_size = page_ptr(shm_rbptr->offset, sizeof(snd_pcm_uframes_t), &offset, &mmap_offset);
|
||||
ptr = mmap(NULL, mmap_size, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, mmap_offset);
|
||||
if (ptr == MAP_FAILED || ptr == NULL) {
|
||||
SYSERR("shm rbptr mmap failed");
|
||||
snd_errornum(PCM, "shm rbptr mmap failed");
|
||||
return -errno;
|
||||
}
|
||||
if (&pcm->hw == rbptr)
|
||||
|
|
@ -126,7 +126,7 @@ static long snd_pcm_shm_action(snd_pcm_t *pcm)
|
|||
if (err != 1)
|
||||
return -EBADFD;
|
||||
if (ctrl->cmd) {
|
||||
SNDERR("Server has not done the cmd");
|
||||
snd_error(PCM, "Server has not done the cmd");
|
||||
return -EBADFD;
|
||||
}
|
||||
result = ctrl->result;
|
||||
|
|
@ -161,7 +161,7 @@ static long snd_pcm_shm_action_fd(snd_pcm_t *pcm, int *fd)
|
|||
if (err != 1)
|
||||
return -EBADFD;
|
||||
if (ctrl->cmd) {
|
||||
SNDERR("Server has not done the cmd");
|
||||
snd_error(PCM, "Server has not done the cmd");
|
||||
return -EBADFD;
|
||||
}
|
||||
if (ctrl->hw.changed) {
|
||||
|
|
@ -354,7 +354,7 @@ static int snd_pcm_shm_munmap(snd_pcm_t *pcm)
|
|||
}
|
||||
err = close(i->u.mmap.fd);
|
||||
if (err < 0) {
|
||||
SYSERR("close failed");
|
||||
snd_errornum(PCM, "close failed");
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
|
@ -641,7 +641,7 @@ static int make_local_socket(const char *filename)
|
|||
|
||||
sock = socket(PF_LOCAL, SOCK_STREAM, 0);
|
||||
if (sock < 0) {
|
||||
SYSERR("socket failed");
|
||||
snd_errornum(PCM, "socket failed");
|
||||
return -errno;
|
||||
}
|
||||
|
||||
|
|
@ -649,7 +649,7 @@ static int make_local_socket(const char *filename)
|
|||
memcpy(addr->sun_path, filename, l);
|
||||
|
||||
if (connect(sock, (struct sockaddr *) addr, size) < 0) {
|
||||
SYSERR("connect failed");
|
||||
snd_errornum(PCM, "connect failed");
|
||||
return -errno;
|
||||
}
|
||||
return sock;
|
||||
|
|
@ -687,7 +687,7 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
result = make_local_socket(sockname);
|
||||
if (result < 0) {
|
||||
SNDERR("server for socket %s is not running", sockname);
|
||||
snd_error(PCM, "server for socket %s is not running", sockname);
|
||||
goto _err;
|
||||
}
|
||||
sock = result;
|
||||
|
|
@ -702,23 +702,23 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
req->namelen = snamelen;
|
||||
err = write(sock, req, reqlen);
|
||||
if (err < 0) {
|
||||
SYSERR("write error");
|
||||
snd_errornum(PCM, "write error");
|
||||
result = -errno;
|
||||
goto _err;
|
||||
}
|
||||
if ((size_t) err != reqlen) {
|
||||
SNDERR("write size error");
|
||||
snd_error(PCM, "write size error");
|
||||
result = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
err = read(sock, &ans, sizeof(ans));
|
||||
if (err < 0) {
|
||||
SYSERR("read error");
|
||||
snd_errornum(PCM, "read error");
|
||||
result = -errno;
|
||||
goto _err;
|
||||
}
|
||||
if (err != sizeof(ans)) {
|
||||
SNDERR("read size error");
|
||||
snd_error(PCM, "read size error");
|
||||
result = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -728,7 +728,7 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
|
||||
ctrl = shmat(ans.cookie, 0, 0);
|
||||
if (!ctrl) {
|
||||
SYSERR("shmat error");
|
||||
snd_errornum(PCM, "shmat error");
|
||||
result = -errno;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -781,7 +781,7 @@ performance.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type shm # Shared memory PCM
|
||||
type shm # Shared memory PCM
|
||||
server STR # Server name
|
||||
pcm STR # PCM name
|
||||
}
|
||||
|
|
@ -830,7 +830,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "server") == 0) {
|
||||
err = snd_config_get_string(n, &server);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -838,29 +838,29 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "pcm") == 0) {
|
||||
err = snd_config_get_string(n, &pcm_name);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!pcm_name) {
|
||||
SNDERR("pcm is not defined");
|
||||
snd_error(PCM, "pcm is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!server) {
|
||||
SNDERR("server is not defined");
|
||||
snd_error(PCM, "server is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_search_definition(root, "server", server, &sconfig);
|
||||
if (err < 0) {
|
||||
SNDERR("Unknown server %s", server);
|
||||
snd_error(PCM, "Unknown server %s", server);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (snd_config_get_type(sconfig) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for server %s definition", server);
|
||||
snd_error(PCM, "Invalid type for server %s definition", server);
|
||||
goto _err;
|
||||
}
|
||||
snd_config_for_each(i, next, sconfig) {
|
||||
|
|
@ -875,7 +875,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "socket") == 0) {
|
||||
err = snd_config_get_string(n, &sockname);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -883,19 +883,19 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "port") == 0) {
|
||||
err = snd_config_get_integer(n, &port);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
_err:
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
|
||||
if (!sockname) {
|
||||
SNDERR("socket is not defined");
|
||||
snd_error(PCM, "socket is not defined");
|
||||
goto _err;
|
||||
}
|
||||
err = snd_pcm_shm_open(pcmp, name, sockname, pcm_name, stream, mode);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ static int set_hw_params(snd_pcm_t *pcm,
|
|||
|
||||
static int set_sw_params(snd_pcm_t *pcm,
|
||||
snd_pcm_sw_params_t *sw_params,
|
||||
snd_spcm_xrun_type_t xrun_type)
|
||||
snd_spcm_xrun_type_t xrun_type)
|
||||
{
|
||||
int err;
|
||||
|
||||
|
|
|
|||
|
|
@ -475,7 +475,7 @@ static int snd_pcm_softvol_hw_refine_cprepare(snd_pcm_t *pcm,
|
|||
(1ULL << SND_PCM_FORMAT_S16_BE) |
|
||||
(1ULL << SND_PCM_FORMAT_S24_LE) |
|
||||
(1ULL << SND_PCM_FORMAT_S32_LE) |
|
||||
(1ULL << SND_PCM_FORMAT_S32_BE),
|
||||
(1ULL << SND_PCM_FORMAT_S32_BE),
|
||||
(1ULL << (SND_PCM_FORMAT_S24_3LE - 32))
|
||||
}
|
||||
};
|
||||
|
|
@ -632,8 +632,9 @@ static int snd_pcm_softvol_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * param
|
|||
slave->format != SND_PCM_FORMAT_S24_LE &&
|
||||
slave->format != SND_PCM_FORMAT_S32_LE &&
|
||||
slave->format != SND_PCM_FORMAT_S32_BE) {
|
||||
SNDERR("softvol supports only S16_LE, S16_BE, S24_LE, S24_3LE, "
|
||||
"S32_LE or S32_BE");
|
||||
snd_error(PCM, "softvol supports only S16_LE, S16_BE, S24_LE, S24_3LE, "
|
||||
"S32_LE or S32_BE");
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
svol->sformat = slave->format;
|
||||
|
|
@ -772,14 +773,14 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
|||
return err;
|
||||
ctl_card = snd_pcm_info_get_card(&info);
|
||||
if (ctl_card < 0) {
|
||||
SNDERR("No card defined for softvol control");
|
||||
snd_error(PCM, "No card defined for softvol control");
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
sprintf(tmp_name, "hw:%d", ctl_card);
|
||||
err = snd_ctl_open(&svol->ctl, tmp_name, 0);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot open CTL %s", tmp_name);
|
||||
snd_error(PCM, "Cannot open CTL %s", tmp_name);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -798,12 +799,12 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
|||
snd_ctl_elem_info_set_id(&cinfo, ctl_id);
|
||||
if ((err = snd_ctl_elem_info(svol->ctl, &cinfo)) < 0) {
|
||||
if (err != -ENOENT) {
|
||||
SNDERR("Cannot get info for CTL %s", tmp_name);
|
||||
snd_error(PCM, "Cannot get info for CTL %s", tmp_name);
|
||||
return err;
|
||||
}
|
||||
err = add_user_ctl(svol, &cinfo, cchannels);
|
||||
if (err < 0) {
|
||||
SNDERR("Cannot add a control");
|
||||
snd_error(PCM, "Cannot add a control");
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -822,14 +823,14 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
|||
(cinfo.access & SNDRV_CTL_ELEM_ACCESS_TLV_READ) != 0)) {
|
||||
err = snd_ctl_elem_remove(svol->ctl, &cinfo.id);
|
||||
if (err < 0) {
|
||||
SNDERR("Control %s mismatch", tmp_name);
|
||||
snd_error(PCM, "Control %s mismatch", tmp_name);
|
||||
return err;
|
||||
}
|
||||
/* clear cinfo including numid */
|
||||
snd_ctl_elem_info_clear(&cinfo);
|
||||
snd_ctl_elem_info_set_id(&cinfo, ctl_id);
|
||||
if ((err = add_user_ctl(svol, &cinfo, cchannels)) < 0) {
|
||||
SNDERR("Cannot add a control");
|
||||
snd_error(PCM, "Cannot add a control");
|
||||
return err;
|
||||
}
|
||||
} else if (svol->max_val > 1) {
|
||||
|
|
@ -852,7 +853,7 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
|||
#ifndef HAVE_SOFT_FLOAT
|
||||
svol->dB_value = calloc(resolution, sizeof(unsigned int));
|
||||
if (! svol->dB_value) {
|
||||
SNDERR("cannot allocate dB table");
|
||||
snd_error(PCM, "cannot allocate dB table");
|
||||
return -ENOMEM;
|
||||
}
|
||||
svol->min_dB = min_dB;
|
||||
|
|
@ -868,7 +869,7 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
|||
if (svol->zero_dB_val)
|
||||
svol->dB_value[svol->zero_dB_val] = 65535;
|
||||
#else
|
||||
SNDERR("Cannot handle the given dB range and resolution");
|
||||
snd_error(PCM, "Cannot handle the given dB range and resolution");
|
||||
return -EINVAL;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1020,28 +1021,28 @@ static int _snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_
|
|||
}
|
||||
if (strcmp(id, "name") == 0) {
|
||||
if ((err = snd_config_get_string(n, &name)) < 0) {
|
||||
SNDERR("field %s is not a string", id);
|
||||
snd_error(PCM, "field %s is not a string", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "index") == 0) {
|
||||
if ((err = snd_config_get_integer(n, &index)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(PCM, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "device") == 0) {
|
||||
if ((err = snd_config_get_integer(n, &device)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(PCM, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (strcmp(id, "subdevice") == 0) {
|
||||
if ((err = snd_config_get_integer(n, &subdevice)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(PCM, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1049,21 +1050,21 @@ static int _snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_
|
|||
if (strcmp(id, "count") == 0) {
|
||||
long v;
|
||||
if ((err = snd_config_get_integer(n, &v)) < 0) {
|
||||
SNDERR("field %s is not an integer", id);
|
||||
snd_error(PCM, "field %s is not an integer", id);
|
||||
goto _err;
|
||||
}
|
||||
if (v < 1 || v > 2) {
|
||||
SNDERR("Invalid count %ld", v);
|
||||
snd_error(PCM, "Invalid count %ld", v);
|
||||
goto _err;
|
||||
}
|
||||
*cchannels = v;
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (name == NULL) {
|
||||
SNDERR("Missing control name");
|
||||
snd_error(PCM, "Missing control name");
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -1100,17 +1101,17 @@ any changes.
|
|||
|
||||
\code
|
||||
pcm.name {
|
||||
type softvol # Soft Volume conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
[format STR] # Slave format
|
||||
}
|
||||
control {
|
||||
name STR # control element id string
|
||||
type softvol # Soft Volume conversion PCM
|
||||
slave STR # Slave name
|
||||
# or
|
||||
slave { # Slave definition
|
||||
pcm STR # Slave PCM name
|
||||
# or
|
||||
pcm { } # Slave PCM definition
|
||||
[format STR] # Slave format
|
||||
}
|
||||
control {
|
||||
name STR # control element id string
|
||||
[card STR] # control card index
|
||||
[iface STR] # interface of the element
|
||||
[index INT] # index of the element
|
||||
|
|
@ -1182,7 +1183,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
|
|||
long v;
|
||||
err = snd_config_get_integer(n, &v);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid resolution value");
|
||||
snd_error(PCM, "Invalid resolution value");
|
||||
return err;
|
||||
}
|
||||
resolution = v;
|
||||
|
|
@ -1191,7 +1192,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "min_dB") == 0) {
|
||||
err = snd_config_get_ireal(n, &min_dB);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid min_dB value");
|
||||
snd_error(PCM, "Invalid min_dB value");
|
||||
return err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -1199,33 +1200,34 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
|
|||
if (strcmp(id, "max_dB") == 0) {
|
||||
err = snd_config_get_ireal(n, &max_dB);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid max_dB value");
|
||||
snd_error(PCM, "Invalid max_dB value");
|
||||
return err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!slave) {
|
||||
SNDERR("slave is not defined");
|
||||
snd_error(PCM, "slave is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!control) {
|
||||
SNDERR("control is not defined");
|
||||
snd_error(PCM, "control is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (min_dB >= 0) {
|
||||
SNDERR("min_dB must be a negative value");
|
||||
snd_error(PCM, "min_dB must be a negative value");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (max_dB <= min_dB || max_dB > MAX_DB_UPPER_LIMIT) {
|
||||
SNDERR("max_dB must be larger than min_dB and less than %d dB",
|
||||
MAX_DB_UPPER_LIMIT);
|
||||
snd_error(PCM, "max_dB must be larger than min_dB and less than %d dB",
|
||||
MAX_DB_UPPER_LIMIT);
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
if (resolution <= 1 || resolution > 1024) {
|
||||
SNDERR("Invalid resolution value %d", resolution);
|
||||
snd_error(PCM, "Invalid resolution value %d", resolution);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (mode & SND_PCM_NO_SOFTVOL) {
|
||||
|
|
@ -1247,7 +1249,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
|
|||
sformat != SND_PCM_FORMAT_S24_LE &&
|
||||
sformat != SND_PCM_FORMAT_S32_LE &&
|
||||
sformat != SND_PCM_FORMAT_S32_BE) {
|
||||
SNDERR("only S16_LE, S16_BE, S24_LE, S24_3LE, S32_LE or S32_BE format is supported");
|
||||
snd_error(PCM, "only S16_LE, S16_BE, S24_LE, S24_3LE, S32_LE or S32_BE format is supported");
|
||||
snd_config_delete(sconf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -681,35 +681,35 @@ static void *const get32float_labels[2 * 2] = {
|
|||
#ifdef GET32F_END
|
||||
get32f_1234F_1234: tmp_float.f = as_floatc(src);
|
||||
if (tmp_float.f >= 1.0)
|
||||
sample = 0x7fffffff;
|
||||
sample = 0x7fffffff;
|
||||
else if (tmp_float.f <= -1.0)
|
||||
sample = 0x80000000;
|
||||
sample = 0x80000000;
|
||||
else
|
||||
sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
|
||||
sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
|
||||
goto GET32F_END;
|
||||
get32f_4321F_1234: tmp_float.i = bswap_32(as_u32c(src));
|
||||
if (tmp_float.f >= 1.0)
|
||||
sample = 0x7fffffff;
|
||||
sample = 0x7fffffff;
|
||||
else if (tmp_float.f <= -1.0)
|
||||
sample = 0x80000000;
|
||||
sample = 0x80000000;
|
||||
else
|
||||
sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
|
||||
sample = (int32_t)(tmp_float.f * (float_t)0x80000000UL);
|
||||
goto GET32F_END;
|
||||
get32f_1234D_1234: tmp_double.d = as_doublec(src);
|
||||
if (tmp_double.d >= 1.0)
|
||||
sample = 0x7fffffff;
|
||||
sample = 0x7fffffff;
|
||||
else if (tmp_double.d <= -1.0)
|
||||
sample = 0x80000000;
|
||||
sample = 0x80000000;
|
||||
else
|
||||
sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
|
||||
sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
|
||||
goto GET32F_END;
|
||||
get32f_4321D_1234: tmp_double.l = bswap_64(as_u64c(src));
|
||||
if (tmp_double.d >= 1.0)
|
||||
sample = 0x7fffffff;
|
||||
sample = 0x7fffffff;
|
||||
else if (tmp_double.d <= -1.0)
|
||||
sample = 0x80000000;
|
||||
sample = 0x80000000;
|
||||
else
|
||||
sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
|
||||
sample = (int32_t)(tmp_double.d * (double_t)0x80000000UL);
|
||||
goto GET32F_END;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ static int level_enable(snd_pcm_scope_t *scope)
|
|||
snd_pcm_scope_set_callback_private(scope, level);
|
||||
level->win = initscr();
|
||||
winsdelln(level->win, snd_pcm_meter_get_channels(level->pcm));
|
||||
getyx(level->win, y, x);
|
||||
getyx(level->win, y, x);
|
||||
level->top = y;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -236,7 +236,7 @@ int _snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
|
|||
if (strcmp(id, "bar_width") == 0) {
|
||||
err = snd_config_get_integer(n, &bar_width);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -244,7 +244,7 @@ int _snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
|
|||
if (strcmp(id, "decay_ms") == 0) {
|
||||
err = snd_config_get_integer(n, &decay_ms);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -252,12 +252,12 @@ int _snd_pcm_scope_level_open(snd_pcm_t *pcm, const char *name,
|
|||
if (strcmp(id, "peak_ms") == 0) {
|
||||
err = snd_config_get_integer(n, &peak_ms);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(PCM, "Invalid type for %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(PCM, "Unknown field %s", id);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (bar_width < 0)
|
||||
|
|
|
|||
|
|
@ -188,30 +188,30 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
|
|||
#endif
|
||||
if (snd_config_get_type(rawmidi_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
if (name)
|
||||
SNDERR("Invalid type for RAWMIDI %s definition", name);
|
||||
snd_error(RAWMIDI, "Invalid type for RAWMIDI %s definition", name);
|
||||
else
|
||||
SNDERR("Invalid type for RAWMIDI definition");
|
||||
snd_error(RAWMIDI, "Invalid type for RAWMIDI definition");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_search(rawmidi_conf, "type", &conf);
|
||||
if (err < 0) {
|
||||
SNDERR("type is not defined");
|
||||
snd_error(RAWMIDI, "type is not defined");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_id(conf, &id);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to get id");
|
||||
snd_error(RAWMIDI, "unable to get id");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_string(conf, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(RAWMIDI, "Invalid type for %s", id);
|
||||
return err;
|
||||
}
|
||||
err = snd_config_search_definition(rawmidi_root, "rawmidi_type", str, &type_conf);
|
||||
if (err >= 0) {
|
||||
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for RAWMIDI type %s definition", str);
|
||||
snd_error(RAWMIDI, "Invalid type for RAWMIDI type %s definition", str);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
|
|||
if (strcmp(id, "lib") == 0) {
|
||||
err = snd_config_get_string(n, &lib);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(RAWMIDI, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -233,12 +233,12 @@ static int snd_rawmidi_open_conf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp
|
|||
if (strcmp(id, "open") == 0) {
|
||||
err = snd_config_get_string(n, &open_name);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(RAWMIDI, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(RAWMIDI, "Unknown field %s", id);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -290,7 +290,7 @@ static int snd_rawmidi_open_noupdate(snd_rawmidi_t **inputp, snd_rawmidi_t **out
|
|||
snd_config_t *rawmidi_conf;
|
||||
err = snd_config_search_definition(root, "rawmidi", name, &rawmidi_conf);
|
||||
if (err < 0) {
|
||||
SNDERR("Unknown RawMidi %s", name);
|
||||
snd_error(RAWMIDI, "Unknown RawMidi %s", name);
|
||||
return err;
|
||||
}
|
||||
err = snd_rawmidi_open_conf(inputp, outputp, name, root, rawmidi_conf, mode);
|
||||
|
|
@ -360,7 +360,7 @@ int snd_rawmidi_open_lconf(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
int snd_rawmidi_close(snd_rawmidi_t *rawmidi)
|
||||
{
|
||||
int err;
|
||||
assert(rawmidi);
|
||||
assert(rawmidi);
|
||||
err = rawmidi->ops->close(rawmidi);
|
||||
free(rawmidi->name);
|
||||
if (rawmidi->open_func)
|
||||
|
|
@ -448,12 +448,12 @@ int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rawmidi, struct pollfd *pfds, un
|
|||
*/
|
||||
int snd_rawmidi_poll_descriptors_revents(snd_rawmidi_t *rawmidi, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
|
||||
{
|
||||
assert(rawmidi && pfds && revents);
|
||||
if (nfds == 1) {
|
||||
*revents = pfds->revents;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
assert(rawmidi && pfds && revents);
|
||||
if (nfds == 1) {
|
||||
*revents = pfds->revents;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ static int snd_rawmidi_hw_close(snd_rawmidi_t *rmidi)
|
|||
return 0;
|
||||
if (close(hw->fd)) {
|
||||
err = -errno;
|
||||
SYSMSG("close failed");
|
||||
snd_checknum(RAWMIDI, "close failed");
|
||||
}
|
||||
free(hw->buf);
|
||||
free(hw);
|
||||
|
|
@ -82,7 +82,7 @@ static int snd_rawmidi_hw_nonblock(snd_rawmidi_t *rmidi, int nonblock)
|
|||
long flags;
|
||||
|
||||
if ((flags = fcntl(hw->fd, F_GETFL)) < 0) {
|
||||
SYSMSG("F_GETFL failed");
|
||||
snd_checknum(RAWMIDI, "F_GETFL failed");
|
||||
return -errno;
|
||||
}
|
||||
if (nonblock)
|
||||
|
|
@ -90,7 +90,7 @@ static int snd_rawmidi_hw_nonblock(snd_rawmidi_t *rmidi, int nonblock)
|
|||
else
|
||||
flags &= ~O_NONBLOCK;
|
||||
if (fcntl(hw->fd, F_SETFL, flags) < 0) {
|
||||
SYSMSG("F_SETFL for O_NONBLOCK failed");
|
||||
snd_checknum(RAWMIDI, "F_SETFL for O_NONBLOCK failed");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -101,7 +101,7 @@ static int snd_rawmidi_hw_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info)
|
|||
snd_rawmidi_hw_t *hw = rmidi->private_data;
|
||||
info->stream = rmidi->stream;
|
||||
if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_INFO, info) < 0) {
|
||||
SYSMSG("SNDRV_RAWMIDI_IOCTL_INFO failed");
|
||||
snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_INFO failed");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -113,7 +113,7 @@ static int snd_rawmidi_hw_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * pa
|
|||
int tstamp;
|
||||
params->stream = rmidi->stream;
|
||||
if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_PARAMS, params) < 0) {
|
||||
SYSMSG("SNDRV_RAWMIDI_IOCTL_PARAMS failed");
|
||||
snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_PARAMS failed");
|
||||
return -errno;
|
||||
}
|
||||
buf_reset(hw);
|
||||
|
|
@ -145,7 +145,7 @@ static int snd_rawmidi_hw_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * st
|
|||
snd_rawmidi_hw_t *hw = rmidi->private_data;
|
||||
status->stream = rmidi->stream;
|
||||
if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_STATUS, status) < 0) {
|
||||
SYSMSG("SNDRV_RAWMIDI_IOCTL_STATUS failed");
|
||||
snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_STATUS failed");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -156,7 +156,7 @@ static int snd_rawmidi_hw_drop(snd_rawmidi_t *rmidi)
|
|||
snd_rawmidi_hw_t *hw = rmidi->private_data;
|
||||
int str = rmidi->stream;
|
||||
if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_DROP, &str) < 0) {
|
||||
SYSMSG("SNDRV_RAWMIDI_IOCTL_DROP failed");
|
||||
snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_DROP failed");
|
||||
return -errno;
|
||||
}
|
||||
buf_reset(hw);
|
||||
|
|
@ -168,7 +168,7 @@ static int snd_rawmidi_hw_drain(snd_rawmidi_t *rmidi)
|
|||
snd_rawmidi_hw_t *hw = rmidi->private_data;
|
||||
int str = rmidi->stream;
|
||||
if (ioctl(hw->fd, SNDRV_RAWMIDI_IOCTL_DRAIN, &str) < 0) {
|
||||
SYSMSG("SNDRV_RAWMIDI_IOCTL_DRAIN failed");
|
||||
snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_DRAIN failed");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -344,11 +344,11 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
sprintf(filename, SNDRV_FILE_RAWMIDI, card, device);
|
||||
|
||||
__again:
|
||||
if (attempt++ > 3) {
|
||||
snd_ctl_close(ctl);
|
||||
return -EBUSY;
|
||||
}
|
||||
ret = snd_ctl_rawmidi_prefer_subdevice(ctl, subdevice);
|
||||
if (attempt++ > 3) {
|
||||
snd_ctl_close(ctl);
|
||||
return -EBUSY;
|
||||
}
|
||||
ret = snd_ctl_rawmidi_prefer_subdevice(ctl, subdevice);
|
||||
if (ret < 0) {
|
||||
snd_ctl_close(ctl);
|
||||
return ret;
|
||||
|
|
@ -382,13 +382,13 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
fd = snd_open_device(filename, fmode);
|
||||
if (fd < 0) {
|
||||
snd_ctl_close(ctl);
|
||||
SYSMSG("open %s failed", filename);
|
||||
snd_checknum(RAWMIDI, "open %s failed", filename);
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
if (ioctl(fd, SNDRV_RAWMIDI_IOCTL_PVERSION, &ver) < 0) {
|
||||
ret = -errno;
|
||||
SYSMSG("SNDRV_RAWMIDI_IOCTL_PVERSION failed");
|
||||
snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_PVERSION failed");
|
||||
close(fd);
|
||||
snd_ctl_close(ctl);
|
||||
return ret;
|
||||
|
|
@ -407,7 +407,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
memset(&info, 0, sizeof(info));
|
||||
info.stream = outputp ? SNDRV_RAWMIDI_STREAM_OUTPUT : SNDRV_RAWMIDI_STREAM_INPUT;
|
||||
if (ioctl(fd, SNDRV_RAWMIDI_IOCTL_INFO, &info) < 0) {
|
||||
SYSMSG("SNDRV_RAWMIDI_IOCTL_INFO failed");
|
||||
snd_checknum(RAWMIDI, "SNDRV_RAWMIDI_IOCTL_INFO failed");
|
||||
ret = -errno;
|
||||
close(fd);
|
||||
snd_ctl_close(ctl);
|
||||
|
|
|
|||
220
src/seq/seq.c
220
src/seq/seq.c
|
|
@ -58,12 +58,12 @@ A typical code would be like below:
|
|||
// create a new client
|
||||
snd_seq_t *open_client()
|
||||
{
|
||||
snd_seq_t *handle;
|
||||
int err;
|
||||
err = snd_seq_open(&handle, "default", SND_SEQ_OPEN_INPUT, 0);
|
||||
if (err < 0)
|
||||
return NULL;
|
||||
snd_seq_set_client_name(handle, "My Client");
|
||||
snd_seq_t *handle;
|
||||
int err;
|
||||
err = snd_seq_open(&handle, "default", SND_SEQ_OPEN_INPUT, 0);
|
||||
if (err < 0)
|
||||
return NULL;
|
||||
snd_seq_set_client_name(handle, "My Client");
|
||||
return handle;
|
||||
}
|
||||
\endcode
|
||||
|
|
@ -138,13 +138,13 @@ Then, a connection from MIDI input port to this program is established.
|
|||
From this time, events from keyboard are automatically sent to this program.
|
||||
Timestamps will be updated according to the subscribed queue.
|
||||
\code
|
||||
MIDI input port (keyboard)
|
||||
|
|
||||
V
|
||||
ALSA sequencer - update timestamp
|
||||
|
|
||||
V
|
||||
application port
|
||||
MIDI input port (keyboard)
|
||||
|
|
||||
V
|
||||
ALSA sequencer - update timestamp
|
||||
|
|
||||
V
|
||||
application port
|
||||
\endcode
|
||||
|
||||
There is another subscription type for opposite direction:
|
||||
|
|
@ -155,13 +155,13 @@ to MIDI port for write.
|
|||
After this connection is established, events will be properly sent
|
||||
to MIDI output device.
|
||||
\code
|
||||
application port
|
||||
|
|
||||
V
|
||||
ALSA sequencer - events are scheduled
|
||||
|
|
||||
V
|
||||
MIDI output port (WaveTable etc.)
|
||||
application port
|
||||
|
|
||||
V
|
||||
ALSA sequencer - events are scheduled
|
||||
|
|
||||
V
|
||||
MIDI output port (WaveTable etc.)
|
||||
\endcode
|
||||
|
||||
From the viewpoint of subscription, the examples above are special cases.
|
||||
|
|
@ -178,13 +178,13 @@ The connection between ports can be done also by the "third" client.
|
|||
Thus, filter applications have to manage
|
||||
only input and output events regardless of receiver/sender addresses.
|
||||
\code
|
||||
sequencer port #1
|
||||
|
|
||||
V
|
||||
ALSA sequencer (scheduled or real-time)
|
||||
|
|
||||
V
|
||||
sequencer port #2
|
||||
sequencer port #1
|
||||
|
|
||||
V
|
||||
ALSA sequencer (scheduled or real-time)
|
||||
|
|
||||
V
|
||||
sequencer port #2
|
||||
\endcode
|
||||
|
||||
For the detail about subscription, see the section \ref seq_subs_more.
|
||||
|
|
@ -454,11 +454,11 @@ For example, to set the tempo of the queue <code>q</code> to
|
|||
\code
|
||||
void set_tempo(snd_seq_t *handle, int queue)
|
||||
{
|
||||
snd_seq_queue_tempo_t *tempo;
|
||||
snd_seq_queue_tempo_alloca(&tempo);
|
||||
snd_seq_queue_tempo_set_tempo(tempo, 1000000); // 60 BPM
|
||||
snd_seq_queue_tempo_set_ppq(tempo, 48); // 48 PPQ
|
||||
snd_seq_set_queue_tempo(handle, queue, tempo);
|
||||
snd_seq_queue_tempo_t *tempo;
|
||||
snd_seq_queue_tempo_alloca(&tempo);
|
||||
snd_seq_queue_tempo_set_tempo(tempo, 1000000); // 60 BPM
|
||||
snd_seq_queue_tempo_set_ppq(tempo, 48); // 48 PPQ
|
||||
snd_seq_set_queue_tempo(handle, queue, tempo);
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -629,19 +629,19 @@ The application port must have capability #SND_SEQ_PORT_CAP_WRITE.
|
|||
\code
|
||||
void capture_keyboard(snd_seq_t *seq)
|
||||
{
|
||||
snd_seq_addr_t sender, dest;
|
||||
snd_seq_port_subscribe_t *subs;
|
||||
sender.client = 64;
|
||||
sender.port = 0;
|
||||
dest.client = 128;
|
||||
dest.port = 0;
|
||||
snd_seq_port_subscribe_alloca(&subs);
|
||||
snd_seq_port_subscribe_set_sender(subs, &sender);
|
||||
snd_seq_port_subscribe_set_dest(subs, &dest);
|
||||
snd_seq_port_subscribe_set_queue(subs, 1);
|
||||
snd_seq_port_subscribe_set_time_update(subs, 1);
|
||||
snd_seq_port_subscribe_set_time_real(subs, 1);
|
||||
snd_seq_subscribe_port(seq, subs);
|
||||
snd_seq_addr_t sender, dest;
|
||||
snd_seq_port_subscribe_t *subs;
|
||||
sender.client = 64;
|
||||
sender.port = 0;
|
||||
dest.client = 128;
|
||||
dest.port = 0;
|
||||
snd_seq_port_subscribe_alloca(&subs);
|
||||
snd_seq_port_subscribe_set_sender(subs, &sender);
|
||||
snd_seq_port_subscribe_set_dest(subs, &dest);
|
||||
snd_seq_port_subscribe_set_queue(subs, 1);
|
||||
snd_seq_port_subscribe_set_time_update(subs, 1);
|
||||
snd_seq_port_subscribe_set_time_real(subs, 1);
|
||||
snd_seq_subscribe_port(seq, subs);
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -652,23 +652,23 @@ The application port must have capability #SND_SEQ_PORT_CAP_READ.
|
|||
\code
|
||||
void subscribe_output(snd_seq_t *seq)
|
||||
{
|
||||
snd_seq_addr_t sender, dest;
|
||||
snd_seq_port_subscribe_t *subs;
|
||||
sender.client = 128;
|
||||
sender.port = 0;
|
||||
dest.client = 65;
|
||||
dest.port = 1;
|
||||
snd_seq_port_subscribe_alloca(&subs);
|
||||
snd_seq_port_subscribe_set_sender(subs, &sender);
|
||||
snd_seq_port_subscribe_set_dest(subs, &dest);
|
||||
snd_seq_subscribe_port(seq, subs);
|
||||
snd_seq_addr_t sender, dest;
|
||||
snd_seq_port_subscribe_t *subs;
|
||||
sender.client = 128;
|
||||
sender.port = 0;
|
||||
dest.client = 65;
|
||||
dest.port = 1;
|
||||
snd_seq_port_subscribe_alloca(&subs);
|
||||
snd_seq_port_subscribe_set_sender(subs, &sender);
|
||||
snd_seq_port_subscribe_set_dest(subs, &dest);
|
||||
snd_seq_subscribe_port(seq, subs);
|
||||
}
|
||||
\endcode
|
||||
This example can be simplified by using #snd_seq_connect_to() function.
|
||||
\code
|
||||
void subscribe_output(snd_seq_t *seq)
|
||||
{
|
||||
snd_seq_connect_to(seq, 0, 65, 1);
|
||||
snd_seq_connect_to(seq, 0, 65, 1);
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -686,16 +686,16 @@ and the receiver
|
|||
// ..in the third application (130:0) ..
|
||||
void coupling(snd_seq_t *seq)
|
||||
{
|
||||
snd_seq_addr_t sender, dest;
|
||||
snd_seq_port_subscribe_t *subs;
|
||||
sender.client = 128;
|
||||
sender.port = 0;
|
||||
dest.client = 129;
|
||||
dest.port = 0;
|
||||
snd_seq_port_subscribe_alloca(&subs);
|
||||
snd_seq_port_subscribe_set_sender(subs, &sender);
|
||||
snd_seq_port_subscribe_set_dest(subs, &dest);
|
||||
snd_seq_subscribe_port(seq, subs);
|
||||
snd_seq_addr_t sender, dest;
|
||||
snd_seq_port_subscribe_t *subs;
|
||||
sender.client = 128;
|
||||
sender.port = 0;
|
||||
dest.client = 129;
|
||||
dest.port = 0;
|
||||
snd_seq_port_subscribe_alloca(&subs);
|
||||
snd_seq_port_subscribe_set_sender(subs, &sender);
|
||||
snd_seq_port_subscribe_set_dest(subs, &dest);
|
||||
snd_seq_subscribe_port(seq, subs);
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -729,17 +729,17 @@ The program appears like this:
|
|||
\code
|
||||
void schedule_event(snd_seq_t *seq)
|
||||
{
|
||||
snd_seq_event_t ev;
|
||||
snd_seq_event_t ev;
|
||||
|
||||
snd_seq_ev_clear(&ev);
|
||||
snd_seq_ev_set_source(&ev, my_port);
|
||||
snd_seq_ev_set_subs(&ev);
|
||||
snd_seq_ev_schedule_tick(&ev, Q, 0, t);
|
||||
... // set event type, data, so on..
|
||||
snd_seq_ev_clear(&ev);
|
||||
snd_seq_ev_set_source(&ev, my_port);
|
||||
snd_seq_ev_set_subs(&ev);
|
||||
snd_seq_ev_schedule_tick(&ev, Q, 0, t);
|
||||
... // set event type, data, so on..
|
||||
|
||||
snd_seq_event_output(seq, &ev);
|
||||
...
|
||||
snd_seq_drain_output(seq); // if necessary
|
||||
snd_seq_event_output(seq, &ev);
|
||||
...
|
||||
snd_seq_drain_output(seq); // if necessary
|
||||
}
|
||||
\endcode
|
||||
Of course, you can use realtime stamp, too.
|
||||
|
|
@ -754,16 +754,16 @@ The program can be more simplified as follows:
|
|||
\code
|
||||
void direct_delivery(snd_seq_t *seq)
|
||||
{
|
||||
snd_seq_event_t ev;
|
||||
snd_seq_event_t ev;
|
||||
|
||||
snd_seq_ev_clear(&ev);
|
||||
snd_seq_ev_set_source(&ev, port);
|
||||
snd_seq_ev_set_subs(&ev);
|
||||
snd_seq_ev_set_direct(&ev);
|
||||
... // set event type, data, so on..
|
||||
snd_seq_ev_clear(&ev);
|
||||
snd_seq_ev_set_source(&ev, port);
|
||||
snd_seq_ev_set_subs(&ev);
|
||||
snd_seq_ev_set_direct(&ev);
|
||||
... // set event type, data, so on..
|
||||
|
||||
snd_seq_event_output(seq, &ev);
|
||||
snd_seq_drain_output(seq);
|
||||
snd_seq_event_output(seq, &ev);
|
||||
snd_seq_drain_output(seq);
|
||||
}
|
||||
\endcode
|
||||
You should flush event soon after output event.
|
||||
|
|
@ -778,15 +778,15 @@ after some modification, will appear as following:
|
|||
\code
|
||||
void event_filter(snd_seq_t *seq, snd_seq_event_t *ev)
|
||||
{
|
||||
while (snd_seq_event_input(seq, &ev) >= 0) {
|
||||
//.. modify input event ..
|
||||
while (snd_seq_event_input(seq, &ev) >= 0) {
|
||||
//.. modify input event ..
|
||||
|
||||
snd_seq_ev_set_source(ev, my_port);
|
||||
snd_seq_ev_set_subs(ev);
|
||||
snd_seq_ev_set_direct(ev);
|
||||
snd_seq_event_output(seq, ev);
|
||||
snd_seq_drain_output(seq);
|
||||
}
|
||||
snd_seq_ev_set_source(ev, my_port);
|
||||
snd_seq_ev_set_subs(ev);
|
||||
snd_seq_ev_set_direct(ev);
|
||||
snd_seq_event_output(seq, ev);
|
||||
snd_seq_drain_output(seq);
|
||||
}
|
||||
}
|
||||
\endcode
|
||||
|
||||
|
|
@ -914,30 +914,30 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
void *h = NULL;
|
||||
if (snd_config_get_type(seq_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
if (name)
|
||||
SNDERR("Invalid type for SEQ %s definition", name);
|
||||
snd_error(SEQUENCER, "Invalid type for SEQ %s definition", name);
|
||||
else
|
||||
SNDERR("Invalid type for SEQ definition");
|
||||
snd_error(SEQUENCER, "Invalid type for SEQ definition");
|
||||
return -EINVAL;
|
||||
}
|
||||
err = snd_config_search(seq_conf, "type", &conf);
|
||||
if (err < 0) {
|
||||
SNDERR("type is not defined");
|
||||
snd_error(SEQUENCER, "type is not defined");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_id(conf, &id);
|
||||
if (err < 0) {
|
||||
SNDERR("unable to get id");
|
||||
snd_error(SEQUENCER, "unable to get id");
|
||||
return err;
|
||||
}
|
||||
err = snd_config_get_string(conf, &str);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(SEQUENCER, "Invalid type for %s", id);
|
||||
return err;
|
||||
}
|
||||
err = snd_config_search_definition(seq_root, "seq_type", str, &type_conf);
|
||||
if (err >= 0) {
|
||||
if (snd_config_get_type(type_conf) != SND_CONFIG_TYPE_COMPOUND) {
|
||||
SNDERR("Invalid type for SEQ type %s definition", str);
|
||||
snd_error(SEQUENCER, "Invalid type for SEQ type %s definition", str);
|
||||
goto _err;
|
||||
}
|
||||
snd_config_for_each(i, next, type_conf) {
|
||||
|
|
@ -950,7 +950,7 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
if (strcmp(id, "lib") == 0) {
|
||||
err = snd_config_get_string(n, &lib);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(SEQUENCER, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
|
|
@ -958,12 +958,12 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
if (strcmp(id, "open") == 0) {
|
||||
err = snd_config_get_string(n, &open_name);
|
||||
if (err < 0) {
|
||||
SNDERR("Invalid type for %s", id);
|
||||
snd_error(SEQUENCER, "Invalid type for %s", id);
|
||||
goto _err;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SNDERR("Unknown field %s", id);
|
||||
snd_error(SEQUENCER, "Unknown field %s", id);
|
||||
err = -EINVAL;
|
||||
goto _err;
|
||||
}
|
||||
|
|
@ -980,10 +980,10 @@ static int snd_seq_open_conf(snd_seq_t **seqp, const char *name,
|
|||
open_func = snd_dlsym(h, open_name, SND_DLSYM_VERSION(SND_SEQ_DLSYM_VERSION));
|
||||
err = 0;
|
||||
if (!h) {
|
||||
SNDERR("Cannot open shared library %s (%s)", lib, errbuf);
|
||||
snd_error(SEQUENCER, "Cannot open shared library %s (%s)", lib, errbuf);
|
||||
err = -ENOENT;
|
||||
} else if (!open_func) {
|
||||
SNDERR("symbol %s is not defined inside %s", open_name, lib);
|
||||
snd_error(SEQUENCER, "symbol %s is not defined inside %s", open_name, lib);
|
||||
snd_dlclose(h);
|
||||
err = -ENXIO;
|
||||
}
|
||||
|
|
@ -1008,7 +1008,7 @@ static int snd_seq_open_noupdate(snd_seq_t **seqp, snd_config_t *root,
|
|||
snd_config_t *seq_conf;
|
||||
err = snd_config_search_definition(root, "seq", name, &seq_conf);
|
||||
if (err < 0) {
|
||||
SNDERR("Unknown SEQ %s", name);
|
||||
snd_error(SEQUENCER, "Unknown SEQ %s", name);
|
||||
return err;
|
||||
}
|
||||
snd_config_set_hop(seq_conf, hop);
|
||||
|
|
@ -1212,12 +1212,12 @@ int snd_seq_poll_descriptors(snd_seq_t *seq, struct pollfd *pfds, unsigned int s
|
|||
*/
|
||||
int snd_seq_poll_descriptors_revents(snd_seq_t *seq, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
|
||||
{
|
||||
assert(seq && pfds && revents);
|
||||
if (nfds == 1) {
|
||||
*revents = pfds->revents;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
assert(seq && pfds && revents);
|
||||
if (nfds == 1) {
|
||||
*revents = pfds->revents;
|
||||
return 0;
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4594,7 +4594,7 @@ static int snd_seq_event_input_feed(snd_seq_t *seq, int timeout)
|
|||
pfd.events = POLLIN;
|
||||
err = poll(&pfd, 1, timeout);
|
||||
if (err < 0) {
|
||||
SYSERR("poll");
|
||||
snd_errornum(SEQUENCER, "poll");
|
||||
return -errno;
|
||||
}
|
||||
if (pfd.revents & POLLIN)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ static int snd_seq_hw_close(snd_seq_t *seq)
|
|||
|
||||
if (close(hw->fd)) {
|
||||
err = -errno;
|
||||
SYSERR("close failed\n");
|
||||
snd_errornum(SEQUENCER, "close failed\n");
|
||||
}
|
||||
free(hw);
|
||||
return err;
|
||||
|
|
@ -58,7 +58,7 @@ static int snd_seq_hw_nonblock(snd_seq_t *seq, int nonblock)
|
|||
long flags;
|
||||
|
||||
if ((flags = fcntl(hw->fd, F_GETFL)) < 0) {
|
||||
SYSERR("F_GETFL failed");
|
||||
snd_errornum(SEQUENCER, "F_GETFL failed");
|
||||
return -errno;
|
||||
}
|
||||
if (nonblock)
|
||||
|
|
@ -66,7 +66,7 @@ static int snd_seq_hw_nonblock(snd_seq_t *seq, int nonblock)
|
|||
else
|
||||
flags &= ~O_NONBLOCK;
|
||||
if (fcntl(hw->fd, F_SETFL, flags) < 0) {
|
||||
SYSERR("F_SETFL for O_NONBLOCK failed");
|
||||
snd_errornum(SEQUENCER, "F_SETFL for O_NONBLOCK failed");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -77,7 +77,7 @@ static int snd_seq_hw_client_id(snd_seq_t *seq)
|
|||
snd_seq_hw_t *hw = seq->private_data;
|
||||
int client;
|
||||
if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_CLIENT_ID, &client) < 0) {
|
||||
SYSERR("SNDRV_SEQ_IOCTL_CLIENT_ID failed");
|
||||
snd_errornum(SEQUENCER, "SNDRV_SEQ_IOCTL_CLIENT_ID failed");
|
||||
return -errno;
|
||||
}
|
||||
return client;
|
||||
|
|
@ -87,7 +87,7 @@ static int snd_seq_hw_system_info(snd_seq_t *seq, snd_seq_system_info_t * info)
|
|||
{
|
||||
snd_seq_hw_t *hw = seq->private_data;
|
||||
if (ioctl(hw->fd, SNDRV_SEQ_IOCTL_SYSTEM_INFO, info) < 0) {
|
||||
SYSERR("SNDRV_SEQ_IOCTL_SYSTEM_INFO failed");
|
||||
snd_errornum(SEQUENCER, "SNDRV_SEQ_IOCTL_SYSTEM_INFO failed");
|
||||
return -errno;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -537,11 +537,11 @@ int snd_seq_hw_open(snd_seq_t **handle, const char *name, int streams, int mode)
|
|||
}
|
||||
#endif
|
||||
if (fd < 0) {
|
||||
SYSERR("open %s failed", filename);
|
||||
snd_errornum(SEQUENCER, "open %s failed", filename);
|
||||
return -errno;
|
||||
}
|
||||
if (ioctl(fd, SNDRV_SEQ_IOCTL_PVERSION, &ver) < 0) {
|
||||
SYSERR("SNDRV_SEQ_IOCTL_PVERSION failed");
|
||||
snd_errornum(SEQUENCER, "SNDRV_SEQ_IOCTL_PVERSION failed");
|
||||
ret = -errno;
|
||||
close(fd);
|
||||
return ret;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue