Commit graph

2202 commits

Author SHA1 Message Date
Pantelis Antoniou
e258382bec pipewire-cli: Introduce an improved object dump method
The dump method can dump objects in a manner that is easy
for humans to parse and understand.

For instance a simple command (on a vanilla NUC2):

	pipewire-0>>dump -sd Device

	23: c="Audio/Device" n="alsa_card.pci-0000:00:03.0" d="Built-in Audio" a="alsa:pcm" p="hw:0" id="HDMI"
		nodes:
		24: s="suspended" i=2/128 n="api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 0" p="alsa:pcm:hw:0,3:playback"
			ports:
			31: d="input" n="playback_FL" f="32 bit float mono audio"
			32: d="input" n="playback_FR" f="32 bit float mono audio"
		25: s="suspended" i=2/128 n="api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 1" p="alsa:pcm:hw:0,7:playback"
			ports:
			33: d="input" n="playback_FL" f="32 bit float mono audio"
			34: d="input" n="playback_FR" f="32 bit float mono audio"
		26: s="suspended" i=2/128 n="api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 2" p="alsa:pcm:hw:0,8:playback"
			ports:
			35: d="input" n="playback_FL" f="32 bit float mono audio"
			36: d="input" n="playback_FR" f="32 bit float mono audio"
		27: s="suspended" i=2/128 n="api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 3" p="alsa:pcm:hw:0,9:playback"
			ports:
			37: d="input" n="playback_FL" f="32 bit float mono audio"
			38: d="input" n="playback_FR" f="32 bit float mono audio"
		43: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 0/Multimedia" p="alsa:pcm:hw:0,3:playback:Multimedia"
			ports:
			44: d="input" n="in_FL" f="32 bit float mono audio"
			45: d="output" n="out_FL" f="32 bit float mono audio"
			106: d="output" n="out_FR" f="32 bit float mono audio"
			107: d="input" n="in_FR" f="32 bit float mono audio"
		46: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 0/Navigation" p="alsa:pcm:hw:0,3:playback:Navigation"
			ports:
			47: d="input" n="in_FL" f="32 bit float mono audio"
			48: d="output" n="out_FL" f="32 bit float mono audio"
			108: d="output" n="out_FR" f="32 bit float mono audio"
			109: d="input" n="in_FR" f="32 bit float mono audio"
		49: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 0/Communication" p="alsa:pcm:hw:0,3:playback:Communication"
			ports:
			50: d="input" n="in_FL" f="32 bit float mono audio"
			51: d="output" n="out_FL" f="32 bit float mono audio"
			110: d="output" n="out_FR" f="32 bit float mono audio"
			111: d="input" n="in_FR" f="32 bit float mono audio"
		52: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 0/Emergency" p="alsa:pcm:hw:0,3:playback:Emergency"
			ports:
			53: d="input" n="in_FL" f="32 bit float mono audio"
			54: d="output" n="out_FL" f="32 bit float mono audio"
			112: d="output" n="out_FR" f="32 bit float mono audio"
			113: d="input" n="in_FR" f="32 bit float mono audio"
		55: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 1/Multimedia" p="alsa:pcm:hw:0,7:playback:Multimedia"
			ports:
			56: d="input" n="in_FL" f="32 bit float mono audio"
			57: d="output" n="out_FL" f="32 bit float mono audio"
			114: d="output" n="out_FR" f="32 bit float mono audio"
			115: d="input" n="in_FR" f="32 bit float mono audio"
		58: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 1/Navigation" p="alsa:pcm:hw:0,7:playback:Navigation"
			ports:
			59: d="input" n="in_FL" f="32 bit float mono audio"
			60: d="output" n="out_FL" f="32 bit float mono audio"
			116: d="output" n="out_FR" f="32 bit float mono audio"
			117: d="input" n="in_FR" f="32 bit float mono audio"
		61: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 1/Communication" p="alsa:pcm:hw:0,7:playback:Communication"
			ports:
			62: d="input" n="in_FL" f="32 bit float mono audio"
			63: d="output" n="out_FL" f="32 bit float mono audio"
			118: d="output" n="out_FR" f="32 bit float mono audio"
			119: d="input" n="in_FR" f="32 bit float mono audio"
		64: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 1/Emergency" p="alsa:pcm:hw:0,7:playback:Emergency"
			ports:
			65: d="input" n="in_FL" f="32 bit float mono audio"
			66: d="output" n="out_FL" f="32 bit float mono audio"
			120: d="output" n="out_FR" f="32 bit float mono audio"
			121: d="input" n="in_FR" f="32 bit float mono audio"
		67: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 2/Multimedia" p="alsa:pcm:hw:0,8:playback:Multimedia"
			ports:
			68: d="input" n="in_FL" f="32 bit float mono audio"
			69: d="output" n="out_FL" f="32 bit float mono audio"
			122: d="output" n="out_FR" f="32 bit float mono audio"
			123: d="input" n="in_FR" f="32 bit float mono audio"
		70: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 2/Navigation" p="alsa:pcm:hw:0,8:playback:Navigation"
			ports:
			71: d="input" n="in_FL" f="32 bit float mono audio"
			72: d="output" n="out_FL" f="32 bit float mono audio"
			124: d="output" n="out_FR" f="32 bit float mono audio"
			125: d="input" n="in_FR" f="32 bit float mono audio"
		73: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 2/Communication" p="alsa:pcm:hw:0,8:playback:Communication"
			ports:
			74: d="input" n="in_FL" f="32 bit float mono audio"
			75: d="output" n="out_FL" f="32 bit float mono audio"
			126: d="output" n="out_FR" f="32 bit float mono audio"
			127: d="input" n="in_FR" f="32 bit float mono audio"
		76: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 2/Emergency" p="alsa:pcm:hw:0,8:playback:Emergency"
			ports:
			77: d="input" n="in_FL" f="32 bit float mono audio"
			78: d="output" n="out_FL" f="32 bit float mono audio"
			128: d="output" n="out_FR" f="32 bit float mono audio"
			129: d="input" n="in_FR" f="32 bit float mono audio"
		79: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 3/Multimedia" p="alsa:pcm:hw:0,9:playback:Multimedia"
			ports:
			80: d="input" n="in_FL" f="32 bit float mono audio"
			81: d="output" n="out_FL" f="32 bit float mono audio"
			130: d="output" n="out_FR" f="32 bit float mono audio"
			131: d="input" n="in_FR" f="32 bit float mono audio"
		82: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 3/Navigation" p="alsa:pcm:hw:0,9:playback:Navigation"
			ports:
			83: d="input" n="in_FL" f="32 bit float mono audio"
			84: d="output" n="out_FL" f="32 bit float mono audio"
			132: d="output" n="out_FR" f="32 bit float mono audio"
			133: d="input" n="in_FR" f="32 bit float mono audio"
		85: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 3/Communication" p="alsa:pcm:hw:0,9:playback:Communication"
			ports:
			86: d="input" n="in_FL" f="32 bit float mono audio"
			87: d="output" n="out_FL" f="32 bit float mono audio"
			134: d="output" n="out_FR" f="32 bit float mono audio"
			135: d="input" n="in_FR" f="32 bit float mono audio"
		88: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:03.0/HDMI 3/Emergency" p="alsa:pcm:hw:0,9:playback:Emergency"
			ports:
			89: d="input" n="in_FL" f="32 bit float mono audio"
			90: d="output" n="out_FL" f="32 bit float mono audio"
			136: d="output" n="out_FR" f="32 bit float mono audio"
			137: d="input" n="in_FR" f="32 bit float mono audio"
	28: c="Audio/Device" n="alsa_card.pci-0000:00:1b.0" d="Built-in Audio" a="alsa:pcm" p="hw:1" id="PCH"
		nodes:
		29: s="running" i=2/128 n="api.alsa.pcm.sink/alsa_card.pci-0000:00:1b.0/ALC283 Analog" p="alsa:pcm:hw:1,0:playback"
			ports:
			39: d="input" n="playback_FL" f="32 bit float mono audio"
			40: d="input" n="playback_FR" f="32 bit float mono audio"
		30: s="suspended" o=2/128 n="api.alsa.pcm.source/alsa_card.pci-0000:00:1b.0/ALC283 Analog" p="alsa:pcm:hw:1,0:capture"
			ports:
			41: d="output" n="capture_FL" f="32 bit float mono audio"
			42: d="output" n="capture_FR" f="32 bit float mono audio"
		91: s="running" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:1b.0/ALC283 Analog/Multimedia" p="alsa:pcm:hw:1,0:playback:Multimedia"
			ports:
			92: d="input" n="in_FL" f="32 bit float mono audio"
			93: d="output" n="out_FL" f="32 bit float mono audio"
			138: d="output" n="out_FR" f="32 bit float mono audio"
			139: d="input" n="in_FR" f="32 bit float mono audio"
		94: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:1b.0/ALC283 Analog/Navigation" p="alsa:pcm:hw:1,0:playback:Navigation"
			ports:
			95: d="input" n="in_FL" f="32 bit float mono audio"
			96: d="output" n="out_FL" f="32 bit float mono audio"
			140: d="output" n="out_FR" f="32 bit float mono audio"
			141: d="input" n="in_FR" f="32 bit float mono audio"
		97: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:1b.0/ALC283 Analog/Communication" p="alsa:pcm:hw:1,0:playback:Communication"
			ports:
			98: d="input" n="in_FL" f="32 bit float mono audio"
			99: d="output" n="out_FL" f="32 bit float mono audio"
			142: d="output" n="out_FR" f="32 bit float mono audio"
			143: d="input" n="in_FR" f="32 bit float mono audio"
		100: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.sink/alsa_card.pci-0000:00:1b.0/ALC283 Analog/Emergency" p="alsa:pcm:hw:1,0:playback:Emergency"
			ports:
			101: d="input" n="in_FL" f="32 bit float mono audio"
			102: d="output" n="out_FL" f="32 bit float mono audio"
			144: d="output" n="out_FR" f="32 bit float mono audio"
			145: d="input" n="in_FR" f="32 bit float mono audio"
		103: s="suspended" i=2/128 o=2/128 n="audio.convert/api.alsa.pcm.source/alsa_card.pci-0000:00:1b.0/ALC283 Analog/Capture" p="alsa:pcm:hw:1,0:capture:Capture"
			ports:
			104: d="input" n="in_FL" f="32 bit float mono audio"
			105: d="output" n="out_FL" f="32 bit float mono audio"
			146: d="input" n="in_FR" f="32 bit float mono audio"
			147: d="output" n="out_FR" f="32 bit float mono audio"

