aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-04-21 14:42:37 +0200
committerTakashi Iwai <tiwai@suse.de>2015-04-21 14:42:37 +0200
commit4cfbd65e9f24766d2ed034fb970a46abf340a714 (patch)
tree89c29650d14fd2f3e97bbef9c3718e84476e3648
parent312a13ef97d04f7b47ce387b76401701d28e806c (diff)
downloadsalsa-lib-4cfbd65e9f24766d2ed034fb970a46abf340a714.tar.gz
Add PCM timestamp type support
Align the PCM protocol version to 2.0.12 Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--src/asound.h20
-rw-r--r--src/pcm_macros.h16
-rw-r--r--src/pcm_params.c1
3 files changed, 28 insertions, 9 deletions
diff --git a/src/asound.h b/src/asound.h
index 51c5231..181e53f 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, 11)
+#define SNDRV_PCM_VERSION SNDRV_PROTOCOL_VERSION(2, 0, 12)
typedef unsigned long snd_pcm_uframes_t;
typedef long snd_pcm_sframes_t;
@@ -337,6 +337,13 @@ typedef enum _snd_pcm_tstamp {
SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_MMAP
} snd_pcm_tstamp_t;
+typedef enum _snd_pcm_tstamp_type {
+ SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0,
+ SND_PCM_TSTAMP_TYPE_MONOTONIC,
+ SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
+ SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
+} snd_pcm_tstamp_type_t;
+
typedef struct snd_pcm_sw_params {
int tstamp_mode;
unsigned int period_step;
@@ -348,7 +355,9 @@ typedef struct snd_pcm_sw_params {
snd_pcm_uframes_t silence_threshold;
snd_pcm_uframes_t silence_size;
snd_pcm_uframes_t boundary;
- unsigned char reserved[60];
+ unsigned int tstamp_type;
+ int pads;
+ unsigned char reserved[54];
unsigned int period_event;
} snd_pcm_sw_params_t;
@@ -417,13 +426,6 @@ struct snd_xfern {
snd_pcm_uframes_t frames;
};
-
-enum {
- SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0,
- SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
- SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
-};
-
enum {
SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int),
SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, snd_pcm_info_t),
diff --git a/src/pcm_macros.h b/src/pcm_macros.h
index cec909d..a35c794 100644
--- a/src/pcm_macros.h
+++ b/src/pcm_macros.h
@@ -1814,6 +1814,22 @@ int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params,
}
__SALSA_EXPORT_FUNC
+int snd_pcm_sw_params_set_tstamp_type(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
+ snd_pcm_tstamp_type_t val)
+{
+ params->tstamp_type = val;
+ return 0;
+}
+
+__SALSA_EXPORT_FUNC
+int snd_pcm_sw_params_get_tstamp_type(const snd_pcm_sw_params_t *params,
+ snd_pcm_tstamp_type_t *val)
+{
+ *val = (snd_pcm_tstamp_type_t) params->tstamp_type;
+ return 0;
+}
+
+__SALSA_EXPORT_FUNC
__SALSA_DEPRECATED
int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params,
unsigned int val)
diff --git a/src/pcm_params.c b/src/pcm_params.c
index 2704153..abd5eca 100644
--- a/src/pcm_params.c
+++ b/src/pcm_params.c
@@ -347,6 +347,7 @@ static int snd_pcm_sw_params_default(snd_pcm_t *pcm,
snd_pcm_sw_params_t *params)
{
params->tstamp_mode = SND_PCM_TSTAMP_NONE;
+ params->tstamp_type = pcm->sw_params.tstamp_type;
params->period_step = 1;
params->sleep_min = 0;
params->avail_min = pcm->period_size;