Commit Graph

90 Commits

Author SHA1 Message Date
Julian Bouzas
412fae485a m-lua-scripting: make sure pod is successfully parsed
Otherwise show a warning
2021-06-25 08:50:08 -04:00
Julian Bouzas
671b8110d9 m-lua-scripting: make sure lua type is valid 2021-06-25 08:50:08 -04:00
Julian Bouzas
c423012238 m-lua-scripting: fix conversion from SPA_TYPE_Bytes to LUA_TNUMBER 2021-06-25 08:50:08 -04:00
George Kiagiadakis
2668900e18 lua: improve the object:activate() callback to report errors
There is now a second param to the callback that is an error string,
if any error happened
2021-06-10 14:53:08 +03:00
George Kiagiadakis
892129bd08 lua: implement metadata:set() 2021-06-08 13:40:13 +03:00
George Kiagiadakis
77454243bc lua: fix refcounting of metadata iterator
wplua_push* takes a full ref
2021-06-08 13:40:13 +03:00
George Kiagiadakis
80fad18e3d lua: remove hack around WpObjectInterest since we can _ref() it now 2021-06-07 18:01:49 +03:00
George Kiagiadakis
38f7483793 state: remove support for groups and propagate save errors
There is no real use for groups in our API. Just use the name of
the file as the default group and be done with it...
Storing multiple groups with this API is problematic because it
forces flushing the file to disk multiple times, one for each group,
and it's just more performant if we use a prefix in the keys
to implement some form of logical separation.

This commit also makes the GKeyFile a temporary object. As we
always load the file from the file system in _load()
and we always replace its contents with a new dictionary in _save(),
there is no point in keeping the keyfile's internal data structures
stored in memory.

Save errors are now also propagated to adhere to the programming
practices of GObject
2021-06-04 18:36:19 +03:00
Julian Bouzas
3fbcf05c9b pipewire-object: take ownership of param argument
The wp_pipewire_object_set_param API must take ownership of the param argument
as described by the documentation.
2021-06-03 14:53:00 -04:00
George Kiagiadakis
a604ac4c0c lua: don't crash if an iterator is NULL
simply behave as if the iterator is valid and has no items in it
2021-06-02 19:38:51 +03:00
George Kiagiadakis
9db0e741cd lua: allow the Log api to debug boxed objects (useful for pods) 2021-06-02 19:38:51 +03:00
George Kiagiadakis
132de309cb lua: fix PipewireObject api: s/set_params/set_param/ and cleanup 2021-06-02 19:38:51 +03:00
George Kiagiadakis
53fdc14d5d lua: add WpState bindings 2021-06-02 19:38:51 +03:00
George Kiagiadakis
e567637d37 docs: convert lua api docs to pure rst
Not all the docs are there yet, this is WIP
2021-05-25 14:19:53 +03:00
Raghavendra
80e7b20a73 docs: Add Lua API documentation 2021-05-25 14:19:53 +03:00
George Kiagiadakis
f0d33cb873 endpoint: remove wp_endpoint_create_link()
Not used and not useful with the current design.
May be reverted in the future, if necessary.
2021-05-21 19:57:31 +03:00
George Kiagiadakis
ac9e1e89c4 wp: remove WpSession and WpEndpointLink
We have ended up not using them, so let's not carry them
in the ABI of 0.4

We can always revert that, but let's first decide how
these objects should be used
2021-05-21 19:57:31 +03:00
Julian Bouzas
419af5a228 spa-pod: respect the SPA size for long and int APIs
Fixes some issues for 32bit architectures
2021-05-12 11:53:31 -04:00
George Kiagiadakis
fc5aa7db1f lua: rename Plugin() to Plugin.find()
Plugin() is confusing because it's not a constructor, it just finds
an existing instance of a plugin object. All other camel-case
functions are constructors in the current lua API.
2021-05-07 11:53:47 +03:00
George Kiagiadakis
a93dbf0845 wp: remove WpSessionBin
This is no longer used and likely not very useful now that we have
a simpler design.
We can re-add it in the future if necessary, but let's keep it out
of the 0.4 release.
2021-05-06 16:04:39 +03:00
George Kiagiadakis
257d5cba47 wp: rename debug.{h,c} to log.{h,c}
Also rename the intermediate lua api table WpDebug -> WpLog

