2019-12-09 16:35:15 +02:00
|
|
|
/* WirePlumber
|
|
|
|
|
*
|
|
|
|
|
* Copyright © 2019 Collabora Ltd.
|
|
|
|
|
* @author George Kiagiadakis <george.kiagiadakis@collabora.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*/
|
|
|
|
|
|
2020-04-14 18:31:17 +03:00
|
|
|
#define G_LOG_DOMAIN "wp-endpoint"
|
|
|
|
|
|
2019-12-09 16:35:15 +02:00
|
|
|
#include "endpoint.h"
|
2020-05-29 09:30:36 +03:00
|
|
|
#include "node.h"
|
2020-11-16 10:35:50 +02:00
|
|
|
#include "object-manager.h"
|
2020-02-12 11:28:07 +02:00
|
|
|
#include "error.h"
|
2021-05-06 15:45:13 +03:00
|
|
|
#include "log.h"
|
2019-12-09 16:35:15 +02:00
|
|
|
#include "wpenums.h"
|
2020-11-25 14:02:33 +02:00
|
|
|
#include "spa-type.h"
|
2020-04-11 11:05:26 +03:00
|
|
|
#include "si-factory.h"
|
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 "private/pipewire-object-mixin.h"
|
2019-12-09 16:35:15 +02:00
|
|
|
|
|
|
|
|
#include <pipewire/extensions/session-manager.h>
|
2020-03-20 14:45:17 +02:00
|
|
|
#include <pipewire/extensions/session-manager/introspect-funcs.h>
|
2020-11-25 14:02:33 +02:00
|
|
|
#include <spa/utils/result.h>
|
2020-03-20 14:45:17 +02:00
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @memberof WpEndpoint
|
|
|
|
|
*
|
|
|
|
|
* @props @b direction
|
|
|
|
|
*
|
|
|
|
|
* @code
|
|
|
|
|
* "direction" WpDirection *
|
|
|
|
|
* @endcode
|
|
|
|
|
*
|
|
|
|
|
* @brief The direction of the endpoint
|
|
|
|
|
*
|
|
|
|
|
* Flags : Read
|
|
|
|
|
*
|
|
|
|
|
* @props @b media-class
|
|
|
|
|
*
|
|
|
|
|
* @code
|
|
|
|
|
* "media-class" gchar *
|
|
|
|
|
* @endcode
|
|
|
|
|
*
|
|
|
|
|
* @brief The media class of the endpoint (ex. "Audio/Sink")
|
|
|
|
|
*
|
|
|
|
|
* Flags : Read
|
|
|
|
|
*
|
|
|
|
|
* @props @b name
|
|
|
|
|
*
|
|
|
|
|
* @code
|
|
|
|
|
* "name" gchar *
|
|
|
|
|
* @endcode
|
|
|
|
|
*
|
|
|
|
|
* @brief The name of the endpoint
|
|
|
|
|
*
|
|
|
|
|
* Flags : Read
|
|
|
|
|
*
|
|
|
|
|
*/
|
2020-06-02 10:56:28 +03:00
|
|
|
enum {
|
2020-11-25 14:02:33 +02:00
|
|
|
PROP_NAME = WP_PW_OBJECT_MIXIN_PROP_CUSTOM_START,
|
2020-06-02 10:56:28 +03:00
|
|
|
PROP_MEDIA_CLASS,
|
|
|
|
|
PROP_DIRECTION,
|
|
|
|
|
};
|
|
|
|
|
|
2020-02-12 11:28:07 +02:00
|
|
|
typedef struct _WpEndpointPrivate WpEndpointPrivate;
|
|
|
|
|
struct _WpEndpointPrivate
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
2021-03-09 13:13:14 -05:00
|
|
|
gint place_holder;
|
2019-12-09 16:35:15 +02:00
|
|
|
};
|
|
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
static void wp_endpoint_pw_object_mixin_priv_interface_init (
|
|
|
|
|
WpPwObjectMixinPrivInterface * iface);
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @file endpoint.c
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* @struct WpEndpoint
|
|
|
|
|
*
|
|
|
|
|
* @section endpoint_section Pipewire Endpoint
|
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
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* @brief The [WpEndpoint](@ref endpoint_section) class allows accessing the properties and methods of a
|
|
|
|
|
* PipeWire endpoint object (`struct pw_endpoint` from the session-manager extension).
|
|
|
|
|
*
|
|
|
|
|
* A [WpEndpoint](@ref endpoint_section) is constructed internally when a new endpoint appears on the
|
|
|
|
|
* PipeWire registry and it is made available through the [WpObjectManager](@ref object_manager_section) 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
|
|
|
*
|
|
|
|
|
*/
|
2021-05-13 17:54:58 +03: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
|
|
|
G_DEFINE_TYPE_WITH_CODE (WpEndpoint, wp_endpoint, WP_TYPE_GLOBAL_PROXY,
|
|
|
|
|
G_ADD_PRIVATE (WpEndpoint)
|
2020-11-25 14:02:33 +02:00
|
|
|
G_IMPLEMENT_INTERFACE (WP_TYPE_PIPEWIRE_OBJECT,
|
|
|
|
|
wp_pw_object_mixin_object_interface_init)
|
|
|
|
|
G_IMPLEMENT_INTERFACE (WP_TYPE_PW_OBJECT_MIXIN_PRIV,
|
|
|
|
|
wp_endpoint_pw_object_mixin_priv_interface_init))
|
2019-12-09 16:35:15 +02:00
|
|
|
|
|
|
|
|
static void
|
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_endpoint_init (WpEndpoint * self)
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-02 10:56:28 +03:00
|
|
|
static void
|
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_endpoint_get_property (GObject * object, guint property_id,
|
2020-06-02 10:56:28 +03:00
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
|
{
|
2020-11-25 14:02:33 +02:00
|
|
|
WpPwObjectMixinData *d = wp_pw_object_mixin_get_data (object);
|
2020-06-02 10:56:28 +03:00
|
|
|
|
|
|
|
|
switch (property_id) {
|
|
|
|
|
case PROP_NAME:
|
2020-11-25 14:02:33 +02:00
|
|
|
g_value_set_string (value, d->info ?
|
|
|
|
|
((struct pw_endpoint_info *) d->info)->name : NULL);
|
2020-06-02 10:56:28 +03:00
|
|
|
break;
|
|
|
|
|
case PROP_MEDIA_CLASS:
|
2020-11-25 14:02:33 +02:00
|
|
|
g_value_set_string (value, d->info ?
|
|
|
|
|
((struct pw_endpoint_info *) d->info)->media_class : NULL);
|
2020-06-02 10:56:28 +03:00
|
|
|
break;
|
|
|
|
|
case PROP_DIRECTION:
|
2020-11-25 14:02:33 +02:00
|
|
|
g_value_set_enum (value, d->info ?
|
|
|
|
|
((struct pw_endpoint_info *) d->info)->direction : 0);
|
2020-06-02 10:56:28 +03:00
|
|
|
break;
|
|
|
|
|
default:
|
2020-11-25 14:02:33 +02:00
|
|
|
wp_pw_object_mixin_get_property (object, property_id, value, pspec);
|
2020-06-02 10:56:28 +03:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
static WpObjectFeatures
|
|
|
|
|
wp_endpoint_get_supported_features (WpObject * object)
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
2021-03-09 13:13:14 -05:00
|
|
|
return wp_pw_object_mixin_get_supported_features(object);
|
2019-12-09 16:35:15 +02: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
|
|
|
static void
|
|
|
|
|
wp_endpoint_activate_execute_step (WpObject * object,
|
|
|
|
|
WpFeatureActivationTransition * transition, guint step,
|
|
|
|
|
WpObjectFeatures missing)
|
2020-01-22 10:34:56 +02: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
|
|
|
switch (step) {
|
2020-11-25 14:02:33 +02:00
|
|
|
case WP_PW_OBJECT_MIXIN_STEP_BIND:
|
|
|
|
|
case WP_TRANSITION_STEP_ERROR:
|
|
|
|
|
/* base class can handle BIND and ERROR */
|
|
|
|
|
WP_OBJECT_CLASS (wp_endpoint_parent_class)->
|
|
|
|
|
activate_execute_step (object, transition, step, missing);
|
|
|
|
|
break;
|
|
|
|
|
case WP_PW_OBJECT_MIXIN_STEP_WAIT_INFO:
|
|
|
|
|
/* just wait, info will be emitted anyway after binding */
|
|
|
|
|
break;
|
|
|
|
|
case WP_PW_OBJECT_MIXIN_STEP_CACHE_PARAMS:
|
|
|
|
|
wp_pw_object_mixin_cache_params (object, missing);
|
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
|
|
|
break;
|
|
|
|
|
default:
|
2020-11-25 14:02:33 +02:00
|
|
|
g_assert_not_reached ();
|
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
|
|
|
}
|
2020-01-22 10:34:56 +02: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
|
|
|
static void
|
|
|
|
|
wp_endpoint_deactivate (WpObject * object, WpObjectFeatures features)
|
2020-05-25 15:33:47 +03:00
|
|
|
{
|
2020-11-25 14:02:33 +02:00
|
|
|
wp_pw_object_mixin_deactivate (object, features);
|
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_OBJECT_CLASS (wp_endpoint_parent_class)->deactivate (object, features);
|
2020-01-22 10:34:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct pw_endpoint_events endpoint_events = {
|
|
|
|
|
PW_VERSION_ENDPOINT_EVENTS,
|
2020-11-25 14:02:33 +02:00
|
|
|
.info = (HandleEventInfoFunc(endpoint)) wp_pw_object_mixin_handle_event_info,
|
|
|
|
|
.param = wp_pw_object_mixin_handle_event_param,
|
2020-01-22 10:34:56 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2020-02-12 11:28:07 +02:00
|
|
|
wp_endpoint_pw_proxy_created (WpProxy * proxy, struct pw_proxy * pw_proxy)
|
2020-01-22 10:34:56 +02:00
|
|
|
{
|
2020-11-25 14:02:33 +02:00
|
|
|
wp_pw_object_mixin_handle_pw_proxy_created (proxy, pw_proxy,
|
|
|
|
|
endpoint, &endpoint_events);
|
2020-01-22 10:34:56 +02:00
|
|
|
}
|
|
|
|
|
|
2021-05-12 13:52:02 -04:00
|
|
|
static void
|
|
|
|
|
wp_endpoint_pw_proxy_destroyed (WpProxy * proxy)
|
|
|
|
|
{
|
|
|
|
|
wp_pw_object_mixin_handle_pw_proxy_destroyed (proxy);
|
|
|
|
|
|
|
|
|
|
WP_PROXY_CLASS (wp_endpoint_parent_class)->pw_proxy_destroyed (proxy);
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-09 16:35:15 +02:00
|
|
|
static void
|
2020-02-12 11:28:07 +02:00
|
|
|
wp_endpoint_class_init (WpEndpointClass * klass)
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = (GObjectClass *) klass;
|
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
|
|
|
WpObjectClass *wpobject_class = (WpObjectClass *) klass;
|
2019-12-09 16:35:15 +02:00
|
|
|
WpProxyClass *proxy_class = (WpProxyClass *) klass;
|
|
|
|
|
|
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
|
|
|
object_class->get_property = wp_endpoint_get_property;
|
|
|
|
|
|
|
|
|
|
wpobject_class->get_supported_features = wp_endpoint_get_supported_features;
|
2020-11-25 14:02:33 +02:00
|
|
|
wpobject_class->activate_get_next_step =
|
|
|
|
|
wp_pw_object_mixin_activate_get_next_step;
|
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
|
|
|
wpobject_class->activate_execute_step = wp_endpoint_activate_execute_step;
|
|
|
|
|
wpobject_class->deactivate = wp_endpoint_deactivate;
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2020-01-30 17:41:25 +02:00
|
|
|
proxy_class->pw_iface_type = PW_TYPE_INTERFACE_Endpoint;
|
|
|
|
|
proxy_class->pw_iface_version = PW_VERSION_ENDPOINT;
|
2020-02-12 11:28:07 +02:00
|
|
|
proxy_class->pw_proxy_created = wp_endpoint_pw_proxy_created;
|
2021-05-12 13:52:02 -04:00
|
|
|
proxy_class->pw_proxy_destroyed = wp_endpoint_pw_proxy_destroyed;
|
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
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
wp_pw_object_mixin_class_override_properties (object_class);
|
2020-02-12 11:28:07 +02:00
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*
|
2020-06-02 10:56:28 +03:00
|
|
|
* WpEndpoint:name:
|
|
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* @brief The name of the endpoint
|
2020-06-02 10:56:28 +03:00
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (object_class, PROP_NAME,
|
|
|
|
|
g_param_spec_string ("name", "name", "name", NULL,
|
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*
|
2020-06-02 10:56:28 +03:00
|
|
|
* WpEndpoint:media-class:
|
|
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* @brief The media class of the endpoint (ex. "Audio/Sink")
|
2020-06-02 10:56:28 +03:00
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (object_class, PROP_MEDIA_CLASS,
|
|
|
|
|
g_param_spec_string ("media-class", "media-class", "media-class", NULL,
|
|
|
|
|
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*
|
2020-06-02 10:56:28 +03:00
|
|
|
* WpEndpoint:direction:
|
|
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* @brief The direction of the endpoint
|
2020-06-02 10:56:28 +03:00
|
|
|
*/
|
|
|
|
|
g_object_class_install_property (object_class, PROP_DIRECTION,
|
|
|
|
|
g_param_spec_enum ("direction", "direction", "direction",
|
|
|
|
|
WP_TYPE_DIRECTION, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
2019-12-09 16:35:15 +02:00
|
|
|
}
|
|
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
static gint
|
|
|
|
|
wp_endpoint_enum_params (gpointer instance, guint32 id,
|
|
|
|
|
guint32 start, guint32 num, WpSpaPod *filter)
|
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
|
|
|
{
|
2020-11-25 14:02:33 +02:00
|
|
|
WpPwObjectMixinData *d = wp_pw_object_mixin_get_data (instance);
|
|
|
|
|
return pw_endpoint_enum_params (d->iface, 0, id, start, num,
|
|
|
|
|
filter ? wp_spa_pod_get_spa_pod (filter) : NULL);
|
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
|
|
|
}
|
|
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
static gint
|
|
|
|
|
wp_endpoint_set_param (gpointer instance, guint32 id, guint32 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
|
|
|
WpSpaPod * param)
|
|
|
|
|
{
|
2020-11-25 14:02:33 +02:00
|
|
|
WpPwObjectMixinData *d = wp_pw_object_mixin_get_data (instance);
|
|
|
|
|
return pw_endpoint_set_param (d->iface, id, flags,
|
|
|
|
|
wp_spa_pod_get_spa_pod (param));
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2020-11-25 14:02:33 +02:00
|
|
|
wp_endpoint_pw_object_mixin_priv_interface_init (
|
|
|
|
|
WpPwObjectMixinPrivInterface * iface)
|
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
|
|
|
{
|
2020-11-25 14:02:33 +02:00
|
|
|
wp_pw_object_mixin_priv_interface_info_init (iface, endpoint, ENDPOINT);
|
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
|
|
|
iface->enum_params = wp_endpoint_enum_params;
|
|
|
|
|
iface->set_param = wp_endpoint_set_param;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @memberof WpEndpoint
|
|
|
|
|
* @param self: the endpoint
|
2020-02-17 15:39:19 +02:00
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* @brief Requires %WP_PIPEWIRE_OBJECT_FEATURE_INFO
|
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
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* @returns the name of the endpoint
|
2020-02-17 15:39:19 +02:00
|
|
|
*/
|
2021-05-13 17:54:58 +03:00
|
|
|
|
2020-02-12 11:28:07 +02:00
|
|
|
const gchar *
|
|
|
|
|
wp_endpoint_get_name (WpEndpoint * self)
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
2020-02-12 11:28:07 +02:00
|
|
|
g_return_val_if_fail (WP_IS_ENDPOINT (self), NULL);
|
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_return_val_if_fail (wp_object_get_active_features (WP_OBJECT (self)) &
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_INFO, NULL);
|
2020-02-12 11:28:07 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
WpPwObjectMixinData *d = wp_pw_object_mixin_get_data (self);
|
|
|
|
|
return ((struct pw_endpoint_info *) d->info)->name;
|
2019-12-09 16:35:15 +02:00
|
|
|
}
|
|
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @memberof WpEndpoint
|
|
|
|
|
* @param self: the endpoint
|
2020-02-17 15:39:19 +02:00
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* @brief Requires %WP_PIPEWIRE_OBJECT_FEATURE_INFO
|
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
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* @returns the media class of the endpoint (ex. "Audio/Sink")
|
2020-02-17 15:39:19 +02:00
|
|
|
*/
|
2021-05-13 17:54:58 +03:00
|
|
|
|
2020-02-12 11:28:07 +02:00
|
|
|
const gchar *
|
|
|
|
|
wp_endpoint_get_media_class (WpEndpoint * self)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (WP_IS_ENDPOINT (self), NULL);
|
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_return_val_if_fail (wp_object_get_active_features (WP_OBJECT (self)) &
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_INFO, NULL);
|
2020-02-12 11:28:07 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
WpPwObjectMixinData *d = wp_pw_object_mixin_get_data (self);
|
|
|
|
|
return ((struct pw_endpoint_info *) d->info)->media_class;
|
2020-02-12 11:28:07 +02:00
|
|
|
}
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @memberof WpEndpoint
|
|
|
|
|
* @param self: the endpoint
|
2020-02-17 15:39:19 +02:00
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* @brief Requires %WP_PIPEWIRE_OBJECT_FEATURE_INFO
|
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
|
|
|
*
|
2021-05-13 17:54:58 +03:00
|
|
|
* @returns the direction of this endpoint
|
2020-02-17 15:39:19 +02:00
|
|
|
*/
|
2021-05-13 17:54:58 +03:00
|
|
|
|
2020-02-12 11:28:07 +02:00
|
|
|
WpDirection
|
|
|
|
|
wp_endpoint_get_direction (WpEndpoint * self)
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
2020-02-12 11:28:07 +02:00
|
|
|
g_return_val_if_fail (WP_IS_ENDPOINT (self), 0);
|
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_return_val_if_fail (wp_object_get_active_features (WP_OBJECT (self)) &
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_INFO, 0);
|
2020-02-12 11:28:07 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
WpPwObjectMixinData *d = wp_pw_object_mixin_get_data (self);
|
|
|
|
|
return (WpDirection) ((struct pw_endpoint_info *) d->info)->direction;
|
2020-02-12 11:28:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* WpImplEndpoint */
|
|
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
enum {
|
|
|
|
|
IMPL_PROP_0,
|
|
|
|
|
IMPL_PROP_ITEM,
|
2019-12-09 16:35:15 +02:00
|
|
|
};
|
|
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @struct WpImplEndpoint
|
|
|
|
|
* @memberof WpEndpoint
|
|
|
|
|
*
|
|
|
|
|
* @section impl_endpoint_section WpImplEndpoint
|
|
|
|
|
*
|
|
|
|
|
* @section impl_endpoint_class_props_section Properties
|
|
|
|
|
*
|
|
|
|
|
* @b item
|
|
|
|
|
*
|
|
|
|
|
* @code
|
|
|
|
|
* “item” WpSiEndpoint *
|
|
|
|
|
* @endcode
|
|
|
|
|
*
|
|
|
|
|
* @brief Flags : Read / Write / Construct Only
|
|
|
|
|
*/
|
2020-03-20 14:45:17 +02:00
|
|
|
struct _WpImplEndpoint
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
2020-03-20 14:45:17 +02:00
|
|
|
WpEndpoint parent;
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
struct spa_interface iface;
|
|
|
|
|
struct pw_endpoint_info info;
|
2020-11-25 14:02:33 +02:00
|
|
|
WpProperties *immutable_props;
|
2020-02-12 11:28:07 +02:00
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
WpSiEndpoint *item;
|
|
|
|
|
};
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
static void wp_endpoint_impl_pw_object_mixin_priv_interface_init (
|
|
|
|
|
WpPwObjectMixinPrivInterface * iface);
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (WpImplEndpoint, wp_impl_endpoint, WP_TYPE_ENDPOINT,
|
|
|
|
|
G_IMPLEMENT_INTERFACE (WP_TYPE_PW_OBJECT_MIXIN_PRIV,
|
|
|
|
|
wp_endpoint_impl_pw_object_mixin_priv_interface_init))
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
static struct spa_param_info impl_param_info[] = {
|
|
|
|
|
SPA_PARAM_INFO (SPA_PARAM_Props, SPA_PARAM_INFO_READWRITE),
|
|
|
|
|
SPA_PARAM_INFO (SPA_PARAM_PropInfo, SPA_PARAM_INFO_READ)
|
|
|
|
|
};
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
static int
|
|
|
|
|
impl_create_link (void *object, const struct spa_dict *props)
|
|
|
|
|
{
|
2021-05-21 19:45:36 +03:00
|
|
|
/* not implemented */
|
|
|
|
|
return -EINVAL;
|
2020-03-20 14:45:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static const struct pw_endpoint_methods impl_endpoint = {
|
|
|
|
|
PW_VERSION_ENDPOINT_METHODS,
|
2020-11-25 14:02:33 +02:00
|
|
|
.add_listener =
|
|
|
|
|
(ImplAddListenerFunc(endpoint)) wp_pw_object_mixin_impl_add_listener,
|
|
|
|
|
.subscribe_params = wp_pw_object_mixin_impl_subscribe_params,
|
|
|
|
|
.enum_params = wp_pw_object_mixin_impl_enum_params,
|
|
|
|
|
.set_param = wp_pw_object_mixin_impl_set_param,
|
2020-03-20 14:45:17 +02:00
|
|
|
.create_link = impl_create_link,
|
2019-12-09 16:35:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void
|
2020-11-25 14:02:33 +02:00
|
|
|
wp_impl_endpoint_init (WpImplEndpoint * self)
|
2020-02-12 11:28:07 +02:00
|
|
|
{
|
2020-11-25 14:02:33 +02:00
|
|
|
WpPwObjectMixinData *d = wp_pw_object_mixin_get_data (self);
|
2019-12-11 23:43:13 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
self->iface = SPA_INTERFACE_INIT (
|
|
|
|
|
PW_TYPE_INTERFACE_Endpoint,
|
|
|
|
|
PW_VERSION_ENDPOINT,
|
|
|
|
|
&impl_endpoint, self);
|
2019-12-11 23:43:13 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
d->info = &self->info;
|
|
|
|
|
d->iface = &self->iface;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
populate_properties (WpImplEndpoint * self)
|
|
|
|
|
{
|
|
|
|
|
WpPwObjectMixinData *d = wp_pw_object_mixin_get_data (self);
|
|
|
|
|
|
|
|
|
|
g_clear_pointer (&d->properties, wp_properties_unref);
|
|
|
|
|
d->properties = wp_si_endpoint_get_properties (self->item);
|
|
|
|
|
if (!d->properties)
|
|
|
|
|
d->properties = wp_properties_new_empty ();
|
|
|
|
|
d->properties = wp_properties_ensure_unique_owner (d->properties);
|
|
|
|
|
wp_properties_update (d->properties, self->immutable_props);
|
|
|
|
|
|
|
|
|
|
self->info.props = (struct spa_dict *) wp_properties_peek_dict (d->properties);
|
2019-12-11 23:43:13 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
static void
|
|
|
|
|
on_si_endpoint_properties_changed (WpSiEndpoint * item, WpImplEndpoint * self)
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
2020-11-25 14:02:33 +02:00
|
|
|
populate_properties (self);
|
|
|
|
|
wp_pw_object_mixin_notify_info (self, PW_ENDPOINT_CHANGE_MASK_PROPS);
|
|
|
|
|
}
|
2020-03-31 14:48:48 +03:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
static void
|
|
|
|
|
on_node_params_changed (WpNode * node, guint32 param_id, WpImplEndpoint * self)
|
|
|
|
|
{
|
|
|
|
|
if (param_id == SPA_PARAM_PropInfo || param_id == SPA_PARAM_Props)
|
|
|
|
|
wp_pw_object_mixin_notify_params_changed (self, param_id);
|
2019-12-09 16:35:15 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
static void
|
2020-11-25 14:02:33 +02:00
|
|
|
wp_impl_endpoint_constructed (GObject * object)
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
2020-11-25 14:02:33 +02:00
|
|
|
WpImplEndpoint *self = WP_IMPL_ENDPOINT (object);
|
|
|
|
|
g_autoptr (GVariant) info = NULL;
|
|
|
|
|
g_autoptr (GVariantIter) immutable_props = NULL;
|
|
|
|
|
g_autoptr (WpObject) node = NULL;
|
|
|
|
|
const gchar *key, *value;
|
|
|
|
|
guchar direction;
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
self->info.version = PW_VERSION_ENDPOINT_INFO;
|
|
|
|
|
|
|
|
|
|
info = wp_si_endpoint_get_registration_info (self->item);
|
|
|
|
|
g_variant_get (info, "(ssya{ss})", &self->info.name,
|
|
|
|
|
&self->info.media_class, &direction, &immutable_props);
|
|
|
|
|
|
|
|
|
|
self->info.direction = (enum pw_direction) direction;
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2021-05-21 19:45:36 +03:00
|
|
|
/* associate with the session (no session anymore, use -1) */
|
|
|
|
|
self->info.session_id = SPA_ID_INVALID;
|
2020-11-25 14:02:33 +02:00
|
|
|
|
|
|
|
|
/* construct export properties (these will come back through
|
|
|
|
|
the registry and appear in wp_proxy_get_global_properties) */
|
|
|
|
|
self->immutable_props = wp_properties_new (
|
|
|
|
|
PW_KEY_ENDPOINT_NAME, self->info.name,
|
|
|
|
|
PW_KEY_MEDIA_CLASS, self->info.media_class,
|
|
|
|
|
NULL);
|
|
|
|
|
wp_properties_setf (self->immutable_props, PW_KEY_SESSION_ID,
|
|
|
|
|
"%d", self->info.session_id);
|
|
|
|
|
|
|
|
|
|
/* populate immutable (global) properties */
|
|
|
|
|
while (g_variant_iter_next (immutable_props, "{&s&s}", &key, &value))
|
|
|
|
|
wp_properties_set (self->immutable_props, key, value);
|
|
|
|
|
|
|
|
|
|
/* populate standard properties */
|
|
|
|
|
populate_properties (self);
|
|
|
|
|
|
|
|
|
|
/* subscribe to changes */
|
|
|
|
|
g_signal_connect_object (self->item, "endpoint-properties-changed",
|
|
|
|
|
G_CALLBACK (on_si_endpoint_properties_changed), self, 0);
|
|
|
|
|
|
|
|
|
|
/* if the item has a node, proxy its ParamProps */
|
|
|
|
|
node = wp_session_item_get_associated_proxy (
|
|
|
|
|
WP_SESSION_ITEM (self->item), WP_TYPE_NODE);
|
|
|
|
|
if (node && (wp_object_get_active_features (node) &
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROPS)) {
|
|
|
|
|
self->info.params = impl_param_info;
|
|
|
|
|
self->info.n_params = G_N_ELEMENTS (impl_param_info);
|
|
|
|
|
|
|
|
|
|
g_signal_connect_object (node, "params-changed",
|
|
|
|
|
G_CALLBACK (on_node_params_changed), self, 0);
|
|
|
|
|
|
|
|
|
|
wp_object_update_features (WP_OBJECT (self),
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROPS, 0);
|
|
|
|
|
} else {
|
|
|
|
|
self->info.params = NULL;
|
|
|
|
|
self->info.n_params = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wp_object_update_features (WP_OBJECT (self),
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_INFO, 0);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (wp_impl_endpoint_parent_class)->constructed (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
wp_impl_endpoint_dispose (GObject * object)
|
|
|
|
|
{
|
|
|
|
|
WpImplEndpoint *self = WP_IMPL_ENDPOINT (object);
|
|
|
|
|
|
|
|
|
|
g_clear_pointer (&self->immutable_props, wp_properties_unref);
|
|
|
|
|
g_clear_pointer (&self->info.name, g_free);
|
|
|
|
|
|
|
|
|
|
wp_object_update_features (WP_OBJECT (self), 0,
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_INFO |
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROPS);
|
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (wp_impl_endpoint_parent_class)->dispose (object);
|
2019-12-09 16:35:15 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
static void
|
|
|
|
|
wp_impl_endpoint_set_property (GObject * object, guint property_id,
|
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
2020-03-20 14:45:17 +02:00
|
|
|
WpImplEndpoint *self = WP_IMPL_ENDPOINT (object);
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
switch (property_id) {
|
|
|
|
|
case IMPL_PROP_ITEM:
|
|
|
|
|
self->item = g_value_get_object (value);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-12-09 16:35:15 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
static void
|
|
|
|
|
wp_impl_endpoint_get_property (GObject * object, guint property_id,
|
|
|
|
|
GValue * value, GParamSpec * pspec)
|
2019-12-09 16:35:15 +02:00
|
|
|
{
|
2020-03-20 14:45:17 +02:00
|
|
|
WpImplEndpoint *self = WP_IMPL_ENDPOINT (object);
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
switch (property_id) {
|
|
|
|
|
case IMPL_PROP_ITEM:
|
|
|
|
|
g_value_set_object (value, self->item);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
|
|
|
|
break;
|
2019-12-09 16:35:15 +02: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
|
|
|
enum {
|
2021-03-09 13:13:14 -05:00
|
|
|
STEP_ACTIVATE_NODE = WP_PW_OBJECT_MIXIN_STEP_CUSTOM_START + 1,
|
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
|
|
|
};
|
2020-03-20 14:45:17 +02: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
|
|
|
static guint
|
|
|
|
|
wp_impl_endpoint_activate_get_next_step (WpObject * object,
|
|
|
|
|
WpFeatureActivationTransition * transition, guint step,
|
|
|
|
|
WpObjectFeatures missing)
|
|
|
|
|
{
|
|
|
|
|
WpImplEndpoint *self = WP_IMPL_ENDPOINT (object);
|
2020-03-31 19:31:54 +03:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
/* before anything else, if the item has a node,
|
|
|
|
|
cache its props so that enum_params works */
|
|
|
|
|
if (missing & WP_PIPEWIRE_OBJECT_FEATURES_ALL) {
|
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_autoptr (WpObject) node = wp_session_item_get_associated_proxy (
|
|
|
|
|
WP_SESSION_ITEM (self->item), WP_TYPE_NODE);
|
2020-05-29 09:30:36 +03:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
if (node && (wp_object_get_supported_features (node) &
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROPS) &&
|
|
|
|
|
!(wp_object_get_active_features (node) &
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROPS))
|
|
|
|
|
return STEP_ACTIVATE_NODE;
|
2020-05-29 09:30:36 +03:00
|
|
|
}
|
2020-11-25 14:02:33 +02:00
|
|
|
|
|
|
|
|
return WP_OBJECT_CLASS (wp_impl_endpoint_parent_class)->
|
|
|
|
|
activate_get_next_step (object, transition, step, missing);
|
2020-05-29 09:30:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
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_impl_endpoint_node_activated (WpObject * node,
|
|
|
|
|
GAsyncResult * res, WpTransition * transition)
|
2020-05-29 09:30:36 +03:00
|
|
|
{
|
2020-11-25 14:02:33 +02:00
|
|
|
WpImplEndpoint *self = wp_transition_get_source_object (transition);
|
2020-05-29 09:30:36 +03:00
|
|
|
g_autoptr (GError) error = NULL;
|
2020-03-20 14:45:17 +02: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
|
|
|
if (!wp_object_activate_finish (node, res, &error)) {
|
|
|
|
|
wp_transition_return_error (transition, g_steal_pointer (&error));
|
2020-05-29 09:30:36 +03:00
|
|
|
return;
|
2020-03-20 14:45:17 +02:00
|
|
|
}
|
2019-12-09 16:35:15 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
self->info.params = impl_param_info;
|
|
|
|
|
self->info.n_params = G_N_ELEMENTS (impl_param_info);
|
|
|
|
|
|
|
|
|
|
g_signal_connect_object (node, "params-changed",
|
|
|
|
|
G_CALLBACK (on_node_params_changed), self, 0);
|
|
|
|
|
|
|
|
|
|
wp_object_update_features (WP_OBJECT (self),
|
|
|
|
|
WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROPS, 0);
|
|
|
|
|
wp_pw_object_mixin_notify_info (self, PW_ENDPOINT_CHANGE_MASK_PARAMS);
|
2020-05-29 09:30:36 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
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_impl_endpoint_activate_execute_step (WpObject * object,
|
|
|
|
|
WpFeatureActivationTransition * transition, guint step,
|
|
|
|
|
WpObjectFeatures missing)
|
2020-05-29 09:30:36 +03: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
|
|
|
WpImplEndpoint *self = WP_IMPL_ENDPOINT (object);
|
2020-05-29 09:30:36 +03: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
|
|
|
switch (step) {
|
|
|
|
|
case STEP_ACTIVATE_NODE: {
|
|
|
|
|
g_autoptr (WpObject) node = wp_session_item_get_associated_proxy (
|
2020-05-29 09:30:36 +03:00
|
|
|
WP_SESSION_ITEM (self->item), WP_TYPE_NODE);
|
2019-12-09 16:35:15 +02: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
|
|
|
wp_object_activate (node,
|
2020-11-25 14:02:33 +02:00
|
|
|
WP_PROXY_FEATURE_BOUND | WP_PIPEWIRE_OBJECT_FEATURE_PARAM_PROPS,
|
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
|
|
|
NULL, (GAsyncReadyCallback) wp_impl_endpoint_node_activated,
|
|
|
|
|
transition);
|
|
|
|
|
break;
|
2019-12-09 16:35:15 +02:00
|
|
|
}
|
2020-11-25 14:02:33 +02:00
|
|
|
case WP_PW_OBJECT_MIXIN_STEP_BIND: {
|
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_autoptr (WpCore) core = wp_object_get_core (WP_OBJECT (self));
|
|
|
|
|
struct pw_core *pw_core = wp_core_get_pw_core (core);
|
|
|
|
|
|
|
|
|
|
/* no pw_core -> we are not connected */
|
|
|
|
|
if (!pw_core) {
|
|
|
|
|
wp_transition_return_error (WP_TRANSITION (transition), g_error_new (
|
|
|
|
|
WP_DOMAIN_LIBRARY, WP_LIBRARY_ERROR_OPERATION_FAILED,
|
|
|
|
|
"The WirePlumber core is not connected; "
|
|
|
|
|
"object cannot be exported to PipeWire"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
2020-03-31 15:14:45 +03: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
|
|
|
/* bind */
|
2021-04-28 20:46:08 +03:00
|
|
|
wp_proxy_watch_bind_error (WP_PROXY (self), WP_TRANSITION (transition));
|
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_proxy_set_pw_proxy (WP_PROXY (self), pw_core_export (pw_core,
|
|
|
|
|
PW_TYPE_INTERFACE_Endpoint,
|
2020-11-25 14:02:33 +02:00
|
|
|
wp_properties_peek_dict (self->immutable_props),
|
|
|
|
|
&self->iface, 0));
|
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
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
WP_OBJECT_CLASS (wp_impl_endpoint_parent_class)->
|
|
|
|
|
activate_execute_step (object, transition, step, missing);
|
|
|
|
|
break;
|
2020-03-31 15:14:45 +03:00
|
|
|
}
|
2019-12-09 16:35:15 +02:00
|
|
|
}
|
|
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
static void
|
|
|
|
|
wp_impl_endpoint_class_init (WpImplEndpointClass * klass)
|
2019-12-09 18:31:43 +02:00
|
|
|
{
|
2020-03-20 14:45:17 +02:00
|
|
|
GObjectClass *object_class = (GObjectClass *) klass;
|
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
|
|
|
WpObjectClass *wpobject_class = (WpObjectClass *) klass;
|
2020-03-20 14:45:17 +02:00
|
|
|
WpProxyClass *proxy_class = (WpProxyClass *) klass;
|
2019-12-09 18:31:43 +02:00
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
object_class->constructed = wp_impl_endpoint_constructed;
|
|
|
|
|
object_class->dispose = wp_impl_endpoint_dispose;
|
2020-03-20 14:45:17 +02:00
|
|
|
object_class->set_property = wp_impl_endpoint_set_property;
|
|
|
|
|
object_class->get_property = wp_impl_endpoint_get_property;
|
2019-12-09 18:31:43 +02: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
|
|
|
wpobject_class->activate_get_next_step =
|
|
|
|
|
wp_impl_endpoint_activate_get_next_step;
|
|
|
|
|
wpobject_class->activate_execute_step =
|
|
|
|
|
wp_impl_endpoint_activate_execute_step;
|
|
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
proxy_class->pw_proxy_created = NULL;
|
2021-04-05 15:42:06 +03:00
|
|
|
proxy_class->pw_proxy_destroyed = NULL;
|
2019-12-09 18:31:43 +02:00
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
g_object_class_install_property (object_class, IMPL_PROP_ITEM,
|
|
|
|
|
g_param_spec_object ("item", "item", "item", WP_TYPE_SI_ENDPOINT,
|
|
|
|
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
2019-12-09 18:31:43 +02:00
|
|
|
}
|
|
|
|
|
|
2020-11-25 14:02:33 +02:00
|
|
|
static GPtrArray *
|
|
|
|
|
wp_impl_endpoint_enum_params_sync (gpointer instance, guint32 id,
|
|
|
|
|
guint32 start, guint32 num, WpSpaPod *filter)
|
|
|
|
|
{
|
|
|
|
|
WpImplEndpoint *self = WP_IMPL_ENDPOINT (instance);
|
|
|
|
|
g_autoptr (WpPipewireObject) node = wp_session_item_get_associated_proxy (
|
|
|
|
|
WP_SESSION_ITEM (self->item), WP_TYPE_NODE);
|
|
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
|
wp_warning_object (self, "associated node is no longer available");
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* bypass a few things, knowing that the node
|
|
|
|
|
caches params in the mixin param store */
|
|
|
|
|
WpPwObjectMixinData *data = wp_pw_object_mixin_get_data (node);
|
|
|
|
|
GPtrArray *params = wp_pw_object_mixin_get_stored_params (data, id);
|
|
|
|
|
/* TODO filter */
|
|
|
|
|
|
|
|
|
|
return params;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gint
|
|
|
|
|
wp_impl_endpoint_set_param (gpointer instance, guint32 id, guint32 flags,
|
|
|
|
|
WpSpaPod * param)
|
|
|
|
|
{
|
|
|
|
|
WpImplEndpoint *self = WP_IMPL_ENDPOINT (instance);
|
|
|
|
|
g_autoptr (WpPipewireObject) node = wp_session_item_get_associated_proxy (
|
|
|
|
|
WP_SESSION_ITEM (self->item), WP_TYPE_NODE);
|
|
|
|
|
|
|
|
|
|
if (!node) {
|
|
|
|
|
wp_warning_object (self, "associated node is no longer available");
|
|
|
|
|
return -EPIPE;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-13 20:11:41 +02:00
|
|
|
WpSpaIdValue idval = wp_spa_id_value_from_number ("Spa:Enum:ParamId", id);
|
|
|
|
|
if (!idval) {
|
2020-11-25 14:02:33 +02:00
|
|
|
wp_critical_object (self, "invalid param id: %u", id);
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-13 20:11:41 +02:00
|
|
|
return wp_pipewire_object_set_param (node, wp_spa_id_value_short_name (idval),
|
|
|
|
|
flags, param) ? 0 : -EIO;
|
2020-11-25 14:02:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define pw_endpoint_emit(hooks,method,version,...) \
|
|
|
|
|
spa_hook_list_call_simple(hooks, struct pw_endpoint_events, \
|
|
|
|
|
method, version, ##__VA_ARGS__)
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
wp_impl_endpoint_emit_info (struct spa_hook_list * hooks, gconstpointer info)
|
|
|
|
|
{
|
|
|
|
|
pw_endpoint_emit (hooks, info, 0, info);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
wp_impl_endpoint_emit_param (struct spa_hook_list * hooks, int seq,
|
|
|
|
|
guint32 id, guint32 index, guint32 next, const struct spa_pod *param)
|
|
|
|
|
{
|
|
|
|
|
pw_endpoint_emit (hooks, param, 0, seq, id, index, next, param);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
wp_endpoint_impl_pw_object_mixin_priv_interface_init (
|
|
|
|
|
WpPwObjectMixinPrivInterface * iface)
|
|
|
|
|
{
|
|
|
|
|
iface->flags |= WP_PW_OBJECT_MIXIN_PRIV_NO_PARAM_CACHE;
|
|
|
|
|
iface->enum_params_sync = wp_impl_endpoint_enum_params_sync;
|
|
|
|
|
iface->set_param = wp_impl_endpoint_set_param;
|
|
|
|
|
iface->emit_info = wp_impl_endpoint_emit_info;
|
|
|
|
|
iface->emit_param = wp_impl_endpoint_emit_param;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-13 17:54:58 +03:00
|
|
|
/*!
|
|
|
|
|
* @memberof WpEndpoint
|
|
|
|
|
* @param core: the core
|
|
|
|
|
* @param item: the endpoint
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): a new [WpImplEndpoint](@ref impl_endpoint_section)
|
|
|
|
|
*/
|
|
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
WpImplEndpoint *
|
|
|
|
|
wp_impl_endpoint_new (WpCore * core, WpSiEndpoint * item)
|
2019-12-09 18:31:43 +02:00
|
|
|
{
|
2020-03-20 14:45:17 +02:00
|
|
|
g_return_val_if_fail (WP_IS_CORE (core), NULL);
|
2019-12-09 18:31:43 +02:00
|
|
|
|
2020-03-20 14:45:17 +02:00
|
|
|
return g_object_new (WP_TYPE_IMPL_ENDPOINT,
|
|
|
|
|
"core", core,
|
|
|
|
|
"item", item,
|
|
|
|
|
NULL);
|
2019-12-09 18:31:43 +02:00
|
|
|
}
|