Commit graph

2202 commits

Author SHA1 Message Date
Wim Taymans
1ab6167f35 port: add function to get port info 2020-02-25 15:05:31 +01:00
Wim Taymans
f37b9ad67b impl-node: fix reposition handling
We only need to sync clients when start/stop has been issued otherwise
we simply write the new position values in the driver segment.

Don't overwrite bar/video position info with invalid values.
2020-02-24 16:49:07 +01:00
Wim Taymans
41989f4889 client-node: don't overwrite the chunk memory pointer
When the client uploads a buffer, copy all data fields except for
the chunk memory that we configured before.
If we overwrite the chunk memory, the users of the buffer would not
be able to find the chunk memory anymore and crash or fail.
2020-02-24 15:08:27 +01:00
Wim Taymans
9bec2e5d8a pw-cat: improve midi errors
EINVAL for invalid events and file
ENOENT for unknown event
2020-02-24 10:20:33 +01:00
Wim Taymans
8ecef35e80 client-node: update n_buffers after we can process them
Make sure we don't configure the buffers before we manage to
completely process them or else we are left with an invalid list
of buffers.

See #209
2020-02-24 10:20:33 +01:00
Wim Taymans
e205523f0a docs: update docs 2020-02-24 10:20:33 +01:00
Fabrice Fontaine
a269bc0bed meson: add tests option
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-02-23 00:09:16 +01:00
Wim Taymans
792402849f stream: print error 2020-02-22 13:50:20 +01:00
Wim Taymans
81a7908d44 filter: print error 2020-02-22 13:50:20 +01:00
Wim Taymans
9cdcd07c02 example: update example 2020-02-22 13:50:20 +01:00
Wim Taymans
f9dccccf91 spa-node: fix properties while loading.
Update the example in the config file to load a spa node
2020-02-21 16:27:00 +01:00
Pantelis Antoniou
b445bdea27 Fix change_mask string generation
The change_mask string generation was buggy and confusing.
Fix it with something more usable.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-02-21 15:14:31 +01:00
Wim Taymans
5517a96202 link: don't try to do things with destroyed ports
When a port is destroyed, mark it as destroyed and avoid doing things
with the port because it is likely to fail.
2020-02-21 15:08:28 +01:00
Wim Taymans
5074ca37ff protocol-native: Improve errors
A missing XDG_RUNTIME_DIR results in ENOENT, like on the server
side.
A too long name results in ENAMETOOLONG, like on the server side.
When we can't find the socket, return EHOSTDOWN to make it more
obvious what is going.
2020-02-21 15:05:43 +01:00
Wim Taymans
b33bd68bac improve error messages
Log an error when we send an error to the client so that we don't need
to log and error anymore.
Improve the error messages when we can
Move some warnings and errors to debug
2020-02-21 15:02:55 +01:00
Wim Taymans
918acd61ef pw-cli: use core object to map id to proxy
We can use the core object to get a proxy for a given id. From there
we can find the user data and the associated global if any.
2020-02-21 11:47:34 +01:00
Pantelis Antoniou
4175191d19 Fix printf attribute compilation errors
Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-02-21 11:30:49 +01:00
Pantelis Antoniou
7ead270265 Implement JSON/YAML command for graph tree traversal
Implement a single command that allows viewing all information
about a remotes properties/parameters and info variables.

This patch creates a framework for accessing properties using
a simple dotted variable access method or JSON/YAML path expressions.

The root of the tree is a sequence of all globals objects, and
accessing a the first one is simply 0 (or /0 is JSON/YAML path form).

	pipewire-0>>graph 0
	id: 0
	type: PipeWire:Interface:Core
	permissions: rwx
	version: 3
	info:
	    id: 0
	    cookie: 1602594817
	    user_name: panto
	    host_name: nuc2
	    version: 0.2.96
	    name: pipewire-0
	    change_mask: props
	    props:
		pipewire.core.name: pipewire-0
		context.profile.modules: none
		pipewire.core.daemon: 1
		link.max-buffers: 16
		default.clock.rate: 48000
		default.clock.quantum: 1024
		default.clock.min-quantum: 32
		default.clock.max-quantum: 8192
		default.video.width: 640
		default.video.height: 480
		default.video.rate.num: 25
		default.video.rate.denom: 1
		mem.allow-mlock: true
		cpu.max-align: 32
		object.id: 0
	properties:
	    pipewire.core.name: pipewire-0

