Add wallclock timestamp API
snd_pcm_hw_params_supports_audio_wallclock_ts() and
snd_pcm_status_get_audio_htstamp() are added.
Bumped the PCM protocol version to 2.0.11.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/src/asound.h b/src/asound.h
index f43c300..efa472a 100644
--- a/src/asound.h
+++ b/src/asound.h
@@ -99,7 +99,7 @@
/* PCM interface */
-#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 9)
+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 11)
typedef unsigned long snd_pcm_uframes_t;
typedef long snd_pcm_sframes_t;
@@ -219,6 +219,7 @@
#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000
#define SNDRV_PCM_INFO_SYNC_START 0x00400000
#define SNDRV_PCM_INFO_NO_PERIOD_WAKEUP 0x00800000
+#define SNDRV_PCM_INFO_HAS_WALL_CLOCK 0x01000000
typedef enum _snd_pcm_state {
SND_PCM_STATE_OPEN = 0,
@@ -361,7 +362,8 @@
snd_pcm_uframes_t avail_max;
snd_pcm_uframes_t overrange;
int suspended_state;
- unsigned char reserved[60];
+ struct timespec audio_tstamp;
+ unsigned char reserved[60 - sizeof(struct timespec)];
} snd_pcm_status_t;
struct snd_pcm_mmap_status {
@@ -370,6 +372,7 @@
snd_pcm_uframes_t hw_ptr;
struct timespec tstamp;
int suspended_state;
+ struct timespec audio_tstamp;
};
struct snd_pcm_mmap_control {
diff --git a/src/pcm_macros.h b/src/pcm_macros.h
index 4a7a72b..04c8b0a 100644
--- a/src/pcm_macros.h
+++ b/src/pcm_macros.h
@@ -463,6 +463,12 @@
}
__SALSA_EXPORT_FUNC
+int snd_pcm_hw_params_supports_audio_wallclock_ts(const snd_pcm_hw_params_t *params)
+{
+ return !!(params->info & SNDRV_PCM_INFO_HAS_WALL_CLOCK);
+}
+
+__SALSA_EXPORT_FUNC
int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
unsigned int *rate_num,
unsigned int *rate_den)
@@ -1986,6 +1992,12 @@
}
__SALSA_EXPORT_FUNC
+void snd_pcm_status_get_audio_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr)
+{
+ *ptr = obj->audio_tstamp;
+}
+
+__SALSA_EXPORT_FUNC
snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj)
{
return obj->delay;