Commit graph

124 commits

Author SHA1 Message Date
Klaas van Schelven
29860175c7 pactl: add get-(source|sink)-mute commands
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Jason Nader
bc8d615c1b pactl: add get_source_volume command
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Jason Nader
258bc97fb1 pactl: add get_default_source command
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Jason Nader
75390822b4 pactl: add get-sink-volume command
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Jason Nader
0e4a92ca69 pactl: add get_default_sink command
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Igor V. Kovalenko
a2db3fcfb2 message-params: clean up
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/525>
2021-03-27 11:18:22 +00:00
Igor V. Kovalenko
1dd05f4a9b message-params: use JSON instead of custom format
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/525>
2021-03-27 11:18:22 +00:00
Georg Chini
4a28b164d1 pactl: Implement list message-handlers
For better readability, "pactl list message-handlers" is introduced which
prints a formatted output of "pactl send-message /core list-handlers".

The patch also adds the functions pa_message_params_read_raw() and
pa_message_params_read_string() for easy parsing of the message response
string. Because the functions need to modify the parameter string,
the message handler and the pa_context_string_callback function now
receive a char* instead of a const char* as parameter argument.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/51>
2020-12-03 14:41:39 +00:00
Georg Chini
68f2f1395d pactl, pacmd, cli-command: Add send-message command
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/51>
2020-12-03 14:41:39 +00:00
Igor V. Kovalenko
2d018a82ad pactl: explicitly print if port availability is unknown
Port availability is a tristate -- not-available / unknown / available.
Explicitly print if availability is unknown to reduce confusion.
2020-11-21 16:34:09 +03:00
Tanu Kaskinen
af42b3eb6f Rename "available group" to "availability group"
"Availability group" is more clear about what the field is about.
Credits to Arun Raghavan for coming up with the better name.
2020-08-10 20:54:21 +03:00
Jaroslav Kysela
b2d3399793 pactl: print device port type and available group
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
2020-06-17 06:06:12 +00:00
scootergrisen
a4264de3a8 channel/s to channel(s) 2019-02-16 11:11:58 +00:00
Arun Raghavan
9e0aa31f0a pactl: Fix some corner cases when setting sink formats
Mostly deals with failure more gracefully, and NULL-initialises the
format array for safety.
2019-01-16 09:39:24 +05:30
Marek Cernocky
65c9195e8f i18n: Fixed plural forms handling 2018-10-09 11:56:31 +03:00
Deepak Srivastava
c37698ddf8 patcl: Error msg from pactl not quite accurate for 'mute' commands
<EP-E358F00C1D9A449EAE69225B9D2530F8>
Updated the error string for mute commands in pactl. If someone forget to specify
the parameter on the commandline the resulting error message isn't quite right.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=90117

Signed-off-by: Deepak Srivastava <srivastava.d@samsung.com>
2015-08-12 15:20:46 +02:00
David Henningsson
17e939dc15 core-util, pactl: Make one localised and one non-localised version of pa_yes_no
We currently use pa_yes_no to write module arguments, so they can not be
localised. Instead add a new pa_yes_no_localised function and use it in pactl
(and thus, revert all other places to use the non-localised version).

BugLink: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1445358
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2015-04-20 17:36:53 +02:00
Tanu Kaskinen
9860bc30ac pactl: Fix relative volume parsing
The recent change to reject leading '+' in pa_atod() broke the
relative volume parsing in pactl. This fixes that.
2015-04-10 11:19:18 +03:00
Ondrej Holecek
5effc83479 update FSF addresses to FSF web page
FSF addresses used in PA sources are no longer valid and rpmlint
generates numerous warnings during packaging because of this.
This patch changes all FSF addresses to FSF web page according to
the GPL how-to: https://www.gnu.org/licenses/gpl-howto.en.html

Done automatically by sed-ing through sources.
2015-01-14 22:20:40 +02:00
Felipe Sateler
4edc15346b pactl: fix getopt indexing for set-*-volume
When pactl is invoked with any options or the -- specifier, optind will
be > 1. Therefore using a static 3 value is wrong. Use optind+2 as both
offset and count difference.

Bug-Debian: http://bugs.debian.org/774810
2015-01-08 13:25:02 +01:00
Peter Meerwald
6d1fd4d1aa pactl: Remove deprecated 'stat' behaviour
the stat command should only output statistics, not info

behaviour was deprecated anno 2011 in 8ace9185 "pactl: Make stat backwards
compatible" -- fix this now