Will dump the devices, while following to dump nodes and ports
of the nodes.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-01-28 12:45:24 +01:00
Pantelis Antoniou
193360abe6 pipewire-cli: Immediately bind the object on creation
Immediately bind the global object upon creation. This
allows to iterate over them without having to wait for
the bind to be completed asynchronously.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-01-28 12:45:21 +01:00
Wim Taymans
b5b3bfbe84 pw-cat: Don't set RT_PROCESS flag
The soundfile function calls are not safe to call from the real-time
thread so don't do that.
2020-01-28 10:35:29 +01:00
Wim Taymans
d43b98e1a4 pw-cat: print errno on errors 2020-01-28 10:35:07 +01:00
Wim Taymans
525ca21ece pw-cat: fix pw-play and pw-record names 2020-01-28 10:33:48 +01:00
George Kiagiadakis
9100fb653d gst: fix typo 2020-01-28 09:55:09 +01:00
Wim Taymans
37396096df pw-cat: fill in the media-name property 2020-01-27 16:54:19 +01:00
Wim Taymans
116b13b1e2 pw-cat: relax some more checks
Don't really care about the format, let sndfile convert and decode
for us to the nearest supported format or else to f32. Fixes support
for ogg.
2020-01-27 16:38:35 +01:00
Wim Taymans
e1e93e5a88 pw-cat: fix s24 formats
Treat s24 format as s32 and let sndfile convert for us. This is
needed because using the raw read bypasses decoding in some cases.
This makes 24 bits flac work.
2020-01-27 15:47:13 +01:00
Wim Taymans
c047bab910 rename pipewire tools
Use the pw- prefix for all pipewire tools. This makes the
commands shorter but also avoids conflicts with password
and patchwork tools (pwcli is taken, pwconv is maybe we someday
can make).

