Hello community,

here is the log from the commit of package pamixer for openSUSE:Factory checked 
in at 2020-08-18 12:00:47
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/pamixer (Old)
 and      /work/SRC/openSUSE:Factory/.pamixer.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "pamixer"

Tue Aug 18 12:00:47 2020 rev:2 rq:827409 version:1.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/pamixer/pamixer.changes  2017-09-05 
15:20:00.288884467 +0200
+++ /work/SRC/openSUSE:Factory/.pamixer.new.3399/pamixer.changes        
2020-08-18 12:02:57.483422773 +0200
@@ -1,0 +2,8 @@
+Mon Aug 17 19:04:17 UTC 2020 - Dirk Mueller <[email protected]>
+
+- update to 1.4:
+  * Allow --get-volume with --get-mute
+  * Check return values when creating and connecting `pa_context`
+  * add "--get-volume-human" option that gives 75% or muted
+
+-------------------------------------------------------------------

Old:
----
  pamixer-1.3.1.tar.gz

New:
----
  pamixer-1.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ pamixer.spec ++++++
--- /var/tmp/diff_new_pack.ThHtGP/_old  2020-08-18 12:02:58.251422878 +0200
+++ /var/tmp/diff_new_pack.ThHtGP/_new  2020-08-18 12:02:58.255422879 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package pamixer
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 # Copyright (c) 2017 Dakota Williams <[email protected]>
 #
 # All modifications and additions to the file contributed by third parties
@@ -13,17 +13,17 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           pamixer
-Version:        1.3.1
+Version:        1.4
 Release:        0
 Summary:        PulseAudio commandline mixer
-License:        GPL-3.0+
+License:        GPL-3.0-or-later
 Group:          Productivity/Multimedia/Sound/Mixers
-Url:            https://github.com/cdemoulins/pamixer
+URL:            https://github.com/cdemoulins/pamixer
 Source0:        
https://github.com/cdemoulins/pamixer/archive/%{version}/%{name}-%{version}.tar.gz
 BuildRequires:  gcc-c++
 BuildRequires:  libboost_program_options-devel
@@ -39,7 +39,7 @@
 
 %build
 export CXXFLAGS="%{optflags}"
-make %{?_smp_mflags}
+%make_build
 
 %install
 mkdir -p %{buildroot}%{_bindir}

++++++ pamixer-1.3.1.tar.gz -> pamixer-1.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pamixer-1.3.1/Makefile new/pamixer-1.4/Makefile
--- old/pamixer-1.3.1/Makefile  2015-12-07 16:15:31.000000000 +0100
+++ new/pamixer-1.4/Makefile    2019-02-13 14:55:29.000000000 +0100
@@ -1,6 +1,11 @@
 LDLIBS   ?= -lpulse -lboost_program_options
-CXXFLAGS ?= --std=c++11 -Wall -Werror -Wextra -pedantic
+CXXFLAGS ?= -std=c++11 -Wall -Werror -Wextra -pedantic
 PREFIX   ?= /usr/local
+RM       ?= rm -f
+
+target   := pamixer
+main     := $(addsuffix .cc,$(target))
+objects  := $(addsuffix .o,callbacks device pulseaudio)
 
 ## Target if make is invoked without any parameters (goal)
 .DEFAULT_GOAL: all
@@ -9,19 +14,15 @@
 .PHONY: all clean distclean install
 
 
-all: pamixer
+all: $(target)
 