v2: (thanks Tanu Kaskinen):
* adjust shell completion

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-11-04 22:22:19 +01:00
Peter Meerwald
36f775482f pactl: Clean up checking for VOL_RELATIVE flag
VOL_RELATIVE if a bit flag (1 << 4), hence we can simply do
    if (vol_flags & VOL_RELATIVE) ...
instead of
    if ((vol_flags & VOL_RELATIVE) == VOL_RELATIVE) ...

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-04-16 00:02:14 +02:00
Peter Meerwald
edaa028290 pactl: Document ability to specify channel volumes individually
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-04-16 00:02:02 +02:00
Peter Meerwald
930159d4c5 pactl: Check consistency of volumes specified
Must use one way to specify volumes consistently, e.g.
+3dB +3dB, mixing different ways is not allowed, such as
40% 1000

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-04-16 00:01:47 +02:00
Parin Porecha
fc9fdfaf7b pactl: Allow to set volume of each channel independently (Bug #39190)
Example: pactl set-sink-volume "sink_name" 32000 40000
If the number of volumes provided is different than the number of channels
(excluding the case where a single volume is provided), an error message
is displayed explaining why the volumes could not be set.

patch proposed by Parin Porecha
code refactoring and commit message slightly edited by Peter Meerwald
2014-04-16 00:01:37 +02:00
Peter Meerwald
997e369691 pactl: Stop parsing option when the first non-option is encountered
fix bug
https://bugs.freedesktop.org/show_bug.cgi?id=77108

see getopt(3):
""By default, getopt() permutes the contents of argv as it scans, so that
  eventually all the nonoptions are at the end.  Two other modes are also
  implemented.   If  the first character of optstring is '+' or the envi‐
  ronment variable POSIXLY_CORRECT is set, then option  processing  stops
  as soon as a nonoption argument is encountered.  If the first character
  of optstring is '-', then each nonoption argv-element is handled as  if
  it were the argument of an option with character code 1.  (This is used
  by programs that were written to expect options and other argv-elements
  in any order and that care about the ordering of the two.)  The special
  argument "--" forces an end of option-scanning regardless of the  scan‐
  ning mode.""

prepend optstring with '+' to use POSIXLY_CORRECT mode

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-04-15 23:53:13 +02:00
Tanu Kaskinen
e1440395d1 pactl: Fix crash with older servers
Servers older than 0.9.15 don't know anything about cards, and card
operations will return a NULL pa_operation object when connected to
that old server. We must check the pa_operation pointer before passing
it to pa_operation_unref(), otherwise a NULL operation will result in
a crash.
2014-03-28 14:49:07 +02:00
Tanu Kaskinen
85891571f4 pactl: Fix a copy-paster error 2014-03-10 12:50:19 +02:00
Luiz Augusto von Dentz
85e7fbc196 introspect: Fix ABI break introduced by b98a2e1
The size of pa_card_profile_info cannot change even if it just a field
appended to end because each entry is appended to a contiguous memory
and accessed by offset this may lead clients to access invalid data.

To fix a new struct called pa_card_profile_info2 is introduced and shall
be used for now on while pa_card_profile_info shall be considered
deprecated but it is still mantained for backward compatibility.

A new field called profiles2 is introduced to pa_card_info, this new field
is an array of pointers to pa_card_profile_info2 so it should be possible
to append new fields to the end of the pa_card_profile_info2 without
breaking binary compatibility as the entries are not accessed by offset.
2013-11-05 21:26:34 +02:00
Luiz Augusto von Dentz
16886bbf87 pactl: Print available flag of card profiles 2013-07-15 19:51:45 +03:00
Tanu Kaskinen
ee5e245afa Use pa_(c)volume_snprint_verbose() everywhere
All pa_cvolume_snprint(), pa_volume_snprint(),
pa_sw_cvolume_snprint_dB() and pa_sw_volume_snprint_dB() calls have
been replaced with pa_cvolume_snprint_verbose() and
pa_volume_snprint_verbose() calls, making the log output more
informative and the code sometimes simpler.
2013-07-09 17:37:04 +03:00
poljar (Damir Jelić)
d806b19714 Remove pa_bool_t and replace it with bool.
commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
2013-07-04 12:25:30 +03:00
poljar (Damir Jelić)
97da92d894 Whitespace cleanup: Remove all multiple newlines
This patch removes all occurrences of double and triple
newlines.

Command used for this:
find .  -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -a -not -name 'adrian-aec.*' -a -not \
        -name reserve.c -a -not -name 'rtkit.*' \
        -exec sed -i -e '/^$/{N;s/^\n$//}' {} \;

Two passes were needed to remove triple newlines.
The excluded files are mirrored files from external sources.
2013-06-24 16:56:24 +03:00
poljar (Damir Jelić)
e95d054e40 Style fix: Remove new lines from opening brackets
This patch replaces every occurrence of ')\n{' with ') {'.

Command used for this:
    find .  -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -a -not -name core-util.c -a -not \
        -name adrian-aec.c -a -not -name g711.c \
        -exec sed -i -e '/)$/{N;s/)\n{$/) {/}' {} \;

The excluded files are mirrored files from external sources.
2013-06-24 16:56:24 +03:00
poljar (Damir Jelić)
cbd274676d Style fix: Add a space between the closing/opening bracket
This patch replaces every occurrence of '){' with ') {'.
The ffmpeg source tree was excluded since it will disappear anyways.

Command used for this:
    find . -type d \( -name ffmpeg \) -prune -o \
        -regex '\(.*\.[hc]\|.*\.cc\)' \
        -exec sed -i -e 's/){/) {/' {} \;
2013-06-24 16:56:24 +03:00
Peter Meerwald
83c3cf0a65 pactl: Use colon to separate priority in profiles output
for example:
  Profiles:
	input:analog-stereo: Analog Stereo Input (sinks: 0, sources: 1, priority. 60)
	output:analog-stereo: Analog Stereo Output (sinks: 1, sources: 0, priority. 6000)

it should be "priority: xxx", not "priority. xxx"

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
2013-06-04 00:38:43 +05:30
Nikolay Amiantov
8cc4e7786f pactl: Flush stdout buffer when printing subscribe events.
"pactl subscribe" is running continuously, and without flushing its output is
not usable for "process-on-arrival" per-line tasks, such as grepping. This
patch should fix this. For example, now:
pactl subscribe | grep 'server'
should print only server events as they arrive.
2013-06-04 00:38:41 +05:30
David Henningsson
596d9aa740 pactl: Document @DEFAULT_SINK@, @DEFAULT_SOURCE@ and @DEFAULT_MONITOR@
I went to implement the possibility to use the default sink/source
but found that it was already working. So I figured I'd update
the help text instead.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2013-02-04 10:01:57 +01:00
poljar (Damir Jelić)
831cae16d4 pactl: Add a command for setting the default sink/source.
This adds two new commands to pactl:
    set-default-sink
    set-default-source

This command has been part of the native protocol for a long time,
no reason not to expose it in pactl.
2013-02-01 07:16:20 +02:00
poljar (Damir Jelić)
9779aa4985 pactl: Add the ability to toggle mute state.
This patch adds the ability to toggle mute for sink/sources and
sink-inputs and source outputs.

All mute commands now accept 1|0|toggle as an argument.
2013-01-27 18:11:54 +02:00
Tanu Kaskinen
19c058dd08 Fix pa_parse_boolean() return value checking.
pa_parse_boolean() return value shouldn't be stored in
pa_bool_t, because 1 and -1 need to be distinguished.
2012-12-19 12:31:50 +02:00
poljar (Damir Jelic)
dcf92db0c3 pactl: Add set-latency-offset command.
This introduces a new command to allow setting the latency offset.

Also the card list command now shows the latency offset on the ports.
2012-06-30 14:42:43 +03:00
Tanu Kaskinen
5f62cf8f40 pactl: Print card port properties with the "list" command. 2012-06-29 13:24:52 +03:00
Arun Raghavan
062a104247 pactl: Print sink-input/source-output corked status
Sending this out for review before committing since it changes pactl output.
2012-06-28 13:42:44 +03:00
poljar
48f4c8ab8f pactl: Add unloading modules by name.
pactl should allow unloading modules by name.

If there are multiple modules with the same name all
of them will be unloaded.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=48289
2012-06-04 18:31:42 +03:00
David Henningsson
70eb40705d pactl: show availability information for "list cards"
Now that the client API exposes availability information for ports
on cards, we can make output consistent with "list sinks" and
"list sources".

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-03-21 12:17:47 +01:00
David Henningsson
793f46320e introspect: Expose port info per card to clients
For volume control UIs to be able to show ports in inactive profiles,
expose all ports together with the card info. This includes updating
the protocol and the client API to show the connection between ports
and for which profiles the ports are relevant.

Update protocol to 26.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2012-03-11 12:23:46 +05:30
Arun Raghavan
87e6f489a9 utils: Fixes for building without NLS 2011-12-13 09:10:08 +05:30
David Henningsson
1623859d1b pactl: Show port availability
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-12-02 18:21:36 +02:00
Colin Guthrie
d6b9e61b90 device-restore: Change the API to include type information (sink vs. source)
This changes the API, but as we have not released yet, this is OK.
2011-08-18 17:33:08 +01:00