Commit graph

144 commits

Author SHA1 Message Date
Pauli Virtanen
d87f838e09 media-session: don't write to freed memory in sm_object_destroy
Unref of node->handle may also free obj, if it was created by
init_object.
2021-01-09 20:37:01 +02:00
Wim Taymans
962bf4d897 media-session: clean proxy and handle in destroy
After we called destroy on the handle and proxy we should not
try to access them anymore so we set them to NULL.

See #534
2021-01-05 10:05:30 +01:00
Wim Taymans
d3f314cf82 media-session: remove -p option
Place properties in the config file now.
2020-12-31 21:25:38 +01:00
Wim Taymans
0bf1aa8f45 media-session: load properties from config 2020-12-31 13:06:17 +01:00
Wim Taymans
85306917a2 media-session: try to load config from state dir first
First try to load conf from the user config directory and then from
the global config dir. Allows users to copy and modify a custom
config file.
2020-12-31 11:46:54 +01:00
Wim Taymans
f29bc42b4d media-session: improve conf parsing
Just use parse_string to convert the value.
2020-12-31 10:11:10 +01:00
Wim Taymans
24c68b0067 media-session: add config files
Remove -e and -d options
Manage modules in media-session.conf
Add alsa-monitor.conf that can match node/device properties with
a regex and update properties on it. All previous configuration and
more cane be done with this.
2020-12-30 13:15:08 +01:00
Wim Taymans
cb8e627b1e media-session: use new properties method to load state 2020-12-29 13:30:04 +01:00
Wim Taymans
921aba9edf media-session: fix help
Use enabled and disabled options from the implementation so that we
can parse them in help.
2020-12-25 19:47:34 +01:00
Pauli Virtanen
09265e116e media-session: accept multiple -p, -e, and -d command-line arguments
Combine arguments together if given multiple times, instead of using the
last one. Useful, since pipewire.conf appears to not do quotes.

Fixes !348
2020-12-22 12:47:34 +01:00
Wim Taymans
e995d3a832 media-session: store config data as json objects
So that we can use the json string escaping functions for keys
and use multiline config files.
2020-12-01 12:05:08 +01:00
Wim Taymans
19dc150643 media-session: don't emit metadata remove in shutdown
When in shutdown we destroy all objects but don't remove all
the metadata associated with them, like route settings.
2020-12-01 12:03:28 +01:00
Wim Taymans
b8300c663b improve some errors
Silence some -ENOENT warnings, they can happen when the object we
are introspecting is destroyed
2020-11-29 16:22:50 +01:00
Wim Taymans
261144c27f media-session: add /etc/pipewire/media-session.d/ dir
Placing files in it will activate options in the session manager.
2020-11-25 16:13:20 +01:00
Wim Taymans
c5ac48c5f4 media-session: clear metadata 2020-11-23 19:35:23 +01:00
Elliott Sales de Andrade
86fd6a0d3e Fix some possible-NULL pointer usage. 2020-11-23 15:36:08 +00:00
Wim Taymans
7ca8491be3 media-session: store values as json
Save settings as jason and use a small json compatible tokenizer to
load settings instead of our own less flexible format.
Save settings with a prefix and filter out entries without prefix
Listen for changes in restore.stream metadata and update properties.
2020-11-22 10:00:58 +01:00
Wim Taymans
5af2efdaa6 media-session: expose metadata method
Expose a method to create an export metadata with a certain name.
2020-11-20 17:58:08 +01:00
Wim Taymans
7ac23c8b82 improve some docs about options
See #387
2020-11-17 21:00:17 +01:00
Wim Taymans
10207456f0 media-session: don't start pulse-bridge automatically
Don't start the pulse-bridge automatically because we don't
know what socket to listen on.
Also, listen by default on a safe socket, not used by pulseaudio.
2020-11-12 16:50:24 +01:00
Wim Taymans
1d001974d7 media-session: enable pulse-bridge by default
Now that we don't interfere with pulseaudio, enable it by default.
2020-11-12 11:11:53 +01:00
Greg V
cc0386e1c5 media-session: ifdef Linux-specific file option 2020-11-09 11:14:20 +00:00
Wim Taymans
1570e62635 remove hooks from objects
Remove the hooks we installed on objects in the destroy/free event
or before calling _destroy. This is not really needed but it is
a nice thing to do because it calls the hook removed callbacks.
2020-11-06 15:53:32 +01:00
Wim Taymans
4f2b1c7684 media-session: avoid recursive rescan
A rescan can trigger a new rescan and with a blocking rountrip this
can recursively never end. Catch a rescan while rescanning and queue
it for when we end the current scan.

