From a6fff088c4d7abeecc306660471b5852ff8b347a893567511f6915bfa38a19cf Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Thu, 23 Oct 2008 20:25:13 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa-utils?expand=0&rev=24 --- alsa-utils-1.0.18rc3-package-fix.diff | 13 ++ alsa-utils-git-fixes.diff | 291 +++++++++++++++++++++++++- alsa-utils.changes | 7 + alsa-utils.spec | 8 +- 4 files changed, 316 insertions(+), 3 deletions(-) create mode 100644 alsa-utils-1.0.18rc3-package-fix.diff diff --git a/alsa-utils-1.0.18rc3-package-fix.diff b/alsa-utils-1.0.18rc3-package-fix.diff new file mode 100644 index 0000000..34fd00c --- /dev/null +++ b/alsa-utils-1.0.18rc3-package-fix.diff @@ -0,0 +1,13 @@ +diff --git a/Makefile.am b/Makefile.am +index a9730dc..b2646e4 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -5,7 +5,7 @@ else + ALSAMIXER_DIR= + endif + SUBDIRS= include alsactl alsaconf $(ALSAMIXER_DIR) amidi amixer aplay iecset seq speaker-test utils m4 po +-EXTRA_DIST= config.rpath TODO gitcompile ++EXTRA_DIST= TODO gitcompile + AUTOMAKE_OPTIONS=foreign + ACLOCAL_AMFLAGS = -I m4 + diff --git a/alsa-utils-git-fixes.diff b/alsa-utils-git-fixes.diff index c0ec390..12c24ca 100644 --- a/alsa-utils-git-fixes.diff +++ b/alsa-utils-git-fixes.diff @@ -1,8 +1,88 @@ +diff --git a/Makefile.am b/Makefile.am +index b2646e4..554617d 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -4,7 +4,13 @@ ALSAMIXER_DIR=alsamixer + else + ALSAMIXER_DIR= + endif +-SUBDIRS= include alsactl alsaconf $(ALSAMIXER_DIR) amidi amixer aplay iecset seq speaker-test utils m4 po ++if ALSACONF ++ALSACONF_DIR=alsaconf ++else ++ALSACONF_DIR= ++endif ++SUBDIRS= include alsactl $(ALSACONF_DIR) $(ALSAMIXER_DIR) amidi amixer \ ++ aplay iecset seq speaker-test utils m4 po + EXTRA_DIST= TODO gitcompile + AUTOMAKE_OPTIONS=foreign + ACLOCAL_AMFLAGS = -I m4 +diff --git a/alsactl/alsactl.1 b/alsactl/alsactl.1 +index d7f30f6..b038a82 100644 +--- a/alsactl/alsactl.1 ++++ b/alsactl/alsactl.1 +@@ -51,6 +51,11 @@ Used with restore command. Try to restore the matching control elements + as much as possible. This option is set as default now. + + .TP ++\fI\-g, \-\-ignore\fP ++Used with store and restore commands. Do not show 'No soundcards found' ++and do not set an error exit code when soundcards are not installed. ++ ++.TP + \fI\-P, \-\-pedantic\fP + Used with restore command. Don't restore mismatching control elements. + This option was the old default behavior. diff --git a/alsactl/alsactl.c b/alsactl/alsactl.c -index 6728fbc..57957bf 100644 +index 6728fbc..f846316 100644 --- a/alsactl/alsactl.c +++ b/alsactl/alsactl.c -@@ -150,7 +150,7 @@ int main(int argc, char *argv[]) +@@ -34,6 +34,7 @@ + + int debugflag = 0; + int force_restore = 1; ++int ignore_nocards = 0; + char *command; + char *statefile = NULL; + +@@ -48,7 +49,8 @@ static void help(void) + printf(" -f,--file # configuration file (default " SYS_ASOUNDRC ")\n"); + printf(" -F,--force try to restore the matching controls as much as possible\n"); + printf(" (default mode)\n"); +- printf(" -P,--pedantic don't restore mismatching controls (old default)\n"); ++ printf(" -g,--ignore ignore 'No soundcards found' error\n"); ++ printf(" -P,--pedantic do not restore mismatching controls (old default)\n"); + printf(" -r,--runstate # save restore and init state to this file (only errors)\n"); + printf(" default settings is 'no file set'\n"); + printf(" -R,--remove remove runstate file at first, otherwise append errors\n"); +@@ -75,6 +77,7 @@ int main(int argc, char *argv[]) + {"env", 1, NULL, 'E'}, + {"initfile", 1, NULL, 'i'}, + {"force", 0, NULL, 'F'}, ++ {"ignore", 0, NULL, 'g'}, + {"pedantic", 0, NULL, 'P'}, + {"runstate", 0, NULL, 'r'}, + {"remove", 0, NULL, 'R'}, +@@ -99,7 +102,7 @@ int main(int argc, char *argv[]) + while (1) { + int c; + +- if ((c = getopt_long(argc, argv, "hdvf:FE:i:Pr:R", long_option, NULL)) < 0) ++ if ((c = getopt_long(argc, argv, "hdvf:FgE:i:Pr:R", long_option, NULL)) < 0) + break; + switch (c) { + case 'h': +@@ -111,6 +114,9 @@ int main(int argc, char *argv[]) + case 'F': + force_restore = 1; + break; ++ case 'g': ++ ignore_nocards = 1; ++ break; + case 'E': + if (putenv(optarg)) { + fprintf(stderr, "environment string '%s' is wrong\n", optarg); +@@ -150,7 +156,7 @@ int main(int argc, char *argv[]) } cardname = argc - optind > 1 ? argv[optind + 1] : NULL; @@ -11,3 +91,210 @@ index 6728fbc..57957bf 100644 int len = strlen(*tmp); if (!strncmp(cardname, *tmp, len)) { long l = strtol(cardname + len, NULL, 0); +diff --git a/alsactl/alsactl.h b/alsactl/alsactl.h +index 408b145..44d27f1 100644 +--- a/alsactl/alsactl.h ++++ b/alsactl/alsactl.h +@@ -1,5 +1,6 @@ + extern int debugflag; + extern int force_restore; ++extern int ignore_nocards; + extern char *command; + extern char *statefile; + +diff --git a/alsactl/state.c b/alsactl/state.c +index 554020b..576721a 100644 +--- a/alsactl/state.c ++++ b/alsactl/state.c +@@ -1507,8 +1507,12 @@ int save_state(const char *file, const char *cardname) + break; + if (card < 0) { + if (first) { +- error("No soundcards found..."); +- return -ENODEV; ++ if (ignore_nocards) { ++ return 0; ++ } else { ++ error("No soundcards found..."); ++ return -ENODEV; ++ } + } + break; + } +@@ -1606,8 +1610,12 @@ int load_state(const char *file, const char *initfile, const char *cardname) + break; + if (card < 0) { + if (first) { +- error("No soundcards found..."); +- return -ENODEV; ++ if (ignore_nocards) { ++ return 0; ++ } else { ++ error("No soundcards found..."); ++ return -ENODEV; ++ } + } + break; + } +diff --git a/aplay/aplay.c b/aplay/aplay.c +index 246faac..c1924e0 100644 +--- a/aplay/aplay.c ++++ b/aplay/aplay.c +@@ -106,6 +106,7 @@ static int vumeter = VUMETER_NONE; + static int buffer_pos = 0; + static size_t bits_per_sample, bits_per_frame; + static size_t chunk_bytes; ++static int test_position = 0; + static snd_output_t *log; + + static int fd = -1; +@@ -186,7 +187,8 @@ _("Usage: %s [OPTION]... [FILE]...\n" + " --disable-resample disable automatic rate resample\n" + " --disable-channels disable automatic channel conversions\n" + " --disable-format disable automatic format conversions\n" +-" --disable-softvol disable software volume control (softvol)\n") ++" --disable-softvol disable software volume control (softvol)\n" ++" --test-position test ring buffer position\n") + , command); + printf(_("Recognized sample formats are:")); + for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { +@@ -347,7 +349,8 @@ enum { + OPT_DISABLE_RESAMPLE, + OPT_DISABLE_CHANNELS, + OPT_DISABLE_FORMAT, +- OPT_DISABLE_SOFTVOL ++ OPT_DISABLE_SOFTVOL, ++ OPT_TEST_POSITION + }; + + int main(int argc, char *argv[]) +@@ -385,6 +388,7 @@ int main(int argc, char *argv[]) + {"disable-channels", 0, 0, OPT_DISABLE_CHANNELS}, + {"disable-format", 0, 0, OPT_DISABLE_FORMAT}, + {"disable-softvol", 0, 0, OPT_DISABLE_SOFTVOL}, ++ {"test-position", 0, 0, OPT_TEST_POSITION}, + {0, 0, 0, 0} + }; + char *pcm_name = "default"; +@@ -563,6 +567,9 @@ int main(int argc, char *argv[]) + case OPT_DISABLE_SOFTVOL: + open_mode |= SND_PCM_NO_SOFTVOL; + break; ++ case OPT_TEST_POSITION: ++ test_position = 1; ++ break; + default: + fprintf(stderr, _("Try `%s --help' for more information.\n"), command); + return 1; +@@ -1089,6 +1096,8 @@ static void set_params(void) + /* not required, but for sure */ + snd_pcm_mmap_commit(handle, offset, 0); + } ++ ++ buffer_frames = buffer_size; /* for position test */ + } + + #ifndef timersub +@@ -1385,6 +1394,25 @@ static void compute_max_peak(u_char *data, size_t count) + } + } + ++static void do_test_position(void) ++{ ++ static int counter = 0; ++ snd_pcm_sframes_t avail, delay; ++ int err; ++ ++ err = snd_pcm_avail_delay(handle, &avail, &delay); ++ if (err < 0) ++ return; ++ if (avail > 4 * (snd_pcm_sframes_t)buffer_frames || ++ avail < -4 * (snd_pcm_sframes_t)buffer_frames || ++ delay > 4 * (snd_pcm_sframes_t)buffer_frames || ++ delay < -4 * (snd_pcm_sframes_t)buffer_frames) { ++ fprintf(stderr, "Suspicious buffer position (%i total): avail = %li, delay = %li, buffer = %li\n", ++counter, (long)avail, (long)delay, (long)buffer_frames); ++ } else if (verbose) { ++ fprintf(stderr, "Buffer position: %li/%li (%li)\n", (long)avail, (long)delay, (long)buffer_frames); ++ } ++} ++ + /* + * write function + */ +@@ -1399,7 +1427,11 @@ static ssize_t pcm_write(u_char *data, size_t count) + count = chunk_size; + } + while (count > 0) { ++ if (test_position) ++ do_test_position(); + r = writei_func(handle, data, count); ++ if (test_position) ++ do_test_position(); + if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) { + snd_pcm_wait(handle, 1000); + } else if (r == -EPIPE) { +@@ -1440,7 +1472,11 @@ static ssize_t pcm_writev(u_char **data, unsigned int channels, size_t count) + size_t offset = result; + for (channel = 0; channel < channels; channel++) + bufs[channel] = data[channel] + offset * bits_per_sample / 8; ++ if (test_position) ++ do_test_position(); + r = writen_func(handle, bufs, count); ++ if (test_position) ++ do_test_position(); + if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) { + snd_pcm_wait(handle, 1000); + } else if (r == -EPIPE) { +@@ -1478,7 +1514,11 @@ static ssize_t pcm_read(u_char *data, size_t rcount) + } + + while (count > 0) { ++ if (test_position) ++ do_test_position(); + r = readi_func(handle, data, count); ++ if (test_position) ++ do_test_position(); + if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) { + snd_pcm_wait(handle, 1000); + } else if (r == -EPIPE) { +@@ -1516,7 +1556,11 @@ static ssize_t pcm_readv(u_char **data, unsigned int channels, size_t rcount) + size_t offset = result; + for (channel = 0; channel < channels; channel++) + bufs[channel] = data[channel] + offset * bits_per_sample / 8; ++ if (test_position) ++ do_test_position(); + r = readn_func(handle, bufs, count); ++ if (test_position) ++ do_test_position(); + if (r == -EAGAIN || (r >= 0 && (size_t)r < count)) { + snd_pcm_wait(handle, 1000); + } else if (r == -EPIPE) { +diff --git a/configure.in b/configure.in +index 5b77fbb..1c95e10 100644 +--- a/configure.in ++++ b/configure.in +@@ -29,6 +29,7 @@ AC_PROG_INSTALL + AC_PROG_LN_S + AM_PATH_ALSA(1.0.16) + ++dnl Disable alsamixer + CURSESINC="" + CURSESLIB="" + CURSES_CFLAGS="" +@@ -41,6 +42,16 @@ AC_ARG_ENABLE(alsamixer, + esac],[alsamixer=true]) + AM_CONDITIONAL(ALSAMIXER, test x$alsamixer = xtrue) + ++dnl Disable alsaconf ++AC_ARG_ENABLE(alsaconf, ++ [ --disable-alsaconf Disable alsaconf packaging], ++ [case "${enableval}" in ++ yes) alsaconf=true ;; ++ no) alsaconf=false ;; ++ *) AC_MSG_ERROR(bad value ${enableval} for --enable-alsaconf) ;; ++ esac],[alsaconf=true]) ++AM_CONDITIONAL(ALSACONF, test x$alsaconf = xtrue) ++ + dnl Checks for header files. + AC_HEADER_STDC + if test x$alsamixer = xtrue; then diff --git a/alsa-utils.changes b/alsa-utils.changes index 98477b7..c06b731 100644 --- a/alsa-utils.changes +++ b/alsa-utils.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Oct 23 16:29:12 CEST 2008 - tiwai@suse.de + +- added --test-position in aplay/arecord for debugging +- can disable the build of alsaconf in configure +- alsactl -g option to ignore 'no soundcards' error + ------------------------------------------------------------------- Thu Sep 11 14:21:15 CEST 2008 - tiwai@suse.de diff --git a/alsa-utils.spec b/alsa-utils.spec index 1e2f3a9..24ed4d5 100644 --- a/alsa-utils.spec +++ b/alsa-utils.spec @@ -28,9 +28,10 @@ Requires: dialog pciutils AutoReqProv: on Summary: Advanced Linux Sound Architecture Utilities Version: 1.0.18 -Release: 1 +Release: 4 Source: ftp://ftp.alsa-project.org/pub/util/alsa-utils-%{package_version}.tar.bz2 Patch: alsa-utils-git-fixes.diff +Patch1: alsa-utils-%{package_version}-package-fix.diff Url: http://www.alsa-project.org/ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -47,6 +48,7 @@ Authors: %prep %setup -q -n %{name}-%{package_version} +%patch1 -p1 %patch -p1 mv alsamixer/README alsamixer/README-alsamixer @@ -76,6 +78,10 @@ make DESTDIR=$RPM_BUILD_ROOT install %{_datadir}/alsa %changelog +* Thu Oct 23 2008 tiwai@suse.de +- added --test-position in aplay/arecord for debugging +- can disable the build of alsaconf in configure +- alsactl -g option to ignore 'no soundcards' error * Thu Sep 11 2008 tiwai@suse.de - fix possible segfaults during parsing in alsactl * Wed Sep 10 2008 tiwai@suse.de