- Remove superfluous Loopback.conf from the source, as it was already included in 1.0.28 tarball - Backport upstream fixes: UCM dummy PCM definition, ICE1712 surround definitions, USB-audio secondary PCM definition, PCM rate plugin boundary overwrap fix, MONOTONIC_RAW timestamp support, PCM route plugin 3-byte format fixes, etc: 0001-ucm-Document-PlaybackPCMIsDummy-and-CapturePCMIsDumm.patch 0002-ICE1712-add-surround71-pcm-definition.patch 0003-USB-Audio-Add-second-S-PDIF-device-on-Phiree-U2.patch 0004-pcm-rate-fix-hw_ptr-exceed-the-boundary.patch 0005-pcm-Provide-a-CLOCK_MONOTONIC_RAW-timestamp-type.patch 0006-Add-timestamp-type-to-sw_params-internal-only.patch 0007-pcm-Add-sw_params-API-functions-to-get-set-timestamp.patch 0008-pcm-Implement-timestamp-type-setup-in-hw-plugin.patch 0009-pcm-Implement-timestamp-type-handling-in-all-plugins.patch 0010-test-audio_time-Set-timestamp-type-explicitly.patch 0011-pcm-route-Use-get-put-labels-for-all-3-byte-formats.patch 0012-pcm-Fill-sw_params-proto-field.patch 0013-pcm-route-Use-get32-for-multi-source-route-calculati.patch 0014-pcm-Drop-snd_pcm_linear_-get-put-32_index.patch OBS-URL: https://build.opensuse.org/request/show/241986 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=162
182 lines
7.0 KiB
Diff
182 lines
7.0 KiB
Diff
From 0d393c29a272b6fc97e9fca3252fb1c58f86e75b Mon Sep 17 00:00:00 2001
|
|
From: Takashi Iwai <tiwai@suse.de>
|
|
Date: Thu, 10 Jul 2014 14:26:37 +0200
|
|
Subject: [PATCH 07/14] pcm: Add sw_params API functions to get/set timestamp
|
|
type
|
|
|
|
For obtaining / changing the timestamp type, add the corresponding
|
|
sw_params accessor API functions together with the public definitions
|
|
of timestamp types.
|
|
|
|
This patch only adds the functions and defines but doesn't bring the
|
|
functional changes yet.
|
|
|
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
|
---
|
|
include/pcm.h | 9 +++++++++
|
|
src/pcm/pcm.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
src/pcm/pcm_local.h | 1 +
|
|
src/pcm/pcm_params.c | 1 +
|
|
4 files changed, 64 insertions(+)
|
|
|
|
diff --git a/include/pcm.h b/include/pcm.h
|
|
index 95b8aed6de2a..11e9f0dfba13 100644
|
|
--- a/include/pcm.h
|
|
+++ b/include/pcm.h
|
|
@@ -317,6 +317,13 @@ typedef enum _snd_pcm_tstamp {
|
|
SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE
|
|
} snd_pcm_tstamp_t;
|
|
|
|
+typedef enum _snd_pcm_tstamp_type {
|
|
+ SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /** gettimeofday equivalent */
|
|
+ SND_PCM_TSTAMP_TYPE_MONOTONIC, /** posix_clock_monotonic equivalent */
|
|
+ SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /** monotonic_raw (no NTP) */
|
|
+ SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
|
|
+} snd_pcm_tstamp_type_t;
|
|
+
|
|
/** Unsigned frames quantity */
|
|
typedef unsigned long snd_pcm_uframes_t;
|
|
/** Signed frames quantity */
|
|
@@ -844,6 +851,8 @@ int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uf
|
|
|
|
int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
|
|
int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val);
|
|
+int snd_pcm_sw_params_set_tstamp_type(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t val);
|
|
+int snd_pcm_sw_params_get_tstamp_type(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t *val);
|
|
int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
|
|
int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
|
|
int snd_pcm_sw_params_set_period_event(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, int val);
|
|
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
|
|
index 7e46014627c2..89844430bf35 100644
|
|
--- a/src/pcm/pcm.c
|
|
+++ b/src/pcm/pcm.c
|
|
@@ -1483,6 +1483,7 @@ int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsign
|
|
#define XRUN(v) [SND_PCM_XRUN_##v] = #v
|
|
#define SILENCE(v) [SND_PCM_SILENCE_##v] = #v
|
|
#define TSTAMP(v) [SND_PCM_TSTAMP_##v] = #v
|
|
+#define TSTAMP_TYPE(v) [SND_PCM_TSTAMP_TYPE_##v] = #v
|
|
#define ACCESS(v) [SND_PCM_ACCESS_##v] = #v
|
|
#define START(v) [SND_PCM_START_##v] = #v
|
|
#define HW_PARAM(v) [SND_PCM_HW_PARAM_##v] = #v
|
|
@@ -1680,6 +1681,12 @@ static const char *const snd_pcm_tstamp_mode_names[] = {
|
|
TSTAMP(NONE),
|
|
TSTAMP(ENABLE),
|
|
};
|
|
+
|
|
+static const char *const snd_pcm_tstamp_type_names[] = {
|
|
+ TSTAMP_TYPE(GETTIMEOFDAY),
|
|
+ TSTAMP_TYPE(MONOTONIC),
|
|
+ TSTAMP_TYPE(MONOTONIC_RAW),
|
|
+};
|
|
#endif
|
|
|
|
/**
|
|
@@ -1826,6 +1833,18 @@ const char *snd_pcm_tstamp_mode_name(snd_pcm_tstamp_t mode)
|
|
}
|
|
|
|
/**
|
|
+ * \brief get name of PCM tstamp type setting
|
|
+ * \param mode PCM tstamp type
|
|
+ * \return ascii name of PCM tstamp type setting
|
|
+ */
|
|
+const char *snd_pcm_tstamp_type_name(snd_pcm_tstamp_t type)
|
|
+{
|
|
+ if (type > SND_PCM_TSTAMP_TYPE_LAST)
|
|
+ return NULL;
|
|
+ return snd_pcm_tstamp_type_names[type];
|
|
+}
|
|
+
|
|
+/**
|
|
* \brief get name of PCM state
|
|
* \param state PCM state
|
|
* \return ascii name of PCM state
|
|
@@ -1899,6 +1918,7 @@ int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out)
|
|
return -EIO;
|
|
}
|
|
snd_output_printf(out, " tstamp_mode : %s\n", snd_pcm_tstamp_mode_name(pcm->tstamp_mode));
|
|
+ snd_output_printf(out, " tstamp_type : %s\n", snd_pcm_tstamp_type_name(pcm->tstamp_mode));
|
|
snd_output_printf(out, " period_step : %d\n", pcm->period_step);
|
|
snd_output_printf(out, " avail_min : %ld\n", pcm->avail_min);
|
|
snd_output_printf(out, " period_event : %i\n", pcm->period_event);
|
|
@@ -5591,6 +5611,7 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
|
return -EIO;
|
|
}
|
|
params->tstamp_mode = pcm->tstamp_mode;
|
|
+ params->tstamp_type = pcm->tstamp_type;
|
|
params->period_step = pcm->period_step;
|
|
params->sleep_min = 0;
|
|
params->avail_min = pcm->avail_min;
|
|
@@ -5613,6 +5634,7 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
|
int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out)
|
|
{
|
|
snd_output_printf(out, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(params->tstamp_mode));
|
|
+ snd_output_printf(out, "tstamp_type: %s\n", snd_pcm_tstamp_type_name(params->tstamp_type));
|
|
snd_output_printf(out, "period_step: %u\n", params->period_step);
|
|
snd_output_printf(out, "avail_min: %lu\n", params->avail_min);
|
|
snd_output_printf(out, "start_threshold: %ld\n", params->start_threshold);
|
|
@@ -5811,6 +5833,37 @@ int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm
|
|
}
|
|
|
|
/**
|
|
+ * \brief Set timestamp type inside a software configuration container
|
|
+ * \param pcm PCM handle
|
|
+ * \param params Software configuration container
|
|
+ * \param val Timestamp type
|
|
+ * \return 0 otherwise a negative error code
|
|
+ */
|
|
+int snd_pcm_sw_params_set_tstamp_type(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t val)
|
|
+{
|
|
+ assert(pcm && params);
|
|
+ if (CHECK_SANITY(val > SND_PCM_TSTAMP_TYPE_LAST)) {
|
|
+ SNDMSG("invalid tstamp_type value %d", val);
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ params->tstamp_type = val;
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+/**
|
|
+ * \brief Get timestamp type from a software configuration container
|
|
+ * \param params Software configuration container
|
|
+ * \param val Returned timestamp type
|
|
+ * \return 0 otherwise a negative error code
|
|
+ */
|
|
+int snd_pcm_sw_params_get_tstamp_type(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t *val)
|
|
+{
|
|
+ assert(params && val);
|
|
+ *val = params->tstamp_type;
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+/**
|
|
* \brief (DEPRECATED) Set minimum number of ticks to sleep inside a software configuration container
|
|
* \param pcm PCM handle
|
|
* \param params Software configuration container
|
|
diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h
|
|
index 8a6c7431cc40..3ed7e1a88792 100644
|
|
--- a/src/pcm/pcm_local.h
|
|
+++ b/src/pcm/pcm_local.h
|
|
@@ -202,6 +202,7 @@ struct _snd_pcm {
|
|
unsigned int period_time; /* period duration */
|
|
snd_interval_t periods;
|
|
snd_pcm_tstamp_t tstamp_mode; /* timestamp mode */
|
|
+ snd_pcm_tstamp_type_t tstamp_type; /* timestamp type */
|
|
unsigned int period_step;
|
|
snd_pcm_uframes_t avail_min; /* min avail frames for wakeup */
|
|
int period_event;
|
|
diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c
|
|
index 0b66e8cbbe64..4adbefae0530 100644
|
|
--- a/src/pcm/pcm_params.c
|
|
+++ b/src/pcm/pcm_params.c
|
|
@@ -2258,6 +2258,7 @@ static int snd_pcm_sw_params_default(snd_pcm_t *pcm, snd_pcm_sw_params_t *params
|
|
assert(pcm && params);
|
|
assert(pcm->setup);
|
|
params->tstamp_mode = SND_PCM_TSTAMP_NONE;
|
|
+ params->tstamp_type = pcm->tstamp_type;
|
|
params->period_step = 1;
|
|
params->sleep_min = 0;
|
|
params->avail_min = pcm->period_size;
|
|
--
|
|
2.0.1
|
|
|