pipewire-monitor -> pw-mon
pipewire-cli -> pw-cli
pipewire-dot -> pw-dot
pwcat -> pw-cat
2020-01-27 15:42:59 +01:00
Wim Taymans
88cd3d3f1e pwcat: add support for WAVEX and 24 bits 2020-01-27 13:32:05 +01:00
Pantelis Antoniou
00fb00924b pwcat: Add list-targets option
The --list-targets option will report on the available
targets for the --target command (and some info about it).

Example:

$ pwplay --list-targets
Available targets ("*" denotes default):
	30: name="alsa_card.pci-0000:00:03.0.playback.3.0" description="Built-in Audio (HDMI 0)" prio=696
	31: name="alsa_card.pci-0000:00:03.0.playback.7.0" description="Built-in Audio (HDMI 1)" prio=632
	32: name="alsa_card.pci-0000:00:03.0.playback.8.0" description="Built-in Audio (HDMI 2)" prio=616
	33: name="alsa_card.pci-0000:00:03.0.playback.9.0" description="Built-in Audio (HDMI 3)" prio=600
*	34: name="alsa_card.pci-0000:00:1b.0.playback.0.0" description="Built-in Audio" prio=936

Getting this working required abandoning the simple stream API, and
the resultant increase in code size.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-01-27 12:23:33 +01:00
Pantelis Antoniou
3f11f7e505 pwcat: Fix --target option
The target option was not working properly. Now you can use
arbitrary nodes as targets.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-01-27 12:23:27 +01:00
Pantelis Antoniou
f0d5d7ec09 pwcat: Add volume control option.
Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-01-27 12:23:21 +01:00
Pantelis Antoniou
588e9562f9 pwcat: simple native playback/record tool
pwcat is analogous to pacat of PulseAudio which implements
both playback and recording capability.

