OSDN Git Service

Added timestamps in strategic places
authorAbramo Bagnara <abramo@alsa-project.org>
Sat, 1 Jul 2000 14:17:25 +0000 (14:17 +0000)
committerAbramo Bagnara <abramo@alsa-project.org>
Sat, 1 Jul 2000 14:17:25 +0000 (14:17 +0000)
src/pcm/pcm.c
src/pcm/pcm_hw.c
src/pcm/pcm_local.h
src/pcm/pcm_multi.c
src/pcm/pcm_plug.c
src/seq/seq.c

index bdbb3ab..39dac4f 100644 (file)
@@ -209,7 +209,7 @@ ssize_t snd_pcm_write(snd_pcm_t *handle, const void *buffer, size_t size)
        assert(size == 0 || buffer);
        assert(handle->valid_setup);
        assert(size % handle->setup.frames_align == 0);
-       return handle->ops->write(handle->op_arg, buffer, size);
+       return handle->ops->write(handle->op_arg, -1, buffer, size);
 }
 
 ssize_t snd_pcm_writev(snd_pcm_t *handle, const struct iovec *vector, unsigned long count)
@@ -217,7 +217,7 @@ ssize_t snd_pcm_writev(snd_pcm_t *handle, const struct iovec *vector, unsigned l
        assert(handle);
        assert(count == 0 || vector);
        assert(handle->valid_setup);
-       return handle->ops->writev(handle->op_arg, vector, count);
+       return handle->ops->writev(handle->op_arg, -1, vector, count);
 }
 
 ssize_t snd_pcm_read(snd_pcm_t *handle, void *buffer, size_t size)
@@ -226,7 +226,7 @@ ssize_t snd_pcm_read(snd_pcm_t *handle, void *buffer, size_t size)
        assert(size == 0 || buffer);
        assert(handle->valid_setup);
        assert(size % handle->setup.frames_align == 0);
-       return handle->ops->read(handle->op_arg, buffer, size);
+       return handle->ops->read(handle->op_arg, -1, buffer, size);
 }
 
 ssize_t snd_pcm_readv(snd_pcm_t *handle, const struct iovec *vector, unsigned long count)
@@ -234,7 +234,7 @@ ssize_t snd_pcm_readv(snd_pcm_t *handle, const struct iovec *vector, unsigned lo
        assert(handle);
        assert(count == 0 || vector);
        assert(handle->valid_setup);
-       return handle->ops->readv(handle->op_arg, vector, count);
+       return handle->ops->readv(handle->op_arg, -1, vector, count);
 }
 
 int snd_pcm_file_descriptor(snd_pcm_t *handle)
index 57ef23f..ac375ad 100644 (file)
@@ -208,12 +208,13 @@ static ssize_t snd_pcm_hw_frame_data(void *private, off_t offset)
        return result;
 }
 
-static ssize_t snd_pcm_hw_write(void *private, const void *buffer, size_t size)
+static ssize_t snd_pcm_hw_write(void *private, snd_timestamp_t tstamp, const void *buffer, size_t size)
 {
        ssize_t result;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
        int fd = hw->fd;
        snd_xfer_t xfer;
+       xfer.tstamp = tstamp;
        xfer.buf = (char*) buffer;
        xfer.count = size;
        result = ioctl(fd, SND_PCM_IOCTL_WRITE_FRAMES, &xfer);
@@ -222,12 +223,13 @@ static ssize_t snd_pcm_hw_write(void *private, const void *buffer, size_t size)
        return result;
 }
 
