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

Modified Files:
        pcm.c pcm_plugin.c pcm_rate.c 
Log Message:
Added snd_pcm_type_name()
Fixed rate conversion plugin (SIGSEGV) - rounding problem


Index: pcm.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm.c,v
retrieving revision 1.249
retrieving revision 1.250
diff -u -r1.249 -r1.250
--- pcm.c       5 Mar 2003 19:56:57 -0000       1.249
+++ pcm.c       8 Mar 2003 16:35:19 -0000       1.250
@@ -1217,6 +1217,7 @@
 }
 
 #ifndef DOC_HIDDEN
+#define PCMTYPE(v) [SND_PCM_TYPE_##v] = #v
 #define STATE(v) [SND_PCM_STATE_##v] = #v
 #define STREAM(v) [SND_PCM_STREAM_##v] = #v
 #define READY(v) [SND_PCM_READY_##v] = #v
@@ -1233,6 +1234,7 @@
 #define FORMATD(v, d) [SND_PCM_FORMAT_##v] = d
 #define SUBFORMATD(v, d) [SND_PCM_SUBFORMAT_##v] = d 
 
+
 static const char *snd_pcm_stream_names[] = {
        STREAM(PLAYBACK),
        STREAM(CAPTURE),
@@ -1339,6 +1341,33 @@
        FORMATD(U18_3BE, "Unsigned 18 bit Big Endian in 3bytes"),
 };
 
+static const char *snd_pcm_type_names[] = {
+       PCMTYPE(HW), 
+       PCMTYPE(HOOKS), 
+       PCMTYPE(MULTI), 
+       PCMTYPE(FILE), 
+       PCMTYPE(NULL), 
+       PCMTYPE(SHM), 
+       PCMTYPE(INET), 
+       PCMTYPE(COPY), 
+       PCMTYPE(LINEAR), 
+       PCMTYPE(ALAW), 
+       PCMTYPE(MULAW), 
+       PCMTYPE(ADPCM), 
+       PCMTYPE(RATE), 
+       PCMTYPE(ROUTE), 
+       PCMTYPE(PLUG), 
+       PCMTYPE(SHARE), 
+       PCMTYPE(METER), 
+       PCMTYPE(MIX), 
+       PCMTYPE(DROUTE), 
+       PCMTYPE(LBSERVER), 
+       PCMTYPE(LINEAR_FLOAT), 
+       PCMTYPE(LADSPA), 
+       PCMTYPE(DMIX), 
+       PCMTYPE(JACK), 
+};
+
 static const char *snd_pcm_subformat_names[] = {
        SUBFORMAT(STD), 
 };
@@ -1510,6 +1539,23 @@
                return NULL;
        return snd_pcm_state_names[state];
 }
+
+/**
+ * \brief get name of PCM type
+ * \param type PCM type
+ * \return ascii name of PCM type
+ */
+#ifndef DOXYGEN
+const char *INTERNAL(snd_pcm_type_name)(snd_pcm_type_t type)
+#else
+const char *snd_pcm_type_name(snd_pcm_type_t type)
+#endif
+{
+       if (type > SND_PCM_TYPE_LAST)
+               return NULL;
+       return snd_pcm_type_names[type];
+}
+default_symbol_version(__snd_pcm_type_name, snd_pcm_type_name, ALSA_0.9.0);
 
 /**
  * \brief Dump current hardware setup for PCM

Index: pcm_plugin.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_plugin.c,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- pcm_plugin.c        7 Mar 2003 18:46:31 -0000       1.89
+++ pcm_plugin.c        8 Mar 2003 16:35:20 -0000       1.90
@@ -351,6 +351,7 @@
        snd_pcm_t *slave = plugin->slave;
        snd_pcm_uframes_t xfer = 0;
        snd_pcm_sframes_t result;
+       int err;
 
        while (size > 0) {
                snd_pcm_uframes_t frames = size;
@@ -358,8 +359,8 @@
                snd_pcm_uframes_t slave_offset;
                snd_pcm_uframes_t slave_frames = ULONG_MAX;
                
-               snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, &slave_frames);
-               if (slave_frames == 0)
+               err = snd_pcm_mmap_begin(slave, &slave_areas, &slave_offset, 
&slave_frames);
+               if (err < 0 || slave_frames == 0)
                        break;
                frames = plugin->write(pcm, areas, offset, frames,
                                       slave_areas, slave_offset, &slave_frames);

Index: pcm_rate.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_rate.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- pcm_rate.c  11 Feb 2003 18:14:50 -0000      1.70
+++ pcm_rate.c  8 Mar 2003 16:35:20 -0000       1.71
@@ -458,11 +458,13 @@
        }
        params->boundary = boundary1;
        sparams.boundary = boundary2;
+#if 0
        if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
                rate->pitch = (((u_int64_t)boundary2 * DIV) + boundary1 / 2) / 
boundary1;
        } else {
                rate->pitch = (((u_int64_t)boundary1 * DIV) + boundary2 / 2) / 
boundary2;
        }
+#endif
        recalc(pcm, &sparams.avail_min);
        recalc(pcm, &sparams.xfer_align);
        recalc(pcm, &sparams.start_threshold);



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to