Fixes #364
2020-11-03 20:25:51 +01:00
Wim Taymans
6962c27af9 media-session: disable bluez5 and pulse-bridge by default
Some distros don't patch this up which interferes with the pulseaudio
server.

Fixes #360
2020-11-03 09:11:20 +01:00
Wim Taymans
c43026d93e don't handle EINTR and EAGAIN as the same
EAGAIN means a non-blocking operation would block and we should not
try again right away but leave the loop and wait instead.

See #358
2020-11-02 16:43:56 +01:00
Wim Taymans
e094640c7b handle EINTR and EAGAIN
Just do the call again instead of failing or logging an error.

Fixes #358
2020-11-02 14:51:07 +01:00
Wim Taymans
f953efdefb media-session: improve enabled/disabled options
Always use a default set of options and have enable/disable
add/remove options to/from it. Previously to enable just one option
you had to list all the other default enabled options as well.
2020-10-30 09:54:18 +01:00
Wim Taymans
a2c70781a3 media-session: use rtkit for session manager data thread 2020-10-21 16:36:37 +02:00
Wim Taymans
3733a5e219 media-session: save last target_node
Keep a per node entry of the saved target node and use this when
there is no other target node.
When explicitly moving a stream, save the new target node.
2020-10-14 12:35:27 +02:00
Wim Taymans
f0102fd490 pulse: move pulse protocol to module 2020-10-08 18:06:11 +02:00
Wim Taymans
d180b8d927 beginnings of pulse protocol 2020-10-08 18:06:11 +02:00
Wim Taymans
30dfe16c52 media-session: destroy errored links
When a link we create is in error, destroy it.
2020-09-14 20:19:44 +02:00
Sanchayan Maity
f4a949dc3a examples: media-session: Conform to XDG base directory spec
Currently pipewire-media-session uses ~/.pipewire-media-session for
storing configuration. Use home directory as specified by XDG base
directory specification viz. XDG_CONFIG_HOME and fall back to using
a default of $HOME/.config as per the spec if XDG_CONFIG_HOME is not
set or empty. Also in addition, all cases are now handled the same
and always end up using "%s/.config/pipewire-media-session".

If neither XDG_CONFIG_HOME or HOME are set, fall back to the earlier
approach.

Fixes: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/271

Signed-off-by: Sanchayan Maity <sanchayan@asymptotic.io>

Fixes !298
2020-09-09 17:51:30 +02:00
Wim Taymans
b6e78f5577 improve debug 2020-09-03 11:14:58 +02:00
Wim Taymans
3174e8b69e media-session: fix spelling mistake 2020-08-17 19:30:26 +02:00
Wim Taymans
688a1ab082 media-session: add module to restore stream settings 2020-08-17 17:55:20 +02:00
Wim Taymans
d337abf690 media-session: escape and unescape keys when saving
So that we can allow space in the keys.
2020-08-17 12:12:11 +02:00
Wim Taymans
48a7e83fab media-session: add module to restore route volumes 2020-08-17 11:17:21 +02:00
Wim Taymans
05416b497c media-session: improve property save/load
Allow spaces in the property values.
2020-08-17 11:10:16 +02:00
Wim Taymans
4ad6c627a0 media-session: add module to restore card profile
Save card profiles to file and restore.
2020-08-13 17:01:47 +02:00
Wim Taymans
efdeceddab media-session: Add module to load/save default nodes
Nodes are stored with their (unique) name and restored with their
ID on the metadata.
2020-08-13 11:33:48 +02:00
Wim Taymans
8a4dd83883 media-session: add API to load/store state 2020-08-13 11:33:48 +02:00
Wim Taymans
a0777d7806 policy-node: only set peer when we actually linked something 2020-08-07 10:50:30 +02:00
Wim Taymans
7cdef8aa32 media-session: improve debug 2020-08-06 17:11:35 +02:00
Wim Taymans
f2cc0e6723 media-session: add some debug for enum-param 2020-07-31 15:21:39 +02:00
Wim Taymans
5bdd65e066 device: pass original seq in async reply
When we get an async reply from the implementer, use the original
seq from the caller in the reply.

Fixes !287
2020-07-31 15:19:45 +02:00
Wim Taymans
5e51cbe48e media-session: improve param enumeration
Don't use subscribe, enum is more manageable.
Use user data field to check for changes.
Only enumerate readable params.
Enum all node params.
2020-07-31 13:59:25 +02:00
Wim Taymans
e35586cd15 media-session: link MONO/UNKNOWN channels only once
Try to only link the MONO and UNKNOWN input ports once
2020-07-27 17:41:52 +02:00
Wim Taymans
34fc7ff529 media-session: link unknown and mono streams to something 2020-07-24 17:39:29 +02:00