Only wav files are supported for now, and you can use the
handy pwplay and pwrecord aliases for easy use.

Playback a wav file
  $ pwplay foo.wav

Record a wav file
  $ pwrecord -r 44100 -c 1 -f s16 foo.wav

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-01-27 12:23:15 +01:00
Wim Taymans
6ac9b7b3a7 spa: add spa_aprintf helper
Add a asprintf helper function that handles errors correctly.
Use this in places where we use asprintf to avoid warnings when we
don't check the return value.
2020-01-27 12:19:21 +01:00
Wim Taymans
aee3191bad examples: don't fail when alsa is not found
Avoid building the session-manager when alsa was not found.
2020-01-27 10:46:19 +01:00
Fabrice Fontaine
4717690a60 meson: add examples option
Add an option to allow the user to disable examples, this will allow to
build pipewire without alsa. Without this option, build with
-Dpipewire-alsa=false -Dalsa=false fails on:

src/examples/meson.build:47:0: ERROR: Unknown variable "alsa_dep".

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-01-27 10:42:46 +01:00
Wim Taymans
0237296400 stream: don't set inactive on cork
We don't pause our clock ticks in the corked state which confuses
the timing code. As a workaround for now, don't set the node to
inactive when corked, this still keeps calling into the process
function and keep things moving. VLC seems to recover better.
2020-01-17 15:34:31 +01:00
Wim Taymans
1c46dc32f8 protocol-native: improve message debug 2020-01-17 11:00:09 +01:00
Wim Taymans
f792c3f536 fix some segfaults 2020-01-16 16:47:01 +01:00
Wim Taymans
6af00219e1 media-session: avoid some segfaults 2020-01-16 16:19:09 +01:00
Wim Taymans
940aba8623 data-loop: use pthread_cancel to stop thread
Use pthread_cancel to terminate the data threads. We need this for
jack support but it's generally useful for a data thread.
2020-01-16 13:27:52 +01:00
Wim Taymans
4169d9196d module-access: handle -EACCES as non-flatpak
If we can't access the root filesystem, grant access to the app.
This should not happen but for now it is a workaround for selinux
where we can't access the gnome-shell root when it connects for
screen sharing.
2020-01-15 17:17:56 +01:00
Wim Taymans
4e8d85da2f Fix some unit test
Run abi checks only on x86_64 until we have sizes for more archs
Don't start a daemon in the tests because that would require
XDG_RUNTIME_DIR set
2020-01-15 13:23:49 +01:00
Wim Taymans
1cedfade3a protocol: improve old version check
Check if the pod size is > 4 because the unit test adds one fd
in the first message.
2020-01-15 12:24:11 +01:00
Wim Taymans
043e7f24fe add some more useful defines
Add define to match all ids for nodes and params.
Add define for invalid permissions
2020-01-15 11:15:51 +01:00
Wim Taymans
cf53ededd0 connection: improve old version check
Check the type of the pod in the message instead. Old versions
should not have 0 there, new versions keep the number of file
descriptors, which should be 0 for the first message.
2020-01-15 10:29:58 +01:00
Wim Taymans
a5b3538053 impl-core: handle NULL resources 2020-01-14 18:07:56 +01:00
Wim Taymans
c21c42e943 media-session: pause policy while creating objects
While we are creating objects on the monitor connection, pause the
policy connection until we have completed a roundtrip and the global
id is bound to the new object.

