alsa-lib: add four upstream patches to better support pulseaudio
This commit is contained in:
parent
41410291c6
commit
37d71576d0
39
alsa-lib-1.0.17-clamprrfw.patch
Normal file
39
alsa-lib-1.0.17-clamprrfw.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 0fbfe2d8d6aac06e6615b7109ffc1fea8c62dee6 Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <mznyfn@0pointer.de>
|
||||
Date: Fri, 18 Jul 2008 21:21:23 +0200
|
||||
Subject: [PATCH] clamp snd_pcm_rewind()/snd_pcm_forward() into the right direction
|
||||
|
||||
The clamping of the input parameter in snd_pcm_rewind()/_forward() is
|
||||
in the wrong direction.
|
||||
|
||||
Signed-off-by: Lennart Poettering <lennart@poettering.net>
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
src/pcm/pcm_plugin.c | 4 ++--
|
||||
1 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
|
||||
index c73a02b..c199d8d 100644
|
||||
--- a/src/pcm/pcm_plugin.c
|
||||
+++ b/src/pcm/pcm_plugin.c
|
||||
@@ -203,7 +203,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t
|
||||
snd_pcm_sframes_t n = snd_pcm_mmap_hw_avail(pcm);
|
||||
snd_pcm_sframes_t sframes;
|
||||
|
||||
- if ((snd_pcm_uframes_t)n > frames)
|
||||
+ if ((snd_pcm_uframes_t)n < frames)
|
||||
frames = n;
|
||||
if (frames == 0)
|
||||
return 0;
|
||||
@@ -236,7 +236,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_
|
||||
snd_pcm_sframes_t n = snd_pcm_mmap_avail(pcm);
|
||||
snd_pcm_uframes_t sframes;
|
||||
|
||||
- if ((snd_pcm_uframes_t)n > frames)
|
||||
+ if ((snd_pcm_uframes_t)n < frames)
|
||||
frames = n;
|
||||
if (frames == 0)
|
||||
return 0;
|
||||
--
|
||||
1.5.5.1
|
||||
|
41
alsa-lib-1.0.17-fixreturnrrfw.patch
Normal file
41
alsa-lib-1.0.17-fixreturnrrfw.patch
Normal file
@ -0,0 +1,41 @@
|
||||
From 8d3fb3102f672a7b09be92811e89d49f89c1742b Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <mznyfn@0pointer.de>
|
||||
Date: Fri, 18 Jul 2008 21:24:38 +0200
|
||||
Subject: [PATCH] fix return value of snd_pcm_rewind()/snd_pcm_forward() to return how much actually has been rewound, instead of what actually could have rewound
|
||||
|
||||
Make snd_pcm_plugin_rewind()/_forward() actually return how much has
|
||||
been rewound/forwarded instead of how much could have been
|
||||
rewounded/forwarded. This makes the code actually do what the
|
||||
documentation of snd_pcm_rewind() suggests.
|
||||
|
||||
Signed-off-by: Lennart Poettering <lennart@poettering.net>
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
src/pcm/pcm_plugin.c | 4 ++--
|
||||
1 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
|
||||
index b377cb2..c4f5b4a 100644
|
||||
--- a/src/pcm/pcm_plugin.c
|
||||
+++ b/src/pcm/pcm_plugin.c
|
||||
@@ -222,7 +222,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t
|
||||
frames = plugin->client_frames(pcm, sframes);
|
||||
snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) frames);
|
||||
snd_atomic_write_end(&plugin->watom);
|
||||
- return n;
|
||||
+ return (snd_pcm_sframes_t) frames;
|
||||
}
|
||||
|
||||
static snd_pcm_sframes_t snd_pcm_plugin_forwardable(snd_pcm_t *pcm)
|
||||
@@ -255,7 +255,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_
|
||||
frames = plugin->client_frames(pcm, sframes);
|
||||
snd_pcm_mmap_appl_forward(pcm, (snd_pcm_uframes_t) frames);
|
||||
snd_atomic_write_end(&plugin->watom);
|
||||
- return n;
|
||||
+ return (snd_pcm_sframes_t) frames;
|
||||
}
|
||||
|
||||
static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
|
||||
--
|
||||
1.5.5.1
|
||||
|
42
alsa-lib-1.0.17-fixtype.patch
Normal file
42
alsa-lib-1.0.17-fixtype.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From 15769ead725b7c215dedd4ea5196955086d2044a Mon Sep 17 00:00:00 2001
|
||||
From: Lennart Poettering <mznyfn@0pointer.de>
|
||||
Date: Fri, 18 Jul 2008 21:22:50 +0200
|
||||
Subject: [PATCH] fix type of internally used sframes variable, to avoid unnecessary casts
|
||||
|
||||
This minor patch fixes the type of the sframes variable in
|
||||
snd_pcm_plugin_forward(). With this fix we need to cast less and the
|
||||
code is less confusing.
|
||||
|
||||
Signed-off-by: Lennart Poettering <lennart@poettering.net>
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
src/pcm/pcm_plugin.c | 6 +++---
|
||||
1 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
|
||||
index c199d8d..b377cb2 100644
|
||||
--- a/src/pcm/pcm_plugin.c
|
||||
+++ b/src/pcm/pcm_plugin.c
|
||||
@@ -234,7 +234,7 @@ static snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private_data;
|
||||
snd_pcm_sframes_t n = snd_pcm_mmap_avail(pcm);
|
||||
- snd_pcm_uframes_t sframes;
|
||||
+ snd_pcm_sframes_t sframes;
|
||||
|
||||
if ((snd_pcm_uframes_t)n < frames)
|
||||
frames = n;
|
||||
@@ -246,8 +246,8 @@ static snd_pcm_sframes_t snd_pcm_plugin_forward(snd_pcm_t *pcm, snd_pcm_uframes_
|
||||
else
|
||||
sframes = frames;
|
||||
snd_atomic_write_begin(&plugin->watom);
|
||||
- sframes = INTERNAL(snd_pcm_forward)(plugin->gen.slave, (snd_pcm_uframes_t) sframes);
|
||||
- if ((snd_pcm_sframes_t) sframes < 0) {
|
||||
+ sframes = INTERNAL(snd_pcm_forward)(plugin->gen.slave, sframes);
|
||||
+ if (sframes < 0) {
|
||||
snd_atomic_write_end(&plugin->watom);
|
||||
return sframes;
|
||||
}
|
||||
--
|
||||
1.5.5.1
|
||||
|
152
alsa-lib-1.0.17-softvolmute.patch
Normal file
152
alsa-lib-1.0.17-softvolmute.patch
Normal file
@ -0,0 +1,152 @@
|
||||
From f78af4ab0412052aabb74c9122a8d8f3ab6d45e6 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Wed, 16 Jul 2008 12:37:51 +0200
|
||||
Subject: [PATCH] Add boolean (mute) functionality to softvol plugin
|
||||
|
||||
When the resolution is set to 2, a boolean control is created as a
|
||||
mute switch instead of a volume control.
|
||||
Also, fixed the possible zero-division error.
|
||||
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
src/pcm/pcm_softvol.c | 59 +++++++++++++++++++++++++++++++++++-------------
|
||||
1 files changed, 43 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c
|
||||
index 7af7f40..eee6424 100644
|
||||
--- a/src/pcm/pcm_softvol.c
|
||||
+++ b/src/pcm/pcm_softvol.c
|
||||
@@ -275,9 +275,15 @@ static void softvol_convert_stereo_vol(snd_pcm_softvol_t *svol,
|
||||
return;
|
||||
}
|
||||
|
||||
- vol[0] = svol->dB_value[svol->cur_vol[0]];
|
||||
- vol[1] = svol->dB_value[svol->cur_vol[1]];
|
||||
- vol_c = svol->dB_value[(svol->cur_vol[0] + svol->cur_vol[1]) / 2];
|
||||
+ if (svol->max_val == 1) {
|
||||
+ vol[0] = svol->cur_vol[0] ? 0xffff : 0;
|
||||
+ vol[1] = svol->cur_vol[1] ? 0xffff : 0;
|
||||
+ vol_c = vol[0] | vol[1];
|
||||
+ } else {
|
||||
+ vol[0] = svol->dB_value[svol->cur_vol[0]];
|
||||
+ vol[1] = svol->dB_value[svol->cur_vol[1]];
|
||||
+ vol_c = svol->dB_value[(svol->cur_vol[0] + svol->cur_vol[1]) / 2];
|
||||
+ }
|
||||
switch (svol->sformat) {
|
||||
case SND_PCM_FORMAT_S16_LE:
|
||||
case SND_PCM_FORMAT_S16_BE:
|
||||
@@ -325,7 +331,10 @@ static void softvol_convert_mono_vol(snd_pcm_softvol_t *svol,
|
||||
return;
|
||||
}
|
||||
|
||||
- vol_scale = svol->dB_value[svol->cur_vol[0]];
|
||||
+ if (svol->max_val == 1)
|
||||
+ vol_scale = svol->cur_vol[0] ? 0xffff : 0;
|
||||
+ else
|
||||
+ vol_scale = svol->dB_value[svol->cur_vol[0]];
|
||||
switch (svol->sformat) {
|
||||
case SND_PCM_FORMAT_S16_LE:
|
||||
case SND_PCM_FORMAT_S16_BE:
|
||||
@@ -569,9 +578,13 @@ static void snd_pcm_softvol_dump(snd_pcm_t *pcm, snd_output_t *out)
|
||||
snd_pcm_softvol_t *svol = pcm->private_data;
|
||||
snd_output_printf(out, "Soft volume PCM\n");
|
||||
snd_output_printf(out, "Control: %s\n", svol->elem.id.name);
|
||||
- snd_output_printf(out, "min_dB: %g\n", svol->min_dB);
|
||||
- snd_output_printf(out, "max_dB: %g\n", svol->max_dB);
|
||||
- snd_output_printf(out, "resolution: %d\n", svol->max_val + 1);
|
||||
+ if (svol->max_val == 1)
|
||||
+ snd_output_printf(out, "boolean\n");
|
||||
+ else {
|
||||
+ snd_output_printf(out, "min_dB: %g\n", svol->min_dB);
|
||||
+ snd_output_printf(out, "max_dB: %g\n", svol->max_dB);
|
||||
+ snd_output_printf(out, "resolution: %d\n", svol->max_val + 1);
|
||||
+ }
|
||||
if (pcm->setup) {
|
||||
snd_output_printf(out, "Its setup is:\n");
|
||||
snd_pcm_dump_setup(pcm, out);
|
||||
@@ -596,13 +609,21 @@ static int add_user_ctl(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo, int
|
||||
int i;
|
||||
unsigned int def_val;
|
||||
|
||||
- err = snd_ctl_elem_add_integer(svol->ctl, &cinfo->id, count, 0, svol->max_val, 0);
|
||||
+ if (svol->max_val == 1)
|
||||
+ err = snd_ctl_elem_add_boolean(svol->ctl, &cinfo->id, count);
|
||||
+ else
|
||||
+ err = snd_ctl_elem_add_integer(svol->ctl, &cinfo->id, count,
|
||||
+ 0, svol->max_val, 0);
|
||||
if (err < 0)
|
||||
return err;
|
||||
- add_tlv_info(svol, cinfo);
|
||||
- /* set zero dB value as default, or max_val if
|
||||
- there is no 0 dB setting */
|
||||
- def_val = svol->zero_dB_val ? svol->zero_dB_val : svol->max_val;
|
||||
+ if (svol->max_val == 1)
|
||||
+ def_val = 1;
|
||||
+ else {
|
||||
+ add_tlv_info(svol, cinfo);
|
||||
+ /* set zero dB value as default, or max_val if
|
||||
+ there is no 0 dB setting */
|
||||
+ def_val = svol->zero_dB_val ? svol->zero_dB_val : svol->max_val;
|
||||
+ }
|
||||
for (i = 0; i < count; i++)
|
||||
svol->elem.value.integer.value[i] = def_val;
|
||||
return snd_ctl_elem_write(svol->ctl, &svol->elem);
|
||||
@@ -647,7 +668,7 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
||||
svol->max_val = resolution - 1;
|
||||
svol->min_dB = min_dB;
|
||||
svol->max_dB = max_dB;
|
||||
- if (svol->max_dB == ZERO_DB)
|
||||
+ if (svol->max_val == 1 || svol->max_dB == ZERO_DB)
|
||||
svol->zero_dB_val = svol->max_val;
|
||||
else if (svol->max_dB < 0)
|
||||
svol->zero_dB_val = 0; /* there is no 0 dB setting */
|
||||
@@ -671,7 +692,8 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
||||
/* hardware control exists */
|
||||
return 1; /* notify */
|
||||
|
||||
- } else if (cinfo->type != SND_CTL_ELEM_TYPE_INTEGER ||
|
||||
+ } else if ((cinfo->type != SND_CTL_ELEM_TYPE_INTEGER &&
|
||||
+ cinfo->type != SND_CTL_ELEM_TYPE_BOOLEAN) ||
|
||||
cinfo->count != (unsigned int)cchannels ||
|
||||
cinfo->value.integer.min != 0 ||
|
||||
cinfo->value.integer.max != resolution - 1) {
|
||||
@@ -684,7 +706,7 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
||||
SNDERR("Cannot add a control");
|
||||
return err;
|
||||
}
|
||||
- } else {
|
||||
+ } else if (svol->max_val > 1) {
|
||||
/* check TLV availability */
|
||||
unsigned int tlv[4];
|
||||
err = snd_ctl_elem_tlv_read(svol->ctl, &cinfo->id, tlv, sizeof(tlv));
|
||||
@@ -693,6 +715,10 @@ static int softvol_load_control(snd_pcm_t *pcm, snd_pcm_softvol_t *svol,
|
||||
}
|
||||
}
|
||||
|
||||
+ if (svol->max_val == 1)
|
||||
+ return 0;
|
||||
+
|
||||
+ /* set up dB table */
|
||||
if (min_dB == PRESET_MIN_DB && max_dB == ZERO_DB && resolution == PRESET_RESOLUTION)
|
||||
svol->dB_value = preset_dB_value;
|
||||
else {
|
||||
@@ -863,6 +889,7 @@ pcm.name {
|
||||
[min_dB REAL] # minimal dB value (default: -51.0)
|
||||
[max_dB REAL] # maximal dB value (default: 0.0)
|
||||
[resolution INT] # resolution (default: 256)
|
||||
+ # resolution = 2 means a mute switch
|
||||
}
|
||||
\endcode
|
||||
|
||||
@@ -965,7 +992,7 @@ int _snd_pcm_softvol_open(snd_pcm_t **pcmp, const char *name,
|
||||
MAX_DB_UPPER_LIMIT);
|
||||
return -EINVAL;
|
||||
}
|
||||
- if (resolution < 0 || resolution > 1024) {
|
||||
+ if (resolution <= 1 || resolution > 1024) {
|
||||
SNDERR("Invalid resolution value %d", resolution);
|
||||
return -EINVAL;
|
||||
}
|
||||
--
|
||||
1.5.5.1
|
||||
|
@ -4,7 +4,7 @@
|
||||
Summary: The Advanced Linux Sound Architecture (ALSA) library
|
||||
Name: alsa-lib
|
||||
Version: 1.0.17
|
||||
Release: 1%{?prever_dot}%{?dist}
|
||||
Release: 2%{?prever_dot}%{?dist}
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
Source: ftp://ftp.alsa-project.org/pub/lib/%{name}-%{version}%{?prever}%{?postver}.tar.bz2
|
||||
@ -12,6 +12,10 @@ Patch0: alsa-lib-1.0.17-config.patch
|
||||
Patch2: alsa-lib-1.0.14-glibc-open.patch
|
||||
Patch3: alsa-lib-pulse-default.patch
|
||||
Patch4: alsa-lib-1.0.16-no-dox-date.patch
|
||||
Patch5: alsa-lib-1.0.17-softvolmute.patch
|
||||
Patch6: alsa-lib-1.0.17-clamprrfw.patch
|
||||
Patch7: alsa-lib-1.0.17-fixtype.patch
|
||||
Patch8: alsa-lib-1.0.17-fixreturnrrfw.patch
|
||||
URL: http://www.alsa-project.org/
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
|
||||
BuildRequires: doxygen
|
||||
@ -44,6 +48,10 @@ against the ALSA libraries and interfaces.
|
||||
%patch2 -p1 -b .glibc-open
|
||||
%patch3 -p1 -b .pulse-default
|
||||
%patch4 -p1 -b .no-dox-date
|
||||
%patch5 -p1 -b .softvolmute
|
||||
%patch6 -p1 -b .clamprrfw
|
||||
%patch7 -p1 -b .fixtype
|
||||
%patch8 -p1 -b .fixreturnrrfw
|
||||
|
||||
%build
|
||||
%configure --with-configdir=%{_sysconfdir}/alsa
|
||||
@ -91,6 +99,9 @@ ln -snf ../../etc/alsa %{_datadir}/alsa
|
||||
%{_datadir}/aclocal/alsa.m4
|
||||
|
||||
%changelog
|
||||
* Mon Jul 21 2008 Jaroslav Kysela <jkysela@redhat.com> - 1.0.17-2
|
||||
- added four patches from upstream (to better support pulseaudio)
|
||||
|
||||
* Mon Jul 21 2008 Jaroslav Kysela <jkysela@redhat.com> - 1.0.17-1
|
||||
- updated to 1.0.17 final
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user