From 8bad45cd50502dfe55af9afd821540737f24e7b0aef722a04683fa152115f8b9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 30 Nov 2012 13:56:26 +0000 Subject: [PATCH] Accepting request 143675 from home:tiwai:branches:multimedia:libs - Build with libsamplerate for aloop (bnc#792173) - Add a patch to handle alsaloop properly without libsamplerate (bnc#792173): 0010-alsaloop-Make-alsaloop-working-without-libsamplerate.patch 0011-alsaloop-Fix-missing-endif.patch - Backport fixes from upstream 0006-alsamixer-fix-handling-of-removed-controls.patch 0007-aplay-Show-usage-if-no-parameter-is-passed.patch 0008-amixer-fix-rounding-of-relative-changes.patch 0009-amixer-Fix-parsing-container-TLV-entries.patch OBS-URL: https://build.opensuse.org/request/show/143675 OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa-utils?expand=0&rev=66 --- ...xer-fix-handling-of-removed-controls.patch | 106 ++++++++++++++++++ ...Show-usage-if-no-parameter-is-passed.patch | 52 +++++++++ ...xer-fix-rounding-of-relative-changes.patch | 35 ++++++ ...er-Fix-parsing-container-TLV-entries.patch | 29 +++++ ...saloop-working-without-libsamplerate.patch | 60 ++++++++++ 0011-alsaloop-Fix-missing-endif.patch | 28 +++++ alsa-utils.changes | 18 +++ alsa-utils.spec | 12 ++ 8 files changed, 340 insertions(+) create mode 100644 0006-alsamixer-fix-handling-of-removed-controls.patch create mode 100644 0007-aplay-Show-usage-if-no-parameter-is-passed.patch create mode 100644 0008-amixer-fix-rounding-of-relative-changes.patch create mode 100644 0009-amixer-Fix-parsing-container-TLV-entries.patch create mode 100644 0010-alsaloop-Make-alsaloop-working-without-libsamplerate.patch create mode 100644 0011-alsaloop-Fix-missing-endif.patch diff --git a/0006-alsamixer-fix-handling-of-removed-controls.patch b/0006-alsamixer-fix-handling-of-removed-controls.patch new file mode 100644 index 0000000..37f839b --- /dev/null +++ b/0006-alsamixer-fix-handling-of-removed-controls.patch @@ -0,0 +1,106 @@ +From f2826072732951b1d4e1bacd8115f9e6a98932d5 Mon Sep 17 00:00:00 2001 +From: Clemens Ladisch +Date: Fri, 19 Oct 2012 12:16:33 +0200 +Subject: [PATCH 6/9] alsamixer: fix handling of removed controls + +When we get a notification that an element has been removed, we have to +recreate our internal control representation to avoid accessing freed +memory. (And the checking for SND_CTL_EVENT_MASK_REMOVE should actually +be done correctly while we're at it.) + +Signed-off-by: Clemens Ladisch +--- + alsamixer/mainloop.c | 9 ++++++++- + alsamixer/mixer_display.c | 1 - + alsamixer/mixer_widget.c | 20 ++++++++------------ + alsamixer/mixer_widget.h | 1 + + 4 files changed, 17 insertions(+), 14 deletions(-) + +diff --git a/alsamixer/mainloop.c b/alsamixer/mainloop.c +index dbfef9b..351f57f 100644 +--- a/alsamixer/mainloop.c ++++ b/alsamixer/mainloop.c +@@ -128,8 +128,15 @@ void mainloop(void) + } + if (!active_widget) + break; +- if (controls_changed) ++ if (controls_changed) { ++ controls_changed = FALSE; ++ create_controls(); ++ control_values_changed = FALSE; + display_controls(); ++ } else if (control_values_changed) { ++ control_values_changed = FALSE; ++ display_controls(); ++ } + } + free(pollfds); + } +diff --git a/alsamixer/mixer_display.c b/alsamixer/mixer_display.c +index 8ba396a..b1f79d0 100644 +--- a/alsamixer/mixer_display.c ++++ b/alsamixer/mixer_display.c +@@ -657,7 +657,6 @@ void display_controls(void) + display_no_controls(); + } + display_scroll_indicators(); +- controls_changed = FALSE; + } + + void compute_controls_layout(void) +diff --git a/alsamixer/mixer_widget.c b/alsamixer/mixer_widget.c +index caaf777..0c2b9e0 100644 +--- a/alsamixer/mixer_widget.c ++++ b/alsamixer/mixer_widget.c +@@ -50,6 +50,7 @@ int focus_control_index; + snd_mixer_selem_id_t *current_selem_id; + unsigned int current_control_flags; + ++bool control_values_changed; + bool controls_changed; + + enum channel_mask { +@@ -59,20 +60,15 @@ enum channel_mask { + + static int elem_callback(snd_mixer_elem_t *elem, unsigned int mask) + { +- unsigned int i; +- +- if (mask & (SND_CTL_EVENT_MASK_REMOVE | +- SND_CTL_EVENT_MASK_INFO | +- SND_CTL_EVENT_MASK_VALUE)) ++ if (mask == SND_CTL_EVENT_MASK_REMOVE) { + controls_changed = TRUE; ++ } else { ++ if (mask & SND_CTL_EVENT_MASK_VALUE) ++ control_values_changed = TRUE; + +- if (mask & SND_CTL_EVENT_MASK_INFO) +- for (i = 0; i < controls_count; ++i) +- if (controls[i].elem == elem) { +- controls[i].flags &= ~IS_ACTIVE; +- if (snd_mixer_selem_is_active(controls[i].elem)) +- controls[i].flags |= IS_ACTIVE; +- } ++ if (mask & SND_CTL_EVENT_MASK_INFO) ++ controls_changed = TRUE; ++ } + + return 0; + } +diff --git a/alsamixer/mixer_widget.h b/alsamixer/mixer_widget.h +index da8628e..086611c 100644 +--- a/alsamixer/mixer_widget.h ++++ b/alsamixer/mixer_widget.h +@@ -24,6 +24,7 @@ extern int focus_control_index; + extern snd_mixer_selem_id_t *current_selem_id; + extern unsigned int current_control_flags; + ++extern bool control_values_changed; + extern bool controls_changed; + + void create_mixer_object(struct snd_mixer_selem_regopt *selem_regopt); +-- +1.8.0.1 + diff --git a/0007-aplay-Show-usage-if-no-parameter-is-passed.patch b/0007-aplay-Show-usage-if-no-parameter-is-passed.patch new file mode 100644 index 0000000..85f98bc --- /dev/null +++ b/0007-aplay-Show-usage-if-no-parameter-is-passed.patch @@ -0,0 +1,52 @@ +From c6614dbdab1cbe541e7d6cd29f3922510e0b6981 Mon Sep 17 00:00:00 2001 +From: Fabio Estevam +Date: Tue, 13 Nov 2012 10:05:39 -0200 +Subject: [PATCH 7/9] aplay: Show usage if no parameter is passed + +When aplay/arecord are called without any argument the application hangs forever. + +Instead of hanging, print the usage and exit. + +Signed-off-by: Fabio Estevam +Signed-off-by: Takashi Iwai +--- + aplay/aplay.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/aplay/aplay.c b/aplay/aplay.c +index 741979a..f35f603 100644 +--- a/aplay/aplay.c ++++ b/aplay/aplay.c +@@ -493,6 +493,7 @@ int main(int argc, char *argv[]) + int tmp, err, c; + int do_device_list = 0, do_pcm_list = 0; + snd_pcm_info_t *info; ++ FILE *direction; + + #ifdef ENABLE_NLS + setlocale(LC_ALL, ""); +@@ -511,14 +512,21 @@ int main(int argc, char *argv[]) + file_type = FORMAT_WAVE; + command = "arecord"; + start_delay = 1; ++ direction = stdout; + } else if (strstr(argv[0], "aplay")) { + stream = SND_PCM_STREAM_PLAYBACK; + command = "aplay"; ++ direction = stdin; + } else { + error(_("command should be named either arecord or aplay")); + return 1; + } + ++ if (isatty(fileno(direction)) && (argc == 1)) { ++ usage(command); ++ return 1; ++ } ++ + chunk_size = -1; + rhwparams.format = DEFAULT_FORMAT; + rhwparams.rate = DEFAULT_SPEED; +-- +1.8.0.1 + diff --git a/0008-amixer-fix-rounding-of-relative-changes.patch b/0008-amixer-fix-rounding-of-relative-changes.patch new file mode 100644 index 0000000..ad0df38 --- /dev/null +++ b/0008-amixer-fix-rounding-of-relative-changes.patch @@ -0,0 +1,35 @@ +From da1c24a24c699125aedc8d4f7c97d974b868dacf Mon Sep 17 00:00:00 2001 +From: Clemens Ladisch +Date: Tue, 13 Nov 2012 21:54:20 +0100 +Subject: [PATCH 8/9] amixer: fix rounding of relative changes + +When doing control changes by a relative amount, amixer used the wrong +rounding direction, which would make it possible to stay at the same raw +value if the step was not big enough to reach the next value. + +Reported-by: Honza Javorek +Signed-off-by: Clemens Ladisch +--- + amixer/amixer.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/amixer/amixer.c b/amixer/amixer.c +index a0a7387..48ed1b2 100644 +--- a/amixer/amixer.c ++++ b/amixer/amixer.c +@@ -425,10 +425,10 @@ static int set_volume_simple(snd_mixer_elem_t *elem, + invalid = 1; + if (*p == '+') { + val = orig + val; +- correct = -1; ++ correct = 1; + } else { + val = orig - val; +- correct = 1; ++ correct = -1; + } + } + p++; +-- +1.8.0.1 + diff --git a/0009-amixer-Fix-parsing-container-TLV-entries.patch b/0009-amixer-Fix-parsing-container-TLV-entries.patch new file mode 100644 index 0000000..a8b55c6 --- /dev/null +++ b/0009-amixer-Fix-parsing-container-TLV-entries.patch @@ -0,0 +1,29 @@ +From d6da86117bddeb5007058bfd599c4839858c7ca9 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Mon, 26 Nov 2012 16:13:57 +0100 +Subject: [PATCH 9/9] amixer: Fix parsing container TLV entries + +Fix the wrong calculation of the size of a container TLV entry, which +resulted in "TLV size error" messages. + +Signed-off-by: Takashi Iwai +--- + amixer/amixer.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/amixer/amixer.c b/amixer/amixer.c +index 48ed1b2..5d5afce 100644 +--- a/amixer/amixer.c ++++ b/amixer/amixer.c +@@ -531,7 +531,7 @@ static void decode_tlv(unsigned int spaces, unsigned int *tlv, unsigned int tlv_ + printf("TLV size error in compound!\n"); + return; + } +- decode_tlv(spaces + 2, tlv + idx, tlv[idx+1]); ++ decode_tlv(spaces + 2, tlv + idx, tlv[idx+1] + 8); + idx += 2 + (tlv[1] + sizeof(unsigned int) - 1) / sizeof(unsigned int); + } + break; +-- +1.8.0.1 + diff --git a/0010-alsaloop-Make-alsaloop-working-without-libsamplerate.patch b/0010-alsaloop-Make-alsaloop-working-without-libsamplerate.patch new file mode 100644 index 0000000..9614534 --- /dev/null +++ b/0010-alsaloop-Make-alsaloop-working-without-libsamplerate.patch @@ -0,0 +1,60 @@ +From b7ea343820a4616b5f6e3b200f776ab742893039 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 30 Nov 2012 14:35:31 +0100 +Subject: [PATCH] alsaloop: Make alsaloop working without libsamplerate + +When alsaloop is built with libsamplerate, it quits immediately with + No libsamplerate suppor +message. It's because the check of -A option and it's set as default +non-zero value. + +Signed-off-by: Takashi Iwai +--- + alsaloop/alsaloop.c | 9 ++++----- + 1 file changed, 4 insertions(+), 5 deletions(-) + +diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c +index 8710dd1..6e94564 100644 +--- a/alsaloop/alsaloop.c ++++ b/alsaloop/alsaloop.c +@@ -387,7 +387,9 @@ static int parse_config(int argc, char *argv[], snd_output_t *output, + int arg_nblock = 0; + int arg_effect = 0; + int arg_resample = 0; ++#ifdef USE_SAMPLERATE + int arg_samplerate = SRC_SINC_FASTEST + 1; ++#else + int arg_sync = SYNC_TYPE_AUTO; + int arg_slave = SLAVE_TYPE_AUTO; + int arg_thread = 0; +@@ -474,6 +476,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output, + case 'n': + arg_resample = 1; + break; ++#ifdef USE_SAMPLERATE + case 'A': + if (strcasecmp(optarg, "sincbest") == 0) + arg_samplerate = SRC_SINC_BEST_QUALITY; +@@ -491,6 +494,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output, + arg_sync = SRC_SINC_FASTEST; + arg_samplerate += 1; + break; ++#endif + case 'S': + if (strcasecmp(optarg, "samplerate") == 0) + arg_sync = SYNC_TYPE_SAMPLERATE; +@@ -610,11 +614,6 @@ static int parse_config(int argc, char *argv[], snd_output_t *output, + loop->src_enable = arg_samplerate > 0; + if (loop->src_enable) + loop->src_converter_type = arg_samplerate - 1; +-#else +- if (arg_samplerate > 0) { +- logit(LOG_CRIT, "No libsamplerate support.\n"); +- exit(EXIT_FAILURE); +- } + #endif + set_loop_time(loop, arg_loop_time); + add_loop(loop); +-- +1.8.0.1 + diff --git a/0011-alsaloop-Fix-missing-endif.patch b/0011-alsaloop-Fix-missing-endif.patch new file mode 100644 index 0000000..c965274 --- /dev/null +++ b/0011-alsaloop-Fix-missing-endif.patch @@ -0,0 +1,28 @@ +From c7b9d3e39431eddd3a205a3f583a07884a90bb1b Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 30 Nov 2012 14:53:12 +0100 +Subject: [PATCH] alsaloop: Fix missing #endif + +Sorry, forgotten. + +Signed-off-by: Takashi Iwai +--- + alsaloop/alsaloop.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/alsaloop/alsaloop.c b/alsaloop/alsaloop.c +index 6e94564..e1a36d2 100644 +--- a/alsaloop/alsaloop.c ++++ b/alsaloop/alsaloop.c +@@ -389,7 +389,7 @@ static int parse_config(int argc, char *argv[], snd_output_t *output, + int arg_resample = 0; + #ifdef USE_SAMPLERATE + int arg_samplerate = SRC_SINC_FASTEST + 1; +-#else ++#endif + int arg_sync = SYNC_TYPE_AUTO; + int arg_slave = SLAVE_TYPE_AUTO; + int arg_thread = 0; +-- +1.8.0.1 + diff --git a/alsa-utils.changes b/alsa-utils.changes index a7aa261..cc6c35e 100644 --- a/alsa-utils.changes +++ b/alsa-utils.changes @@ -1,3 +1,21 @@ +------------------------------------------------------------------- +Fri Nov 30 14:38:07 CET 2012 - tiwai@suse.de + +- Build with libsamplerate for aloop (bnc#792173) +- Add a patch to handle alsaloop properly without libsamplerate + (bnc#792173): + 0010-alsaloop-Make-alsaloop-working-without-libsamplerate.patch + 0011-alsaloop-Fix-missing-endif.patch + +------------------------------------------------------------------- +Thu Nov 29 18:41:34 CET 2012 - tiwai@suse.de + +- Backport fixes from upstream + 0006-alsamixer-fix-handling-of-removed-controls.patch + 0007-aplay-Show-usage-if-no-parameter-is-passed.patch + 0008-amixer-fix-rounding-of-relative-changes.patch + 0009-amixer-Fix-parsing-container-TLV-entries.patch + ------------------------------------------------------------------- Mon Nov 12 16:37:20 CET 2012 - tiwai@suse.de diff --git a/alsa-utils.spec b/alsa-utils.spec index 63cf1ce..495bc49 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -61,6 +61,12 @@ Patch2: 0002-aplay-Add-support-for-channel-mapping.patch Patch3: 0003-aplay-More-support-for-channel-map-option.patch Patch4: 0004-speaker-test-Update-man-page-for-chmap-option.patch Patch5: 0005-aplay-fix-typo-silence-warning.patch +Patch6: 0006-alsamixer-fix-handling-of-removed-controls.patch +Patch7: 0007-aplay-Show-usage-if-no-parameter-is-passed.patch +Patch8: 0008-amixer-fix-rounding-of-relative-changes.patch +Patch9: 0009-amixer-Fix-parsing-container-TLV-entries.patch +Patch10: 0010-alsaloop-Make-alsaloop-working-without-libsamplerate.patch +Patch11: 0011-alsaloop-Fix-missing-endif.patch # Patch99: alsa-utils-gettext-version-removal.diff Url: http://www.alsa-project.org/ @@ -81,6 +87,12 @@ sed -i -e's/EXTRA_DIST= config.rpath /EXTRA_DIST=/' Makefile.am %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 %if %suse_version < 1020 %patch99 -p1 %endif