unsigned int flags, struct compr_config *config);
void (*close)(void *compress_data);
int (*get_hpointer)(void *compress_data,
- unsigned int *avail, struct timespec *tstamp);
+ unsigned long long *avail, struct timespec *tstamp);
int (*get_tstamp)(void *compress_data,
unsigned long long *samples, unsigned int *sampling_rate);
int (*write)(void *compress_data, const void *buf, size_t size);
unsigned int *avail, struct timespec *tstamp);
+/*
+ * compress_get_hpointe64r: get the hw timestamp
+ * return 0 on success, negative on error
+ *
+ * @compress: compress stream on which query is made
+ * @avail: buffer availble for write/read, in bytes
+ * @tstamp: hw time
+ */
+int compress_get_hpointer64(struct compress *compress,
+ unsigned long long *avail, struct timespec *tstamp);
+
+
/*
* compress_get_tstamp: get the raw hw timestamp
* return 0 on success, negative on error
#include <dlfcn.h>
#include <stdio.h>
#include <string.h>
+#include <limits.h>
#include <sys/errno.h>
#include <sys/time.h>
#include "tinycompress/tinycompress.h"
int compress_get_hpointer(struct compress *compress,
unsigned int *avail, struct timespec *tstamp)
+{
+ unsigned long long _avail;
+ int ret;
+
+ ret = compress->ops->get_hpointer(compress->data, &_avail, tstamp);
+ if (ret >= 0) {
+ if (_avail > UINT_MAX)
+ _avail = UINT_MAX;
+ *avail = (unsigned int)_avail;
+ }
+ return ret;
+}
+
+int compress_get_hpointer64(struct compress *compress,
+ unsigned long long *avail, struct timespec *tstamp)
{
return compress->ops->get_hpointer(compress->data, avail, tstamp);
}
}
static int compress_hw_get_hpointer(void *data,
- unsigned int *avail, struct timespec *tstamp)
+ unsigned long long *avail, struct timespec *tstamp)
{
struct compress_hw_data *compress = (struct compress_hw_data *)data;
struct snd_compr_avail kavail32;
if (0 == kavail64.tstamp.sampling_rate)
return oops(compress, ENODATA, "sample rate unknown");
- *avail = (unsigned int)kavail64.avail;
+ *avail = kavail64.avail;
time = kavail64.tstamp.pcm_io_frames / kavail64.tstamp.sampling_rate;
tstamp->tv_sec = time;
time = kavail64.tstamp.pcm_io_frames % kavail64.tstamp.sampling_rate;