Update of /cvsroot/alsa/alsa-lib/src/pcm
In directory sc8-pr-cvs1:/tmp/cvs-serv2844/src/pcm

Modified Files:
        Makefile.am pcm.c pcm_symbols.c 
Added Files:
        pcm_asym.c 
Log Message:
- added asym plugin.



--- NEW FILE: pcm_asym.c ---
/**
 * \file pcm/pcm_asym.c
 * \ingroup PCM_Plugins
 * \brief PCM Asymmetrical Plugin Interface
 * \author Takashi Iwai <[EMAIL PROTECTED]>
 * \date 2003
 */

#include "pcm_local.h"

#ifndef PIC
/* entry for static linking */
const char *_snd_module_pcm_asym = "";
#endif

/*! \page pcm_plugins

\section pcm_plugins_asym Plugin: asym

This plugin is a combination of playback and capture PCM streams.
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
        }
}
\endcode

For example, you can combine a dmix plugin and a dsnoop plugin as
as a single PCM for playback and capture directions, respectively.
\code
pcm.duplex {
        type asym
        playback.pcm "dmix"
        capture.pcm "dsnoop"
}
\endcode

By defining only a single direction, the resultant PCM becomes
half-duplex.

\subsection pcm_plugins_asym_funcref Function reference

<UL>
  <LI>_snd_pcm_asym_open()
</UL>

*/

/**
 * \brief Creates a new asym stream PCM
 * \param pcmp Returns created PCM handle
 * \param name Name of PCM
 * \param root Root configuration node
 * \param conf Configuration node with copy PCM description
 * \param stream Stream type
 * \param mode Stream mode
 * \retval zero on success otherwise a negative error code
 * \warning Using of this function might be dangerous in the sense
 *          of compatibility reasons. The prototype might be freely
 *          changed in future.
 */
int _snd_pcm_asym_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_iterator_t i, next;
        int err;
        snd_config_t *slave = NULL, *sconf;
        snd_config_for_each(i, next, conf) {
                snd_config_t *n = snd_config_iterator_entry(i);
                const char *id;
                if (snd_config_get_id(n, &id) < 0)
                        continue;
                if (snd_pcm_conf_generic_id(id))
                        continue;
                if (strcmp(id, "playback") == 0) {
                        if (stream == SND_PCM_STREAM_PLAYBACK)
                                slave = n;
                        continue;
                }
                if (strcmp(id, "capture") == 0) {
                        if (stream == SND_PCM_STREAM_CAPTURE)
                                slave = n;
                        continue;
                }
                SNDERR("Unknown field %s", id);
                return -EINVAL;
        }
        if (! slave) {
                SNDERR("%s slave is not defined",
                       stream == SND_PCM_STREAM_PLAYBACK ? "playback" : "capture");
                return -EINVAL;
        }
        err = snd_pcm_slave_conf(root, slave, &sconf, 0);
        if (err < 0)
                return err;
        err = snd_pcm_open_slave(pcmp, root, sconf, stream, mode);
        snd_config_delete(sconf);
        return err;
}
#ifndef DOC_HIDDEN
SND_DLSYM_BUILD_VERSION(_snd_pcm_asym_open, SND_PCM_DLSYM_VERSION);
#endif

Index: Makefile.am
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/Makefile.am,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- Makefile.am 17 Sep 2003 17:09:45 -0000      1.49
+++ Makefile.am 8 Jan 2004 14:05:55 -0000       1.50
@@ -11,7 +11,7 @@
                    pcm_shm.c pcm_file.c pcm_null.c pcm_share.c \
                    pcm_meter.c pcm_hooks.c pcm_lfloat.c pcm_ladspa.c \
                    pcm_direct.c pcm_dmix.c pcm_dsnoop.c pcm_dshare.c \
-                   pcm_symbols.c
+                   pcm_asym.c pcm_symbols.c
 noinst_HEADERS = pcm_local.h pcm_plugin.h mask.h mask_inline.h \
                 interval.h interval_inline.h plugin_ops.h ladspa.h \
                 pcm_direct.h pcm_dmix_i386.h pcm_dmix_x86_64.h

Index: pcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm.c,v
retrieving revision 1.264
retrieving revision 1.265
diff -u -r1.264 -r1.265
--- pcm.c       29 Dec 2003 09:10:48 -0000      1.264
+++ pcm.c       8 Jan 2004 14:05:55 -0000       1.265
@@ -1782,7 +1782,7 @@
 static char *build_in_pcms[] = {
        "adpcm", "alaw", "copy", "dmix", "file", "hooks", "hw", "ladspa", "lfloat",
        "linear", "meter", "mulaw", "multi", "null", "plug", "rate", "route", "share",
-       "shm", "dsnoop", "dshare", NULL
+       "shm", "dsnoop", "dshare", "asym", NULL
 };
 
 static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,

Index: pcm_symbols.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_symbols.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- pcm_symbols.c       18 Mar 2003 20:37:56 -0000      1.9
+++ pcm_symbols.c       8 Jan 2004 14:05:56 -0000       1.10
@@ -43,6 +43,7 @@
 extern const char *_snd_module_pcm_dmix;
 extern const char *_snd_module_pcm_dsnoop;
 extern const char *_snd_module_pcm_dshare;
+extern const char *_snd_module_pcm_asym;
 
 static const char **snd_pcm_open_objects[] = {
        &_snd_module_pcm_adpcm,
@@ -65,7 +66,8 @@
        &_snd_module_pcm_ladspa,
        &_snd_module_pcm_dmix,
        &_snd_module_pcm_dsnoop,
-       &_snd_module_pcm_dshare
+       &_snd_module_pcm_dshare,
+       &_snd_module_pcm_asym
 };
        
 void *snd_pcm_open_symbols(void)



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to