Displaying a nodes information is simply:

	pipewire-0>>graph /32
	id: 32
	type: PipeWire:Interface:Node
	permissions: rwx
	version: 3
	info:
	    id: 32
	    max_input_ports: 128
	    max_output_ports: 0
	    n_input_ports: 2
	    n_output_ports: 2
	    state: suspended
	    error:
	    change_mask: "n_input_ports,n_output_ports,state,props,params"
	    props:
		object.path: alsa:pcm:HDMI:3:playback
		api.alsa.path: "hw:0,3"
		api.alsa.pcm.card: 0
		api.alsa.pcm.device: 3
		api.alsa.pcm.subdevice: 0
		api.alsa.pcm.stream: playback
		api.alsa.pcm.id: "HDMI 0"
		api.alsa.pcm.name: "HDMI 0"
		api.alsa.pcm.subname: "subdevice #0"
		api.alsa.pcm.class: generic
		api.alsa.pcm.subclass: generic-mix
		api.alsa.pcm.sync-id: 00000000:00000000:00000000:00000000
		device.id: 26
		factory.name: api.alsa.pcm.sink
		priority.master: 696
		priority.session: 696
		media.class: Audio/Sink
		node.name: alsa_card.pci-0000:00:03.0.playback.3.0
		node.description: "Built-in Audio (HDMI 0)"
		factory.id: 17
		client.id: 24
		device.api: alsa
		node.driver: true
		factory.mode: merge
		audio.adapt.slave:
		library.name: audioconvert/libspa-audioconvert
		object.id: 32
	    params:
		EnumFormat:
		    mediaType: audio
		    mediaSubtype: raw
		    format:
			default: S32LE
			alt0: S32LE
			alt1: S16LE
		    rate:
			default: 48000
			min: 32000
			max: 48000
		    channels: 2
		    position:
		      - FL
		      - FR
		PropInfo:
		  - id: volume
		    name: Volume
		    type:
			default: 1.000000
			min: 0.000000
			max: 10.000000
		  - id: mute
		    name: Mute
		    type:
			default: false
			alt0: false
			alt1: true
		  - id: channelVolumes
		    name: "Channel Volumes"
		    type:
			default: 1.000000
			min: 0.000000
			max: 10.000000
		Props:
		    volume: 1.000000
		    mute: false
		    channelVolumes: []
		Format: {}
		EnumPortConfig:
		  - direction: Input
		    mode: dsp
		  - direction: Output
		    mode: dsp
		  - direction: Input
		    mode: convert
		  - direction: Output
		    mode: convert
		PortConfig: {}
	properties:
	    object.path: alsa:pcm:HDMI:3:playback
	    factory.id: 17
	    client.id: 24
	    device.id: 26
	    priority.session: 696
	    priority.master: 696
	    node.description: "Built-in Audio (HDMI 0)"
	    node.name: alsa_card.pci-0000:00:03.0.playback.3.0
	    media.class: Audio/Sink

To simply display the parameters of the same object:

	pipewire-0>>graph 32/info/params
	EnumFormat:
	    mediaType: audio
	    mediaSubtype: raw
	    format:
		default: S32LE
		alt0: S32LE
		alt1: S16LE
	    rate:
		default: 48000
		min: 32000
		max: 48000
	    channels: 2
	    position:
	      - FL
	      - FR
	PropInfo:
	  - id: volume
	    name: Volume
	    type:
		default: 1.000000
		min: 0.000000
		max: 10.000000
	  - id: mute
	    name: Mute
	    type:
		default: false
		alt0: false
		alt1: true
	  - id: channelVolumes
	    name: "Channel Volumes"
	    type:
		default: 1.000000
		min: 0.000000
		max: 10.000000
	Props:
	    volume: 1.000000
	    mute: false
	    channelVolumes: []
	Format: {}
	EnumPortConfig:
	  - direction: Input
	    mode: dsp
	  - direction: Output
	    mode: dsp
	  - direction: Input
	    mode: convert
	  - direction: Output
	    mode: convert
	PortConfig: {}

The graph command also supports the following options:

	-y Select YAML format (this is the default)
	-j Select JSON format
	-n Display numeric instead of textual IDs
	-f Display full type info, i.e. instead of EnumFormat will
	   display Spa:Enum:ParamId:EnumFormat

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-02-21 11:30:49 +01:00
Pantelis Antoniou
3b53a6e049 pw-cli: Collect and display parameters from global symbols
Until now there was no method to display parameters along with
information of their parent object.

This patchset stores parameter info in the global object so
that it may displayed along with its parent object.

This is a necessary step to be able to display and modify parameters
in a simple form like the following

