Accepting request 242199 from multimedia:libs
1 OBS-URL: https://build.opensuse.org/request/show/242199 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa?expand=0&rev=151
This commit is contained in:
commit
7ecc4f9c98
@ -0,0 +1,42 @@
|
|||||||
|
From 7a748af4db17cb0b26d19e5f9939d277128ec94b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
|
||||||
|
Date: Thu, 26 Jun 2014 13:30:25 +0300
|
||||||
|
Subject: [PATCH 01/14] ucm: Document PlaybackPCMIsDummy and CapturePCMIsDummy
|
||||||
|
values
|
||||||
|
|
||||||
|
At least PulseAudio needs special handling for dummy devices. To allow
|
||||||
|
that to happen automatically, the UCM configuration should contain the
|
||||||
|
information about which PCMs are dummy.
|
||||||
|
|
||||||
|
Signed-off-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
|
||||||
|
Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
include/use-case.h | 10 ++++++++++
|
||||||
|
1 file changed, 10 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/include/use-case.h b/include/use-case.h
|
||||||
|
index 4e13249133e6..f30168f86471 100644
|
||||||
|
--- a/include/use-case.h
|
||||||
|
+++ b/include/use-case.h
|
||||||
|
@@ -258,7 +258,17 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
|
||||||
|
* Recommended names for values:
|
||||||
|
* TQ - Tone Quality
|
||||||
|
* PlaybackPCM - full PCM playback device name
|
||||||
|
+ * PlaybackPCMIsDummy - Valid values: "yes" and "no". If set to "yes", the
|
||||||
|
+ * PCM named by the PlaybackPCM value is a dummy device,
|
||||||
|
+ * meaning that opening it enables an audio path in the
|
||||||
|
+ * hardware, but writing to the PCM device has no
|
||||||
|
+ * effect.
|
||||||
|
* CapturePCM - full PCM capture device name
|
||||||
|
+ * CapturePCMIsDummy - Valid values: "yes" and "no". If set to "yes", the
|
||||||
|
+ * PCM named by the CapturePCM value is a dummy device,
|
||||||
|
+ * meaning that opening it enables an audio path in the
|
||||||
|
+ * hardware, but reading from the PCM device has no
|
||||||
|
+ * effect.
|
||||||
|
* PlaybackRate - playback device sample rate
|
||||||
|
* PlaybackChannels - playback device channel count
|
||||||
|
* PlaybackCTL - playback control device name
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
58
0002-ICE1712-add-surround71-pcm-definition.patch
Normal file
58
0002-ICE1712-add-surround71-pcm-definition.patch
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
From 27cc710b5784cb3ab68cff2a9d9daf9fa479149e Mon Sep 17 00:00:00 2001
|
||||||
|
From: "Alexander E. Patrakov" <patrakov@gmail.com>
|
||||||
|
Date: Tue, 1 Jul 2014 00:40:48 +0600
|
||||||
|
Subject: [PATCH 02/14] ICE1712: add surround71 pcm definition
|
||||||
|
|
||||||
|
The M-Audio Delta 1010 card has 7.1 analog output, but no ready-made pcm
|
||||||
|
definition to use it.
|
||||||
|
|
||||||
|
Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
|
||||||
|
Reported-and-tested-by: Matt Zagrabelny <mzagrabe@d.umn.edu>
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/conf/cards/ICE1712.conf | 22 ++++++++++++++++++++++
|
||||||
|
1 file changed, 22 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/conf/cards/ICE1712.conf b/src/conf/cards/ICE1712.conf
|
||||||
|
index 398fa7ad5307..db62684e25f2 100644
|
||||||
|
--- a/src/conf/cards/ICE1712.conf
|
||||||
|
+++ b/src/conf/cards/ICE1712.conf
|
||||||
|
@@ -78,6 +78,7 @@ ICE1712.pcm.surround40.0 {
|
||||||
|
<confdir:pcm/surround41.conf>
|
||||||
|
<confdir:pcm/surround50.conf>
|
||||||
|
<confdir:pcm/surround51.conf>
|
||||||
|
+<confdir:pcm/surround71.conf>
|
||||||
|
|
||||||
|
ICE1712.pcm.surround51.0 {
|
||||||
|
@args [ CARD ]
|
||||||
|
@@ -98,6 +99,27 @@ ICE1712.pcm.surround51.0 {
|
||||||
|
slave.channels 10
|
||||||
|
}
|
||||||
|
|
||||||
|
+ICE1712.pcm.surround71.0 {
|
||||||
|
+ @args [ CARD ]
|
||||||
|
+ @args.CARD {
|
||||||
|
+ type string
|
||||||
|
+ }
|
||||||
|
+ type route
|
||||||
|
+ ttable.0.0 1
|
||||||
|
+ ttable.1.1 1
|
||||||
|
+ ttable.2.2 1
|
||||||
|
+ ttable.3.3 1
|
||||||
|
+ ttable.4.4 1
|
||||||
|
+ ttable.5.5 1
|
||||||
|
+ ttable.6.6 1
|
||||||
|
+ ttable.7.7 1
|
||||||
|
+ slave.pcm {
|
||||||
|
+ type hw
|
||||||
|
+ card $CARD
|
||||||
|
+ }
|
||||||
|
+ slave.channels 10
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
<confdir:pcm/iec958.conf>
|
||||||
|
|
||||||
|
ICE1712.pcm.iec958.0 {
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
84
0003-USB-Audio-Add-second-S-PDIF-device-on-Phiree-U2.patch
Normal file
84
0003-USB-Audio-Add-second-S-PDIF-device-on-Phiree-U2.patch
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
From ea865bba4615d906144ae5d4f72a4aad2baffe1f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Anssi Hannula <anssi.hannula@iki.fi>
|
||||||
|
Date: Tue, 8 Jul 2014 11:19:20 +0300
|
||||||
|
Subject: [PATCH 03/14] USB-Audio: Add second S/PDIF device on Phiree U2
|
||||||
|
|
||||||
|
Phiree U2 has an unusual configuration. It only has S/PDIF output, but
|
||||||
|
there are still two devices presented:
|
||||||
|
- device 0: PCM audio, subject to volume control
|
||||||
|
- device 1: non-PCM data (passthrough), not subject to volume control
|
||||||
|
|
||||||
|
It looks like the AES bits are set according to the selected device,
|
||||||
|
since outputting PCM data via device 1 will not work (silence).
|
||||||
|
|
||||||
|
Currently only the device 0 is shown via the "iec958" alias, and the
|
||||||
|
second device is not accessible via hinted aliases.
|
||||||
|
|
||||||
|
Simply provide access to both of these devices via the "iec958" alias.
|
||||||
|
|
||||||
|
Reported-by: touc @ XBMC forum
|
||||||
|
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/conf/cards/USB-Audio.conf | 40 ++++++++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 40 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/conf/cards/USB-Audio.conf b/src/conf/cards/USB-Audio.conf
|
||||||
|
index ce3ae019f7f6..77a48b9f5562 100644
|
||||||
|
--- a/src/conf/cards/USB-Audio.conf
|
||||||
|
+++ b/src/conf/cards/USB-Audio.conf
|
||||||
|
@@ -52,6 +52,11 @@ USB-Audio.pcm.iec958_device {
|
||||||
|
"USB Device 0x46d:0x992" 999
|
||||||
|
}
|
||||||
|
|
||||||
|
+# Second iec958 device number, if any.
|
||||||
|
+USB-Audio.pcm.iec958_2_device {
|
||||||
|
+ "PHIREE U2" 1 # 0 = PCM S/PDIF, 1 = non-PCM S/PDIF
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
|
||||||
|
# If a device requires non-standard definitions for front, surround40,
|
||||||
|
# surround51, surround71 or iec958, they can be defined here.
|
||||||
|
@@ -422,4 +427,39 @@ USB-Audio.pcm.iec958.0 {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+USB-Audio.pcm.iec958.1 {
|
||||||
|
+ @args [ CARD AES0 AES1 AES2 AES3 ]
|
||||||
|
+ @args.CARD { type string }
|
||||||
|
+ @args.AES0 { type integer }
|
||||||
|
+ @args.AES1 { type integer }
|
||||||
|
+ @args.AES2 { type integer }
|
||||||
|
+ @args.AES3 { type integer }
|
||||||
|
+ @func refer
|
||||||
|
+ name {
|
||||||
|
+ @func concat
|
||||||
|
+ strings [
|
||||||
|
+ "cards.USB-Audio."
|
||||||
|
+ { @func card_name card $CARD }
|
||||||
|
+ ".pcm.iec958_2:CARD=" $CARD
|
||||||
|
+ ",AES0=" $AES0 ",AES1=" $AES1 ",AES2=" $AES2 ",AES3=" $AES3
|
||||||
|
+ ]
|
||||||
|
+ }
|
||||||
|
+ default {
|
||||||
|
+ # FIXME: we cannot set the AES parameters
|
||||||
|
+ type hw
|
||||||
|
+ card $CARD
|
||||||
|
+ device {
|
||||||
|
+ @func refer
|
||||||
|
+ name {
|
||||||
|
+ @func concat
|
||||||
|
+ strings [
|
||||||
|
+ "cards.USB-Audio.pcm.iec958_2_device."
|
||||||
|
+ { @func card_name card $CARD }
|
||||||
|
+ ]
|
||||||
|
+ }
|
||||||
|
+ default 999
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
# vim: ft=alsaconf
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
30
0004-pcm-rate-fix-hw_ptr-exceed-the-boundary.patch
Normal file
30
0004-pcm-rate-fix-hw_ptr-exceed-the-boundary.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
From 035f196bcdc1e9903ed52ad1859dc23d3aa74e72 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Shengjiu Wang <shengjiu.wang@freescale.com>
|
||||||
|
Date: Mon, 14 Jul 2014 16:55:48 +0800
|
||||||
|
Subject: [PATCH 04/14] pcm: rate: fix hw_ptr exceed the boundary
|
||||||
|
|
||||||
|
For long time test case, the hw_ptr will exceed the boundary, then cause
|
||||||
|
the avail size wrong.
|
||||||
|
|
||||||
|
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/pcm/pcm_rate.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
|
||||||
|
index 7f667d4c6a52..2563d824ddb8 100644
|
||||||
|
--- a/src/pcm/pcm_rate.c
|
||||||
|
+++ b/src/pcm/pcm_rate.c
|
||||||
|
@@ -574,6 +574,8 @@ static inline void snd_pcm_rate_sync_hwptr(snd_pcm_t *pcm)
|
||||||
|
rate->hw_ptr =
|
||||||
|
(slave_hw_ptr / rate->gen.slave->period_size) * pcm->period_size +
|
||||||
|
rate->ops.input_frames(rate->obj, slave_hw_ptr % rate->gen.slave->period_size);
|
||||||
|
+
|
||||||
|
+ rate->hw_ptr %= pcm->boundary;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int snd_pcm_rate_hwsync(snd_pcm_t *pcm)
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
37
0005-pcm-Provide-a-CLOCK_MONOTONIC_RAW-timestamp-type.patch
Normal file
37
0005-pcm-Provide-a-CLOCK_MONOTONIC_RAW-timestamp-type.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
From 85e4704151677b8fcc5ccfc396071828e9ec1b8e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mark Brown <broonie@linaro.org>
|
||||||
|
Date: Tue, 8 Jul 2014 16:52:32 +0200
|
||||||
|
Subject: [PATCH 05/14] pcm: Provide a CLOCK_MONOTONIC_RAW timestamp type
|
||||||
|
|
||||||
|
For applications which need to synchronise with external timebases such
|
||||||
|
as broadcast TV applications the kernel monotonic time is not optimal as
|
||||||
|
it includes adjustments from NTP and so may still include discontinuities
|
||||||
|
due to that. A raw monotonic time which does not include any adjustments
|
||||||
|
is available in the kernel from getrawmonotonic() so provide userspace with
|
||||||
|
a new timestamp type SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW which provides
|
||||||
|
timestamps based on this as an option.
|
||||||
|
|
||||||
|
Reported-by: Daniel Thompson <daniel.thompson@linaro.org>
|
||||||
|
Signed-off-by: Mark Brown <broonie@linaro.org>
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
include/sound/asound.h | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/include/sound/asound.h b/include/sound/asound.h
|
||||||
|
index 1774a5c3ef10..9061cdd5b69f 100644
|
||||||
|
--- a/include/sound/asound.h
|
||||||
|
+++ b/include/sound/asound.h
|
||||||
|
@@ -457,7 +457,8 @@ struct snd_xfern {
|
||||||
|
enum {
|
||||||
|
SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */
|
||||||
|
SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */
|
||||||
|
- SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
|
||||||
|
+ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */
|
||||||
|
+ SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* channel positions */
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
41
0006-Add-timestamp-type-to-sw_params-internal-only.patch
Normal file
41
0006-Add-timestamp-type-to-sw_params-internal-only.patch
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
From 5250a8e212fd927735cfc27612b060c31dc3a230 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Thu, 10 Jul 2014 14:22:33 +0200
|
||||||
|
Subject: [PATCH 06/14] Add timestamp type to sw_params (internal only)
|
||||||
|
|
||||||
|
This patch is just the udpate of sound/asound.h taken from the kernel
|
||||||
|
commit. The API changes and PCM structure changes will follow after
|
||||||
|
this.
|
||||||
|
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
include/sound/asound.h | 6 ++++--
|
||||||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/sound/asound.h b/include/sound/asound.h
|
||||||
|
index 9061cdd5b69f..552f41bd1ca9 100644
|
||||||
|
--- a/include/sound/asound.h
|
||||||
|
+++ b/include/sound/asound.h
|
||||||
|
@@ -136,7 +136,7 @@ struct snd_hwdep_dsp_image {
|
||||||
|
* *
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
-#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 signed long snd_pcm_sframes_t;
|
||||||
|
@@ -386,7 +386,9 @@ struct snd_pcm_sw_params {
|
||||||
|
snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
|
||||||
|
snd_pcm_uframes_t silence_size; /* silence block size */
|
||||||
|
snd_pcm_uframes_t boundary; /* pointers wrap point */
|
||||||
|
- unsigned char reserved[64]; /* reserved for future */
|
||||||
|
+ unsigned int tstamp_type; /* timestamp type */
|
||||||
|
+ int pads; /* alignment, reserved */
|
||||||
|
+ unsigned char reserved[56]; /* reserved for future */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct snd_pcm_channel_info {
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
181
0007-pcm-Add-sw_params-API-functions-to-get-set-timestamp.patch
Normal file
181
0007-pcm-Add-sw_params-API-functions-to-get-set-timestamp.patch
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
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
|
||||||
|
|
113
0008-pcm-Implement-timestamp-type-setup-in-hw-plugin.patch
Normal file
113
0008-pcm-Implement-timestamp-type-setup-in-hw-plugin.patch
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
From 9b716075de4f2f7f15e428ee7efaa8960ef45b9c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Thu, 10 Jul 2014 14:32:50 +0200
|
||||||
|
Subject: [PATCH 08/14] pcm: Implement timestamp type setup in hw plugin
|
||||||
|
|
||||||
|
This patch implements the support for sw_params timestamp type in PCM
|
||||||
|
hw layer. As gettimestamp() is still unchanged, the resultant
|
||||||
|
timstamps may be still with CLOCK_MONOTONIC even if you pass monotonic
|
||||||
|
raw type. More fixes will follow.
|
||||||
|
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/pcm/pcm_hw.c | 37 ++++++++++++++++++++++++++++++++-----
|
||||||
|
1 file changed, 32 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
|
||||||
|
index ed8319728130..bafa8debeb0b 100644
|
||||||
|
--- a/src/pcm/pcm_hw.c
|
||||||
|
+++ b/src/pcm/pcm_hw.c
|
||||||
|
@@ -304,7 +304,8 @@ static int snd_pcm_hw_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||||
|
|
||||||
|
if (params->info != ~0U) {
|
||||||
|
params->info &= ~0xf0000000;
|
||||||
|
- params->info |= (pcm->monotonic ? SND_PCM_INFO_MONOTONIC : 0);
|
||||||
|
+ if (pcm->tstamp_type != SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY)
|
||||||
|
+ params->info |= SND_PCM_INFO_MONOTONIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -328,7 +329,8 @@ static int snd_pcm_hw_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
params->info &= ~0xf0000000;
|
||||||
|
- params->info |= (pcm->monotonic ? SND_PCM_INFO_MONOTONIC : 0);
|
||||||
|
+ if (pcm->tstamp_type != SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY)
|
||||||
|
+ params->info |= SND_PCM_INFO_MONOTONIC;
|
||||||
|
err = sync_ptr(hw, 0);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
@@ -435,6 +437,7 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
||||||
|
int old_period_event = sw_get_period_event(params);
|
||||||
|
sw_set_period_event(params, 0);
|
||||||
|
if ((snd_pcm_tstamp_t) params->tstamp_mode == pcm->tstamp_mode &&
|
||||||
|
+ (snd_pcm_tstamp_type_t) params->tstamp_type == pcm->tstamp_type &&
|
||||||
|
params->period_step == pcm->period_step &&
|
||||||
|
params->start_threshold == pcm->start_threshold &&
|
||||||
|
params->stop_threshold == pcm->stop_threshold &&
|
||||||
|
@@ -444,11 +447,33 @@ static int snd_pcm_hw_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params)
|
||||||
|
hw->mmap_control->avail_min = params->avail_min;
|
||||||
|
return sync_ptr(hw, 0);
|
||||||
|
}
|
||||||
|
+ if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW &&
|
||||||
|
+ hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) {
|
||||||
|
+ SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW");
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ }
|
||||||
|
+ if (params->tstamp_type == SND_PCM_TSTAMP_TYPE_MONOTONIC &&
|
||||||
|
+ hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 5)) {
|
||||||
|
+ SYSMSG("Kernel doesn't support SND_PCM_TSTAMP_TYPE_MONOTONIC");
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ }
|
||||||
|
if (ioctl(fd, SNDRV_PCM_IOCTL_SW_PARAMS, params) < 0) {
|
||||||
|
err = -errno;
|
||||||
|
SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
+ if ((snd_pcm_tstamp_type_t) params->tstamp_type != pcm->tstamp_type) {
|
||||||
|
+ if (hw->version < SNDRV_PROTOCOL_VERSION(2, 0, 12)) {
|
||||||
|
+ int on = (snd_pcm_tstamp_type_t) params->tstamp_type ==
|
||||||
|
+ SND_PCM_TSTAMP_TYPE_MONOTONIC;
|
||||||
|
+ if (ioctl(fd, SNDRV_PCM_IOCTL_TSTAMP, &on) < 0) {
|
||||||
|
+ err = -errno;
|
||||||
|
+ SNDMSG("TSTAMP failed\n");
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ pcm->tstamp_type = params->tstamp_type;
|
||||||
|
+ }
|
||||||
|
sw_set_period_event(params, old_period_event);
|
||||||
|
hw->mmap_control->avail_min = params->avail_min;
|
||||||
|
if (hw->period_event != old_period_event) {
|
||||||
|
@@ -1381,7 +1406,8 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name,
|
||||||
|
int fd, int mmap_emulation ATTRIBUTE_UNUSED,
|
||||||
|
int sync_ptr_ioctl)
|
||||||
|
{
|
||||||
|
- int ver, mode, monotonic = 0;
|
||||||
|
+ int ver, mode;
|
||||||
|
+ snd_pcm_tstamp_type_t tstamp_type = SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY;
|
||||||
|
long fmode;
|
||||||
|
snd_pcm_t *pcm = NULL;
|
||||||
|
snd_pcm_hw_t *hw = NULL;
|
||||||
|
@@ -1429,7 +1455,7 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name,
|
||||||
|
SNDMSG("TTSTAMP failed\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
- monotonic = 1;
|
||||||
|
+ tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
@@ -1471,7 +1497,8 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name,
|
||||||
|
pcm->private_data = hw;
|
||||||
|
pcm->poll_fd = fd;
|
||||||
|
pcm->poll_events = info.stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
|
||||||
|
- pcm->monotonic = monotonic;
|
||||||
|
+ pcm->tstamp_type = tstamp_type;
|
||||||
|
+ pcm->monotonic = tstamp_type != SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY;
|
||||||
|
|
||||||
|
ret = snd_pcm_hw_mmap_status(pcm);
|
||||||
|
if (ret < 0) {
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
602
0009-pcm-Implement-timestamp-type-handling-in-all-plugins.patch
Normal file
602
0009-pcm-Implement-timestamp-type-handling-in-all-plugins.patch
Normal file
@ -0,0 +1,602 @@
|
|||||||
|
From 65ff6fdafb705b5e2e6d4b9a94a80e5de89f5de1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Thu, 10 Jul 2014 14:37:49 +0200
|
||||||
|
Subject: [PATCH 09/14] pcm: Implement timestamp type handling in all plugins
|
||||||
|
|
||||||
|
Now all PCM plugins do support the proper timestamp type or pass it
|
||||||
|
over slaves. The internal monotonic flag is dropped and replaced with
|
||||||
|
tstamp_type in all places.
|
||||||
|
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/pcm/pcm_adpcm.c | 2 +-
|
||||||
|
src/pcm/pcm_alaw.c | 2 +-
|
||||||
|
src/pcm/pcm_copy.c | 2 +-
|
||||||
|
src/pcm/pcm_direct.c | 4 ++--
|
||||||
|
src/pcm/pcm_direct.h | 2 +-
|
||||||
|
src/pcm/pcm_dmix.c | 8 ++++----
|
||||||
|
src/pcm/pcm_dshare.c | 8 ++++----
|
||||||
|
src/pcm/pcm_dsnoop.c | 4 ++--
|
||||||
|
src/pcm/pcm_file.c | 6 +++---
|
||||||
|
src/pcm/pcm_generic.c | 2 +-
|
||||||
|
src/pcm/pcm_hooks.c | 2 +-
|
||||||
|
src/pcm/pcm_hw.c | 1 -
|
||||||
|
src/pcm/pcm_iec958.c | 2 +-
|
||||||
|
src/pcm/pcm_ioplug.c | 9 ++++++---
|
||||||
|
src/pcm/pcm_ladspa.c | 2 +-
|
||||||
|
src/pcm/pcm_lfloat.c | 2 +-
|
||||||
|
src/pcm/pcm_linear.c | 2 +-
|
||||||
|
src/pcm/pcm_local.h | 45 +++++++++++++++++++++++++++++----------------
|
||||||
|
src/pcm/pcm_meter.c | 2 +-
|
||||||
|
src/pcm/pcm_mmap_emul.c | 2 +-
|
||||||
|
src/pcm/pcm_mulaw.c | 2 +-
|
||||||
|
src/pcm/pcm_multi.c | 2 +-
|
||||||
|
src/pcm/pcm_null.c | 2 +-
|
||||||
|
src/pcm/pcm_plug.c | 2 +-
|
||||||
|
src/pcm/pcm_rate.c | 4 ++--
|
||||||
|
src/pcm/pcm_route.c | 2 +-
|
||||||
|
src/pcm/pcm_share.c | 6 +++---
|
||||||
|
src/pcm/pcm_softvol.c | 2 +-
|
||||||
|
28 files changed, 73 insertions(+), 58 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm_adpcm.c b/src/pcm/pcm_adpcm.c
|
||||||
|
index 6f0e7c4cc631..1a83c5a0e21c 100644
|
||||||
|
--- a/src/pcm/pcm_adpcm.c
|
||||||
|
+++ b/src/pcm/pcm_adpcm.c
|
||||||
|
@@ -579,7 +579,7 @@ int snd_pcm_adpcm_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor
|
||||||
|
pcm->private_data = adpcm;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &adpcm->plug.hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &adpcm->plug.appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_alaw.c b/src/pcm/pcm_alaw.c
|
||||||
|
index 1b1bab83c944..db759e3effa4 100644
|
||||||
|
--- a/src/pcm/pcm_alaw.c
|
||||||
|
+++ b/src/pcm/pcm_alaw.c
|
||||||
|
@@ -453,7 +453,7 @@ int snd_pcm_alaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sform
|
||||||
|
pcm->private_data = alaw;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &alaw->plug.hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &alaw->plug.appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_copy.c b/src/pcm/pcm_copy.c
|
||||||
|
index 56a1f6bcc912..66d3a4719856 100644
|
||||||
|
--- a/src/pcm/pcm_copy.c
|
||||||
|
+++ b/src/pcm/pcm_copy.c
|
||||||
|
@@ -209,7 +209,7 @@ int snd_pcm_copy_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int
|
||||||
|
pcm->private_data = copy;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, ©->plug.hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, ©->plug.appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c
|
||||||
|
index 5416cf71674c..8e37bcba5e19 100644
|
||||||
|
--- a/src/pcm/pcm_direct.c
|
||||||
|
+++ b/src/pcm/pcm_direct.c
|
||||||
|
@@ -840,6 +840,7 @@ static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
|
||||||
|
COPY_SLAVE(period_time);
|
||||||
|
COPY_SLAVE(periods);
|
||||||
|
COPY_SLAVE(tstamp_mode);
|
||||||
|
+ COPY_SLAVE(tstamp_type);
|
||||||
|
COPY_SLAVE(period_step);
|
||||||
|
COPY_SLAVE(avail_min);
|
||||||
|
COPY_SLAVE(start_threshold);
|
||||||
|
@@ -857,7 +858,6 @@ static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
|
||||||
|
COPY_SLAVE(buffer_time);
|
||||||
|
COPY_SLAVE(sample_bits);
|
||||||
|
COPY_SLAVE(frame_bits);
|
||||||
|
- COPY_SLAVE(monotonic);
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef COPY_SLAVE
|
||||||
|
@@ -1204,6 +1204,7 @@ static void copy_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
|
||||||
|
COPY_SLAVE(period_time);
|
||||||
|
COPY_SLAVE(periods);
|
||||||
|
COPY_SLAVE(tstamp_mode);
|
||||||
|
+ COPY_SLAVE(tstamp_type);
|
||||||
|
COPY_SLAVE(period_step);
|
||||||
|
COPY_SLAVE(avail_min);
|
||||||
|
COPY_SLAVE(start_threshold);
|
||||||
|
@@ -1221,7 +1222,6 @@ static void copy_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm)
|
||||||
|
COPY_SLAVE(buffer_time);
|
||||||
|
COPY_SLAVE(sample_bits);
|
||||||
|
COPY_SLAVE(frame_bits);
|
||||||
|
- COPY_SLAVE(monotonic);
|
||||||
|
|
||||||
|
spcm->info &= ~SND_PCM_INFO_PAUSE;
|
||||||
|
spcm->boundary = recalc_boundary_size(dmix->shmptr->s.boundary, spcm->buffer_size);
|
||||||
|
diff --git a/src/pcm/pcm_direct.h b/src/pcm/pcm_direct.h
|
||||||
|
index 5ae39c0e4237..9b1ddbcf424a 100644
|
||||||
|
--- a/src/pcm/pcm_direct.h
|
||||||
|
+++ b/src/pcm/pcm_direct.h
|
||||||
|
@@ -85,8 +85,8 @@ typedef struct {
|
||||||
|
unsigned int period_size;
|
||||||
|
unsigned int period_time;
|
||||||
|
snd_interval_t periods;
|
||||||
|
- unsigned int monotonic;
|
||||||
|
snd_pcm_tstamp_t tstamp_mode;
|
||||||
|
+ snd_pcm_tstamp_type_t tstamp_type;
|
||||||
|
unsigned int period_step;
|
||||||
|
unsigned int sleep_min; /* not used */
|
||||||
|
unsigned int avail_min;
|
||||||
|
diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c
|
||||||
|
index 4aa6d4eab4a2..7c535093ea0f 100644
|
||||||
|
--- a/src/pcm/pcm_dmix.c
|
||||||
|
+++ b/src/pcm/pcm_dmix.c
|
||||||
|
@@ -428,7 +428,7 @@ static int snd_pcm_dmix_sync_ptr(snd_pcm_t *pcm)
|
||||||
|
dmix->avail_max = avail;
|
||||||
|
if (avail >= pcm->stop_threshold) {
|
||||||
|
snd_timer_stop(dmix->timer);
|
||||||
|
- gettimestamp(&dmix->trigger_tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&dmix->trigger_tstamp, pcm->tstamp_type);
|
||||||
|
if (dmix->state == SND_PCM_STATE_RUNNING) {
|
||||||
|
dmix->state = SND_PCM_STATE_XRUN;
|
||||||
|
return -EPIPE;
|
||||||
|
@@ -477,7 +477,7 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||||
|
memset(status, 0, sizeof(*status));
|
||||||
|
status->state = snd_pcm_dmix_state(pcm);
|
||||||
|
status->trigger_tstamp = dmix->trigger_tstamp;
|
||||||
|
- gettimestamp(&status->tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&status->tstamp, pcm->tstamp_type);
|
||||||
|
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;
|
||||||
|
@@ -596,7 +596,7 @@ static int snd_pcm_dmix_start(snd_pcm_t *pcm)
|
||||||
|
return err;
|
||||||
|
snd_pcm_dmix_sync_area(pcm);
|
||||||
|
}
|
||||||
|
- gettimestamp(&dmix->trigger_tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&dmix->trigger_tstamp, pcm->tstamp_type);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1104,7 +1104,7 @@ int snd_pcm_dmix_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
|
||||||
|
pcm->poll_fd = dmix->poll_fd;
|
||||||
|
pcm->poll_events = POLLIN; /* it's different than other plugins */
|
||||||
|
- pcm->monotonic = spcm->monotonic;
|
||||||
|
+ pcm->tstamp_type = spcm->tstamp_type;
|
||||||
|
pcm->mmap_rw = 1;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &dmix->hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &dmix->appl_ptr, -1, 0);
|
||||||
|
diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c
|
||||||
|
index f2d1103a6bfb..b985172825e7 100644
|
||||||
|
--- a/src/pcm/pcm_dshare.c
|
||||||
|
+++ b/src/pcm/pcm_dshare.c
|
||||||
|
@@ -195,7 +195,7 @@ static int snd_pcm_dshare_sync_ptr(snd_pcm_t *pcm)
|
||||||
|
dshare->avail_max = avail;
|
||||||
|
if (avail >= pcm->stop_threshold) {
|
||||||
|
snd_timer_stop(dshare->timer);
|
||||||
|
- gettimestamp(&dshare->trigger_tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&dshare->trigger_tstamp, pcm->tstamp_type);
|
||||||
|
if (dshare->state == SND_PCM_STATE_RUNNING) {
|
||||||
|
dshare->state = SND_PCM_STATE_XRUN;
|
||||||
|
return -EPIPE;
|
||||||
|
@@ -226,7 +226,7 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||||
|
memset(status, 0, sizeof(*status));
|
||||||
|
status->state = snd_pcm_state(dshare->spcm);
|
||||||
|
status->trigger_tstamp = dshare->trigger_tstamp;
|
||||||
|
- gettimestamp(&status->tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&status->tstamp, pcm->tstamp_type);
|
||||||
|
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;
|
||||||
|
@@ -346,7 +346,7 @@ static int snd_pcm_dshare_start(snd_pcm_t *pcm)
|
||||||
|
return err;
|
||||||
|
snd_pcm_dshare_sync_area(pcm);
|
||||||
|
}
|
||||||
|
- gettimestamp(&dshare->trigger_tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&dshare->trigger_tstamp, pcm->tstamp_type);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -792,7 +792,7 @@ int snd_pcm_dshare_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
|
||||||
|
pcm->poll_fd = dshare->poll_fd;
|
||||||
|
pcm->poll_events = POLLIN; /* it's different than other plugins */
|
||||||
|
- pcm->monotonic = spcm->monotonic;
|
||||||
|
+ pcm->tstamp_type = spcm->tstamp_type;
|
||||||
|
pcm->mmap_rw = 1;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &dshare->hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &dshare->appl_ptr, -1, 0);
|
||||||
|
diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c
|
||||||
|
index 76379140c133..0f9c9df481bc 100644
|
||||||
|
--- a/src/pcm/pcm_dsnoop.c
|
||||||
|
+++ b/src/pcm/pcm_dsnoop.c
|
||||||
|
@@ -159,7 +159,7 @@ static int snd_pcm_dsnoop_sync_ptr(snd_pcm_t *pcm)
|
||||||
|
if (pcm->stop_threshold >= pcm->boundary) /* don't care */
|
||||||
|
return 0;
|
||||||
|
if ((avail = snd_pcm_mmap_capture_hw_avail(pcm)) >= pcm->stop_threshold) {
|
||||||
|
- gettimestamp(&dsnoop->trigger_tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&dsnoop->trigger_tstamp, pcm->tstamp_type);
|
||||||
|
dsnoop->state = SND_PCM_STATE_XRUN;
|
||||||
|
dsnoop->avail_max = avail;
|
||||||
|
return -EPIPE;
|
||||||
|
@@ -690,7 +690,7 @@ int snd_pcm_dsnoop_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
|
||||||
|
pcm->poll_fd = dsnoop->poll_fd;
|
||||||
|
pcm->poll_events = POLLIN; /* it's different than other plugins */
|
||||||
|
- pcm->monotonic = spcm->monotonic;
|
||||||
|
+ pcm->tstamp_type = spcm->tstamp_type;
|
||||||
|
pcm->mmap_rw = 1;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &dsnoop->hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &dsnoop->appl_ptr, -1, 0);
|
||||||
|
diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c
|
||||||
|
index b139f7f24dc3..a0b8bf41bf5b 100644
|
||||||
|
--- a/src/pcm/pcm_file.c
|
||||||
|
+++ b/src/pcm/pcm_file.c
|
||||||
|
@@ -781,10 +781,10 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
pcm->mmap_shadow = 1;
|
||||||
|
+ pcm->tstamp_type = SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY;
|
||||||
|
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
|
||||||
|
- pcm->monotonic = clock_gettime(CLOCK_MONOTONIC, ×pec) == 0;
|
||||||
|
-#else
|
||||||
|
- pcm->monotonic = 0;
|
||||||
|
+ if (clock_gettime(CLOCK_MONOTONIC, ×pec) == 0)
|
||||||
|
+ pcm->tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC;
|
||||||
|
#endif
|
||||||
|
pcm->stream = stream;
|
||||||
|
snd_pcm_link_hw_ptr(pcm, slave);
|
||||||
|
diff --git a/src/pcm/pcm_generic.c b/src/pcm/pcm_generic.c
|
||||||
|
index f068ee2585bc..9b605911f868 100644
|
||||||
|
--- a/src/pcm/pcm_generic.c
|
||||||
|
+++ b/src/pcm/pcm_generic.c
|
||||||
|
@@ -294,7 +294,7 @@ int snd_pcm_generic_real_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail,
|
||||||
|
if (ok && (snd_pcm_uframes_t)avail1 == *avail)
|
||||||
|
break;
|
||||||
|
*avail = avail1;
|
||||||
|
- gettimestamp(tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(tstamp, pcm->tstamp_type);
|
||||||
|
ok = 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
diff --git a/src/pcm/pcm_hooks.c b/src/pcm/pcm_hooks.c
|
||||||
|
index f83728245ecd..0b93c641daaa 100644
|
||||||
|
--- a/src/pcm/pcm_hooks.c
|
||||||
|
+++ b/src/pcm/pcm_hooks.c
|
||||||
|
@@ -240,7 +240,7 @@ int snd_pcm_hooks_open(snd_pcm_t **pcmp, const char *name, snd_pcm_t *slave, int
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
pcm->mmap_shadow = 1;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_link_hw_ptr(pcm, slave);
|
||||||
|
snd_pcm_link_appl_ptr(pcm, slave);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
|
||||||
|
index bafa8debeb0b..74cff672a0c1 100644
|
||||||
|
--- a/src/pcm/pcm_hw.c
|
||||||
|
+++ b/src/pcm/pcm_hw.c
|
||||||
|
@@ -1498,7 +1498,6 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name,
|
||||||
|
pcm->poll_fd = fd;
|
||||||
|
pcm->poll_events = info.stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
|
||||||
|
pcm->tstamp_type = tstamp_type;
|
||||||
|
- pcm->monotonic = tstamp_type != SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY;
|
||||||
|
|
||||||
|
ret = snd_pcm_hw_mmap_status(pcm);
|
||||||
|
if (ret < 0) {
|
||||||
|
diff --git a/src/pcm/pcm_iec958.c b/src/pcm/pcm_iec958.c
|
||||||
|
index 0c61fc17995b..38c4ce7e2421 100644
|
||||||
|
--- a/src/pcm/pcm_iec958.c
|
||||||
|
+++ b/src/pcm/pcm_iec958.c
|
||||||
|
@@ -534,7 +534,7 @@ int snd_pcm_iec958_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo
|
||||||
|
pcm->private_data = iec;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &iec->plug.hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &iec->plug.appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c
|
||||||
|
index c1c3a9835d47..85a88911eafc 100644
|
||||||
|
--- a/src/pcm/pcm_ioplug.c
|
||||||
|
+++ b/src/pcm/pcm_ioplug.c
|
||||||
|
@@ -448,7 +448,7 @@ static int snd_pcm_ioplug_start(snd_pcm_t *pcm)
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
- gettimestamp(&io->trigger_tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&io->trigger_tstamp, pcm->tstamp_type);
|
||||||
|
io->data->state = SND_PCM_STATE_RUNNING;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -463,7 +463,7 @@ static int snd_pcm_ioplug_drop(snd_pcm_t *pcm)
|
||||||
|
|
||||||
|
io->data->callback->stop(io->data);
|
||||||
|
|
||||||
|
- gettimestamp(&io->trigger_tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&io->trigger_tstamp, pcm->tstamp_type);
|
||||||
|
io->data->state = SND_PCM_STATE_SETUP;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -1069,7 +1069,10 @@ int snd_pcm_ioplug_reinit_status(snd_pcm_ioplug_t *ioplug)
|
||||||
|
{
|
||||||
|
ioplug->pcm->poll_fd = ioplug->poll_fd;
|
||||||
|
ioplug->pcm->poll_events = ioplug->poll_events;
|
||||||
|
- ioplug->pcm->monotonic = (ioplug->flags & SND_PCM_IOPLUG_FLAG_MONOTONIC) != 0;
|
||||||
|
+ if (ioplug->flags & SND_PCM_IOPLUG_FLAG_MONOTONIC)
|
||||||
|
+ ioplug->pcm->tstamp_type = SND_PCM_TSTAMP_TYPE_MONOTONIC;
|
||||||
|
+ else
|
||||||
|
+ ioplug->pcm->tstamp_type = SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY;
|
||||||
|
ioplug->pcm->mmap_rw = ioplug->mmap_rw;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c
|
||||||
|
index 7d1e3df878b0..631ee0f35b73 100644
|
||||||
|
--- a/src/pcm/pcm_ladspa.c
|
||||||
|
+++ b/src/pcm/pcm_ladspa.c
|
||||||
|
@@ -1641,7 +1641,7 @@ int snd_pcm_ladspa_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
pcm->private_data = ladspa;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &ladspa->plug.hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &ladspa->plug.appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_lfloat.c b/src/pcm/pcm_lfloat.c
|
||||||
|
index bbf72c274222..324282f0b7fc 100644
|
||||||
|
--- a/src/pcm/pcm_lfloat.c
|
||||||
|
+++ b/src/pcm/pcm_lfloat.c
|
||||||
|
@@ -412,7 +412,7 @@ int snd_pcm_lfloat_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo
|
||||||
|
pcm->private_data = lfloat;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &lfloat->plug.hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &lfloat->plug.appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_linear.c b/src/pcm/pcm_linear.c
|
||||||
|
index 7aa894185444..3d5bbb8a3688 100644
|
||||||
|
--- a/src/pcm/pcm_linear.c
|
||||||
|
+++ b/src/pcm/pcm_linear.c
|
||||||
|
@@ -484,7 +484,7 @@ int snd_pcm_linear_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfo
|
||||||
|
pcm->private_data = linear;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &linear->plug.hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &linear->plug.appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h
|
||||||
|
index 3ed7e1a88792..2206afe2c4a9 100644
|
||||||
|
--- a/src/pcm/pcm_local.h
|
||||||
|
+++ b/src/pcm/pcm_local.h
|
||||||
|
@@ -191,7 +191,6 @@ struct _snd_pcm {
|
||||||
|
int poll_fd;
|
||||||
|
unsigned short poll_events;
|
||||||
|
int setup: 1,
|
||||||
|
- monotonic: 1,
|
||||||
|
compat: 1;
|
||||||
|
snd_pcm_access_t access; /* access mode */
|
||||||
|
snd_pcm_format_t format; /* SND_PCM_FORMAT_* */
|
||||||
|
@@ -960,26 +959,40 @@ typedef union snd_tmp_double {
|
||||||
|
} snd_tmp_double_t;
|
||||||
|
|
||||||
|
/* get the current timestamp */
|
||||||
|
-static inline void gettimestamp(snd_htimestamp_t *tstamp, int monotonic)
|
||||||
|
+#ifdef HAVE_CLOCK_GETTIME
|
||||||
|
+static inline void gettimestamp(snd_htimestamp_t *tstamp,
|
||||||
|
+ snd_pcm_tstamp_type_t tstamp_type)
|
||||||
|
{
|
||||||
|
-#if defined(HAVE_CLOCK_GETTIME)
|
||||||
|
-#if defined(CLOCK_MONOTONIC)
|
||||||
|
- if (monotonic) {
|
||||||
|
- clock_gettime(CLOCK_MONOTONIC, tstamp);
|
||||||
|
- } else {
|
||||||
|
-#endif
|
||||||
|
- clock_gettime(CLOCK_REALTIME, tstamp);
|
||||||
|
-#else
|
||||||
|
- struct timeval tv;
|
||||||
|
+ clockid_t id;
|
||||||
|
|
||||||
|
- gettimeofday(&tv, 0);
|
||||||
|
- tstamp->tv_sec = tv.tv_sec;
|
||||||
|
- tstamp->tv_nsec = tv.tv_usec * 1000L;
|
||||||
|
+ switch (tstamp_type) {
|
||||||
|
+#ifdef CLOCK_MONOTONIC_RAW
|
||||||
|
+ case SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW:
|
||||||
|
+ id = CLOCK_MONOTONIC_RAW;
|
||||||
|
+ break;
|
||||||
|
#endif
|
||||||
|
-#if defined(HAVE_CLOCK_GETTIME)
|
||||||
|
- }
|
||||||
|
+#ifdef CLOCK_MONOTONIC
|
||||||
|
+ case SND_PCM_TSTAMP_TYPE_MONOTONIC:
|
||||||
|
+ id = CLOCK_MONOTONIC;
|
||||||
|
+ break;
|
||||||
|
#endif
|
||||||
|
+ default:
|
||||||
|
+ id = CLOCK_REALTIME;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ clock_gettime(id, tstamp);
|
||||||
|
+}
|
||||||
|
+#else /* HAVE_CLOCK_GETTIME */
|
||||||
|
+static inline void gettimestamp(snd_htimestamp_t *tstamp,
|
||||||
|
+ snd_pcm_tstamp_type_t tstamp_type)
|
||||||
|
+{
|
||||||
|
+ struct timeval tv;
|
||||||
|
+
|
||||||
|
+ gettimeofday(&tv, 0);
|
||||||
|
+ tstamp->tv_sec = tv.tv_sec;
|
||||||
|
+ tstamp->tv_nsec = tv.tv_usec * 1000L;
|
||||||
|
}
|
||||||
|
+#endif /* HAVE_CLOCK_GETTIME */
|
||||||
|
|
||||||
|
snd_pcm_chmap_query_t **
|
||||||
|
_snd_pcm_make_single_query_chmaps(const snd_pcm_chmap_t *src);
|
||||||
|
diff --git a/src/pcm/pcm_meter.c b/src/pcm/pcm_meter.c
|
||||||
|
index 676fbef89c30..034f582564a8 100644
|
||||||
|
--- a/src/pcm/pcm_meter.c
|
||||||
|
+++ b/src/pcm/pcm_meter.c
|
||||||
|
@@ -591,7 +591,7 @@ int snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name, unsigned int frequenc
|
||||||
|
pcm->private_data = meter;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_link_hw_ptr(pcm, slave);
|
||||||
|
snd_pcm_link_appl_ptr(pcm, slave);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_mmap_emul.c b/src/pcm/pcm_mmap_emul.c
|
||||||
|
index 63789bc07c1b..b2b15efd07d9 100644
|
||||||
|
--- a/src/pcm/pcm_mmap_emul.c
|
||||||
|
+++ b/src/pcm/pcm_mmap_emul.c
|
||||||
|
@@ -428,7 +428,7 @@ int __snd_pcm_mmap_emul_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
pcm->private_data = map;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &map->hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &map->appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_mulaw.c b/src/pcm/pcm_mulaw.c
|
||||||
|
index 7adce38e9f48..011b2a516be0 100644
|
||||||
|
--- a/src/pcm/pcm_mulaw.c
|
||||||
|
+++ b/src/pcm/pcm_mulaw.c
|
||||||
|
@@ -467,7 +467,7 @@ int snd_pcm_mulaw_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sfor
|
||||||
|
pcm->private_data = mulaw;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &mulaw->plug.hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &mulaw->plug.appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c
|
||||||
|
index a84e0ce48c59..4b8299ed6bcd 100644
|
||||||
|
--- a/src/pcm/pcm_multi.c
|
||||||
|
+++ b/src/pcm/pcm_multi.c
|
||||||
|
@@ -1077,7 +1077,7 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
pcm->private_data = multi;
|
||||||
|
pcm->poll_fd = multi->slaves[master_slave].pcm->poll_fd;
|
||||||
|
pcm->poll_events = multi->slaves[master_slave].pcm->poll_events;
|
||||||
|
- pcm->monotonic = multi->slaves[master_slave].pcm->monotonic;
|
||||||
|
+ pcm->tstamp_type = multi->slaves[master_slave].pcm->tstamp_type;
|
||||||
|
snd_pcm_link_hw_ptr(pcm, multi->slaves[master_slave].pcm);
|
||||||
|
snd_pcm_link_appl_ptr(pcm, multi->slaves[master_slave].pcm);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c
|
||||||
|
index 655261f74e1f..f11a1020f7e3 100644
|
||||||
|
--- a/src/pcm/pcm_null.c
|
||||||
|
+++ b/src/pcm/pcm_null.c
|
||||||
|
@@ -100,7 +100,7 @@ static int snd_pcm_null_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
||||||
|
memset(status, 0, sizeof(*status));
|
||||||
|
status->state = null->state;
|
||||||
|
status->trigger_tstamp = null->trigger_tstamp;
|
||||||
|
- gettimestamp(&status->tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&status->tstamp, pcm->tstamp_type);
|
||||||
|
status->avail = snd_pcm_null_avail_update(pcm);
|
||||||
|
status->avail_max = pcm->buffer_size;
|
||||||
|
return 0;
|
||||||
|
diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c
|
||||||
|
index 7a6c2b99c639..5639b9ea8044 100644
|
||||||
|
--- a/src/pcm/pcm_plug.c
|
||||||
|
+++ b/src/pcm/pcm_plug.c
|
||||||
|
@@ -1127,7 +1127,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
pcm->mmap_shadow = 1;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_link_hw_ptr(pcm, slave);
|
||||||
|
snd_pcm_link_appl_ptr(pcm, slave);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c
|
||||||
|
index 2563d824ddb8..5e811bb7192a 100644
|
||||||
|
--- a/src/pcm/pcm_rate.c
|
||||||
|
+++ b/src/pcm/pcm_rate.c
|
||||||
|
@@ -1069,7 +1069,7 @@ static int snd_pcm_rate_start(snd_pcm_t *pcm)
|
||||||
|
if (snd_pcm_state(rate->gen.slave) != SND_PCM_STATE_PREPARED)
|
||||||
|
return -EBADFD;
|
||||||
|
|
||||||
|
- gettimestamp(&rate->trigger_tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&rate->trigger_tstamp, pcm->tstamp_type);
|
||||||
|
|
||||||
|
avail = snd_pcm_mmap_playback_hw_avail(rate->gen.slave);
|
||||||
|
if (avail == 0) {
|
||||||
|
@@ -1372,7 +1372,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
pcm->mmap_rw = 1;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &rate->hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &rate->appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c
|
||||||
|
index 751e36f28fdf..2f0be38b1906 100644
|
||||||
|
--- a/src/pcm/pcm_route.c
|
||||||
|
+++ b/src/pcm/pcm_route.c
|
||||||
|
@@ -1122,7 +1122,7 @@ int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
pcm->private_data = route;
|
||||||
|
pcm->poll_fd = slave->poll_fd;
|
||||||
|
pcm->poll_events = slave->poll_events;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &route->plug.hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &route->plug.appl_ptr, -1, 0);
|
||||||
|
err = route_load_ttable(&route->params, pcm->stream, tt_ssize, ttable, tt_cused, tt_sused);
|
||||||
|
diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c
|
||||||
|
index 118ab2617780..97705447dd6d 100644
|
||||||
|
--- a/src/pcm/pcm_share.c
|
||||||
|
+++ b/src/pcm/pcm_share.c
|
||||||
|
@@ -971,7 +971,7 @@ static int snd_pcm_share_start(snd_pcm_t *pcm)
|
||||||
|
}
|
||||||
|
slave->running_count++;
|
||||||
|
_snd_pcm_share_update(pcm);
|
||||||
|
- gettimestamp(&share->trigger_tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&share->trigger_tstamp, pcm->tstamp_type);
|
||||||
|
_end:
|
||||||
|
Pthread_mutex_unlock(&slave->mutex);
|
||||||
|
return err;
|
||||||
|
@@ -1126,7 +1126,7 @@ static void _snd_pcm_share_stop(snd_pcm_t *pcm, snd_pcm_state_t state)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
- gettimestamp(&share->trigger_tstamp, pcm->monotonic);
|
||||||
|
+ gettimestamp(&share->trigger_tstamp, pcm->tstamp_type);
|
||||||
|
if (pcm->stream == SND_PCM_STREAM_CAPTURE) {
|
||||||
|
snd_pcm_areas_copy(pcm->stopped_areas, 0,
|
||||||
|
pcm->running_areas, 0,
|
||||||
|
@@ -1526,7 +1526,7 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
|
||||||
|
pcm->private_data = share;
|
||||||
|
pcm->poll_fd = share->client_socket;
|
||||||
|
pcm->poll_events = stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN;
|
||||||
|
- pcm->monotonic = slave->pcm->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->pcm->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &share->hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &share->appl_ptr, -1, 0);
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c
|
||||||
|
index 5da92049cc88..c6cfd8896b26 100644
|
||||||
|
--- a/src/pcm/pcm_softvol.c
|
||||||
|
+++ b/src/pcm/pcm_softvol.c
|
||||||
|
@@ -903,7 +903,7 @@ int snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
|
||||||
|
* an extra buffer.
|
||||||
|
*/
|
||||||
|
pcm->mmap_shadow = 1;
|
||||||
|
- pcm->monotonic = slave->monotonic;
|
||||||
|
+ pcm->tstamp_type = slave->tstamp_type;
|
||||||
|
snd_pcm_set_hw_ptr(pcm, &svol->plug.hw_ptr, -1, 0);
|
||||||
|
snd_pcm_set_appl_ptr(pcm, &svol->plug.appl_ptr, -1, 0);
|
||||||
|
*pcmp = pcm;
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
51
0010-test-audio_time-Set-timestamp-type-explicitly.patch
Normal file
51
0010-test-audio_time-Set-timestamp-type-explicitly.patch
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
From 52444bd43afbadb8637f5fac3fe5fd90575ee216 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Mon, 14 Jul 2014 18:12:49 +0200
|
||||||
|
Subject: [PATCH 10/14] test/audio_time: Set timestamp type explicitly
|
||||||
|
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
test/audio_time.c | 13 +++++++++++++
|
||||||
|
1 file changed, 13 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/test/audio_time.c b/test/audio_time.c
|
||||||
|
index 03817c7c673b..7435db6a7fd8 100644
|
||||||
|
--- a/test/audio_time.c
|
||||||
|
+++ b/test/audio_time.c
|
||||||
|
@@ -57,6 +57,7 @@ void gettimestamp(snd_pcm_t *handle, snd_htimestamp_t *timestamp,
|
||||||
|
#define TRACK_PLAYBACK /* dump playback timing info */
|
||||||
|
#define TRACK_SAMPLE_COUNTS /* show difference between sample counters and audiotimestamps returned by driver */
|
||||||
|
#define PLAYBACK_BUFFERS 4
|
||||||
|
+#define TSTAMP_TYPE SND_PCM_TSTAMP_TYPE_MONOTONIC
|
||||||
|
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
@@ -128,6 +129,12 @@ int main(void)
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ err = snd_pcm_sw_params_set_tstamp_type(handle_p, swparams_p, TSTAMP_TYPE);
|
||||||
|
+ if (err < 0) {
|
||||||
|
+ printf("Unable to set tstamp type : %s\n", snd_strerror(err));
|
||||||
|
+ goto _exit;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* write the sw parameters */
|
||||||
|
err = snd_pcm_sw_params(handle_p, swparams_p);
|
||||||
|
if (err < 0) {
|
||||||
|
@@ -177,6 +184,12 @@ int main(void)
|
||||||
|
goto _exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ err = snd_pcm_sw_params_set_tstamp_type(handle_c, swparams_c, TSTAMP_TYPE);
|
||||||
|
+ if (err < 0) {
|
||||||
|
+ printf("Unable to set tstamp type : %s\n", snd_strerror(err));
|
||||||
|
+ goto _exit;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* write the sw parameters */
|
||||||
|
err = snd_pcm_sw_params(handle_c, swparams_c);
|
||||||
|
if (err < 0) {
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
@ -0,0 +1,35 @@
|
|||||||
|
From de63b942acf520a25ff469cf338a99eb3da65570 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Mon, 21 Jul 2014 16:30:54 +0200
|
||||||
|
Subject: [PATCH 11/14] pcm: route: Use get/put labels for all 3 byte formats
|
||||||
|
|
||||||
|
So far, use_getput flag is set only when the src or dest format is
|
||||||
|
24bit physical width. But, also 18 and 20 bit physical width formats
|
||||||
|
should set the flag, too. This patch makes the check broader to cover
|
||||||
|
all 3 bytes formats.
|
||||||
|
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/pcm/pcm_route.c | 6 ++++--
|
||||||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c
|
||||||
|
index 2f0be38b1906..72c198cb25d2 100644
|
||||||
|
--- a/src/pcm/pcm_route.c
|
||||||
|
+++ b/src/pcm/pcm_route.c
|
||||||
|
@@ -644,8 +644,10 @@ static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||||
|
}
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
- route->params.use_getput = snd_pcm_format_physical_width(src_format) == 24 ||
|
||||||
|
- snd_pcm_format_physical_width(dst_format) == 24;
|
||||||
|
+ /* 3 bytes formats? */
|
||||||
|
+ route->params.use_getput =
|
||||||
|
+ (snd_pcm_format_physical_width(src_format) + 7) / 3 == 3 ||
|
||||||
|
+ (snd_pcm_format_physical_width(dst_format) + 7) / 3 == 3;
|
||||||
|
route->params.get_idx = snd_pcm_linear_get_index(src_format, SND_PCM_FORMAT_S16);
|
||||||
|
route->params.put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, dst_format);
|
||||||
|
route->params.conv_idx = snd_pcm_linear_convert_index(src_format, dst_format);
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
58
0012-pcm-Fill-sw_params-proto-field.patch
Normal file
58
0012-pcm-Fill-sw_params-proto-field.patch
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
From 55c53625212702debf55c719ec62f6c81c780927 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Wed, 16 Jul 2014 17:48:34 +0200
|
||||||
|
Subject: [PATCH 12/14] pcm: Fill sw_params proto field
|
||||||
|
|
||||||
|
Fill the new proto field introduced to sw_params with the current PCM
|
||||||
|
protocol version. This makes tstamp_type evaluated properly in the
|
||||||
|
kernel.
|
||||||
|
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
include/sound/asound.h | 4 ++--
|
||||||
|
src/pcm/pcm.c | 1 +
|
||||||
|
src/pcm/pcm_params.c | 1 +
|
||||||
|
3 files changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/include/sound/asound.h b/include/sound/asound.h
|
||||||
|
index 552f41bd1ca9..c819df421434 100644
|
||||||
|
--- a/include/sound/asound.h
|
||||||
|
+++ b/include/sound/asound.h
|
||||||
|
@@ -386,8 +386,8 @@ struct snd_pcm_sw_params {
|
||||||
|
snd_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
|
||||||
|
snd_pcm_uframes_t silence_size; /* silence block size */
|
||||||
|
snd_pcm_uframes_t boundary; /* pointers wrap point */
|
||||||
|
- unsigned int tstamp_type; /* timestamp type */
|
||||||
|
- int pads; /* alignment, reserved */
|
||||||
|
+ unsigned int proto; /* protocol version */
|
||||||
|
+ unsigned int tstamp_type; /* timestamp type (req. proto >= 2.0.12) */
|
||||||
|
unsigned char reserved[56]; /* reserved for future */
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
|
||||||
|
index 89844430bf35..1399a5b2e671 100644
|
||||||
|
--- a/src/pcm/pcm.c
|
||||||
|
+++ b/src/pcm/pcm.c
|
||||||
|
@@ -5610,6 +5610,7 @@ int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
|
||||||
|
SNDMSG("PCM not set up");
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
+ params->proto = SNDRV_PCM_VERSION;
|
||||||
|
params->tstamp_mode = pcm->tstamp_mode;
|
||||||
|
params->tstamp_type = pcm->tstamp_type;
|
||||||
|
params->period_step = pcm->period_step;
|
||||||
|
diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c
|
||||||
|
index 4adbefae0530..6e57904e445b 100644
|
||||||
|
--- a/src/pcm/pcm_params.c
|
||||||
|
+++ b/src/pcm/pcm_params.c
|
||||||
|
@@ -2257,6 +2257,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->proto = SNDRV_PCM_VERSION;
|
||||||
|
params->tstamp_mode = SND_PCM_TSTAMP_NONE;
|
||||||
|
params->tstamp_type = pcm->tstamp_type;
|
||||||
|
params->period_step = 1;
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
342
0013-pcm-route-Use-get32-for-multi-source-route-calculati.patch
Normal file
342
0013-pcm-route-Use-get32-for-multi-source-route-calculati.patch
Normal file
@ -0,0 +1,342 @@
|
|||||||
|
From fd84adc63e307572d05274be44c782a787087cda Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Tue, 22 Jul 2014 11:55:40 +0200
|
||||||
|
Subject: [PATCH 13/14] pcm: route: Use get32 for multi-source route
|
||||||
|
calculation
|
||||||
|
|
||||||
|
The PCM route plugin can assign the destination value from average of
|
||||||
|
multiple sources with attenuation. This requires the read of each
|
||||||
|
channel value, sums and writes the resultant value in the requested
|
||||||
|
format.
|
||||||
|
|
||||||
|
Currently, get_labels is used for reading source values while
|
||||||
|
put32_labels is used for writing the dest value. This is, however,
|
||||||
|
a buggy implementation; get_labels gives the value as is only with
|
||||||
|
endianness and signedness conversions, but put32_labels assumes that
|
||||||
|
the value is normalized to 32bit int and it shifts down to the dest
|
||||||
|
format. In addition, the current code lacks get_labels entries for
|
||||||
|
the 24bit formats, as Shengjiu Wang spotted out.
|
||||||
|
|
||||||
|
For fixing these bugs, this patch replaces the read with
|
||||||
|
get32_labels and use always 64bit int for sum. This simplifies the
|
||||||
|
code a lot and drops many lines.
|
||||||
|
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/pcm/pcm_route.c | 128 +++++++++------------------------------------------
|
||||||
|
src/pcm/plugin_ops.h | 81 --------------------------------
|
||||||
|
2 files changed, 23 insertions(+), 186 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c
|
||||||
|
index 72c198cb25d2..5dac7ebcb7df 100644
|
||||||
|
--- a/src/pcm/pcm_route.c
|
||||||
|
+++ b/src/pcm/pcm_route.c
|
||||||
|
@@ -60,7 +60,7 @@ typedef struct {
|
||||||
|
typedef struct snd_pcm_route_ttable_dst snd_pcm_route_ttable_dst_t;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
- enum {UINT32=0, UINT64=1, FLOAT=2} sum_idx;
|
||||||
|
+ enum {UINT64, FLOAT} sum_idx;
|
||||||
|
unsigned int get_idx;
|
||||||
|
unsigned int put_idx;
|
||||||
|
unsigned int conv_idx;
|
||||||
|
@@ -233,55 +233,34 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
||||||
|
const snd_pcm_route_ttable_dst_t* ttable,
|
||||||
|
const snd_pcm_route_params_t *params)
|
||||||
|
{
|
||||||
|
-#define GETS_LABELS
|
||||||
|
+#define GET32_LABELS
|
||||||
|
#define PUT32_LABELS
|
||||||
|
#include "plugin_ops.h"
|
||||||
|
-#undef GETS_LABELS
|
||||||
|
+#undef GET32_LABELS
|
||||||
|
#undef PUT32_LABELS
|
||||||
|
- static void *const zero_labels[3] = {
|
||||||
|
- &&zero_int32, &&zero_int64,
|
||||||
|
+ static void *const zero_labels[2] = {
|
||||||
|
+ &&zero_int64,
|
||||||
|
#if SND_PCM_PLUGIN_ROUTE_FLOAT
|
||||||
|
&&zero_float
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
/* sum_type att */
|
||||||
|
- static void *const add_labels[3 * 2] = {
|
||||||
|
- &&add_int32_noatt, &&add_int32_att,
|
||||||
|
+ static void *const add_labels[2 * 2] = {
|
||||||
|
&&add_int64_noatt, &&add_int64_att,
|
||||||
|
#if SND_PCM_PLUGIN_ROUTE_FLOAT
|
||||||
|
&&add_float_noatt, &&add_float_att
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
- /* sum_type att shift */
|
||||||
|
- static void *const norm_labels[3 * 2 * 4] = {
|
||||||
|
- 0,
|
||||||
|
- &&norm_int32_8_noatt,
|
||||||
|
- &&norm_int32_16_noatt,
|
||||||
|
- &&norm_int32_24_noatt,
|
||||||
|
- 0,
|
||||||
|
- &&norm_int32_8_att,
|
||||||
|
- &&norm_int32_16_att,
|
||||||
|
- &&norm_int32_24_att,
|
||||||
|
- &&norm_int64_0_noatt,
|
||||||
|
- &&norm_int64_8_noatt,
|
||||||
|
- &&norm_int64_16_noatt,
|
||||||
|
- &&norm_int64_24_noatt,
|
||||||
|
- &&norm_int64_0_att,
|
||||||
|
- &&norm_int64_8_att,
|
||||||
|
- &&norm_int64_16_att,
|
||||||
|
- &&norm_int64_24_att,
|
||||||
|
+ /* sum_type att */
|
||||||
|
+ static void *const norm_labels[2 * 2] = {
|
||||||
|
+ &&norm_int64_noatt,
|
||||||
|
+ &&norm_int64_att,
|
||||||
|
#if SND_PCM_PLUGIN_ROUTE_FLOAT
|
||||||
|
- &&norm_float_0,
|
||||||
|
- &&norm_float_8,
|
||||||
|
- &&norm_float_16,
|
||||||
|
- &&norm_float_24,
|
||||||
|
- &&norm_float_0,
|
||||||
|
- &&norm_float_8,
|
||||||
|
- &&norm_float_16,
|
||||||
|
- &&norm_float_24,
|
||||||
|
+ &&norm_float,
|
||||||
|
+ &&norm_float,
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
- void *zero, *get, *add, *norm, *put32;
|
||||||
|
+ void *zero, *get32, *add, *norm, *put32;
|
||||||
|
int nsrcs = ttable->nsrcs;
|
||||||
|
char *dst;
|
||||||
|
int dst_step;
|
||||||
|
@@ -323,9 +302,9 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
||||||
|
}
|
||||||
|
|
||||||
|
zero = zero_labels[params->sum_idx];
|
||||||
|
- get = gets_labels[params->get_idx];
|
||||||
|
+ get32 = get32_labels[params->get_idx];
|
||||||
|
add = add_labels[params->sum_idx * 2 + ttable->att];
|
||||||
|
- norm = norm_labels[params->sum_idx * 8 + ttable->att * 4 + 4 - params->src_size];
|
||||||
|
+ norm = norm_labels[params->sum_idx * 2 + ttable->att];
|
||||||
|
put32 = put32_labels[params->put_idx];
|
||||||
|
dst = snd_pcm_channel_area_addr(dst_area, dst_offset);
|
||||||
|
dst_step = snd_pcm_channel_area_step(dst_area);
|
||||||
|
@@ -336,9 +315,6 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
||||||
|
|
||||||
|
/* Zero sum */
|
||||||
|
goto *zero;
|
||||||
|
- zero_int32:
|
||||||
|
- sum.as_sint32 = 0;
|
||||||
|
- goto zero_end;
|
||||||
|
zero_int64:
|
||||||
|
sum.as_sint64 = 0;
|
||||||
|
goto zero_end;
|
||||||
|
@@ -352,21 +328,14 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
||||||
|
const char *src = srcs[srcidx];
|
||||||
|
|
||||||
|
/* Get sample */
|
||||||
|
- goto *get;
|
||||||
|
-#define GETS_END after_get
|
||||||
|
+ goto *get32;
|
||||||
|
+#define GET32_END after_get
|
||||||
|
#include "plugin_ops.h"
|
||||||
|
-#undef GETS_END
|
||||||
|
+#undef GET32_END
|
||||||
|
after_get:
|
||||||
|
|
||||||
|
/* Sum */
|
||||||
|
goto *add;
|
||||||
|
- add_int32_att:
|
||||||
|
- sum.as_sint32 += sample * ttp->as_int;
|
||||||
|
- goto after_sum;
|
||||||
|
- add_int32_noatt:
|
||||||
|
- if (ttp->as_int)
|
||||||
|
- sum.as_sint32 += sample;
|
||||||
|
- goto after_sum;
|
||||||
|
add_int64_att:
|
||||||
|
sum.as_sint64 += (int64_t) sample * ttp->as_int;
|
||||||
|
goto after_sum;
|
||||||
|
@@ -390,48 +359,10 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
||||||
|
|
||||||
|
/* Normalization */
|
||||||
|
goto *norm;
|
||||||
|
- norm_int32_8_att:
|
||||||
|
- sum.as_sint64 = sum.as_sint32;
|
||||||
|
- norm_int64_8_att:
|
||||||
|
- sum.as_sint64 <<= 8;
|
||||||
|
- norm_int64_0_att:
|
||||||
|
+ norm_int64_att:
|
||||||
|
div(sum.as_sint64);
|
||||||
|
- goto norm_int;
|
||||||
|
-
|
||||||
|
- norm_int32_16_att:
|
||||||
|
- sum.as_sint64 = sum.as_sint32;
|
||||||
|
- norm_int64_16_att:
|
||||||
|
- sum.as_sint64 <<= 16;
|
||||||
|
- div(sum.as_sint64);
|
||||||
|
- goto norm_int;
|
||||||
|
-
|
||||||
|
- norm_int32_24_att:
|
||||||
|
- sum.as_sint64 = sum.as_sint32;
|
||||||
|
- norm_int64_24_att:
|
||||||
|
- sum.as_sint64 <<= 24;
|
||||||
|
- div(sum.as_sint64);
|
||||||
|
- goto norm_int;
|
||||||
|
-
|
||||||
|
- norm_int32_8_noatt:
|
||||||
|
- sum.as_sint64 = sum.as_sint32;
|
||||||
|
- norm_int64_8_noatt:
|
||||||
|
- sum.as_sint64 <<= 8;
|
||||||
|
- goto norm_int;
|
||||||
|
-
|
||||||
|
- norm_int32_16_noatt:
|
||||||
|
- sum.as_sint64 = sum.as_sint32;
|
||||||
|
- norm_int64_16_noatt:
|
||||||
|
- sum.as_sint64 <<= 16;
|
||||||
|
- goto norm_int;
|
||||||
|
-
|
||||||
|
- norm_int32_24_noatt:
|
||||||
|
- sum.as_sint64 = sum.as_sint32;
|
||||||
|
- norm_int64_24_noatt:
|
||||||
|
- sum.as_sint64 <<= 24;
|
||||||
|
- goto norm_int;
|
||||||
|
-
|
||||||
|
- norm_int64_0_noatt:
|
||||||
|
- norm_int:
|
||||||
|
+ /* fallthru */
|
||||||
|
+ norm_int64_noatt:
|
||||||
|
if (sum.as_sint64 > (int64_t)0x7fffffff)
|
||||||
|
sample = 0x7fffffff; /* maximum positive value */
|
||||||
|
else if (sum.as_sint64 < -(int64_t)0x80000000)
|
||||||
|
@@ -441,16 +372,6 @@ static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
||||||
|
goto after_norm;
|
||||||
|
|
||||||
|
#if SND_PCM_PLUGIN_ROUTE_FLOAT
|
||||||
|
- norm_float_8:
|
||||||
|
- sum.as_float *= 1 << 8;
|
||||||
|
- goto norm_float;
|
||||||
|
- norm_float_16:
|
||||||
|
- sum.as_float *= 1 << 16;
|
||||||
|
- goto norm_float;
|
||||||
|
- norm_float_24:
|
||||||
|
- sum.as_float *= 1 << 24;
|
||||||
|
- goto norm_float;
|
||||||
|
- norm_float_0:
|
||||||
|
norm_float:
|
||||||
|
sum.as_float = rint(sum.as_float);
|
||||||
|
if (sum.as_float > (int64_t)0x7fffffff)
|
||||||
|
@@ -648,7 +569,7 @@ static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||||
|
route->params.use_getput =
|
||||||
|
(snd_pcm_format_physical_width(src_format) + 7) / 3 == 3 ||
|
||||||
|
(snd_pcm_format_physical_width(dst_format) + 7) / 3 == 3;
|
||||||
|
- route->params.get_idx = snd_pcm_linear_get_index(src_format, SND_PCM_FORMAT_S16);
|
||||||
|
+ route->params.get_idx = snd_pcm_linear_get32_index(src_format, SND_PCM_FORMAT_S32);
|
||||||
|
route->params.put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, dst_format);
|
||||||
|
route->params.conv_idx = snd_pcm_linear_convert_index(src_format, dst_format);
|
||||||
|
route->params.src_size = snd_pcm_format_width(src_format) / 8;
|
||||||
|
@@ -656,10 +577,7 @@ static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||||
|
#if SND_PCM_PLUGIN_ROUTE_FLOAT
|
||||||
|
route->params.sum_idx = FLOAT;
|
||||||
|
#else
|
||||||
|
- if (snd_pcm_format_width(src_format) == 32)
|
||||||
|
- route->params.sum_idx = UINT64;
|
||||||
|
- else
|
||||||
|
- route->params.sum_idx = UINT32;
|
||||||
|
+ route->params.sum_idx = UINT64;
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
diff --git a/src/pcm/plugin_ops.h b/src/pcm/plugin_ops.h
|
||||||
|
index 21535c9ca8d6..eb8c2c4f4dac 100644
|
||||||
|
--- a/src/pcm/plugin_ops.h
|
||||||
|
+++ b/src/pcm/plugin_ops.h
|
||||||
|
@@ -668,87 +668,6 @@ getu_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GETU_END;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
-#ifdef GETS_LABELS
|
||||||
|
-/* width endswap sign_toggle */
|
||||||
|
-static void *const gets_labels[4 * 2 * 2] = {
|
||||||
|
- &&gets_1_1, /* 8h -> 8h */
|
||||||
|
- &&gets_1_9, /* 8h ^> 8h */
|
||||||
|
- &&gets_1_1, /* 8s -> 8h */
|
||||||
|
- &&gets_1_9, /* 8s ^> 8h */
|
||||||
|
- &&gets_12_12, /* 16h -> 16h */
|
||||||
|
- &&gets_12_92, /* 16h ^> 16h */
|
||||||
|
- &&gets_12_21, /* 16s -> 16h */
|
||||||
|
- &&gets_12_A1, /* 16s ^> 16h */
|
||||||
|
- &&gets_0123_0123, /* 24h -> 24h */
|
||||||
|
- &&gets_0123_0923, /* 24h ^> 24h */
|
||||||
|
- &&gets_1230_0321, /* 24s -> 24h */
|
||||||
|
- &&gets_1230_0B21, /* 24s ^> 24h */
|
||||||
|
- &&gets_1234_1234, /* 32h -> 32h */
|
||||||
|
- &&gets_1234_9234, /* 32h ^> 32h */
|
||||||
|
- &&gets_1234_4321, /* 32s -> 32h */
|
||||||
|
- &&gets_1234_C321, /* 32s ^> 32h */
|
||||||
|
-};
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
-#ifdef GETS_END
|
||||||
|
-while (0) {
|
||||||
|
-gets_1_1: sample = as_s8c(src); goto GETS_END;
|
||||||
|
-gets_1_9: sample = (int8_t)(as_s8c(src) ^ 0x80); goto GETS_END;
|
||||||
|
-gets_12_12: sample = as_s16c(src); goto GETS_END;
|
||||||
|
-gets_12_92: sample = (int16_t)(as_s16c(src) ^ 0x8000); goto GETS_END;
|
||||||
|
-gets_12_21: sample = (int16_t)bswap_16(as_s16c(src)); goto GETS_END;
|
||||||
|
-gets_12_A1: sample = (int16_t)bswap_16(as_s16c(src) ^ 0x80); goto GETS_END;
|
||||||
|
-gets_0123_0123: sample = sx24((int32_t)(as_s32c(src) << 8) >> 8); goto GETS_END;
|
||||||
|
-gets_0123_0923: sample = sx24((int32_t)((as_s32c(src) ^ 0x800000) << 8) >> 8); goto GETS_END;
|
||||||
|
-gets_1230_0321: sample = sx24((int32_t)(bswap_32(as_s32c(src)) << 8) >> 8); goto GETS_END;
|
||||||
|
-gets_1230_0B21: sample = sx24((int32_t)(bswap_32(as_s32c(src) ^ 0x8000) << 8) >> 8); goto GETS_END;
|
||||||
|
-gets_1234_1234: sample = as_s32c(src); goto GETS_END;
|
||||||
|
-gets_1234_9234: sample = (int32_t)(as_s32c(src) ^ 0x80000000); goto GETS_END;
|
||||||
|
-gets_1234_4321: sample = (int32_t)bswap_32(as_s32c(src)); goto GETS_END;
|
||||||
|
-gets_1234_C321: sample = (int32_t)bswap_32(as_s32c(src) ^ 0x80); goto GETS_END;
|
||||||
|
-}
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
-#ifdef PUT_LABELS
|
||||||
|
-/* width endswap sign_toggle */
|
||||||
|
-static void *const put_labels[4 * 2 * 2] = {
|
||||||
|
- &&put_1_1, /* 8h -> 8h */
|
||||||
|
- &&put_1_9, /* 8h ^> 8h */
|
||||||
|
- &&put_1_1, /* 8h -> 8s */
|
||||||
|
- &&put_1_9, /* 8h ^> 8s */
|
||||||
|
- &&put_12_12, /* 16h -> 16h */
|
||||||
|
- &&put_12_92, /* 16h ^> 16h */
|
||||||
|
- &&put_12_21, /* 16h -> 16s */
|
||||||
|
- &&put_12_29, /* 16h ^> 16s */
|
||||||
|
- &&put_0123_0123, /* 24h -> 24h */
|
||||||
|
- &&put_0123_0923, /* 24h ^> 24h */
|
||||||
|
- &&put_0123_3210, /* 24h -> 24s */
|
||||||
|
- &&put_0123_3290, /* 24h ^> 24s */
|
||||||
|
- &&put_1234_1234, /* 32h -> 32h */
|
||||||
|
- &&put_1234_9234, /* 32h ^> 32h */
|
||||||
|
- &&put_1234_4321, /* 32h -> 32s */
|
||||||
|
- &&put_1234_4329, /* 32h ^> 32s */
|
||||||
|
-};
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
-#ifdef PUT_END
|
||||||
|
-put_1_1: as_s8(dst) = sample; goto PUT_END;
|
||||||
|
-put_1_9: as_u8(dst) = sample ^ 0x80; goto PUT_END;
|
||||||
|
-put_12_12: as_s16(dst) = sample; goto PUT_END;
|
||||||
|
-put_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT_END;
|
||||||
|
-put_12_21: as_s16(dst) = bswap_16(sample); goto PUT_END;
|
||||||
|
-put_12_29: as_u16(dst) = bswap_16(sample) ^ 0x80; goto PUT_END;
|
||||||
|
-/* this always writes the unused byte in 24-bit formats as 0x00 */
|
||||||
|
-put_0123_0123: as_s32(dst) = sx24(sample & 0x00ffffff); goto PUT_END;
|
||||||
|
-put_0123_0923: as_u32(dst) = sx24((sample & 0x00ffffff) ^ 0x800000); goto PUT_END;
|
||||||
|
-put_0123_3210: as_s32(dst) = sx24s(bswap_32(sample) & 0xffffff00); goto PUT_END;
|
||||||
|
-put_0123_3290: as_u32(dst) = sx24s((bswap_32(sample) & 0xffffff00) ^ 0x8000); goto PUT_END;
|
||||||
|
-put_1234_1234: as_s32(dst) = sample; goto PUT_END;
|
||||||
|
-put_1234_9234: as_u32(dst) = sample ^ 0x80000000; goto PUT_END;
|
||||||
|
-put_1234_4321: as_s32(dst) = bswap_32(sample); goto PUT_END;
|
||||||
|
-put_1234_4329: as_u32(dst) = bswap_32(sample) ^ 0x80; goto PUT_END;
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
#ifdef PUT32F_LABELS
|
||||||
|
/* type (0 = float, 1 = float64), endswap */
|
||||||
|
static void *const put32float_labels[2 * 2] = {
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
143
0014-pcm-Drop-snd_pcm_linear_-get-put-32_index.patch
Normal file
143
0014-pcm-Drop-snd_pcm_linear_-get-put-32_index.patch
Normal file
@ -0,0 +1,143 @@
|
|||||||
|
From 7a5646f58ba2e8154a274a5ae0f8ec963f331f97 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Tue, 22 Jul 2014 12:20:50 +0200
|
||||||
|
Subject: [PATCH 14/14] pcm: Drop snd_pcm_linear_{get|put}32_index()
|
||||||
|
|
||||||
|
These are identical with snd_pcm_linear_{get|put}_index().
|
||||||
|
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
src/pcm/pcm_lfloat.c | 4 ++--
|
||||||
|
src/pcm/pcm_linear.c | 44 ++++----------------------------------------
|
||||||
|
src/pcm/pcm_plugin.h | 4 ----
|
||||||
|
src/pcm/pcm_route.c | 4 ++--
|
||||||
|
4 files changed, 8 insertions(+), 48 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/pcm/pcm_lfloat.c b/src/pcm/pcm_lfloat.c
|
||||||
|
index 324282f0b7fc..2f3e578fc503 100644
|
||||||
|
--- a/src/pcm/pcm_lfloat.c
|
||||||
|
+++ b/src/pcm/pcm_lfloat.c
|
||||||
|
@@ -286,11 +286,11 @@ static int snd_pcm_lfloat_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||||
|
err = INTERNAL(snd_pcm_hw_params_get_format)(params, &dst_format);
|
||||||
|
}
|
||||||
|
if (snd_pcm_format_linear(src_format)) {
|
||||||
|
- lfloat->int32_idx = snd_pcm_linear_get32_index(src_format, SND_PCM_FORMAT_S32);
|
||||||
|
+ lfloat->int32_idx = snd_pcm_linear_get_index(src_format, SND_PCM_FORMAT_S32);
|
||||||
|
lfloat->float32_idx = snd_pcm_lfloat_put_s32_index(dst_format);
|
||||||
|
lfloat->func = snd_pcm_lfloat_convert_integer_float;
|
||||||
|
} else {
|
||||||
|
- lfloat->int32_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, dst_format);
|
||||||
|
+ lfloat->int32_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, dst_format);
|
||||||
|
lfloat->float32_idx = snd_pcm_lfloat_get_s32_index(src_format);
|
||||||
|
lfloat->func = snd_pcm_lfloat_convert_float_integer;
|
||||||
|
}
|
||||||
|
diff --git a/src/pcm/pcm_linear.c b/src/pcm/pcm_linear.c
|
||||||
|
index 3d5bbb8a3688..9a92abd04fb8 100644
|
||||||
|
--- a/src/pcm/pcm_linear.c
|
||||||
|
+++ b/src/pcm/pcm_linear.c
|
||||||
|
@@ -107,11 +107,6 @@ int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-int snd_pcm_linear_get32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
|
||||||
|
-{
|
||||||
|
- return snd_pcm_linear_get_index(src_format, dst_format);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
|
||||||
|
{
|
||||||
|
int sign, width, pwidth, endian;
|
||||||
|
@@ -143,37 +138,6 @@ int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-int snd_pcm_linear_put32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format)
|
||||||
|
-{
|
||||||
|
- int sign, width, pwidth, endian;
|
||||||
|
- sign = (snd_pcm_format_signed(src_format) !=
|
||||||
|
- snd_pcm_format_signed(dst_format));
|
||||||
|
-#ifdef SND_LITTLE_ENDIAN
|
||||||
|
- endian = snd_pcm_format_big_endian(dst_format);
|
||||||
|
-#else
|
||||||
|
- endian = snd_pcm_format_little_endian(dst_format);
|
||||||
|
-#endif
|
||||||
|
- if (endian < 0)
|
||||||
|
- endian = 0;
|
||||||
|
- pwidth = snd_pcm_format_physical_width(dst_format);
|
||||||
|
- width = snd_pcm_format_width(dst_format);
|
||||||
|
- if (pwidth == 24) {
|
||||||
|
- switch (width) {
|
||||||
|
- case 24:
|
||||||
|
- width = 0; break;
|
||||||
|
- case 20:
|
||||||
|
- width = 1; break;
|
||||||
|
- case 18:
|
||||||
|
- default:
|
||||||
|
- width = 2; break;
|
||||||
|
- }
|
||||||
|
- return width * 4 + endian * 2 + sign + 16;
|
||||||
|
- } else {
|
||||||
|
- width = width / 8 - 1;
|
||||||
|
- return width * 4 + endian * 2 + sign;
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
|
||||||
|
const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
|
||||||
|
unsigned int channels, snd_pcm_uframes_t frames,
|
||||||
|
@@ -342,11 +306,11 @@ static int snd_pcm_linear_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
||||||
|
snd_pcm_format_physical_width(linear->sformat) == 24);
|
||||||
|
if (linear->use_getput) {
|
||||||
|
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
|
||||||
|
- linear->get_idx = snd_pcm_linear_get32_index(format, SND_PCM_FORMAT_S32);
|
||||||
|
- linear->put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, linear->sformat);
|
||||||
|
+ linear->get_idx = snd_pcm_linear_get_index(format, SND_PCM_FORMAT_S32);
|
||||||
|
+ linear->put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, linear->sformat);
|
||||||
|
} else {
|
||||||
|
- linear->get_idx = snd_pcm_linear_get32_index(linear->sformat, SND_PCM_FORMAT_S32);
|
||||||
|
- linear->put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, format);
|
||||||
|
+ linear->get_idx = snd_pcm_linear_get_index(linear->sformat, SND_PCM_FORMAT_S32);
|
||||||
|
+ linear->put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, format);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (pcm->stream == SND_PCM_STREAM_PLAYBACK)
|
||||||
|
diff --git a/src/pcm/pcm_plugin.h b/src/pcm/pcm_plugin.h
|
||||||
|
index 19e82c3e7321..b0a3e1869ea1 100644
|
||||||
|
--- a/src/pcm/pcm_plugin.h
|
||||||
|
+++ b/src/pcm/pcm_plugin.h
|
||||||
|
@@ -86,8 +86,6 @@ snd_pcm_sframes_t snd_pcm_plugin_undo_write_generic
|
||||||
|
/* make local functions really local */
|
||||||
|
#define snd_pcm_linear_get_index snd1_pcm_linear_get_index
|
||||||
|
#define snd_pcm_linear_put_index snd1_pcm_linear_put_index
|
||||||
|
-#define snd_pcm_linear_get32_index snd1_pcm_linear_get32_index
|
||||||
|
-#define snd_pcm_linear_put32_index snd1_pcm_linear_put32_index
|
||||||
|
#define snd_pcm_linear_convert_index snd1_pcm_linear_convert_index
|
||||||
|
#define snd_pcm_linear_convert snd1_pcm_linear_convert
|
||||||
|
#define snd_pcm_linear_getput snd1_pcm_linear_getput
|
||||||
|
@@ -100,8 +98,6 @@ snd_pcm_sframes_t snd_pcm_plugin_undo_write_generic
|
||||||
|
|
||||||
|
int snd_pcm_linear_get_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
||||||
|
int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
||||||
|
-int snd_pcm_linear_get32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
||||||
|
-int snd_pcm_linear_put32_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
||||||
|
int snd_pcm_linear_convert_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_format);
|
||||||
|
|
||||||
|
void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
|
||||||
|
diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c
|
||||||
|
index 5dac7ebcb7df..e7de9b51f1fc 100644
|
||||||
|
--- a/src/pcm/pcm_route.c
|
||||||
|
+++ b/src/pcm/pcm_route.c
|
||||||
|
@@ -569,8 +569,8 @@ static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
|
||||||
|
route->params.use_getput =
|
||||||
|
(snd_pcm_format_physical_width(src_format) + 7) / 3 == 3 ||
|
||||||
|
(snd_pcm_format_physical_width(dst_format) + 7) / 3 == 3;
|
||||||
|
- route->params.get_idx = snd_pcm_linear_get32_index(src_format, SND_PCM_FORMAT_S32);
|
||||||
|
- route->params.put_idx = snd_pcm_linear_put32_index(SND_PCM_FORMAT_S32, dst_format);
|
||||||
|
+ route->params.get_idx = snd_pcm_linear_get_index(src_format, SND_PCM_FORMAT_S32);
|
||||||
|
+ route->params.put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, dst_format);
|
||||||
|
route->params.conv_idx = snd_pcm_linear_convert_index(src_format, dst_format);
|
||||||
|
route->params.src_size = snd_pcm_format_width(src_format) / 8;
|
||||||
|
route->params.dst_sfmt = dst_format;
|
||||||
|
--
|
||||||
|
2.0.1
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
#
|
|
||||||
# Configuration for the Intel HD audio (ICH6/ICH7)
|
|
||||||
#
|
|
||||||
|
|
||||||
<confdir:pcm/front.conf>
|
|
||||||
|
|
||||||
Loopback.pcm.front.0 {
|
|
||||||
@args [ CARD ]
|
|
||||||
@args.CARD {
|
|
||||||
type string
|
|
||||||
}
|
|
||||||
type softvol
|
|
||||||
slave.pcm {
|
|
||||||
type hw
|
|
||||||
card $CARD
|
|
||||||
}
|
|
||||||
control {
|
|
||||||
name "PCM Playback Volume"
|
|
||||||
card $CARD
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# default with dmix+softvol & dsnoop
|
|
||||||
Loopback.pcm.default {
|
|
||||||
@args [ CARD ]
|
|
||||||
@args.CARD {
|
|
||||||
type string
|
|
||||||
}
|
|
||||||
type asym
|
|
||||||
playback.pcm {
|
|
||||||
type plug
|
|
||||||
slave.pcm {
|
|
||||||
type softvol
|
|
||||||
slave.pcm {
|
|
||||||
@func concat
|
|
||||||
strings [ "dmix:" $CARD ]
|
|
||||||
}
|
|
||||||
control {
|
|
||||||
name "PCM Playback Volume"
|
|
||||||
card $CARD
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
capture.pcm {
|
|
||||||
type plug
|
|
||||||
slave.pcm {
|
|
||||||
type softvol
|
|
||||||
slave.pcm {
|
|
||||||
@func concat
|
|
||||||
strings [ "dsnoop:" $CARD ]
|
|
||||||
}
|
|
||||||
control {
|
|
||||||
name "Digital Capture Volume"
|
|
||||||
card $CARD
|
|
||||||
}
|
|
||||||
min_dB -30.0
|
|
||||||
max_dB 30.0
|
|
||||||
resolution 121
|
|
||||||
}
|
|
||||||
# to avoid possible phase inversions with digital mics
|
|
||||||
route_policy copy
|
|
||||||
}
|
|
||||||
hint.device 0
|
|
||||||
}
|
|
||||||
|
|
||||||
<confdir:pcm/surround40.conf>
|
|
||||||
<confdir:pcm/surround41.conf>
|
|
||||||
<confdir:pcm/surround50.conf>
|
|
||||||
<confdir:pcm/surround51.conf>
|
|
||||||
<confdir:pcm/surround71.conf>
|
|
||||||
|
|
||||||
Loopback.pcm.surround40.0 cards.Loopback.pcm.front.0
|
|
||||||
Loopback.pcm.surround51.0 cards.Loopback.pcm.front.0
|
|
||||||
Loopback.pcm.surround71.0 cards.Loopback.pcm.front.0
|
|
24
alsa.changes
24
alsa.changes
@ -1,3 +1,27 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jul 22 17:46:51 CEST 2014 - tiwai@suse.de
|
||||||
|
|
||||||
|
- 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
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jun 18 13:08:38 CEST 2014 - tiwai@suse.de
|
Wed Jun 18 13:08:38 CEST 2014 - tiwai@suse.de
|
||||||
|
|
||||||
|
30
alsa.spec
30
alsa.spec
@ -49,9 +49,22 @@ Source33: alsa-info.sh
|
|||||||
Source34: alsa-init.sh
|
Source34: alsa-init.sh
|
||||||
Source40: 50-alsa.conf
|
Source40: 50-alsa.conf
|
||||||
Source41: install-snd-module
|
Source41: install-snd-module
|
||||||
Source50: Loopback.conf
|
|
||||||
# Patch: alsa-lib-git-fixes.diff
|
# Patch: alsa-lib-git-fixes.diff
|
||||||
# upstream fixes
|
# upstream fixes
|
||||||
|
Patch1: 0001-ucm-Document-PlaybackPCMIsDummy-and-CapturePCMIsDumm.patch
|
||||||
|
Patch2: 0002-ICE1712-add-surround71-pcm-definition.patch
|
||||||
|
Patch3: 0003-USB-Audio-Add-second-S-PDIF-device-on-Phiree-U2.patch
|
||||||
|
Patch4: 0004-pcm-rate-fix-hw_ptr-exceed-the-boundary.patch
|
||||||
|
Patch5: 0005-pcm-Provide-a-CLOCK_MONOTONIC_RAW-timestamp-type.patch
|
||||||
|
Patch6: 0006-Add-timestamp-type-to-sw_params-internal-only.patch
|
||||||
|
Patch7: 0007-pcm-Add-sw_params-API-functions-to-get-set-timestamp.patch
|
||||||
|
Patch8: 0008-pcm-Implement-timestamp-type-setup-in-hw-plugin.patch
|
||||||
|
Patch9: 0009-pcm-Implement-timestamp-type-handling-in-all-plugins.patch
|
||||||
|
Patch10: 0010-test-audio_time-Set-timestamp-type-explicitly.patch
|
||||||
|
Patch11: 0011-pcm-route-Use-get-put-labels-for-all-3-byte-formats.patch
|
||||||
|
Patch12: 0012-pcm-Fill-sw_params-proto-field.patch
|
||||||
|
Patch13: 0013-pcm-route-Use-get32-for-multi-source-route-calculati.patch
|
||||||
|
Patch14: 0014-pcm-Drop-snd_pcm_linear_-get-put-32_index.patch
|
||||||
# rest suse patches
|
# rest suse patches
|
||||||
Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff
|
Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff
|
||||||
BuildRequires: doxygen
|
BuildRequires: doxygen
|
||||||
@ -119,8 +132,21 @@ Architecture.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n alsa-lib-%{package_version}
|
%setup -q -n alsa-lib-%{package_version}
|
||||||
cp %{SOURCE50} src/conf/cards
|
|
||||||
# %patch -p1
|
# %patch -p1
|
||||||
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
%patch3 -p1
|
||||||
|
%patch4 -p1
|
||||||
|
%patch5 -p1
|
||||||
|
%patch6 -p1
|
||||||
|
%patch7 -p1
|
||||||
|
%patch8 -p1
|
||||||
|
%patch9 -p1
|
||||||
|
%patch10 -p1
|
||||||
|
%patch11 -p1
|
||||||
|
%patch12 -p1
|
||||||
|
%patch13 -p1
|
||||||
|
%patch14 -p1
|
||||||
%if 0%{?suse_version} == 1130
|
%if 0%{?suse_version} == 1130
|
||||||
%patch99 -p1
|
%patch99 -p1
|
||||||
%endif
|
%endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user