libs/alsa-lib-1.0.13/src/confmisc.c File Reference

Configuration helper functions. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "local.h"

Include dependency graph for confmisc.c:

Go to the source code of this file.

Functions

int snd_config_get_bool_ascii (const char *ascii)
 Gets the boolean value from the given ASCII string.
int snd_config_get_bool (const snd_config_t *conf)
 Gets the boolean value from a configuration node.
int snd_config_get_ctl_iface_ascii (const char *ascii)
 Gets the control interface index from the given ASCII string.
int snd_config_get_ctl_iface (const snd_config_t *conf)
 Gets the control interface index from a configuration node.
int snd_func_getenv (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns an environment value.
 SND_DLSYM_BUILD_VERSION (snd_func_getenv, SND_CONFIG_DLSYM_VERSION_EVALUATE)
int snd_func_igetenv (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns an integer environment value.
 SND_DLSYM_BUILD_VERSION (snd_func_igetenv, SND_CONFIG_DLSYM_VERSION_EVALUATE)
int snd_func_concat (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Merges the given strings.
 SND_DLSYM_BUILD_VERSION (snd_func_concat, SND_CONFIG_DLSYM_VERSION_EVALUATE)
int snd_func_datadir (snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, snd_config_t *private_data ATTRIBUTE_UNUSED)
 Returns the ALSA data directory.
 SND_DLSYM_BUILD_VERSION (snd_func_datadir, SND_CONFIG_DLSYM_VERSION_EVALUATE)
static int open_ctl (long card, snd_ctl_t **ctl)
int snd_func_private_string (snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, snd_config_t *private_data)
 Returns the string from private_data.
 SND_DLSYM_BUILD_VERSION (snd_func_private_string, SND_CONFIG_DLSYM_VERSION_EVALUATE)
int snd_determine_driver (int card, char **driver)
int snd_func_private_card_driver (snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, snd_config_t *private_data)
 Returns the driver identification from private_data.
 SND_DLSYM_BUILD_VERSION (snd_func_private_card_driver, SND_CONFIG_DLSYM_VERSION_EVALUATE)
int snd_func_card_driver (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns the driver identification for a card.
 SND_DLSYM_BUILD_VERSION (snd_func_card_driver, SND_CONFIG_DLSYM_VERSION_EVALUATE)
int snd_func_card_id (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Returns the identification of a card.
 SND_DLSYM_BUILD_VERSION (snd_func_card_id, SND_CONFIG_DLSYM_VERSION_EVALUATE)
int snd_func_pcm_id (snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
 Returns the pcm identification of a device.
 SND_DLSYM_BUILD_VERSION (snd_func_pcm_id, SND_CONFIG_DLSYM_VERSION_EVALUATE)
int snd_func_pcm_args_by_class (snd_config_t **dst, snd_config_t *root, snd_config_t *src, void *private_data)
 Returns the pcm card and device arguments (in form CARD=N,DEV=M) for pcm specified by class and index.
 SND_DLSYM_BUILD_VERSION (snd_func_pcm_args_by_class, SND_CONFIG_DLSYM_VERSION_EVALUATE)
int snd_func_private_pcm_subdevice (snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED, snd_config_t *src, snd_config_t *private_data)
 Returns the PCM subdevice from private_data.
 SND_DLSYM_BUILD_VERSION (snd_func_private_pcm_subdevice, SND_CONFIG_DLSYM_VERSION_EVALUATE)
int snd_func_refer (snd_config_t **dst, snd_config_t *root, snd_config_t *src, snd_config_t *private_data)
 Copies the specified configuration node.
 SND_DLSYM_BUILD_VERSION (snd_func_refer, SND_CONFIG_DLSYM_VERSION_EVALUATE)


Detailed Description

Configuration helper functions.

Author:
Abramo Bagnara <abramo@alsa-project.org>

Jaroslav Kysela <perex@suse.cz>

Date:
2000-2001
Configuration helper functions.

See the Runtime functions in configuration files page for more details.

Definition in file confmisc.c.


Function Documentation

static int open_ctl ( long  card,
snd_ctl_t **  ctl 
) [static]

Definition at line 481 of file confmisc.c.

References name, and snprintf().

Referenced by snd_determine_driver(), snd_func_card_id(), snd_func_pcm_args_by_class(), and snd_func_pcm_id().

int snd_config_get_bool ( const snd_config_t *  conf  ) 

Gets the boolean value from a configuration node.

Parameters:
conf Handle to the configuration node to be parsed.
Returns:
0 or 1 if successful, otherwise a negative error code.

Definition at line 108 of file confmisc.c.

References id, snd_config_get_bool_ascii(), snd_config_get_id(), snd_config_get_integer(), and snd_config_get_string().

int snd_config_get_bool_ascii ( const char *  ascii  ) 

Gets the boolean value from the given ASCII string.

Parameters:
ascii The string to be parsed.
Returns:
0 or 1 if successful, otherwise a negative error code.

Definition at line 80 of file confmisc.c.

Referenced by snd_config_get_bool(), and snd_config_hook_load().

int snd_config_get_ctl_iface ( const snd_config_t *  conf  ) 

Gets the control interface index from a configuration node.

Parameters:
conf Handle to the configuration node to be parsed.
Returns:
The control interface index if successful, otherwise a negative error code.

Definition at line 165 of file confmisc.c.

References id, snd_config_get_ctl_iface_ascii(), snd_config_get_id(), snd_config_get_integer(), and snd_config_get_string().

int snd_config_get_ctl_iface_ascii ( const char *  ascii  ) 

Gets the control interface index from the given ASCII string.

Parameters:
ascii The string to be parsed.
Returns:
The control interface index if successful, otherwise a negative error code.

Definition at line 142 of file confmisc.c.

References safe_strtol().

Referenced by snd_config_get_ctl_iface().

int snd_determine_driver ( int  card,
char **  driver 
)

Definition at line 548 of file confmisc.c.

References ctl, and open_ctl().

Referenced by snd_config_hook_load_for_all_cards(), and snd_func_private_card_driver().

SND_DLSYM_BUILD_VERSION ( snd_func_refer  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_private_pcm_subdevice  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_pcm_args_by_class  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_pcm_id  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_card_id  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_card_driver  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_private_card_driver  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_private_string  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_datadir  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_concat  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_igetenv  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

SND_DLSYM_BUILD_VERSION ( snd_func_getenv  ,
SND_CONFIG_DLSYM_VERSION_EVALUATE   
)

int snd_func_card_driver ( snd_config_t **  dst,
snd_config_t *  root,
snd_config_t *  src,
snd_config_t *  private_data 
)

Returns the driver identification for a card.

Parameters:
dst The function puts the handle to the result configuration node (with type string) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node, with a card definition.
private_data Handle to the private_data node.
Returns:
A non-negative value if successful, otherwise a negative error code.
Example:
        {
                @func card_driver
                card 0
        }

Definition at line 645 of file confmisc.c.

References free(), n, snd_config_delete(), snd_config_evaluate(), snd_config_get_ascii(), snd_config_imake_integer(), snd_config_search(), and snd_func_private_card_driver().

int snd_func_card_id ( snd_config_t **  dst,
snd_config_t *  root,
snd_config_t *  src,
snd_config_t *  private_data 
)

Returns the identification of a card.

Parameters:
dst The function puts the handle to the result configuration node (with type string) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node, with a card definition.
private_data Handle to the private_data node.
Returns:
A non-negative value if successful, otherwise a negative error code.
Example:
        {
                @func card_id
                card 0
        }

Definition at line 703 of file confmisc.c.

References ctl, free(), id, n, open_ctl(), snd_config_evaluate(), snd_config_get_id(), snd_config_get_integer(), snd_config_imake_string(), and snd_config_search().

int snd_func_concat ( snd_config_t **  dst,
snd_config_t *  root,
snd_config_t *  src,
snd_config_t *  private_data 
)

Merges the given strings.

Parameters:
dst The function puts the handle to the result configuration node (with type string) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node, with a definition for strings.
private_data Handle to the private_data node.
Returns:
A non-negative value if successful, otherwise a negative error code.
Example (result is "a1b2c3"):
        {
                @func concat
                strings [ "a1" "b2" "c3" ]
        }

Definition at line 375 of file confmisc.c.

References free(), id, memcpy(), n, ptr, safe_strtol(), snd_config_evaluate(), snd_config_get_ascii(), snd_config_get_id(), snd_config_imake_string(), snd_config_iterator_entry(), and snd_config_search().

int snd_func_datadir ( snd_config_t **  dst,
snd_config_t *root  ATTRIBUTE_UNUSED,
snd_config_t *  src,
snd_config_t *private_data  ATTRIBUTE_UNUSED 
)

Returns the ALSA data directory.

Parameters:
dst The function puts the handle to the result configuration node (with type string) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node.
private_data Handle to the private_data node. Not used.
Returns:
A non-negative value if successful, otherwise a negative error code.
Example (result is "/usr/share/alsa" using the default paths):
        {
                @func datadir
        }

Definition at line 466 of file confmisc.c.

References id, snd_config_get_id(), and snd_config_imake_string().

int snd_func_getenv ( snd_config_t **  dst,
snd_config_t *  root,
snd_config_t *  src,
snd_config_t *  private_data 
)

Returns an environment value.

Parameters:
dst The function puts the handle to the result configuration node (with type string) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node, with definitions for vars and default.
private_data Handle to the private_data node.
Returns:
Zero if successful, otherwise a negative error code.
Example:
        {
                @func getenv
                vars [ MY_CARD CARD C ]
                default 0
        }

Definition at line 217 of file confmisc.c.

References d, free(), id, n, ptr, safe_strtol(), snd_config_evaluate(), snd_config_get_ascii(), snd_config_get_id(), snd_config_get_string(), snd_config_get_type(), snd_config_imake_string(), snd_config_iterator_entry(), and snd_config_search().

Referenced by snd_func_igetenv().

int snd_func_igetenv ( snd_config_t **  dst,
snd_config_t *  root,
snd_config_t *  src,
snd_config_t *  private_data 
)

Returns an integer environment value.

Parameters:
dst The function puts the handle to the result configuration node (with type integer) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node, with definitions for vars and default.
private_data Handle to the private_data node.
Returns:
Zero if successful, otherwise a negative error code.
Example:
        {
                @func igetenv
                vars [ MY_DEVICE DEVICE D ]
                default 0
        }

Definition at line 324 of file confmisc.c.

References d, id, safe_strtol(), snd_config_delete(), snd_config_get_id(), snd_config_get_string(), snd_config_imake_integer(), and snd_func_getenv().

int snd_func_pcm_args_by_class ( snd_config_t **  dst,
snd_config_t *  root,
snd_config_t *  src,
void *  private_data 
)

Returns the pcm card and device arguments (in form CARD=N,DEV=M) for pcm specified by class and index.

Parameters:
dst The function puts the handle to the result configuration node (with type string) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node, with definitions for class and index.
private_data Handle to the private_data node.
Returns:
A non-negative value if successful, otherwise a negative error code.
Example:
        {
                @func pcm_args_by_class
                class 0
                index 0
        }

Definition at line 874 of file confmisc.c.

References ctl, dev, id, memset(), n, name, open_ctl(), s, snd_config_evaluate(), snd_config_get_id(), snd_config_get_integer(), snd_config_imake_string(), snd_config_search(), and snprintf().

int snd_func_pcm_id ( snd_config_t **  dst,
snd_config_t *  root,
snd_config_t *  src,
void *  private_data 
)

Returns the pcm identification of a device.

Parameters:
dst The function puts the handle to the result configuration node (with type string) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node, with definitions for card, device and (optionally) subdevice.
private_data Handle to the private_data node.
Returns:
A non-negative value if successful, otherwise a negative error code.
Example:
        {
                @func pcm_id
                card 0
                device 0
                subdevice 0     # optional
        }

Definition at line 778 of file confmisc.c.

References ctl, device, id, n, open_ctl(), snd_config_evaluate(), snd_config_get_id(), snd_config_get_integer(), snd_config_imake_string(), and snd_config_search().

int snd_func_private_card_driver ( snd_config_t **  dst,
snd_config_t *root  ATTRIBUTE_UNUSED,
snd_config_t *  src,
snd_config_t *  private_data 
)

Returns the driver identification from private_data.

Parameters:
dst The function puts the handle to the result configuration node (with type string) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node.
private_data Handle to the private_data node (type integer, id "card").
Returns:
A non-negative value if successful, otherwise a negative error code.
Example:
        {
                @func private_card_driver
        }

Definition at line 598 of file confmisc.c.

References free(), id, snd_config_get_id(), snd_config_get_integer(), snd_config_imake_string(), snd_config_test_id(), and snd_determine_driver().

Referenced by snd_func_card_driver().

int snd_func_private_pcm_subdevice ( snd_config_t **  dst,
snd_config_t *root  ATTRIBUTE_UNUSED,
snd_config_t *  src,
snd_config_t *  private_data 
)

Returns the PCM subdevice from private_data.

Parameters:
dst The function puts the handle to the result configuration node (with type integer) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node.
private_data Handle to the private_data node (type pointer, id "pcm_handle").
Returns:
A non-negative value if successful, otherwise a negative error code.
Example:
        {
                @func private_pcm_subdevice
        }

Definition at line 988 of file confmisc.c.

References data, id, snd_config_copy(), snd_config_get_id(), snd_config_get_pointer(), snd_config_imake_integer(), and snd_config_test_id().

int snd_func_private_string ( snd_config_t **  dst,
snd_config_t *root  ATTRIBUTE_UNUSED,
snd_config_t *  src,
snd_config_t *  private_data 
)

Returns the string from private_data.

Parameters:
dst The function puts the handle to the result configuration node (with type string) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node.
private_data Handle to the private_data node (type string, id "string").
Returns:
A non-negative value if successful, otherwise a negative error code.
Example:
        {
                @func private_string
        }

Definition at line 520 of file confmisc.c.

References id, snd_config_copy(), snd_config_get_id(), snd_config_get_string(), snd_config_imake_string(), and snd_config_test_id().

int snd_func_refer ( snd_config_t **  dst,
snd_config_t *  root,
snd_config_t *  src,
snd_config_t *  private_data 
)

Copies the specified configuration node.

Parameters:
dst The function puts the handle to the result configuration node (with the same type as the specified node) at the address specified by dst.
root Handle to the root source node.
src Handle to the source node, with definitions for name and (optionally) file.
private_data Handle to the private_data node.
Returns:
A non-negative value if successful, otherwise a negative error code.
Note:
The root source node can be modified!
Example:
        {
                @func refer
                file "/etc/myconf.conf"         # optional
                name "id1.id2.id3"
        }

Definition at line 1046 of file confmisc.c.

References _end, id, n, name, snd_config_copy(), snd_config_delete(), snd_config_evaluate(), snd_config_get_id(), snd_config_get_string(), snd_config_load(), snd_config_search(), snd_config_search_definition(), and snd_config_set_id().


Generated on Fri Nov 28 00:07:34 2008 for elphel by  doxygen 1.5.1