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

Modified Files:
        pcm_hw.c 
Log Message:
Fixed tstamps for newer driver

Index: pcm_hw.c
===================================================================
RCS file: /cvsroot/alsa/alsa-lib/src/pcm/pcm_hw.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -r1.117 -r1.118
--- pcm_hw.c    28 Feb 2003 17:23:33 -0000      1.117
+++ pcm_hw.c    1 Mar 2003 20:32:02 -0000       1.118
@@ -77,10 +77,6 @@
 #define SND_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct sndrv_pcm_hw_params_old)
 #define SND_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct sndrv_pcm_hw_params_old)
 
-#define SND_PCM_IOCTL_HWSYNC _IO ('A', 0x22)
-#define SND_PCM_IOCTL_XRUN   _IO ('A', 0x48)
-#define SND_PCM_IOCTL_FORWARD _IOW('A', 0x49, sndrv_pcm_uframes_t)
-
 static int use_old_hw_params_ioctl(int fd, unsigned int cmd, snd_pcm_hw_params_t 
*params);
 static snd_pcm_sframes_t snd_pcm_hw_avail_update(snd_pcm_t *pcm);
 
@@ -119,8 +115,12 @@
 
 struct timespec snd_pcm_hw_fast_tstamp(snd_pcm_t *pcm)
 {
+       struct timespec res;
        snd_pcm_hw_t *hw = pcm->private_data;
-       return FAST_PCM_TSTAMP(hw);
+       res = FAST_PCM_TSTAMP(hw);
+       if (SNDRV_PROTOCOL_VERSION(2, 0, 5) > hw->version)
+               res.tv_nsec *= 1000L;
+       return res;
 }
 
 static int snd_pcm_hw_nonblock(snd_pcm_t *pcm, int nonblock)
@@ -407,6 +407,10 @@
                SYSERR("SNDRV_PCM_IOCTL_STATUS failed");
                return err;
        }
+       if (SNDRV_PROTOCOL_VERSION(2, 0, 5) > hw->version) {
+               status->tstamp.tv_nsec *= 1000L;
+               status->trigger_tstamp.tv_nsec *= 1000L;
+       }
        return 0;
 }
 
@@ -433,9 +437,9 @@
        snd_pcm_hw_t *hw = pcm->private_data;
        int fd = hw->fd, err;
        if (SNDRV_PROTOCOL_VERSION(2, 0, 3) <= hw->version) {
-               if (ioctl(fd, SND_PCM_IOCTL_HWSYNC) < 0) {
+               if (ioctl(fd, SNDRV_PCM_IOCTL_HWSYNC) < 0) {
                        err = -errno;
-                       // SYSERR("SND_PCM_IOCTL_HWSYNC failed");
+                       // SYSERR("SNDRV_PCM_IOCTL_HWSYNC failed");
                        return err;
                }
        } else {
@@ -552,7 +556,7 @@
        snd_pcm_hw_t *hw = pcm->private_data;
        int err;
        if (SNDRV_PROTOCOL_VERSION(2, 0, 4) <= hw->version) {
-               if (ioctl(hw->fd, SND_PCM_IOCTL_FORWARD, &frames) < 0) {
+               if (ioctl(hw->fd, SNDRV_PCM_IOCTL_FORWARD, &frames) < 0) {
                        err = -errno;
                        SYSERR("SNDRV_PCM_IOCTL_FORWARD failed");
                        return err;
@@ -831,7 +835,7 @@
                if (avail >= pcm->stop_threshold) {
                        /* SNDRV_PCM_IOCTL_XRUN ioctl has been implemented since PCM 
kernel API 2.0.1 */
                        if (SNDRV_PROTOCOL_VERSION(2, 0, 1) <= hw->version) {
-                               if (ioctl(hw->fd, SND_PCM_IOCTL_XRUN) < 0)
+                               if (ioctl(hw->fd, SNDRV_PCM_IOCTL_XRUN) < 0)
                                        return -errno;
                        }
                        /* everything is ok, state == SND_PCM_STATE_XRUN at the moment 
*/
@@ -961,6 +965,15 @@
        }
        if (SNDRV_PROTOCOL_INCOMPATIBLE(ver, SNDRV_PCM_VERSION_MAX))
                return -SND_ERROR_INCOMPATIBLE_VERSION;
+
+       if (SNDRV_PROTOCOL_VERSION(2, 0, 5) <= ver) {
+               int on = 1;
+               if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
+                       ret = -errno;
+                       SNDERR("TSTAMP failed\n");
+                       return ret;
+               }                       
+       }
        
        hw = calloc(1, sizeof(snd_pcm_hw_t));
        if (!hw) {



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to