This way, when we resume the policy connection, we can always find the
newly created and bound object. Without the pause, it's possible that
we receive the new global on the policy connection before we got the
bind reply on the monitor connection and then we would end up with 2
proxies that are not linked together correctly.

Fixes #204
2020-01-14 16:38:40 +01:00
Wim Taymans
0ea8a92ea5 core: implement pw_core_set_paused
Make it possible to pause emision of events from the core object.
This is interesting if we need to wait for completion of some operations
on another connection before resuming processing.

See #204
2020-01-14 16:37:01 +01:00
Wim Taymans
6ed219c48c core: add some defines 2020-01-14 11:07:45 +01:00
Wim Taymans
c624ca7591 alsa-monitor: don't crash when dbus connection failed 2020-01-14 10:53:12 +01:00
Wim Taymans
3d8c8b4a85 client: don't update client permissions with defaults
Make the default permissions only apply to other objects than the
client. Otherwise when hiding all objects, we would also hide the
client and be disconnected.
2020-01-14 10:00:54 +01:00
Wim Taymans
6c8fd3c29d media-session: instal media session
Install the example media-session
Load the media session according to the PATH
Include the example directory in the PATH so we can run the media
session.
2020-01-13 16:27:46 +01:00
Wim Taymans
b99074879f policy-node: use the daemon samplerate
Use the samplerate of the daemon to configure the nodes.
2020-01-09 15:52:53 +01:00
Wim Taymans
852ac043d3 Use the DSP format for dsp formats
Use the DSP media subtype to describe DSP formats. DSP formats
don't include the rate, channels and channel position in the
format and must use the rate and duration from the position io. This
makes it possible to later change the samplerate dynamically without
having to renegotiate the graph.

The same goes for the video DSP format, which uses the io_video_size
from the io_position to get the size/stride. Set this up in the node
based on the defaults from the context.

Make it possible to define defaults in the daemon config file, such
as samplerate, quantum, video size and framerate. This is stored in
the context and used for the DSP formats.
2020-01-09 15:18:59 +01:00
Wim Taymans
f42ca8b52e stream: emit io_changed event 2020-01-09 13:27:43 +01:00
Wim Taymans
96d4ec3207 use defined key for factory.name 2020-01-09 09:46:04 +01:00
Wim Taymans
2bca786fff policy-node: use priority of the nodes 2020-01-08 17:29:11 +01:00
Wim Taymans
7c615f4e64 stream: only set media.class when not set before 2020-01-08 15:16:32 +01:00
Wim Taymans
92c26fa124 suspend-node: only suspend devices 2020-01-08 15:16:17 +01:00
Wim Taymans
a3ddc6b744 media-session: add module to suspend nodes 2020-01-08 13:24:06 +01:00
Wim Taymans
b0705a89b0 filter: handle NULL param 2020-01-08 13:22:23 +01:00
Wim Taymans
aa36a72427 main: handle execv failure
Log an error, exit daemon
2020-01-08 12:38:46 +01:00
Wim Taymans
ffbb74c4af policy-node: implement video nodes
Always activate video nodes right away
Implement exclusive access again
2020-01-08 10:48:48 +01:00
Wim Taymans
fa98389fef node: copy more properties to the global
Copy media.type and category to global
Set media_class in example
2020-01-08 10:48:00 +01:00
Wim Taymans
b312e77385 Make simple node policy
Make it possible to run the session manager without endpoint
modules. Add a simple node policy that links nodes.

Move the session-manager implementation and startup of the
endpoint monitors to a separate module.

Handle async set_param on the device
2020-01-07 17:19:09 +01:00
Wim Taymans
3b05896cd6 bluez5: cleanups
Use export_device
2020-01-03 13:02:59 +01:00
Wim Taymans
bdc82bb94b typemap: add more video types 2020-01-03 09:33:59 +01:00