aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-10-11 16:48:17 +0200
committerTakashi Iwai <tiwai@suse.de>2013-10-11 16:49:06 +0200
commit60f5a833368c2656923344ccae172ab64b3ba1a3 (patch)
treeea51a03a39f901f557a6fc13163d7d6a89a0f8d8
parent2d2439017a600b36ee554027586c2eb9b2c28f31 (diff)
downloadsalsa-lib-60f5a833368c2656923344ccae172ab64b3ba1a3.tar.gz
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>
-rw-r--r--src/asound.h7
-rw-r--r--src/pcm_macros.h12
2 files changed, 17 insertions, 2 deletions
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 @@ enum {
/* 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 @@ typedef enum _snd_pcm_subformat {
#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 @@ typedef struct snd_pcm_status {
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 @@ struct snd_pcm_mmap_status {
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 @@ int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params)
}
__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 @@ void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *p
}
__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;