2019-07-05 10:22:28 -04:00
|
|
|
/* WirePlumber
|
|
|
|
|
*
|
|
|
|
|
* Copyright © 2019 Collabora Ltd.
|
|
|
|
|
* @author Julian Bouzas <julian.bouzas@collabora.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*/
|
|
|
|
|
|
2020-01-22 18:54:45 +02:00
|
|
|
#ifndef __WIREPLUMBER_NODE_H__
|
|
|
|
|
#define __WIREPLUMBER_NODE_H__
|
2019-07-05 10:22:28 -04:00
|
|
|
|
lib: refactor WpProxy
This is an attempt to unclutter the API of WpProxy and
split functionality into smaller pieces, making it easier
to work with.
In this new class layout, we have the following classes:
- WpObject: base class for everything; handles activating
| and deactivating "features"
|- WpProxy: base class for anything that wraps a pw_proxy;
| handles events from pw_proxy and nothing more
|- WpGlobalProxy: handles integration with the registry
All the other classes derive from WpGlobalProxy. The reason
for separating WpGlobalProxy from WpProxy, though, is that
classes such as WpImplNode / WpSpaDevice can also derive from
WpProxy now, without interfacing with the registry.
All objects that come with an "info" structure and have properties
and/or params also implement the WpPipewireObject interface. This
provides the API to query properties and get/set params. Essentially,
this is implemented by all classes except WpMetadata (pw_metadata
does not have info)
This interface is implemented on each object separately, using
a private "mixin", which is a set of vfunc implementations and helper
functions (and macros) to facilitate the implementation of this interface.
A notable difference to the old WpProxy is that now features can be
deactivated, so it is possible to enable something and later disable
it again.
This commit disables modules, tests, tools, etc, to avoid growing the
patch more, while ensuring that the project compiles.
2020-11-10 19:17:02 +02:00
|
|
|
#include "global-proxy.h"
|
2020-04-21 16:49:26 +03:00
|
|
|
#include "port.h"
|
|
|
|
|
#include "iterator.h"
|
2020-05-05 12:17:08 +03:00
|
|
|
#include "object-interest.h"
|
2019-07-05 10:22:28 -04:00
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
2020-01-30 17:41:25 +02:00
|
|
|
struct pw_impl_node;
|
|
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @memberof WpNode
|
|
|
|
|
*
|
|
|
|
|
* @brief
|
|
|
|
|
* @arg WP_NODE_STATE_ERROR: error state
|
|
|
|
|
* @arg WP_NODE_STATE_CREATING: the node is being created
|
|
|
|
|
* @arg WP_NODE_STATE_SUSPENDED: the node is suspended, the device might be closed
|
|
|
|
|
* @arg WP_NODE_STATE_IDLE: the node is running but there is no active port
|
|
|
|
|
* @arg WP_NODE_STATE_RUNNING: the node is running
|
2020-04-21 16:49:26 +03:00
|
|
|
*/
|
|
|
|
|
typedef enum {
|
|
|
|
|
WP_NODE_STATE_ERROR = -1,
|
|
|
|
|
WP_NODE_STATE_CREATING = 0,
|
|
|
|
|
WP_NODE_STATE_SUSPENDED = 1,
|
|
|
|
|
WP_NODE_STATE_IDLE = 2,
|
|
|
|
|
WP_NODE_STATE_RUNNING = 3,
|
|
|
|
|
} WpNodeState;
|
|
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @memberof WpNode
|
|
|
|
|
*
|
|
|
|
|
* @brief
|
|
|
|
|
* @arg WP_NODE_FEATURE_PORTS: caches information about ports, enabling
|
2020-05-05 12:17:08 +03:00
|
|
|
* the use of wp_node_get_n_ports(), wp_node_lookup_port(),
|
2021-02-05 10:20:33 -05:00
|
|
|
* wp_node_new_ports_iterator() and related methods
|
2020-04-21 16:49:26 +03:00
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* An extension of [WpProxyFeatures](@ref proxy_features_section)
|
2020-04-21 16:49:26 +03:00
|
|
|
*/
|
|
|
|
|
typedef enum { /*< flags >*/
|
lib: refactor WpProxy
This is an attempt to unclutter the API of WpProxy and
split functionality into smaller pieces, making it easier
to work with.
In this new class layout, we have the following classes:
- WpObject: base class for everything; handles activating
| and deactivating "features"
|- WpProxy: base class for anything that wraps a pw_proxy;
| handles events from pw_proxy and nothing more
|- WpGlobalProxy: handles integration with the registry
All the other classes derive from WpGlobalProxy. The reason
for separating WpGlobalProxy from WpProxy, though, is that
classes such as WpImplNode / WpSpaDevice can also derive from
WpProxy now, without interfacing with the registry.
All objects that come with an "info" structure and have properties
and/or params also implement the WpPipewireObject interface. This
provides the API to query properties and get/set params. Essentially,
this is implemented by all classes except WpMetadata (pw_metadata
does not have info)
This interface is implemented on each object separately, using
a private "mixin", which is a set of vfunc implementations and helper
functions (and macros) to facilitate the implementation of this interface.
A notable difference to the old WpProxy is that now features can be
deactivated, so it is possible to enable something and later disable
it again.
This commit disables modules, tests, tools, etc, to avoid growing the
patch more, while ensuring that the project compiles.
2020-11-10 19:17:02 +02:00
|
|
|
WP_NODE_FEATURE_PORTS = (WP_PROXY_FEATURE_CUSTOM_START << 0),
|
2020-04-21 16:49:26 +03:00
|
|
|
} WpNodeFeatures;
|
|
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @memberof WpNode
|
|
|
|
|
*
|
|
|
|
|
* @brief The [WpNode](@ref node_section)
|
|
|
|
|
* <a href="https://developer.gnome.org/gobject/stable/gobject-Type-Information.html#GType">
|
|
|
|
|
* GType</a>
|
|
|
|
|
*
|
|
|
|
|
* @code
|
|
|
|
|
* #define WP_TYPE_NODE (wp_node_get_type ())
|
|
|
|
|
* @endcode
|
2020-02-17 15:39:19 +02:00
|
|
|
*
|
|
|
|
|
*/
|
2020-01-22 18:54:45 +02:00
|
|
|
#define WP_TYPE_NODE (wp_node_get_type ())
|
2020-01-16 18:50:07 +02:00
|
|
|
WP_API
|
lib: refactor WpProxy
This is an attempt to unclutter the API of WpProxy and
split functionality into smaller pieces, making it easier
to work with.
In this new class layout, we have the following classes:
- WpObject: base class for everything; handles activating
| and deactivating "features"
|- WpProxy: base class for anything that wraps a pw_proxy;
| handles events from pw_proxy and nothing more
|- WpGlobalProxy: handles integration with the registry
All the other classes derive from WpGlobalProxy. The reason
for separating WpGlobalProxy from WpProxy, though, is that
classes such as WpImplNode / WpSpaDevice can also derive from
WpProxy now, without interfacing with the registry.
All objects that come with an "info" structure and have properties
and/or params also implement the WpPipewireObject interface. This
provides the API to query properties and get/set params. Essentially,
this is implemented by all classes except WpMetadata (pw_metadata
does not have info)
This interface is implemented on each object separately, using
a private "mixin", which is a set of vfunc implementations and helper
functions (and macros) to facilitate the implementation of this interface.
A notable difference to the old WpProxy is that now features can be
deactivated, so it is possible to enable something and later disable
it again.
This commit disables modules, tests, tools, etc, to avoid growing the
patch more, while ensuring that the project compiles.
2020-11-10 19:17:02 +02:00
|
|
|
G_DECLARE_FINAL_TYPE (WpNode, wp_node, WP, NODE, WpGlobalProxy)
|
2020-01-30 17:41:25 +02:00
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
WpNode * wp_node_new_from_factory (WpCore * core,
|
|
|
|
|
const gchar * factory_name, WpProperties * properties);
|
|
|
|
|
|
2020-04-21 16:49:26 +03:00
|
|
|
WP_API
|
|
|
|
|
WpNodeState wp_node_get_state (WpNode * self, const gchar ** error);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
guint wp_node_get_n_input_ports (WpNode * self, guint * max);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
guint wp_node_get_n_output_ports (WpNode * self, guint * max);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
guint wp_node_get_n_ports (WpNode * self);
|
|
|
|
|
|
|
|
|
|
WP_API
|
2021-02-05 10:20:33 -05:00
|
|
|
WpIterator * wp_node_new_ports_iterator (WpNode * self);
|
2020-04-21 16:49:26 +03:00
|
|
|
|
|
|
|
|
WP_API
|
2021-02-05 10:20:33 -05:00
|
|
|
WpIterator * wp_node_new_ports_filtered_iterator (WpNode * self, ...)
|
2020-05-05 12:17:08 +03:00
|
|
|
G_GNUC_NULL_TERMINATED;
|
|
|
|
|
|
|
|
|
|
WP_API
|
2021-02-05 10:20:33 -05:00
|
|
|
WpIterator * wp_node_new_ports_filtered_iterator_full (WpNode * self,
|
2020-05-05 12:17:08 +03:00
|
|
|
WpObjectInterest * interest);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
WpPort * wp_node_lookup_port (WpNode * self, ...) G_GNUC_NULL_TERMINATED;
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
WpPort * wp_node_lookup_port_full (WpNode * self, WpObjectInterest * interest);
|
2020-04-21 16:49:26 +03:00
|
|
|
|
2020-05-21 14:10:41 -04:00
|
|
|
WP_API
|
2021-02-05 11:05:26 +02:00
|
|
|
void wp_node_send_command (WpNode * self, const gchar *command);
|
2020-05-21 14:10:41 -04:00
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @memberof WpNode
|
|
|
|
|
*
|
|
|
|
|
* @brief The [WpImplNode](@ref impl_node_section)
|
|
|
|
|
* <a href="https://developer.gnome.org/gobject/stable/gobject-Type-Information.html#GType">
|
|
|
|
|
* GType</a>
|
|
|
|
|
*
|
|
|
|
|
* @code
|
|
|
|
|
* #define WP_TYPE_IMPL_NODE (wp_impl_node_get_type ())
|
|
|
|
|
* @endcode
|
2020-02-17 15:39:19 +02:00
|
|
|
*
|
|
|
|
|
*/
|
2020-01-30 17:41:25 +02:00
|
|
|
#define WP_TYPE_IMPL_NODE (wp_impl_node_get_type ())
|
|
|
|
|
WP_API
|
2021-01-18 17:33:16 +02:00
|
|
|
G_DECLARE_FINAL_TYPE (WpImplNode, wp_impl_node, WP, IMPL_NODE, WpProxy)
|
2020-01-30 17:41:25 +02:00
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
WpImplNode * wp_impl_node_new_wrap (WpCore * core, struct pw_impl_node * node);
|
|
|
|
|
|
|
|
|
|
WP_API
|
|
|
|
|
WpImplNode * wp_impl_node_new_from_pw_factory (WpCore * core,
|
|
|
|
|
const gchar * factory_name, WpProperties * properties);
|
2019-07-05 10:22:28 -04:00
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
|
|
#endif
|