-pamixer: pulseaudio.o device.o pamixer.o callbacks.o
-       $(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@
+$(target): $(main) $(objects)
 
 clean:
-       rm -f pulseaudio.o
-       rm -f device.o
-       rm -f pamixer.o
-       rm -f callbacks.o
+       $(RM) $(objects)
 
 distclean: clean
-       rm -f pamixer
+       $(RM) $(target)
 
 install: pamixer
-       install pamixer $(PREFIX)/bin/
+       install $(target) $(PREFIX)/bin/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pamixer-1.3.1/README.rst new/pamixer-1.4/README.rst
--- old/pamixer-1.3.1/README.rst        2015-12-07 16:15:31.000000000 +0100
+++ new/pamixer-1.4/README.rst  2019-02-13 14:55:29.000000000 +0100
@@ -46,6 +46,7 @@
           --source arg          choose a different source than the default
           --default-source      select the default source
           --get-volume          get the current volume
+          --get-volume-human    get the current volume percentage or the 
string "muted"
           --set-volume arg      set the volume
           -i [ --increase ] arg increase the volume
           -d [ --decrease ] arg decrease the volume
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pamixer-1.3.1/pamixer.cc new/pamixer-1.4/pamixer.cc
--- old/pamixer-1.3.1/pamixer.cc        2015-12-07 16:15:31.000000000 +0100
+++ new/pamixer-1.4/pamixer.cc  2019-02-13 14:55:29.000000000 +0100
@@ -91,6 +91,7 @@
         ("source", po::value(&source_name), "choose a different source than 
the default")
         ("default-source", "select the default source")
         ("get-volume", "get the current volume")
+        ("get-volume-human", "get the current volume percentage or the string 
\"muted\"")
         ("set-volume", po::value<int>(&value), "set the volume")
         ("increase,i", po::value<int>(&value), "increase the volume")
         ("decrease,d", po::value<int>(&value), "decrease the volume")
@@ -123,9 +124,14 @@
         conflicting_options(vm, "unmute", "mute");
         conflicting_options(vm, "sink", "source");
         conflicting_options(vm, "sink", "default-source");
-        conflicting_options(vm, "get-volume", "get-mute");
         conflicting_options(vm, "get-volume", "list-sinks");
         conflicting_options(vm, "get-volume", "list-sources");
+        conflicting_options(vm, "get-volume", "get-volume-human");
+        conflicting_options(vm, "get-volume-human", "list-sinks");
+        conflicting_options(vm, "get-volume-human", "list-sources");
+        conflicting_options(vm, "get-volume-human", "get-mute");
+        conflicting_options(vm, "get-mute", "list-sinks");
+        conflicting_options(vm, "get-mute", "list-sources");
 
         Pulseaudio pulse("pamixer");
         Device device = get_selected_device(pulse, vm, sink_name, source_name);
@@ -152,36 +158,47 @@
             device = get_selected_device(pulse, vm, sink_name, source_name);
         }
 
-        if (vm.count("toggle-mute")) {
-            pulse.set_mute(device, !device.mute);
-        } else if (vm.count("mute")) {
-            pulse.set_mute(device, true);
-        } else if (vm.count("unmute")) {
-            pulse.set_mute(device, false);
+        if (vm.count("toggle-mute") || vm.count("mute") || vm.count("unmute")) 
{
+            if (vm.count("toggle-mute")) {
+                pulse.set_mute(device, !device.mute);
+            } else {
+                pulse.set_mute(device, vm.count("mute") || 
!vm.count("unmute"));
+            }
+            device = get_selected_device(pulse, vm, sink_name, source_name);
         }
 
         int ret = 0;
-        if (vm.count("get-volume")) {
-            cout << device.volume_percent << "\n" << flush;
-            ret = (device.volume_percent > 0 ? 0 : 1);
+        if (vm.count("get-volume") && vm.count("get-mute")) {
+            cout << boolalpha << device.mute << ' ' << device.volume_percent 
<< '\n';
+            ret = !device.mute;
+        } else if (vm.count("get-volume")) {
+            cout << device.volume_percent << '\n';
+            ret = device.volume_percent <= 0;
+        } else if (vm.count("get-volume-human")) {
+            if (device.mute) {
+                cout << "muted\n";
+            } else {
+                cout << device.volume_percent << "%\n";
+            }
+            ret = (device.volume_percent <= 0) || device.mute;
         } else if (vm.count("get-mute")) {
-            cout << boolalpha << device.mute << "\n" << flush;
-            ret = (device.mute ? 0 : 1);
+            cout << boolalpha << device.mute << '\n';
+            ret = !device.mute;
         } else {
             if (vm.count("list-sinks")) {
-                list<Device> sinks = pulse.get_sinks();
-                list<Device>::iterator it;
-                cout << "Sinks:" << endl;
-                for (it = sinks.begin(); it != sinks.end(); ++it) {
-                    cout << it->index << " \"" << it->name << "\" \"" << 
it->description << "\"" << endl;
+                cout << "Sinks:\n";
+                for (const Device& sink : pulse.get_sinks()) {
+                    cout << sink.index << " \""
+                         << sink.name << "\" \""
+                         << sink.description << "\"\n";
                 }
             }
             if (vm.count("list-sources")) {
-                list<Device> sources = pulse.get_sources();
-                list<Device>::iterator it;
-                cout << "Sources:" << endl;
-                for (it = sources.begin(); it != sources.end(); ++it) {
-                    cout << it->index << " \"" << it->name << "\" \"" << 
it->description << "\"" << endl;
+                cout << "Sources:\n";
+                for (const Device& source : pulse.get_sources()) {
+                    cout << source.index << " \""
+                         << source.name << "\" \""
+                         << source.description << "\"\n";
                 }
             }
         }
@@ -190,13 +207,13 @@
     }
     catch (const char* message)
     {
-        cerr << message << endl;
+        cerr << message << '\n';
         return 3;
     }
     catch (const std::exception& e)
     {
-        cerr << argv[0] << ": " << e.what() << endl << endl;
-        cerr << options << endl;
+        cerr << argv[0] << ": " << e.what() << "\n\n";
+        cerr << options << '\n';
         return 2;
     }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/pamixer-1.3.1/pulseaudio.cc 
new/pamixer-1.4/pulseaudio.cc
--- old/pamixer-1.3.1/pulseaudio.cc     2015-12-07 16:15:31.000000000 +0100
+++ new/pamixer-1.4/pulseaudio.cc       2019-02-13 14:55:29.000000000 +0100
@@ -41,13 +41,14 @@
     pa_context_set_state_callback(context, &state_cb, this);
 
     state = CONNECTING;
-    pa_context_connect(context, NULL, PA_CONTEXT_NOFLAGS, NULL);
+    if (pa_context_connect(context, NULL, PA_CONTEXT_NOFLAGS, NULL) < 0)
+        throw "Connection error\n";
     while (state == CONNECTING) {
-        pa_mainloop_iterate(mainloop, 1, &retval);
+        if (pa_mainloop_iterate(mainloop, 1, &retval) < 0)
+            throw "Mainloop error\n";
     }
-    if (state == ERROR) {
+    if (state == ERROR)
         throw "Connection error\n";
-    }
 }
 
 Pulseaudio::~Pulseaudio() {


Reply via email to