summaryrefslogtreecommitdiff
path: root/src/pactl
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-19 19:14:32 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-12-19 19:14:32 +0100
commitce6f922de24f004f9c108fc6d921ec141fb7818c (patch)
tree2e1e1b1012fb0a2f2f8cb212d8de4834b3207295 /src/pactl
parent102e19229600ac49dcfc6373ccc4ce3b135b62c8 (diff)
New upstream version 11.6.2.1
Diffstat (limited to 'src/pactl')
-rw-r--r--src/pactl/Makefile.am11
-rw-r--r--src/pactl/Makefile.in28
-rw-r--r--src/pactl/m4/Makefile25
-rw-r--r--src/pactl/m4/Makefile.in5
-rw-r--r--src/pactl/src/Makefile.am27
-rw-r--r--src/pactl/src/Makefile.in50
-rw-r--r--src/pactl/src/core-util.c41
-rw-r--r--src/pactl/src/pactl-set-cmd.c30
-rw-r--r--src/pactl/src/pactl-set-volume.c26
-rw-r--r--src/pactl/src/pactl.c356
10 files changed, 338 insertions, 261 deletions
diff --git a/src/pactl/Makefile.am b/src/pactl/Makefile.am
index a79c464..905d49c 100644
--- a/src/pactl/Makefile.am
+++ b/src/pactl/Makefile.am
@@ -6,9 +6,8 @@ SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = ABOUT-NLS aclocal.m4 am ar-lib autom4te.cache CHANGES \
- compile config.guess config.h config.h.in config.status \
- config.sub configure configure.ac COPYING COPYRIGHT \
- CREDITS depcomp INSTALL install-sh m4 Makefile.am \
- Makefile.in mdate-sh missing mkinstalldirs py-compile \
- README test-driver texinfo.tex TODO VERSION ylwrap
+EXTRA_DIST = aclocal.m4 ar-lib am autom4te.cache \
+ compile config.guess config.status \
+ config.sub configure configure.ac COPYING \
+ depcomp INSTALL install-sh m4 Makefile.am \
+ Makefile.in missing mkinstalldirs README
diff --git a/src/pactl/Makefile.in b/src/pactl/Makefile.in
index 909b723..7747984 100644
--- a/src/pactl/Makefile.in
+++ b/src/pactl/Makefile.in
@@ -160,8 +160,8 @@ ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/mkinstalldirs \
- NEWS README compile config.guess config.sub depcomp install-sh \
- missing
+ COPYING INSTALL NEWS README ar-lib compile config.guess \
+ config.sub depcomp install-sh missing mkinstalldirs
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
am__relativize = \
dir0=`pwd`; \
@@ -189,7 +189,6 @@ am__relativize = \
done; \
reldir="$$dir2"
ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AUTOCONF = @AUTOCONF@
@@ -197,9 +196,6 @@ AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
-CCAS = @CCAS@
-CCASDEPMODE = @CCASDEPMODE@
-CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
@@ -215,9 +211,6 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-GCJ = @GCJ@
-GCJDEPMODE = @GCJDEPMODE@
-GCJFLAGS = @GCJFLAGS@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
@@ -270,15 +263,12 @@ VERSION = @VERSION@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_GCJ = @ac_ct_GCJ@
ac_ct_OBJC = @ac_ct_OBJC@
ac_ct_OBJCXX = @ac_ct_OBJCXX@
am__include = @am__include@
@@ -295,7 +285,6 @@ build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
-depend_audio = @depend_audio@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
@@ -308,7 +297,6 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-ldadd_audio = @ldadd_audio@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
@@ -324,6 +312,7 @@ runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
+subdirs = @subdirs@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
@@ -332,12 +321,11 @@ top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src
ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = ABOUT-NLS aclocal.m4 am ar-lib autom4te.cache CHANGES \
- compile config.guess config.h config.h.in config.status \
- config.sub configure configure.ac COPYING COPYRIGHT \
- CREDITS depcomp INSTALL install-sh m4 Makefile.am \
- Makefile.in mdate-sh missing mkinstalldirs py-compile \
- README test-driver texinfo.tex TODO VERSION ylwrap
+EXTRA_DIST = aclocal.m4 ar-lib am autom4te.cache \
+ compile config.guess config.status \
+ config.sub configure configure.ac COPYING \
+ depcomp INSTALL install-sh m4 Makefile.am \
+ Makefile.in missing mkinstalldirs README
all: all-recursive
diff --git a/src/pactl/m4/Makefile b/src/pactl/m4/Makefile
index 5ae7ccc..30b316a 100644
--- a/src/pactl/m4/Makefile
+++ b/src/pactl/m4/Makefile
@@ -93,7 +93,7 @@ am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_$(V))
@@ -116,14 +116,15 @@ am__can_run_installinfo = \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/mkinstalldirs \
+ ChangeLog
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = ${SHELL} /home/jos/src/own_stuff/daisy-player/daisy-player-11.6.1.1/src/pactl/missing aclocal-1.15
+ACLOCAL = ${SHELL} /home/jos/src/own_stuff/eBook-speaker/src/pactl/missing aclocal-1.15
AMTAR = $${TAR-tar}
AM_DEFAULT_VERBOSITY = 0
-AUTOCONF = ${SHELL} /home/jos/src/own_stuff/daisy-player/daisy-player-11.6.1.1/src/pactl/missing autoconf
-AUTOHEADER = ${SHELL} /home/jos/src/own_stuff/daisy-player/daisy-player-11.6.1.1/src/pactl/missing autoheader
-AUTOMAKE = ${SHELL} /home/jos/src/own_stuff/daisy-player/daisy-player-11.6.1.1/src/pactl/missing automake-1.15
+AUTOCONF = ${SHELL} /home/jos/src/own_stuff/eBook-speaker/src/pactl/missing autoconf
+AUTOHEADER = ${SHELL} /home/jos/src/own_stuff/eBook-speaker/src/pactl/missing autoheader
+AUTOMAKE = ${SHELL} /home/jos/src/own_stuff/eBook-speaker/src/pactl/missing automake-1.15
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
@@ -148,7 +149,7 @@ LDFLAGS =
LIBOBJS =
LIBS = -lsndfile -lpulse -lg -lc
LTLIBOBJS =
-MAKEINFO = ${SHELL} /home/jos/src/own_stuff/daisy-player/daisy-player-11.6.1.1/src/pactl/missing makeinfo
+MAKEINFO = ${SHELL} /home/jos/src/own_stuff/eBook-speaker/src/pactl/missing makeinfo
MKDIR_P = /bin/mkdir -p
OBJEXT = o
PACKAGE = pactl-set-volume
@@ -164,10 +165,10 @@ SET_MAKE =
SHELL = /bin/bash
STRIP =
VERSION = 1.0
-abs_builddir = /home/jos/src/own_stuff/daisy-player/daisy-player-11.6.1.1/src/pactl/m4
-abs_srcdir = /home/jos/src/own_stuff/daisy-player/daisy-player-11.6.1.1/src/pactl/m4
-abs_top_builddir = /home/jos/src/own_stuff/daisy-player/daisy-player-11.6.1.1/src/pactl
-abs_top_srcdir = /home/jos/src/own_stuff/daisy-player/daisy-player-11.6.1.1/src/pactl
+abs_builddir = /home/jos/src/own_stuff/eBook-speaker/src/pactl/m4
+abs_srcdir = /home/jos/src/own_stuff/eBook-speaker/src/pactl/m4
+abs_top_builddir = /home/jos/src/own_stuff/eBook-speaker/src/pactl
+abs_top_srcdir = /home/jos/src/own_stuff/eBook-speaker/src/pactl
ac_ct_CC = gcc
am__include = include
am__leading_dot = .
@@ -194,7 +195,7 @@ host_vendor = pc
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
-install_sh = ${SHELL} /home/jos/src/own_stuff/daisy-player/daisy-player-11.6.1.1/src/pactl/install-sh
+install_sh = ${SHELL} /home/jos/src/own_stuff/eBook-speaker/src/pactl/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
diff --git a/src/pactl/m4/Makefile.in b/src/pactl/m4/Makefile.in
index d51b7a7..e64abf9 100644
--- a/src/pactl/m4/Makefile.in
+++ b/src/pactl/m4/Makefile.in
@@ -93,7 +93,7 @@ am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
AM_V_P = $(am__v_P_@AM_V@)
@@ -116,7 +116,8 @@ am__can_run_installinfo = \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-am__DIST_COMMON = $(srcdir)/Makefile.in ChangeLog
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/mkinstalldirs \
+ ChangeLog
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
diff --git a/src/pactl/src/Makefile.am b/src/pactl/src/Makefile.am
index b4e8b03..73f7c71 100644
--- a/src/pactl/src/Makefile.am
+++ b/src/pactl/src/Makefile.am
@@ -1,18 +1,13 @@
AUTOMAKE_OPTIONS = foreign
-AM_CFLAGS = -D PA_BINARY=\"./\" -D LOCALEDIR=\"$(prefix)/share/locale\" \
- -D PA_DEFAULT_CONFIG_DIR=pulseconfdir -D TCP_NODELAY=1 \
- -D PA_MACHINE_ID=\"\" -Wall -Wextra -D RLIMIT_NOFILE=\"\" \
- -D PA_MACHINE_ID_FALLBACK=\"\" -D PA_BUILDDIR=\"\" \
- -D PA_SINK_CLIENT_FLAGS_MASK=0xFFFFFF \
- -D PA_SINK_SHARE_VOLUME_WITH_MASTER=0x1000000U \
- -D PA_SOURCE_CLIENT_FLAGS_MASK=0xFFFFFF \
- -Wall -Wunused-function -Winit-self -fno-common -O3 \
- --param=ssp-buffer-size=4 -Wformat -Werror=format-security \
- -DPROGRAMNAME_LOCALEDIR=\"${PROGRAMNAME_LOCALEDIR}\" \
- -lm -pthread -g
-
-bin_PROGRAMS = pactl-set-volume
+AM_CFLAGS = -I . -D LOCALEDIR=\"$(prefix)/share/locale\" -Wall -Wextra \
+ -Wunused -Wunused-variable -Wunused-function \
+ -Wmissing-declarations \
+ -ggdb -I /usr/include/libxml2/ -O3 \
+ -Wuninitialized -Winit-self \
+ -DPROGRAMNAME_LOCALEDIR=\"${PROGRAMNAME_LOCALEDIR}\"
+
+bin_PROGRAMS = pactl-set-cmd
DEPENDENCIES = $(depend)
@@ -24,14 +19,14 @@ libtool:
$(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
-pactl_set_volume_SOURCES = strbuf.c core-util.c pactl.c pactl-set-volume.c
+pactl_set_cmd_SOURCES = strbuf.c core-util.c pactl.c pactl-set-cmd.c
-pactl_set_volume_DEPENDENCIES = $(DEPENDENCIES)
+pactl_set_cmd_DEPENDENCIES = $(DEPENDENCIES)
depend = @LIBOBJS@
profile:
- pactl-set-volume
+ pactl-set-cmd
.c.s:
$(COMPILE) -S $<
diff --git a/src/pactl/src/Makefile.in b/src/pactl/src/Makefile.in
index 6ee159a..f6807ed 100644
--- a/src/pactl/src/Makefile.in
+++ b/src/pactl/src/Makefile.in
@@ -88,22 +88,22 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-bin_PROGRAMS = pactl-set-volume$(EXEEXT)
+bin_PROGRAMS = pactl-set-cmd$(EXEEXT)
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
-am_pactl_set_volume_OBJECTS = strbuf.$(OBJEXT) core-util.$(OBJEXT) \
- pactl.$(OBJEXT) pactl-set-volume.$(OBJEXT)
-pactl_set_volume_OBJECTS = $(am_pactl_set_volume_OBJECTS)
-pactl_set_volume_LDADD = $(LDADD)
+am_pactl_set_cmd_OBJECTS = strbuf.$(OBJEXT) core-util.$(OBJEXT) \
+ pactl.$(OBJEXT) pactl-set-cmd.$(OBJEXT)
+pactl_set_cmd_OBJECTS = $(am_pactl_set_cmd_OBJECTS)
+pactl_set_cmd_LDADD = $(LDADD)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
@@ -132,8 +132,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
-SOURCES = $(pactl_set_volume_SOURCES)
-DIST_SOURCES = $(pactl_set_volume_SOURCES)
+SOURCES = $(pactl_set_cmd_SOURCES)
+DIST_SOURCES = $(pactl_set_cmd_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -158,7 +158,8 @@ am__define_uniq_tagged_files = \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
-am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
+am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \
+ $(top_srcdir)/mkinstalldirs
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -258,23 +259,18 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
-AM_CFLAGS = -D PA_BINARY=\"./\" -D LOCALEDIR=\"$(prefix)/share/locale\" \
- -D PA_DEFAULT_CONFIG_DIR=pulseconfdir -D TCP_NODELAY=1 \
- -D PA_MACHINE_ID=\"\" -Wall -Wextra -D RLIMIT_NOFILE=\"\" \
- -D PA_MACHINE_ID_FALLBACK=\"\" -D PA_BUILDDIR=\"\" \
- -D PA_SINK_CLIENT_FLAGS_MASK=0xFFFFFF \
- -D PA_SINK_SHARE_VOLUME_WITH_MASTER=0x1000000U \
- -D PA_SOURCE_CLIENT_FLAGS_MASK=0xFFFFFF \
- -Wall -Wunused-function -Winit-self -fno-common -O3 \
- --param=ssp-buffer-size=4 -Wformat -Werror=format-security \
- -DPROGRAMNAME_LOCALEDIR=\"${PROGRAMNAME_LOCALEDIR}\" \
- -lm -pthread -g
+AM_CFLAGS = -I . -D LOCALEDIR=\"$(prefix)/share/locale\" -Wall -Wextra \
+ -Wunused -Wunused-variable -Wunused-function \
+ -Wmissing-declarations \
+ -ggdb -I /usr/include/libxml2/ -O3 \
+ -Wuninitialized -Winit-self \
+ -DPROGRAMNAME_LOCALEDIR=\"${PROGRAMNAME_LOCALEDIR}\"
DEPENDENCIES = $(depend)
LDADD = $(ldadd)
CLEANFILES = $(EXTRA_PROGRAMS)
-pactl_set_volume_SOURCES = strbuf.c core-util.c pactl.c pactl-set-volume.c
-pactl_set_volume_DEPENDENCIES = $(DEPENDENCIES)
+pactl_set_cmd_SOURCES = strbuf.c core-util.c pactl.c pactl-set-cmd.c
+pactl_set_cmd_DEPENDENCIES = $(DEPENDENCIES)
depend = @LIBOBJS@
all: all-am
@@ -352,9 +348,9 @@ uninstall-binPROGRAMS:
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
-pactl-set-volume$(EXEEXT): $(pactl_set_volume_OBJECTS) $(pactl_set_volume_DEPENDENCIES) $(EXTRA_pactl_set_volume_DEPENDENCIES)
- @rm -f pactl-set-volume$(EXEEXT)
- $(AM_V_CCLD)$(LINK) $(pactl_set_volume_OBJECTS) $(pactl_set_volume_LDADD) $(LIBS)
+pactl-set-cmd$(EXEEXT): $(pactl_set_cmd_OBJECTS) $(pactl_set_cmd_DEPENDENCIES) $(EXTRA_pactl_set_cmd_DEPENDENCIES)
+ @rm -f pactl-set-cmd$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(pactl_set_cmd_OBJECTS) $(pactl_set_cmd_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -363,7 +359,7 @@ distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/core-util.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pactl-set-volume.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pactl-set-cmd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pactl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strbuf.Po@am__quote@
@@ -596,7 +592,7 @@ libtool:
$(SHELL) ./config.status --recheck
profile:
- pactl-set-volume
+ pactl-set-cmd
.c.s:
$(COMPILE) -S $<
diff --git a/src/pactl/src/core-util.c b/src/pactl/src/core-util.c
index ab10cf2..17648fa 100644
--- a/src/pactl/src/core-util.c
+++ b/src/pactl/src/core-util.c
@@ -354,47 +354,6 @@ char *pa_getcwd(void) {
}
}
-int pa_reset_sigsv(const int except[]) {
- int sig;
-
- for (sig = 1; sig < NSIG; sig++) {
- bool reset = true;
-
- switch (sig) {
- case SIGKILL:
- case SIGSTOP:
- reset = false;
- break;
-
- default: {
- int i;
-
- for (i = 0; except[i] > 0; i++) {
- if (sig == except[i]) {
- reset = false;
- break;
- }
- }
- }
- }
-
- if (reset) {
- struct sigaction sa;
-
- memset(&sa, 0, sizeof(sa));
- sa.sa_handler = SIG_DFL;
-
- /* On Linux the first two RT signals are reserved by
- * glibc, and sigaction() will return EINVAL for them. */
- if ((sigaction(sig, &sa, NULL) < 0))
- if (errno != EINVAL)
- return -1;
- }
- }
-
- return 0;
-}
-
void pa_set_env(const char *key, const char *value) {
pa_assert(key);
pa_assert(value);
diff --git a/src/pactl/src/pactl-set-cmd.c b/src/pactl/src/pactl-set-cmd.c
new file mode 100644
index 0000000..773f8c8
--- /dev/null
+++ b/src/pactl/src/pactl-set-cmd.c
@@ -0,0 +1,30 @@
+/*
+ * pactl-set-cmd - test the pactl program
+ *
+ * (C)2018 - Jos Lemmens
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+extern char *pactl (char *, char *, char *);
+
+char sink_info[10][100];
+
+int main (int argc, char *argv[])
+{
+ int x;
+ char sink_info[10][100];
+
+ if (argc != 4)
+ {
+ printf ("Usage: %s set-sink-volume | set-sink-mute | list\n \
+ <pulseaudio_device> <volume>\n", *argv);
+ return EXIT_FAILURE;
+ } // if
+ memcpy (sink_info, pactl (argv[1], argv[2], argv[3]), 1000);
+ for (x = 0; *sink_info[x]; x++)
+ printf ("%d %s\n", x, sink_info[x]);
+ return EXIT_SUCCESS;
+} // main
diff --git a/src/pactl/src/pactl-set-volume.c b/src/pactl/src/pactl-set-volume.c
deleted file mode 100644
index 044dbfa..0000000
--- a/src/pactl/src/pactl-set-volume.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * pactl-set-volume - test the pactl program
- *
- * (C)2018 - Jos Lemmens
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-extern int pactl (char *, char *);
-
-int main (int argc, char *argv[])
-{
-
- if (argc != 3)
- {
- printf ("Usage: %s <pulseaudio_device> <volume>\n", *argv);
- return -1;
- } // if
-printf ("argv[0] %s\n", argv[0]);
-printf ("argv[1] %s\n", argv[1]);
-printf ("argv[2] %s\n", argv[2]);
-printf ("argv[3] %s\n", argv[3]);
- pactl (argv[1], argv[2]);
-} // main
diff --git a/src/pactl/src/pactl.c b/src/pactl/src/pactl.c
index 6b731f5..6702571 100644
--- a/src/pactl/src/pactl.c
+++ b/src/pactl/src/pactl.c
@@ -18,7 +18,7 @@
***/
#ifdef HAVE_CONFIG_H
-#include "../config.h"
+#include <config.h>
#endif
#include <signal.h>
@@ -32,15 +32,18 @@
#include <locale.h>
#include <ctype.h>
-#include "sndfile.h"
+#include <sndfile.h>
#include <pulse/pulseaudio.h>
#include <pulse/ext-device-restore.h>
-#include "i18n.h"
+#include "i18n.h"
#include "macro.h"
#include "core-util.h"
+extern char *pactl (char *, char *, char *);
+extern char sink_info[10][100];
+
static pa_context *context = NULL;
static pa_mainloop_api *mainloop_api = NULL;
@@ -59,13 +62,20 @@ static pa_cvolume volume;
static enum volume_flags
{
VOL_UINT = 0,
- VOL_PERCENT = 1,
+ VOL_PERCENT = 1,
VOL_LINEAR = 2,
VOL_DECIBEL = 3,
VOL_ABSOLUTE = 0 << 4,
VOL_RELATIVE = 1 << 4,
} volume_flags;
+static enum mute_flags {
+ INVALID_MUTE = -1,
+ UNMUTE = 0,
+ MUTE = 1,
+ TOGGLE_MUTE = 2
+} mute = INVALID_MUTE;
+
static pa_proplist *proplist = NULL;
static SNDFILE *sndfile = NULL;
@@ -77,35 +87,36 @@ static pa_stream *sample_stream = NULL;
* function, which shuts down the program if actions reaches zero. */
static int actions = 0;
+static bool nl = false;
-static enum
-{
- SET_SINK_VOLUME
+static enum {
+ SET_SINK_VOLUME,
+ SET_SINK_MUTE,
+ LIST
} action = SET_SINK_VOLUME;
-static void quit (int ret)
+static void quit(int ret)
{
pa_assert(mainloop_api);
mainloop_api->quit(mainloop_api, ret);
}
-static void context_drain_complete (pa_context *c, void *userdata)
+static void context_drain_complete(pa_context *c, void *userdata)
{
userdata = userdata; // avoid notification
pa_context_disconnect(c);
}
-static void drain (void)
-{
+static void drain(void) {
pa_operation *o;
- if (! (o = pa_context_drain (context, context_drain_complete, NULL)))
+ if (!(o = pa_context_drain(context, context_drain_complete, NULL)))
pa_context_disconnect(context);
else
pa_operation_unref(o);
}
-static void complete_action(void)
+static void complete_action (void)
{
pa_assert(actions > 0);
@@ -113,10 +124,76 @@ static void complete_action(void)
drain();
}
-static void simple_callback (pa_context *c, int success, void *userdata)
+static inline const char *pa_yes_no_localised(bool b)
+{
+ return b ? _("yes") : _("no");
+}
+
+static inline const char *pa_strnull(const char *x)
+{
+ return x ? x : "(null)";
+}
+
+static void get_sink_info_callback (pa_context *c, const pa_sink_info *i,
+ int is_last, void *userdata)
{
c = c; // avoid notification
userdata = userdata; // avoid notification
+
+ char
+ cv[PA_CVOLUME_SNPRINT_VERBOSE_MAX];
+
+ if (is_last < 0)
+ {
+ quit(1);
+ return;
+ }
+
+ if (is_last)
+ {
+ complete_action();
+ return;
+ }
+
+ pa_assert(i);
+
+ nl = true;
+
+ char *str;
+ int x;
+
+ strncpy (sink_info[i->index], i->description, 70);
+ for (x = strlen (sink_info[i->index]); x < 55; x++)
+ sink_info[i->index][x] = ' ';
+ sink_info[i->index][52] = 0;
+ str = malloc (255);
+ sprintf (str, _("%s"),
+ pa_cvolume_snprint_verbose (cv, sizeof (cv), &i->volume,
+ &i->channel_map, i->flags & PA_SINK_DECIBEL_VOLUME));
+ x = 0;
+ while (str[x] != '%')
+ {
+ if (str[x] == 0)
+ {
+ x--;
+ break;
+ } // if
+ x++;
+ } // while
+ str[++x] = 0;
+ while (str[x] != ' ')
+ {
+ if (--x == 0)
+ break;
+ }
+ sprintf (sink_info[i->index] + 52, " Muted: %3s Volume:%s",
+ pa_yes_no_localised(i->mute), str + x);
+}
+
+static void simple_callback (pa_context *c, int success, void *userdata)
+{
+c = c; // avoidj notification
+userdata = userdata; // avoid notification
if (!success)
{
quit(1);
@@ -126,16 +203,16 @@ userdata = userdata; // avoid notification
complete_action();
}
-static void volume_relative_adjust (pa_cvolume *cv)
+
+static void volume_relative_adjust(pa_cvolume *cv)
{
pa_assert(volume_flags & VOL_RELATIVE);
/* Relative volume change is additive in case of UINT or PERCENT
* and multiplicative for LINEAR or DECIBEL */
- if ((volume_flags & 0x0F) == VOL_UINT || (volume_flags & 0x0F) == VOL_PERCENT)
- {
+ if ((volume_flags & 0x0F) == VOL_UINT || (volume_flags & 0x0F) == VOL_PERCENT) {
unsigned i;
- for (i = 0; i < cv->channels; i++)
+ for (i = 0; i < cv->channels; i++)
{
if (cv->values[i] + volume.values[i] < PA_VOLUME_NORM)
cv->values[i] = PA_VOLUME_MUTED;
@@ -147,14 +224,11 @@ static void volume_relative_adjust (pa_cvolume *cv)
pa_sw_cvolume_multiply(cv, cv, &volume);
}
-static void fill_volume(pa_cvolume *cv, unsigned supported)
-{
- if (volume.channels == 1)
- {
+static void fill_volume(pa_cvolume *cv, unsigned supported) {
+ if (volume.channels == 1) {
pa_cvolume_set(&volume, supported, volume.values[0]);
}
- else
- if (volume.channels != supported)
+ else if (volume.channels != supported)
{
quit(1);
return;
@@ -166,13 +240,12 @@ static void fill_volume(pa_cvolume *cv, unsigned supported)
*cv = volume;
}
-static void get_sink_volume_callback(pa_context *c, const pa_sink_info *i, int is_last, void *userdata)
+static void get_sink_volume_callback (pa_context *c, const pa_sink_info *i, int is_last, void *userdata)
{
userdata = userdata; // avoid notification
pa_cvolume cv;
- if (is_last < 0)
- {
+ if (is_last < 0) {
quit(1);
return;
}
@@ -184,59 +257,29 @@ userdata = userdata; // avoid notification
cv = i->volume;
fill_volume(&cv, i->channel_map.channels);
- pa_operation_unref (pa_context_set_sink_volume_by_name(c, sink_name, &cv, simple_callback, NULL));
-}
-/* PA_MAX_FORMATS is defined in internal.h so we just define a sane value here */
-#define MAX_FORMATS 256
+ pa_operation_unref(pa_context_set_sink_volume_by_name(c, sink_name, &cv, simple_callback, NULL));
+}
-static void context_state_callback (pa_context *c, void *userdata)
+static void sink_toggle_mute_callback (pa_context *c, const pa_sink_info *i, int is_last, void *userdata)
{
userdata = userdata; // avoid notification
- pa_operation *o = NULL;
-
- pa_assert (c);
- switch (pa_context_get_state (c))
- {
- case PA_CONTEXT_CONNECTING:
- case PA_CONTEXT_AUTHORIZING:
- case PA_CONTEXT_SETTING_NAME:
- break;
-
- case PA_CONTEXT_READY:
- switch (action)
- {
- case SET_SINK_VOLUME:
- o = pa_context_get_sink_info_by_name(c, sink_name, get_sink_volume_callback, NULL);
- break;
-
- }
-
- if (o)
- {
- pa_operation_unref(o);
- actions++;
- }
-
- if (actions == 0)
- {
- quit(1);
- }
+ if (is_last < 0) {
+ quit(1);
+ return;
+ }
- break;
+ if (is_last)
+ return;
- case PA_CONTEXT_TERMINATED:
- quit(0);
- break;
+ pa_assert(i);
- case PA_CONTEXT_FAILED:
- default:
- quit(1);
- }
+ pa_operation_unref(pa_context_set_sink_mute_by_name(c, i->name, !i->mute, simple_callback, NULL));
}
-static void exit_signal_callback (pa_mainloop_api *m, pa_signal_event *e,
- int sig, void *userdata)
+#define MAX_FORMATS 256
+
+static void exit_signal_callback(pa_mainloop_api *m, pa_signal_event *e, int sig, void *userdata)
{
m = m; // avoid notification
e = e; // avoid notification
@@ -245,43 +288,43 @@ userdata = userdata; // avoid notification
quit(0);
}
-static int parse_volume (const char *vol_spec, pa_volume_t *vol,
- enum volume_flags *vol_flags)
+static int parse_volume (const char *vol_spec, pa_volume_t *vol, enum volume_flags *vol_flags)
{
double v;
char *vs;
const char *atod_input;
- pa_assert (vol_spec);
- pa_assert (vol);
- pa_assert (vol_flags);
+ pa_assert(vol_spec);
+ pa_assert(vol);
+ pa_assert(vol_flags);
- vs = pa_xstrdup (vol_spec);
+ vs = pa_xstrdup(vol_spec);
- *vol_flags = (pa_startswith (vs, "+") || pa_startswith (vs, "-")) ?
- VOL_RELATIVE : VOL_ABSOLUTE;
+ *vol_flags = (pa_startswith(vs, "+") || pa_startswith(vs, "-")) ? VOL_RELATIVE : VOL_ABSOLUTE;
if (strchr(vs, '.'))
*vol_flags |= VOL_LINEAR;
- if (pa_endswith (vs, "%"))
- {
+ if (pa_endswith(vs, "%")) {
*vol_flags |= VOL_PERCENT;
vs[strlen(vs)-1] = 0;
}
+ if (pa_endswith(vs, "db") || pa_endswith(vs, "dB")) {
+ *vol_flags |= VOL_DECIBEL;
+ vs[strlen(vs)-2] = 0;
+ }
+
atod_input = vs;
if (atod_input[0] == '+')
atod_input++; /* pa_atod() doesn't accept leading '+', so skip it. */
- if (pa_atod(atod_input, &v) < 0)
- {
+ if (pa_atod(atod_input, &v) < 0) {
pa_xfree(vs);
return -1;
}
pa_xfree(vs);
- if (*vol_flags & VOL_RELATIVE)
- {
+ if (*vol_flags & VOL_RELATIVE) {
if ((*vol_flags & 0x0F) == VOL_UINT)
v += (double) PA_VOLUME_NORM;
if ((*vol_flags & 0x0F) == VOL_PERCENT)
@@ -296,8 +339,7 @@ static int parse_volume (const char *vol_spec, pa_volume_t *vol,
if ((*vol_flags & 0x0F) == VOL_DECIBEL)
v = pa_sw_volume_from_dB(v);
- if (!PA_VOLUME_IS_VALID((pa_volume_t) v))
- {
+ if (!PA_VOLUME_IS_VALID((pa_volume_t) v)) {
return -1;
}
@@ -310,67 +352,159 @@ static int parse_volumes (char *args, unsigned n)
{
unsigned i;
- if (n >= PA_CHANNELS_MAX)
- {
+ if (n >= PA_CHANNELS_MAX) {
return -1;
}
volume.channels = n;
- for (i = 0; i < volume.channels; i++)
- {
+ for (i = 0; i < volume.channels; i++) {
enum volume_flags flags;
if (parse_volume (args, &volume.values[i], &flags) < 0)
return -1;
- if (i > 0 && flags != volume_flags)
- {
+ if (i > 0 && flags != volume_flags) {
return -1;
- }
- else
+ } else
volume_flags = flags;
- } // for
+ }
return 0;
}
-enum
+static enum mute_flags parse_mute(const char *mute_text) {
+ int b;
+
+ pa_assert(mute_text);
+
+ if (pa_streq("toggle", mute_text))
+ return TOGGLE_MUTE;
+
+ b = pa_parse_boolean(mute_text);
+ switch (b) {
+ case 0:
+ return UNMUTE;
+ case 1:
+ return MUTE;
+ default:
+ return INVALID_MUTE;
+ }
+}
+
+static void context_state_callback (pa_context *c, void *userdata)
{
- ARG_VERSION = 256
-};
+userdata = userdata; // avoid notification
+ pa_operation *o = NULL;
+
+ pa_assert(c);
+
+ switch (pa_context_get_state(c)) {
+ case PA_CONTEXT_CONNECTING:
+ case PA_CONTEXT_AUTHORIZING:
+ case PA_CONTEXT_SETTING_NAME:
+ break;
+
+ case PA_CONTEXT_READY:
+ switch (action)
+ {
+ case SET_SINK_MUTE:
+ if (mute == TOGGLE_MUTE)
+ o = pa_context_get_sink_info_by_name(c, sink_name, sink_toggle_mute_callback, NULL);
+ else
+ o = pa_context_set_sink_mute_by_name(c, sink_name, mute, simple_callback, NULL);
+ break;
+
+ case SET_SINK_VOLUME:
+ o = pa_context_get_sink_info_by_name(c, sink_name, get_sink_volume_callback, NULL);
+ break;
+
+ case LIST:
+ if (pa_streq(list_type, "sinks"))
+ {
+ o = pa_context_get_sink_info_list
+ (c, get_sink_info_callback, NULL);
+ if (o)
+ {
+ pa_operation_unref(o);
+ actions++;
+ }
+ o = NULL;
+ }
+ break;
+ } // switch
+
+ if (o)
+ {
+ pa_operation_unref(o);
+ actions++;
+ }
+
+ if (actions == 0)
+ {
+ quit(1);
+ }
-int pactl (char *device, char *volume)
+ break;
+
+ case PA_CONTEXT_TERMINATED:
+ quit(0);
+ break;
+
+ case PA_CONTEXT_FAILED:
+ default:
+ quit(1);
+ }
+}
+
+char *pactl (char *cmd, char *device, char *arg)
{
pa_mainloop *m = NULL;
int ret = 1;
char *server = NULL;
+ setlocale(LC_ALL, "");
+\
proplist = pa_proplist_new();
- action = SET_SINK_VOLUME;
- sink_name = pa_xstrdup (device);
- if (parse_volumes (volume, 1) < 0)
- goto quit;
- if (! (m = pa_mainloop_new()))
+ if (pa_streq (cmd, "set-sink-volume"))
+ {
+ action = SET_SINK_VOLUME;
+ sink_name = pa_xstrdup (device);
+ if (parse_volumes (arg, 1) < 0)
+ goto quit;
+ }
+ else if (pa_streq (cmd, "set-sink-mute"))
+ {
+ action = SET_SINK_MUTE;
+ if ((mute = parse_mute (arg)) == INVALID_MUTE)
+ goto quit;
+ sink_name = pa_xstrdup (device);
+ }
+ else if (pa_streq(cmd, "list"))
+ {
+ action = LIST;
+ list_type = pa_xstrdup("sinks");
+ }
+
+ if (!(m = pa_mainloop_new()))
{
goto quit;
}
- mainloop_api = pa_mainloop_get_api (m);
+ mainloop_api = pa_mainloop_get_api(m);
pa_assert_se(pa_signal_init(mainloop_api) == 0);
pa_signal_new(SIGINT, exit_signal_callback, NULL);
pa_signal_new(SIGTERM, exit_signal_callback, NULL);
pa_disable_sigpipe();
- if (! (context = pa_context_new_with_proplist(mainloop_api, NULL, proplist)))
+ if (!(context = pa_context_new_with_proplist(mainloop_api, NULL, proplist)))
{
goto quit;
}
pa_context_set_state_callback(context, context_state_callback, NULL);
- if (pa_context_connect(context, server, 0, NULL) < 0)
- {
+ if (pa_context_connect(context, server, 0, NULL) < 0) {
goto quit;
}
@@ -409,5 +543,5 @@ quit:
if (proplist)
pa_proplist_free(proplist);
- return ret;
-} // pactl
+ return (char *) sink_info;
+}