mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-02 09:01:48 -05:00
Added timestamps in strategic places
This commit is contained in:
parent
cc79e0c6ea
commit
9c72daca41
6 changed files with 26 additions and 20 deletions
|
|
@ -209,7 +209,7 @@ ssize_t snd_pcm_write(snd_pcm_t *handle, const void *buffer, size_t size)
|
||||||
assert(size == 0 || buffer);
|
assert(size == 0 || buffer);
|
||||||
assert(handle->valid_setup);
|
assert(handle->valid_setup);
|
||||||
assert(size % handle->setup.frames_align == 0);
|
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)
|
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(handle);
|
||||||
assert(count == 0 || vector);
|
assert(count == 0 || vector);
|
||||||
assert(handle->valid_setup);
|
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)
|
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(size == 0 || buffer);
|
||||||
assert(handle->valid_setup);
|
assert(handle->valid_setup);
|
||||||
assert(size % handle->setup.frames_align == 0);
|
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)
|
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(handle);
|
||||||
assert(count == 0 || vector);
|
assert(count == 0 || vector);
|
||||||
assert(handle->valid_setup);
|
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)
|
int snd_pcm_file_descriptor(snd_pcm_t *handle)
|
||||||
|
|
|
||||||
|
|
@ -208,12 +208,13 @@ static ssize_t snd_pcm_hw_frame_data(void *private, off_t offset)
|
||||||
return result;
|
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;
|
ssize_t result;
|
||||||
snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
|
snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
|
||||||
int fd = hw->fd;
|
int fd = hw->fd;
|
||||||
snd_xfer_t xfer;
|
snd_xfer_t xfer;
|
||||||
|
xfer.tstamp = tstamp;
|
||||||
xfer.buf = (char*) buffer;
|
xfer.buf = (char*) buffer;
|
||||||
xfer.count = size;
|
xfer.count = size;
|
||||||
result = ioctl(fd, SND_PCM_IOCTL_WRITE_FRAMES, &xfer);
|
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;
|
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;
|
ssize_t result;
|
||||||
snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
|
snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
|
||||||
int fd = hw->fd;
|
int fd = hw->fd;
|
||||||
snd_xferv_t xferv;
|
snd_xferv_t xferv;
|
||||||
|
xferv.tstamp = tstamp;
|
||||||
xferv.vector = vector;
|
xferv.vector = vector;
|
||||||
xferv.count = count;
|
xferv.count = count;
|
||||||
result = ioctl(fd, SND_PCM_IOCTL_WRITEV_FRAMES, &xferv);
|
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;
|
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;
|
ssize_t result;
|
||||||
snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
|
snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
|
||||||
int fd = hw->fd;
|
int fd = hw->fd;
|
||||||
snd_xfer_t xfer;
|
snd_xfer_t xfer;
|
||||||
|
xfer.tstamp = tstamp;
|
||||||
xfer.buf = buffer;
|
xfer.buf = buffer;
|
||||||
xfer.count = size;
|
xfer.count = size;
|
||||||
result = ioctl(fd, SND_PCM_IOCTL_READ_FRAMES, &xfer);
|
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;
|
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;
|
ssize_t result;
|
||||||
snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
|
snd_pcm_hw_t *hw = (snd_pcm_hw_t*) private;
|
||||||
int fd = hw->fd;
|
int fd = hw->fd;
|
||||||
snd_xferv_t xferv;
|
snd_xferv_t xferv;
|
||||||
|
xferv.tstamp = tstamp;
|
||||||
xferv.vector = vector;
|
xferv.vector = vector;
|
||||||
xferv.count = count;
|
xferv.count = count;
|
||||||
result = ioctl(fd, SND_PCM_IOCTL_READV_FRAMES, &xferv);
|
result = ioctl(fd, SND_PCM_IOCTL_READV_FRAMES, &xferv);
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ struct snd_pcm_ops {
|
||||||
int (*state)(void *private);
|
int (*state)(void *private);
|
||||||
ssize_t (*frame_io)(void *private, int update);
|
ssize_t (*frame_io)(void *private, int update);
|
||||||
ssize_t (*frame_data)(void *private, off_t offset);
|
ssize_t (*frame_data)(void *private, off_t offset);
|
||||||
ssize_t (*write)(void *private, const void *buffer, size_t size);
|
ssize_t (*write)(void *private, snd_timestamp_t tstamp, const void *buffer, size_t size);
|
||||||
ssize_t (*writev)(void *private, const struct iovec *vector, unsigned long count);
|
ssize_t (*writev)(void *private, snd_timestamp_t tstamp, const struct iovec *vector, unsigned long count);
|
||||||
ssize_t (*read)(void *private, void *buffer, size_t size);
|
ssize_t (*read)(void *private, snd_timestamp_t tstamp, void *buffer, size_t size);
|
||||||
ssize_t (*readv)(void *private, const struct iovec *vector, unsigned long count);
|
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_status)(void *private, snd_pcm_mmap_status_t **status);
|
||||||
int (*mmap_control)(void *private, snd_pcm_mmap_control_t **control);
|
int (*mmap_control)(void *private, snd_pcm_mmap_control_t **control);
|
||||||
int (*mmap_data)(void *private, void **buffer, size_t bsize);
|
int (*mmap_data)(void *private, void **buffer, size_t bsize);
|
||||||
|
|
|
||||||
|
|
@ -390,7 +390,7 @@ static ssize_t snd_pcm_multi_frame_data(void *private, off_t offset)
|
||||||
return newpos;
|
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_multi_t *multi = (snd_pcm_multi_t*) private;
|
||||||
snd_pcm_t *handle = multi->handle;
|
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;
|
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;
|
snd_pcm_multi_t *multi = (snd_pcm_multi_t*) private;
|
||||||
return -ENOSYS;
|
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;
|
snd_pcm_multi_t *multi = (snd_pcm_multi_t*) private;
|
||||||
return -ENOSYS;
|
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;
|
snd_pcm_multi_t *multi = (snd_pcm_multi_t*) private;
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
|
#include <limits.h>
|
||||||
#include "pcm_local.h"
|
#include "pcm_local.h"
|
||||||
|
|
||||||
/* snd_pcm_plugin externs */
|
/* 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);
|
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_plug_t *plug = (snd_pcm_plug_t*) private;
|
||||||
snd_pcm_t *handle = plug->handle;
|
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;
|
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_plug_t *plug = (snd_pcm_plug_t*) private;
|
||||||
snd_pcm_t *handle = plug->handle;
|
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;
|
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_plug_t *plug = (snd_pcm_plug_t*) private;
|
||||||
snd_pcm_t *handle = plug->handle;
|
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;
|
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_plug_t *plug = (snd_pcm_plug_t*) private;
|
||||||
snd_pcm_t *handle = plug->handle;
|
snd_pcm_t *handle = plug->handle;
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include "asoundlib.h"
|
#include "asoundlib.h"
|
||||||
#include "seq_priv.h"
|
#include "seq_priv.h"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue