From 9c72daca41fa5da6c6a37d9cef5b9765f45368b7 Mon Sep 17 00:00:00 2001 From: Abramo Bagnara Date: Sat, 1 Jul 2000 14:17:25 +0000 Subject: [PATCH] Added timestamps in strategic places --- src/pcm/pcm.c | 8 ++++---- src/pcm/pcm_hw.c | 12 ++++++++---- src/pcm/pcm_local.h | 8 ++++---- src/pcm/pcm_multi.c | 8 ++++---- src/pcm/pcm_plug.c | 9 +++++---- src/seq/seq.c | 1 + 6 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index bdbb3ab3..39dac4f6 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -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) diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index 57ef23fc..ac375ad2 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -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); diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index 11734afa..75891ddf 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -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); diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c index 318dd0b5..2ee15292 100644 --- a/src/pcm/pcm_multi.c +++ b/src/pcm/pcm_multi.c @@ -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; diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index 8a2bef01..56378ea1 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -26,6 +26,7 @@ #include #include #include +#include #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; diff --git a/src/seq/seq.c b/src/seq/seq.c index bd40bba9..7f552dbe 100644 --- a/src/seq/seq.c +++ b/src/seq/seq.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "asoundlib.h" #include "seq_priv.h" -- 2.47.1