Commit graph

344 commits

Author SHA1 Message Date
Barnabás Pőcze
f5d51162c4 treewide: mark things static and const
Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.

All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
2021-06-30 14:44:08 +02:00
Wim Taymans
2c5d89ff19 pw-cli: allow '-' for port/node in create-link
Passing a '-' as the port or node for create-link will omit sending
the property to create-link so we can check if the link factory handles
missing properties too.

See #1365
2021-06-30 11:52:57 +02:00
Wim Taymans
5497d2d907 pw-cat: fix format string 2021-06-28 17:21:28 +02:00
Niklāvs Koļesņikovs
71d39e90ed meson: adds post meson setup/--reconfigure summary for auto features
As suggested by George Kiagiadakis, adds calls to summary() function
for each feature that is by default set to auto, so that an overview
of their effective state is printed at the end of meson setup or
meson --reconfigure command.

Currently ordering is a bit messy but tidying it up would detach
the summary() functions from the dependencies they rely on and could
be done later along with meson_options.txt re-ordering so that the
two match as much as possible.
2021-06-25 08:31:12 +00:00
George Kiagiadakis
59407d2f08 includes: update all references to extensions to point to pipewire/extensions
This also brings the advantage that all tools, examples, modules, components
can also be compiled standalone out-of-tree using libpipewire from the system
2021-06-18 17:54:18 +03:00
Wim Taymans
07d43a001b pw-dump: remember the subject of metadata
So that we can also print it instead of printing 0.
2021-06-16 12:17:30 +02:00
Peter Hutterer
0054319d88 meson.build: add -D_GNU_SOURCE to the project arguments
This appends it to every compilation command so we can get rid of the c_args
for (almost all) executables.
2021-06-09 07:47:51 +00:00
Wim Taymans
9a90030596 pw-cli: fix command parsing after pw_split changes
Don't assume anything about the way the split function maintain the
state.
2021-06-07 11:17:45 +02:00
Wim Taymans
6971d11901 pw-cat: support u8 format as well 2021-06-03 10:10:18 +02:00
Peter Hutterer
e0471c6757 pipewire: allow NULL pointers in pw_properties_free()
Just like the real free() we should just ignore a NULL pointer, makes the
caller code easier for those instances where properties are optional.

Patch generated with concinelle with a few manual fixes.
2021-06-02 10:56:46 +00:00
Peter Hutterer
a1e821c259 pw-dump: use the spa_ato* helpers for string to number conversions 2021-06-02 07:39:41 +00:00
Peter Hutterer
1a5faa7b52 spa: add a header for ANSI color sequences
Makes the code more readable and guarantees we use the same sequences for the
same colors everywhere.
2021-06-02 14:17:29 +10:00
Wim Taymans
f383ac21dd pw-cat: remove debug 2021-05-27 15:26:09 +02:00
Wim Taymans
b9b89b92b2 spa: add some latency helpers
Add more fields to the latency object.
Add methods to create, parse and process latency info.
2021-05-27 15:26:09 +02:00
Wim Taymans
f007ca475c pw-cli: handle failure to create context
Fixes #1234
2021-05-26 10:18:15 +02:00
Peter Hutterer
e1211e6a94 tools: fix scan-build errors for unused variables
All cases of value stored but never read
2021-05-26 07:51:27 +00:00
Peter Hutterer
92514d57e4 treewide: replace plain strcmp() calls with spa_streq 2021-05-18 22:10:27 +10:00
Peter Hutterer
522f87d5ea treewide: replace strcmp() != 0 with !spa_streq
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
95a84e797a treewide: replace !strcmp() with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Peter Hutterer
7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Wim Taymans
59842b3bd6 make and use pw_properties_serialize_dict()
Remove the multiple other variants and make a better one. Flags are for
future options for escaping and formatting.
2021-05-14 09:08:46 +02:00
Barnabás Pőcze
68f75bbd57 tools/pw-dump: fix parentheses around isatty() call
Previously,

  isatty(fileno(data.out) && getenv("NO_COLOR") == NULL))

would call `isatty()` with

  fileno(data.out) && getenv("NO_COLOR") == NULL

as its argument. This meant that, for example,

  NO_COLOR=1 pw-dump

would still produce colored output when run with
a TTY as its standard input.

Fix that by moving the parenthesis.