pipewire-0>> set 12 volume=0.7
pipewire-0>> get 12 volume
0.7

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-02-21 11:30:49 +01:00
Pantelis Antoniou
e58d33e8d8 Terminate PW_KEY_SEC_LABEL key with '\0'
The socket call does not terminate the string with '\0' so
we have to use the length explicitly.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
2020-02-21 11:30:49 +01:00
Wim Taymans
8b874a9514 pw-cat: handle midi EOF better
Return 0 when there are no more events, 1 when we have an event and
< 0 for errors. Use this to correctly push the last set of events on
EOS and then return 0 and stop without an error.
2020-02-21 11:19:35 +01:00
Wim Taymans
d8bac82e72 improve logging
Remove some harmless warnings from the log
Remove some excessive info logging
2020-02-21 11:09:34 +01:00
Wim Taymans
a528189d26 slave -> follower
We use master/follower terminology everywhere.
2020-02-21 10:47:32 +01:00
Wim Taymans
bdeeebfdd4 enable and fix -Werror=suggest-attribute=format 2020-02-20 18:20:04 +01:00
Wim Taymans
2a3bf485e7 pw-dot: rename lightgreen to palegreen
lightgreen does not seem to exist for me as a color, dot complains.
2020-02-20 13:28:34 +01:00
Wim Taymans
d3634aca7e media-session: rework device reservation
Monitor the device reservation objects and mark the device available.
Don't select nodes from devices that are not available.
Acquire the device reservation when a device starts.
Release the device reservation when we suspend the device again.
2020-02-19 18:15:57 +01:00
Wim Taymans
11086f23ea pod: add and use reserve_bytes helper 2020-02-19 11:02:00 +01:00
Wim Taymans
cc1ed84f9f midi: simplify some things 2020-02-19 10:48:16 +01:00
Wim Taymans
7df66cd6ad pw-cat: keep our own time
Don't try to use the time from the io_position, it is updated in
the RT thread and might be slightly wrong for our purposes.
2020-02-19 10:19:59 +01:00
Wim Taymans
ea911f2e3f tweak buffers a little
JACK can handle 2 buffers at most, make the default buffer allocator
allocate 2 buffers when no params are given.
Prefer 2 buffers, it allows some form of async fill/consume
2020-02-19 10:17:00 +01:00
Wim Taymans
ddcb08a98a pw-cat: read midi file from memory
mmap the midi file and read from memory. Simplifies some things and
allows us to potentially parse from the RT thread later.
2020-02-19 09:58:47 +01:00
Wim Taymans
463b9e4e29 buffers: handle -ENOENT
enum_param should return -ENOENT when the param is not known.
When negotiating buffers handle -ENOENT. This means the port does
not know about the property and we should assume anything is fine
so just use the filter from the first port.
2020-02-18 17:34:41 +01:00
Wim Taymans
b6a6d1f0bb pw-cat: fix tempo changes
Use time in seconds as event timestamp.
Apply tempo from the new events, keep track of elapsed time and
time since tempo change to get the right time.
Skip metadata midi in pw-cat.
2020-02-18 16:13:35 +01:00
Wim Taymans
fe616e38d8 pw-cat: add midi support 2020-02-18 13:38:26 +01:00
Wim Taymans
427a6316d3 stream: also call process when queue is empty
When we just picked a buffer from the queue and it is now empty,
call the process method to fill up the queue again or else we
won't have a buffer for the next wakeup.
2020-02-18 13:38:25 +01:00
Wim Taymans
1239009d30 stream: add port properties
Set the port DSP property when dealing with midi.
2020-02-18 10:50:53 +01:00
Wim Taymans
319df9fce9 pw-cat: add option to set resampler quality 2020-02-14 20:34:08 +01:00
Wim Taymans
0a26c478f7 pw-cat: small cleaups
Set endianness correctly
Move setup of output file format outside of sample format function.
2020-02-13 09:51:25 +01:00
Wim Taymans
5e71a01e8d pw-cat: fix setup of defaults
In record mode, setup the parameters before we open.
2020-02-13 08:59:41 +01:00
Wim Taymans
dfdbec1303 node: improve debug of params
List the param id and the name
2020-02-12 17:58:22 +01:00
Wim Taymans
fe85a3b817 pw-cat: refactor a bit
Try to keep the sndfile code in one place
2020-02-12 17:57:42 +01:00
Wim Taymans
e5bdb04b3a pass data around instead of resource
Avoids method calls to get the userdata from a resource
2020-02-12 16:32:55 +01:00
Wim Taymans
b79e63cded device: fix call to enum_params, we need to pass data 2020-02-12 16:29:22 +01:00
Wim Taymans
e72129b9ca device: fix data pointer for subscribe_params 2020-02-12 16:24:31 +01:00
Wim Taymans
495dc7c3af device: implement subscribe_params
Also add subscribe params for the device, like for Node and Port.
2020-02-12 16:07:10 +01:00
Wim Taymans
df65e0bcd3 pw-cat: fix remote name option 2020-02-12 13:39:47 +01:00
Wim Taymans
f726a77385 filter: expose pw_filter_get_name() 2020-02-12 08:57:09 +01:00
Georges Basile Stavracas Neto
4778b5911e pipewire/filter: Remove duplicated function declaration
pw_stream_get_name() is already declared at steam.h, and including
filter.h breaks the build with more strict build flags.
2020-02-11 17:43:45 -03:00
Wim Taymans
c82e38ad35 conf: limit buffers to 16
Old v0 clients can only handle up to 16 buffers. It's unfortunate that
we have to enforce this globally but otherwise it is possible that
a new client allocated more buffers which it then tries to share with
an old client and fail.
2020-02-11 16:03:38 +01:00
Wim Taymans
1a6848801f fix compiler warnings 2020-02-11 15:25:53 +01:00