-static ssize_t snd_pcm_hw_writev(void *private, const struct iovec *vector, unsigned long count)
+static ssize_t snd_pcm_hw_writev(void *private, snd_timestamp_t tstamp, const struct iovec *vector, unsigned long count)
 {
        ssize_t result;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
        int fd = hw->fd;
        snd_xferv_t xferv;
+       xferv.tstamp = tstamp;
        xferv.vector = vector;
        xferv.count = count;
        result = ioctl(fd, SND_PCM_IOCTL_WRITEV_FRAMES, &xferv);
@@ -236,12 +238,13 @@ static ssize_t snd_pcm_hw_writev(void *private, const struct iovec *vector, unsi
        return result;
 }
 
-static ssize_t snd_pcm_hw_read(void *private, void *buffer, size_t size)
+static ssize_t snd_pcm_hw_read(void *private, snd_timestamp_t tstamp, void *buffer, size_t size)
 {
        ssize_t result;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
        int fd = hw->fd;
        snd_xfer_t xfer;
+       xfer.tstamp = tstamp;
        xfer.buf = buffer;
        xfer.count = size;
        result = ioctl(fd, SND_PCM_IOCTL_READ_FRAMES, &xfer);
@@ -250,12 +253,13 @@ static ssize_t snd_pcm_hw_read(void *private, void *buffer, size_t size)
        return result;
 }
 
-ssize_t snd_pcm_hw_readv(void *private, const struct iovec *vector, unsigned long count)
+ssize_t snd_pcm_hw_readv(void *private, snd_timestamp_t tstamp, const struct iovec *vector, unsigned long count)
 {
        ssize_t result;
        snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
        int fd = hw->fd;
        snd_xferv_t xferv;
+       xferv.tstamp = tstamp;
        xferv.vector = vector;
        xferv.count = count;
        result = ioctl(fd, SND_PCM_IOCTL_READV_FRAMES, &xferv);
index 11734af..75891dd 100644 (file)
@@ -40,10 +40,10 @@ struct snd_pcm_ops {
        int (*state)(void *private);
        ssize_t (*frame_io)(void *private, int update);
        ssize_t (*frame_data)(void *private, off_t offset);
-       ssize_t (*write)(void *private, const void *buffer, size_t size);
-       ssize_t (*writev)(void *private, const struct iovec *vector, unsigned long count);
-       ssize_t (*read)(void *private, void *buffer, size_t size);
-       ssize_t (*readv)(void *private, const struct iovec *vector, unsigned long count);
+       ssize_t (*write)(void *private, snd_timestamp_t tstamp, const void *buffer, size_t size);
+       ssize_t (*writev)(void *private, snd_timestamp_t tstamp, const struct iovec *vector, unsigned long count);
+       ssize_t (*read)(void *private, snd_timestamp_t tstamp, void *buffer, size_t size);
+       ssize_t (*readv)(void *private, snd_timestamp_t tstamp, const struct iovec *vector, unsigned long count);
        int (*mmap_status)(void *private, snd_pcm_mmap_status_t **status);
        int (*mmap_control)(void *private, snd_pcm_mmap_control_t **control);
        int (*mmap_data)(void *private, void **buffer, size_t bsize);
index 318dd0b..2ee1529 100644 (file)
@@ -390,7 +390,7 @@ static ssize_t snd_pcm_multi_frame_data(void *private, off_t offset)
        return newpos;
 }
   
-ssize_t snd_pcm_multi_write(void *private, const void *buf, size_t count)
+ssize_t snd_pcm_multi_write(void *private, snd_timestamp_t timestamp UNUSED, const void *buf, size_t count)
 {
        snd_pcm_multi_t *multi = (snd_pcm_multi_t*) private;
        snd_pcm_t *handle = multi->handle;
@@ -429,19 +429,19 @@ ssize_t snd_pcm_multi_write(void *private, const void *buf, size_t count)
        return count;
 }
 
-ssize_t snd_pcm_multi_read(void *private, void *buf, size_t count)
+ssize_t snd_pcm_multi_read(void *private, snd_timestamp_t timestamp UNUSED, void *buf, size_t count)
 {
        snd_pcm_multi_t *multi = (snd_pcm_multi_t*) private;
        return -ENOSYS;
 }
 
-ssize_t snd_pcm_multi_writev(void *private, const struct iovec *vector, unsigned long count)
+ssize_t snd_pcm_multi_writev(void *private, snd_timestamp_t timestamp UNUSED, const struct iovec *vector, unsigned long count)
 {
        snd_pcm_multi_t *multi = (snd_pcm_multi_t*) private;
        return -ENOSYS;
 }
 
-ssize_t snd_pcm_multi_readv(void *private, const struct iovec *vector, unsigned long count)
+ssize_t snd_pcm_multi_readv(void *private, snd_timestamp_t timestamp UNUSED, const struct iovec *vector, unsigned long count)
 {
        snd_pcm_multi_t *multi = (snd_pcm_multi_t*) private;
        return -ENOSYS;
index 8a2bef0..56378ea 100644 (file)
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <math.h>
 #include <sys/uio.h>
+#include <limits.h>
 #include "pcm_local.h"
 
 /* snd_pcm_plugin externs */
@@ -376,7 +377,7 @@ static ssize_t snd_pcm_plug_frame_data(void *private, off_t offset)
        return snd_pcm_plug_client_size(plug, ret);
 }
   
-ssize_t snd_pcm_plug_writev(void *private, const struct iovec *vector, unsigned long count)
+ssize_t snd_pcm_plug_writev(void *private, snd_timestamp_t tstamp UNUSED, const struct iovec *vector, unsigned long count)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) private;
        snd_pcm_t *handle = plug->handle;
@@ -419,7 +420,7 @@ ssize_t snd_pcm_plug_writev(void *private, const struct iovec *vector, unsigned
        return size;
 }
 
-ssize_t snd_pcm_plug_readv(void *private, const struct iovec *vector, unsigned long count)
+ssize_t snd_pcm_plug_readv(void *private, snd_timestamp_t tstamp UNUSED, const struct iovec *vector, unsigned long count)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) private;
        snd_pcm_t *handle = plug->handle;
@@ -462,7 +463,7 @@ ssize_t snd_pcm_plug_readv(void *private, const struct iovec *vector, unsigned l
        return size;
 }
 
-ssize_t snd_pcm_plug_write(void *private, const void *buf, size_t count)
+ssize_t snd_pcm_plug_write(void *private, snd_timestamp_t tstamp UNUSED, const void *buf, size_t count)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) private;
        snd_pcm_t *handle = plug->handle;
@@ -496,7 +497,7 @@ ssize_t snd_pcm_plug_write(void *private, const void *buf, size_t count)
        return size;
 }
 
-ssize_t snd_pcm_plug_read(void *private, void *buf, size_t count)
+ssize_t snd_pcm_plug_read(void *private, snd_timestamp_t tstamp UNUSED, void *buf, size_t count)
 {
        snd_pcm_plug_t *plug = (snd_pcm_plug_t*) private;
        snd_pcm_t *handle = plug->handle;
index bd40bba..7f552db 100644 (file)
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
+#include <sys/time.h>
 #include "asoundlib.h"
 #include "seq_priv.h"