Fixes: af63d08453 ("tools/pw-dump: only print colors if we're connected to a terminal")
2021-05-08 03:57:34 +02:00
Peter Hutterer
af63d08453 tools/pw-dump: only print colors if we're connected to a terminal
We don't want ansi escape codes in the output of `pw-dump > log`. And where
colors are needed after the fact, it's easy to just run `jq . $file`.
2021-05-07 06:57:31 +00:00
Peter Hutterer
2405f0942b spa/buffer: rename SPA_MEMBER to SPA_PTROFF
SPA_MEMBER is misleading, all we're doing here is pointer+offset and a
type-casting the result. Rename to SPA_PTROFF which is more expressive (and
has the same number of characters so we don't need to re-indent).
2021-05-06 09:39:39 +00:00
Wim Taymans
3c11b75e32 pw-cli: allow setting keys by their value.
Makes things like:

  pw-cli s 102 Props '{ 16777216: 1.2 }'

work. Useful when dealing with custom properties that don't have a name
in the type array.
2021-05-03 11:50:42 +02:00
Wim Taymans
7145b2becf pw-cli: add support for creating Struct in pod
Support creating Struct as well. When an object property is marked as
Struct, use [] to start the struct and copy each item with its type into
the struct:

pw-cli s 0 Route '{ info = [ "foo": 0.1  "bar": null [ 0.1 10 "hat" ]] }'
2021-04-30 17:21:42 +02:00
Wim Taymans
aea55f662a i18n: move to separate .h file
So that we can include it where needed and don't cause redefined _()
macros for other projects.

Fixes #1120
2021-04-30 09:57:30 +02:00
Wim Taymans
c52637f783 pw-loopback: implement with the module
Implement pw-loopback by loading the module-loopback.

Fixes #1061
2021-04-22 16:16:21 +02:00
Wim Taymans
66e37f6bb7 pw-cli: free properties in create_ functions 2021-04-19 16:37:05 +02:00
Wim Taymans
036c54b043 Add i18n support for some more user-visible strings 2021-04-15 17:56:40 +02:00
Peter Hutterer
223f20709d meson: replace join_paths(a, b) with a / b
More readable and from the meson reference manual:
(since 0.49.0) Using the/ operator on strings is equivalent to calling join_paths.
2021-04-15 06:57:00 +00:00
Wim Taymans
23854539fe pw-dump: reparse and format JSON metadata values
Reparse the metadata value as json and dump it. This ensures the JSON
is valid and that the colors are applied properly.
2021-04-13 20:59:42 +02:00
Wim Taymans
bded2a02a0 pw-dump: output Spa:String:JSON values as literal
Don't escape the Spa:String:JSON types in the metadata as it is
supposed to be valid JSON that can be output directly. We might want
to reparse and reformat it later to be sure.
2021-04-13 19:03:06 +02:00
Wim Taymans
ca4b549472 pw-cli: handle properties without type info
Some properties don't have type info and then we want to skip
constructing the pod instead of crashing. This makes it possible to
cut and paste the output of pw-dump Route into pw-cli s <card> Route,
for example.
2021-04-09 16:14:50 +02:00
Wim Taymans
d57979517e pw-loopback: fix help text
The id in the help text is not supported
2021-04-09 15:56:00 +02:00
Wim Taymans
6217f20c04 pw-cli: allow param names in enum-params
So that "pw-cli e <object.id> Props" works
2021-04-09 15:55:04 +02:00
Wim Taymans
87706c7442 pw-cli: use more powerful pw_properties_new_string()
Remove our custom property parsing code and use
pw_properties_new_string() for more powerful syntax.
2021-04-09 15:53:33 +02:00
Wim Taymans
9019edec31 pw-link: improve unlink
When we only have one argument, just check the link id and if that
fails don't try to check the second argument because we would crash.
2021-04-08 15:32:06 +02:00
Wim Taymans
1b29531336 pw-link: make it possible to use ids
Make it possible to link/unlink using port ids
Make it possible to unlink using the link id
2021-04-08 13:09:51 +02:00
Wim Taymans
40194833ce pw-link: add option to print ids
Add an option to print the object ids
Improve monitor output
2021-04-08 12:54:53 +02:00
Wim Taymans
a296007ed9 pw-link: implement monitor 2021-04-08 12:08:04 +02:00
Wim Taymans
67a3f28bdf tools: add new pw-link tool
pw-link can be used to list, link and unlink ports.
2021-04-07 18:56:44 +02:00
Wim Taymans
3dfd7f26b9 meson: improve tools build
Build the tools and sources from a list.
2021-04-07 18:56:44 +02:00
Erkki Seppälä
6a10ac36aa pw-dot: added -9/--90 for outputting using 'splines = ortho'
This results in always drawing edges with 90-degree angles instead of
smooth splines. Graphs laid out this way may be look nicer sometimes,
but it is slower to lay out with large graphs.
2021-04-02 12:04:32 +03:00
Erkki Seppälä
71b53f1590 pw-dot: added -L/--lr for outputting the graph using 'rankdir = "LR"'
Graphs laid out this way may be look nicer sometimes.
2021-04-02 12:04:32 +03:00
Erkki Seppälä
21a36f3c51 pw-dot: using output - will write the output to stdout
This enables single-liners for viewing the graph in applicable shells.
2021-04-02 12:04:32 +03:00
Erkki Seppälä
4a0b7fa9b8 pw-dot: send diagnostic messages to stderr, not stdout
This will help when using stdout for other purposes in the
future (e.g. next commit).
2021-04-02 12:04:32 +03:00
Wim Taymans
90de408e31 loopback: use _raw_build helpers
Now that the raw_builder supports wildcard for rate, use it in loopback
and add an option to force resampling as well.
2021-04-01 10:47:23 +02:00
Wim Taymans
c85a04fb49 tools: add some check when parsing the profile info
Fail when we can't parse the profile info to avoid using invalid
values.
2021-03-27 20:37:26 +01:00
Wim Taymans
ae22852a9b remove some useless checks
The variable was already dereferenced above and thus can't be NULL
2021-03-27 20:36:43 +01:00