Keeps things more consistent with the function names (wp_log*),
with the lua api (Log.*) and with pipewire using log.{h,c} as well.
After all, these functions are for logging...
2021-05-06 15:50:07 +03:00
George Kiagiadakis
c2834ea344 lua: remove the ability to specify spa_libs in the lua config
This is not useful, we can do this on the pipewire-style config files
2021-04-22 17:44:17 +03:00
George Kiagiadakis
af9b9a84f0 daemon: init export core in the daemon and share it with modules
Also, use a context property to control whether to enable this core
or not and enable it only in the daemon
2021-04-22 15:07:47 +03:00
George Kiagiadakis
b46587393c lua: change the "wireplumber.interactive" property to "wireplumber.daemon"
with inverted semantics
2021-04-22 13:48:06 +03:00
George Kiagiadakis
4d5959ffdb lua: add WpObject get_active/supported_features() bindings 2021-04-13 19:34:07 +03:00
George Kiagiadakis
7c617742a9 lua: add g_get_real/monotonic_time() bindings
Useful to tag objects with their creation time
2021-04-13 19:33:06 +03:00
George Kiagiadakis
21dccd5edb lua: add a Debug.dump_table() utility function
Prints a table recursively with print()
2021-04-09 15:52:17 +03:00
George Kiagiadakis
28ff1061f5 lua: add a Core.require_api() utility function
This function loads and enables "api" plugins and makes them
available in the specified callback. This is intended to be used
by interactive scripts in order to get access to "api" plugins
such as the new "default-nodes-api" and "mixer-api"
2021-04-09 15:52:17 +03:00
Julian Bouzas
317550a7bd m-lua-scripting: add object manager get_n_objects API 2021-04-08 14:07:05 -04:00
George Kiagiadakis
0ecefcb55d policy-node: use default-nodes-api plugin 2021-03-31 13:10:13 +03:00
George Kiagiadakis
fd2ddffdd7 lua: s/Feature.Object.ALL/Features.ALL/
It looks nicer to have groups of features in 'Features.'
instead of 'Feature.'
2021-03-29 18:35:35 +03:00
Julian Bouzas
06c12fe7c2 m-lua-scripting: add get_associated_proxy session item Lua API 2021-03-26 16:16:02 -04:00
Julian Bouzas
3aef916d51 session-item: add _register and _remove API
Allows using object managers to listen for registered items
2021-03-18 14:30:11 -04:00
Julian Bouzas
120aab04ae session-item: refactor and inherit from WpObject
This adds WP_SESSION_ITEM_FEATURE_ACTIVE and WP_SESSION_ITEM_FEATURE_EXPORTED
features, so _activate and _export APIs have been removed. Modules and unit
tests have also been updated.
2021-03-18 14:30:05 -04:00
Julian Bouzas
12b2c00d0b lib: remove WpEndpointStream API
Add all that goes with it.
2021-03-18 12:10:37 -04:00
Julian Bouzas
1b5980476b m-lua-script: add object_deactivate API 2021-03-15 07:52:57 -04:00
Julian Bouzas
003afc3e7b m-lua-script: add closure for object_activate API 2021-03-15 07:52:55 -04:00
Julian Bouzas
ab04334448 m-lua-scripting: add WpSessionBin add API
Needed when adding streams to softdsp endpoints
2021-03-04 14:18:41 -05:00
George Kiagiadakis
15a74052a1 lua/api: add Link() constructor 2021-03-03 13:15:13 +02:00
George Kiagiadakis
79ba66e46b lua/api: default Constraint type always to pw-global
now that interest is declared on G_TYPE_OBJECT by default
(in optional Interest function arguments), this conditional default
no longer works as expected...

besides, it may be confusing to have a different default depending
on the interest type
2021-03-02 18:26:34 +02:00
George Kiagiadakis
9399f3db66 lua/api: simplify & improve session_item_configure 2021-03-02 14:39:00 +02:00
George Kiagiadakis
a4ec7538bc lua/api: make the type optional when declaring Interest as a function argument
it makes no sense to specify the type when calling, for instance,
session:lookup_endpoint() or similar functions

it also makes it easier to use iterate or lookup in the object
manager, when we already know the type of the objects that the om
contains
2021-03-02 14:08:43 +02:00
George Kiagiadakis
905636dc8d lua/api: improve getting optional Interest arguments
Add the ability to construct an Interest argument without
using the Interest keyword, so instead of:

  om:lookup(Interest { type = "session" })

we can now write:

  om:lookup { type = "session" }

... and also remove lookup_filtered from ObjectManager
2021-03-02 13:11:54 +02:00
Julian Bouzas
862e253607 m-lua-scripting: add get_n_streams endpoint API 2021-03-01 13:14:57 -05:00
Julian Bouzas
2052eb2b1f m-lua-scripting: add lookup session API
Also improves session API to accept object interests.
2021-03-01 13:14:57 -05:00
George Kiagiadakis
5b4fe3cd85 lua/pod: don't crash on parsing objects with unknown keys, just ignore them 2021-03-01 17:57:32 +02:00
George Kiagiadakis
51e24c58b5 m-lua-scripting/pod: retrieve Ids in Array & Choice as strings, if possible
When an Array or Choice that contains Spa:Id appears as a value for an object
field, it is possible to retrieve the Id type from that object field type.
2021-02-23 13:56:38 +02:00
George Kiagiadakis
5302700c6d m-lua-scripting/pod: s/id_type/object_id/ as commented on !125 2021-02-23 12:47:24 +02:00
Julian Bouzas
bd65f9578d m-lua-scripting: add support for choices when creating object pods 2021-02-23 10:41:46 +00:00
Julian Bouzas
0694889245 m-lua-scripting: refactor array and choice pod constructors to accept Id names 2021-02-23 10:41:46 +00:00