[alsa-cvslog] alsa-lib: Impemented snd_pcm_htimestamp() function.
Brought to you by:
perex
|
From: Jaroslav K. <pe...@pe...> - 2008-01-09 12:50:48
|
changeset: 2380:50b7338f68eb
tag: tip
user: perex
date: Wed Jan 09 13:50:45 2008 +0100
files: include/pcm.h src/pcm/pcm.c src/pcm/pcm_dmix.c src/pcm/pcm_dshare.c src/pcm/pcm_dsnoop.c src/pcm/pcm_generic.c src/pcm/pcm_generic.h src/pcm/pcm_hooks.c src/pcm/pcm_hw.c src/pcm/pcm_ioplug.c src/pcm/pcm_local.h src/pcm/pcm_meter.c src/pcm/pcm_mmap_emul.c src/pcm/pcm_multi.c src/pcm/pcm_null.c src/pcm/pcm_plugin.c src/pcm/pcm_rate.c src/pcm/pcm_share.c src/pcm/pcm_shm.c
description:
Impemented snd_pcm_htimestamp() function.
diff -r 397c4a383b22 -r 50b7338f68eb include/pcm.h
--- a/include/pcm.h Wed Jan 09 11:13:34 2008 +0100
+++ b/include/pcm.h Wed Jan 09 13:50:45 2008 +0100
@@ -427,6 +427,7 @@ int snd_pcm_hwsync(snd_pcm_t *pcm);
int snd_pcm_hwsync(snd_pcm_t *pcm);
int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp);
int snd_pcm_resume(snd_pcm_t *pcm);
+int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp);
snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);
snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm.c
--- a/src/pcm/pcm.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm.c Wed Jan 09 13:50:45 2008 +0100
@@ -343,7 +343,8 @@ The timestamp mode specifies, if timesta
The timestamp mode specifies, if timestamps are activated. Currently, only
#SND_PCM_TSTAMP_NONE and #SND_PCM_TSTAMP_MMAP
modes are known. The mmap mode means that timestamp is taken
-on every period time boundary.
+on every period time boundary. Corresponding position in the ring buffer
+assigned to timestamp can be obtained using #snd_pcm_htimestamp() function.
\par Transfer align
@@ -383,7 +384,7 @@ These parameters can be obtained: the cu
These parameters can be obtained: the current stream state -
#snd_pcm_status_get_state(), timestamp of trigger -
#snd_pcm_status_get_trigger_tstamp(), timestamp of last
-update #snd_pcm_status_get_tstamp(), delay in samples -
+pointer update #snd_pcm_status_get_tstamp(), delay in samples -
#snd_pcm_status_get_delay(), available count in samples -
#snd_pcm_status_get_avail(), maximum available samples -
#snd_pcm_status_get_avail_max(), ADC over-range count in
@@ -977,6 +978,26 @@ int snd_pcm_resume(snd_pcm_t *pcm)
return -EIO;
}
return pcm->fast_ops->resume(pcm->fast_op_arg);
+}
+
+/**
+ * \brief Obtain last position update hi-res timestamp
+ * \param pcm PCM handle
+ * \param avail Number of available frames when timestamp was grabbed
+ * \param tstamp Hi-res timestamp
+ * \return 0 on success otherwise a negative error code
+ *
+ * Note this function does not update the actual r/w pointer
+ * for applications.
+ */
+int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp)
+{
+ assert(pcm);
+ if (CHECK_SANITY(! pcm->setup)) {
+ SNDMSG("PCM not set up");
+ return -EIO;
+ }
+ return pcm->fast_ops->htimestamp(pcm->fast_op_arg, avail, tstamp);
}
/**
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_dmix.c
--- a/src/pcm/pcm_dmix.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_dmix.c Wed Jan 09 13:50:45 2008 +0100
@@ -382,10 +382,7 @@ static int snd_pcm_dmix_status(snd_pcm_t
memset(status, 0, sizeof(*status));
status->state = snd_pcm_dmix_state(pcm);
status->trigger_tstamp = dmix->trigger_tstamp;
- if (pcm->tstamp_mode == SND_PCM_TSTAMP_MMAP)
- status->tstamp = snd_pcm_hw_fast_tstamp(dmix->spcm);
- else
- gettimestamp(&status->tstamp, pcm->monotonic);
+ gettimestamp(&status->tstamp, pcm->monotonic);
status->avail = snd_pcm_mmap_playback_avail(pcm);
status->avail_max = status->avail > dmix->avail_max ? status->avail : dmix->avail_max;
dmix->avail_max = 0;
@@ -669,6 +666,27 @@ static snd_pcm_sframes_t snd_pcm_dmix_av
dmix->state == SND_PCM_STATE_DRAINING)
snd_pcm_dmix_sync_ptr(pcm);
return snd_pcm_mmap_playback_avail(pcm);
+}
+
+static int snd_pcm_dmix_htimestamp(snd_pcm_t *pcm,
+ snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_direct_t *dmix = pcm->private_data;
+ snd_pcm_uframes_t avail1;
+ int ok = 0;
+
+ while (1) {
+ if (dmix->state == SND_PCM_STATE_RUNNING ||
+ dmix->state == SND_PCM_STATE_DRAINING)
+ snd_pcm_dmix_sync_ptr(pcm);
+ avail1 = snd_pcm_mmap_playback_avail(pcm);
+ if (ok && *avail == avail1)
+ break;
+ *avail = avail1;
+ *tstamp = snd_pcm_hw_fast_tstamp(pcm);
+ }
+ return 0;
}
static int snd_pcm_dmix_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
@@ -731,6 +749,7 @@ static snd_pcm_fast_ops_t snd_pcm_dmix_f
.readn = snd_pcm_dmix_readn,
.avail_update = snd_pcm_dmix_avail_update,
.mmap_commit = snd_pcm_dmix_mmap_commit,
+ .htimestamp = snd_pcm_dmix_htimestamp,
.poll_descriptors = NULL,
.poll_descriptors_count = NULL,
.poll_revents = snd_pcm_dmix_poll_revents,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_dshare.c
--- a/src/pcm/pcm_dshare.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_dshare.c Wed Jan 09 13:50:45 2008 +0100
@@ -226,10 +226,7 @@ static int snd_pcm_dshare_status(snd_pcm
memset(status, 0, sizeof(*status));
status->state = snd_pcm_state(dshare->spcm);
status->trigger_tstamp = dshare->trigger_tstamp;
- if (pcm->tstamp_mode == SND_PCM_TSTAMP_MMAP)
- status->tstamp = snd_pcm_hw_fast_tstamp(dshare->spcm);
- else
- gettimestamp(&status->tstamp, pcm->monotonic);
+ gettimestamp(&status->tstamp, pcm->monotonic);
status->avail = snd_pcm_mmap_playback_avail(pcm);
status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max;
dshare->avail_max = 0;
@@ -515,6 +512,27 @@ static snd_pcm_sframes_t snd_pcm_dshare_
dshare->state == SND_PCM_STATE_DRAINING)
snd_pcm_dshare_sync_ptr(pcm);
return snd_pcm_mmap_playback_avail(pcm);
+}
+
+static int snd_pcm_dshare_htimestamp(snd_pcm_t *pcm,
+ snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_direct_t *dshare = pcm->private_data;
+ snd_pcm_uframes_t avail1;
+ int ok = 0;
+
+ while (1) {
+ if (dshare->state == SND_PCM_STATE_RUNNING ||
+ dshare->state == SND_PCM_STATE_DRAINING)
+ snd_pcm_dshare_sync_ptr(pcm);
+ avail1 = snd_pcm_mmap_playback_avail(pcm);
+ if (ok && *avail == avail1)
+ break;
+ *avail = avail1;
+ *tstamp = snd_pcm_hw_fast_tstamp(pcm);
+ }
+ return 0;
}
static void snd_pcm_dshare_dump(snd_pcm_t *pcm, snd_output_t *out)
@@ -568,6 +586,7 @@ static snd_pcm_fast_ops_t snd_pcm_dshare
.readn = snd_pcm_dshare_readn,
.avail_update = snd_pcm_dshare_avail_update,
.mmap_commit = snd_pcm_dshare_mmap_commit,
+ .htimestamp = snd_pcm_dshare_htimestamp,
.poll_descriptors = NULL,
.poll_descriptors_count = NULL,
.poll_revents = snd_pcm_direct_poll_revents,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_dsnoop.c
--- a/src/pcm/pcm_dsnoop.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_dsnoop.c Wed Jan 09 13:50:45 2008 +0100
@@ -172,10 +172,7 @@ static int snd_pcm_dsnoop_status(snd_pcm
state = snd_pcm_state(dsnoop->spcm);
status->state = state == SND_PCM_STATE_RUNNING ? dsnoop->state : state;
status->trigger_tstamp = dsnoop->trigger_tstamp;
- if (pcm->tstamp_mode == SND_PCM_TSTAMP_MMAP)
- status->tstamp = snd_pcm_hw_fast_tstamp(dsnoop->spcm);
- else
- gettimestamp(&status->tstamp, pcm->monotonic);
+ gettimestamp(&status->tstamp, pcm->monotonic);
status->avail = snd_pcm_mmap_capture_avail(pcm);
status->avail_max = status->avail > dsnoop->avail_max ? status->avail : dsnoop->avail_max;
dsnoop->avail_max = 0;
@@ -405,6 +402,27 @@ static snd_pcm_sframes_t snd_pcm_dsnoop_
return err;
}
return snd_pcm_mmap_capture_avail(pcm);
+}
+
+static int snd_pcm_dsnoop_htimestamp(snd_pcm_t *pcm,
+ snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_direct_t *dsnoop = pcm->private_data;
+ snd_pcm_uframes_t avail1;
+ int ok = 0;
+
+ while (1) {
+ if (dsnoop->state == SND_PCM_STATE_RUNNING ||
+ dsnoop->state == SND_PCM_STATE_DRAINING)
+ snd_pcm_dsnoop_sync_ptr(pcm);
+ avail1 = snd_pcm_mmap_capture_avail(pcm);
+ if (ok && *avail == avail1)
+ break;
+ *avail = avail1;
+ *tstamp = snd_pcm_hw_fast_tstamp(pcm);
+ }
+ return 0;
}
static void snd_pcm_dsnoop_dump(snd_pcm_t *pcm, snd_output_t *out)
@@ -458,6 +476,7 @@ static snd_pcm_fast_ops_t snd_pcm_dsnoop
.readn = snd_pcm_mmap_readn,
.avail_update = snd_pcm_dsnoop_avail_update,
.mmap_commit = snd_pcm_dsnoop_mmap_commit,
+ .htimestamp = snd_pcm_dsnoop_htimestamp,
.poll_descriptors = NULL,
.poll_descriptors_count = NULL,
.poll_revents = snd_pcm_direct_poll_revents,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_generic.c
--- a/src/pcm/pcm_generic.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_generic.c Wed Jan 09 13:50:45 2008 +0100
@@ -259,6 +259,13 @@ snd_pcm_sframes_t snd_pcm_generic_avail_
return snd_pcm_avail_update(generic->slave);
}
+int snd_pcm_generic_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_generic_t *generic = pcm->private_data;
+ return snd_pcm_htimestamp(generic->slave, avail, tstamp);
+}
+
int snd_pcm_generic_mmap(snd_pcm_t *pcm)
{
if (pcm->mmap_shadow) {
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_generic.h
--- a/src/pcm/pcm_generic.h Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_generic.h Wed Jan 09 13:50:45 2008 +0100
@@ -137,5 +137,7 @@ snd_pcm_sframes_t snd_pcm_generic_mmap_c
snd_pcm_uframes_t offset,
snd_pcm_uframes_t size);
snd_pcm_sframes_t snd_pcm_generic_avail_update(snd_pcm_t *pcm);
+int snd_pcm_generic_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *timestamp);
int snd_pcm_generic_mmap(snd_pcm_t *pcm);
int snd_pcm_generic_munmap(snd_pcm_t *pcm);
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_hooks.c
--- a/src/pcm/pcm_hooks.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_hooks.c Wed Jan 09 13:50:45 2008 +0100
@@ -159,6 +159,7 @@ static snd_pcm_fast_ops_t snd_pcm_hooks_
.readn = snd_pcm_generic_readn,
.avail_update = snd_pcm_generic_avail_update,
.mmap_commit = snd_pcm_generic_mmap_commit,
+ .htimestamp = snd_pcm_generic_htimestamp,
.poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
.poll_descriptors = snd_pcm_generic_poll_descriptors,
.poll_revents = snd_pcm_generic_poll_revents,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_hw.c
--- a/src/pcm/pcm_hw.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_hw.c Wed Jan 09 13:50:45 2008 +0100
@@ -846,6 +846,26 @@ static snd_pcm_sframes_t snd_pcm_hw_avai
return avail;
}
+static int snd_pcm_hw_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_sframes_t avail1;
+ int ok = 0;
+
+ /* unfortunately, loop is necessary to ensure valid timestamp */
+ while (1) {
+ avail1 = snd_pcm_hw_avail_update(pcm);
+ if (avail1 < 0)
+ return avail1;
+ if (ok && (snd_pcm_uframes_t)avail1 == *avail)
+ break;
+ *avail = avail1;
+ *tstamp = snd_pcm_hw_fast_tstamp(pcm);
+ ok = 1;
+ }
+ return 0;
+}
+
static void snd_pcm_hw_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_hw_t *hw = pcm->private_data;
@@ -902,6 +922,7 @@ static snd_pcm_fast_ops_t snd_pcm_hw_fas
.readn = snd_pcm_hw_readn,
.avail_update = snd_pcm_hw_avail_update,
.mmap_commit = snd_pcm_hw_mmap_commit,
+ .htimestamp = snd_pcm_hw_htimestamp,
.poll_descriptors = NULL,
.poll_descriptors_count = NULL,
.poll_revents = NULL,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_ioplug.c
--- a/src/pcm/pcm_ioplug.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_ioplug.c Wed Jan 09 13:50:45 2008 +0100
@@ -634,6 +634,13 @@ static snd_pcm_sframes_t snd_pcm_ioplug_
if (avail > io->avail_max)
io->avail_max = avail;
return (snd_pcm_sframes_t)avail;
+}
+
+static int snd_pcm_ioplug_htimestamp(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t *avail ATTRIBUTE_UNUSED,
+ snd_htimestamp_t *tstamp ATTRIBUTE_UNUSED)
+{
+ return -EIO; /* not implemented yet */
}
static int snd_pcm_ioplug_nonblock(snd_pcm_t *pcm, int nonblock)
@@ -774,6 +781,7 @@ static snd_pcm_fast_ops_t snd_pcm_ioplug
.readn = snd_pcm_ioplug_readn,
.avail_update = snd_pcm_ioplug_avail_update,
.mmap_commit = snd_pcm_ioplug_mmap_commit,
+ .htimestamp = snd_pcm_ioplug_htimestamp,
.poll_descriptors_count = snd_pcm_ioplug_poll_descriptors_count,
.poll_descriptors = snd_pcm_ioplug_poll_descriptors,
.poll_revents = snd_pcm_ioplug_poll_revents,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_local.h
--- a/src/pcm/pcm_local.h Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_local.h Wed Jan 09 13:50:45 2008 +0100
@@ -163,6 +163,7 @@ typedef struct {
snd_pcm_sframes_t (*readn)(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
snd_pcm_sframes_t (*avail_update)(snd_pcm_t *pcm);
snd_pcm_sframes_t (*mmap_commit)(snd_pcm_t *pcm, snd_pcm_uframes_t offset, snd_pcm_uframes_t size);
+ int (*htimestamp)(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp);
int (*poll_descriptors_count)(snd_pcm_t *pcm);
int (*poll_descriptors)(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);
int (*poll_revents)(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_meter.c
--- a/src/pcm/pcm_meter.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_meter.c Wed Jan 09 13:50:45 2008 +0100
@@ -536,6 +536,7 @@ static snd_pcm_fast_ops_t snd_pcm_meter_
.readn = snd_pcm_mmap_readn,
.avail_update = snd_pcm_meter_avail_update,
.mmap_commit = snd_pcm_meter_mmap_commit,
+ .htimestamp = snd_pcm_generic_htimestamp,
.poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
.poll_descriptors = snd_pcm_generic_poll_descriptors,
.poll_revents = snd_pcm_generic_poll_revents,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_mmap_emul.c
--- a/src/pcm/pcm_mmap_emul.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_mmap_emul.c Wed Jan 09 13:50:45 2008 +0100
@@ -370,6 +370,7 @@ static snd_pcm_fast_ops_t snd_pcm_mmap_e
.readn = snd_pcm_generic_readn,
.avail_update = snd_pcm_mmap_emul_avail_update,
.mmap_commit = snd_pcm_mmap_emul_mmap_commit,
+ .htimestamp = snd_pcm_generic_htimestamp,
.poll_descriptors = snd_pcm_generic_poll_descriptors,
.poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
.poll_revents = snd_pcm_generic_poll_revents,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_multi.c
--- a/src/pcm/pcm_multi.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_multi.c Wed Jan 09 13:50:45 2008 +0100
@@ -431,6 +431,14 @@ static snd_pcm_sframes_t snd_pcm_multi_a
return ret;
}
+static int snd_pcm_multi_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_multi_t *multi = pcm->private_data;
+ snd_pcm_t *slave = multi->slaves[multi->master_slave].pcm;
+ return snd_pcm_htimestamp(slave, avail, tstamp);
+}
+
static int snd_pcm_multi_prepare(snd_pcm_t *pcm)
{
snd_pcm_multi_t *multi = pcm->private_data;
@@ -792,6 +800,7 @@ static snd_pcm_fast_ops_t snd_pcm_multi_
.unlink = snd_pcm_multi_unlink,
.avail_update = snd_pcm_multi_avail_update,
.mmap_commit = snd_pcm_multi_mmap_commit,
+ .htimestamp = snd_pcm_multi_htimestamp,
.poll_descriptors_count = snd_pcm_multi_poll_descriptors_count,
.poll_descriptors = snd_pcm_multi_poll_descriptors,
.poll_revents = snd_pcm_multi_poll_revents,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_null.c
--- a/src/pcm/pcm_null.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_null.c Wed Jan 09 13:50:45 2008 +0100
@@ -242,6 +242,13 @@ static snd_pcm_sframes_t snd_pcm_null_av
static snd_pcm_sframes_t snd_pcm_null_avail_update(snd_pcm_t *pcm)
{
return pcm->buffer_size;
+}
+
+static int snd_pcm_null_htimestamp(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t *avail ATTRIBUTE_UNUSED,
+ snd_htimestamp_t *tstamp ATTRIBUTE_UNUSED)
+{
+ return -EIO;
}
static int snd_pcm_null_hw_refine(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_hw_params_t *params)
@@ -312,6 +319,7 @@ static snd_pcm_fast_ops_t snd_pcm_null_f
.readn = snd_pcm_null_readn,
.avail_update = snd_pcm_null_avail_update,
.mmap_commit = snd_pcm_null_mmap_commit,
+ .htimestamp = snd_pcm_null_htimestamp,
};
/**
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_plugin.c
--- a/src/pcm/pcm_plugin.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_plugin.c Wed Jan 09 13:50:45 2008 +0100
@@ -575,6 +575,7 @@ snd_pcm_fast_ops_t snd_pcm_plugin_fast_o
.readn = snd_pcm_plugin_readn,
.avail_update = snd_pcm_plugin_avail_update,
.mmap_commit = snd_pcm_plugin_mmap_commit,
+ .htimestamp = snd_pcm_generic_htimestamp,
.poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
.poll_descriptors = snd_pcm_generic_poll_descriptors,
.poll_revents = snd_pcm_generic_poll_revents,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_rate.c
--- a/src/pcm/pcm_rate.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_rate.c Wed Jan 09 13:50:45 2008 +0100
@@ -1020,6 +1020,13 @@ static snd_pcm_sframes_t snd_pcm_rate_av
}
}
+static int snd_pcm_rate_htimestamp(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t *avail ATTRIBUTE_UNUSED,
+ snd_htimestamp_t *tstamp ATTRIBUTE_UNUSED)
+{
+ return -EIO; /* not implemented yet */
+}
+
static int snd_pcm_rate_poll_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
{
snd_pcm_rate_t *rate = pcm->private_data;
@@ -1189,6 +1196,7 @@ static snd_pcm_fast_ops_t snd_pcm_rate_f
.readn = snd_pcm_mmap_readn,
.avail_update = snd_pcm_rate_avail_update,
.mmap_commit = snd_pcm_rate_mmap_commit,
+ .htimestamp = snd_pcm_rate_htimestamp,
.poll_descriptors_count = snd_pcm_generic_poll_descriptors_count,
.poll_descriptors = snd_pcm_generic_poll_descriptors,
.poll_revents = snd_pcm_rate_poll_revents,
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_share.c
--- a/src/pcm/pcm_share.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_share.c Wed Jan 09 13:50:45 2008 +0100
@@ -798,6 +798,18 @@ static snd_pcm_sframes_t snd_pcm_share_a
return avail;
}
+static int snd_pcm_share_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
+ snd_htimestamp_t *tstamp)
+{
+ snd_pcm_share_t *share = pcm->private_data;
+ snd_pcm_share_slave_t *slave = share->slave;
+ int err;
+ Pthread_mutex_lock(&slave->mutex);
+ err = snd_pcm_htimestamp(slave->pcm, avail, tstamp);
+ Pthread_mutex_unlock(&slave->mutex);
+ return err;
+}
+
/* Call it with mutex held */
static snd_pcm_sframes_t _snd_pcm_share_mmap_commit(snd_pcm_t *pcm,
snd_pcm_uframes_t offset ATTRIBUTE_UNUSED,
@@ -1308,6 +1320,7 @@ static snd_pcm_fast_ops_t snd_pcm_share_
.forward = snd_pcm_share_forward,
.resume = snd_pcm_share_resume,
.avail_update = snd_pcm_share_avail_update,
+ .htimestamp = snd_pcm_share_htimestamp,
.mmap_commit = snd_pcm_share_mmap_commit,
};
diff -r 397c4a383b22 -r 50b7338f68eb src/pcm/pcm_shm.c
--- a/src/pcm/pcm_shm.c Wed Jan 09 11:13:34 2008 +0100
+++ b/src/pcm/pcm_shm.c Wed Jan 09 13:50:45 2008 +0100
@@ -441,6 +441,13 @@ static snd_pcm_sframes_t snd_pcm_shm_ava
return err;
}
+static int snd_pcm_shm_htimestamp(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t *avail ATTRIBUTE_UNUSED,
+ snd_htimestamp_t *tstamp ATTRIBUTE_UNUSED)
+{
+ return -EIO; /* not implemented yet */
+}
+
static int snd_pcm_shm_prepare(snd_pcm_t *pcm)
{
snd_pcm_shm_t *shm = pcm->private_data;
@@ -609,6 +616,7 @@ static snd_pcm_fast_ops_t snd_pcm_shm_fa
.readn = snd_pcm_mmap_readn,
.avail_update = snd_pcm_shm_avail_update,
.mmap_commit = snd_pcm_shm_mmap_commit,
+ .htimestamp = snd_pcm_shm_htimestamp,
};
static int make_local_socket(const char *filename)
|