Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Julian Bouzas
WirePlumber
Commits
55ff0a63
Commit
55ff0a63
authored
Jan 08, 2020
by
Julian Bouzas
Browse files
proxy: add WpProxyDevice subclass
parent
59580e7c
Changes
5
Hide whitespace changes
Inline
Side-by-side
lib/wp/meson.build
View file @
55ff0a63
...
...
@@ -13,6 +13,7 @@ wp_lib_sources = [
'properties.c',
'proxy.c',
'proxy-client.c',
'proxy-device.c',
'proxy-link.c',
'proxy-node.c',
'proxy-port.c',
...
...
@@ -35,6 +36,7 @@ wp_lib_headers = [
'properties.h',
'proxy.h',
'proxy-client.h',
'proxy-device.h',
'proxy-node.h',
'proxy-port.h',
'proxy-link.h',
...
...
lib/wp/proxy-device.c
0 → 100644
View file @
55ff0a63
/* WirePlumber
*
* Copyright © 2019 Collabora Ltd.
* @author Julian Bouzas <julian.bouzas@collabora.com>
*
* SPDX-License-Identifier: MIT
*/
#include "proxy-device.h"
#include "error.h"
#include "private.h"
#include <pipewire/pipewire.h>
struct
_WpProxyDevice
{
WpProxy
parent
;
struct
pw_device_info
*
info
;
/* The device proxy listener */
struct
spa_hook
listener
;
};
enum
{
PROP_0
,
PROP_INFO
,
PROP_PROPERTIES
,
};
G_DEFINE_TYPE
(
WpProxyDevice
,
wp_proxy_device
,
WP_TYPE_PROXY
)
static
void
wp_proxy_device_init
(
WpProxyDevice
*
self
)
{
}
static
void
wp_proxy_device_finalize
(
GObject
*
object
)
{
WpProxyDevice
*
self
=
WP_PROXY_DEVICE
(
object
);
g_clear_pointer
(
&
self
->
info
,
pw_device_info_free
);
G_OBJECT_CLASS
(
wp_proxy_device_parent_class
)
->
finalize
(
object
);
}
static
void
wp_proxy_device_get_property
(
GObject
*
object
,
guint
property_id
,
GValue
*
value
,
GParamSpec
*
pspec
)
{
WpProxyDevice
*
self
=
WP_PROXY_DEVICE
(
object
);
switch
(
property_id
)
{
case
PROP_INFO
:
g_value_set_pointer
(
value
,
self
->
info
);
break
;
case
PROP_PROPERTIES
:
g_value_take_boxed
(
value
,
wp_proxy_device_get_properties
(
self
));
break
;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID
(
object
,
property_id
,
pspec
);
break
;
}
}
static
void
device_event_info
(
void
*
data
,
const
struct
pw_device_info
*
info
)
{
WpProxyDevice
*
self
=
WP_PROXY_DEVICE
(
data
);
self
->
info
=
pw_device_info_update
(
self
->
info
,
info
);
g_object_notify
(
G_OBJECT
(
self
),
"info"
);
if
(
info
->
change_mask
&
PW_DEVICE_CHANGE_MASK_PROPS
)
g_object_notify
(
G_OBJECT
(
self
),
"properties"
);
wp_proxy_set_feature_ready
(
WP_PROXY
(
self
),
WP_PROXY_FEATURE_INFO
);
}
static
const
struct
pw_device_proxy_events
device_events
=
{
PW_VERSION_DEVICE_PROXY_EVENTS
,
.
info
=
device_event_info
,
};
static
void
wp_proxy_device_pw_proxy_created
(
WpProxy
*
proxy
,
struct
pw_proxy
*
pw_proxy
)
{
WpProxyDevice
*
self
=
WP_PROXY_DEVICE
(
proxy
);
pw_device_proxy_add_listener
((
struct
pw_device_proxy
*
)
pw_proxy
,
&
self
->
listener
,
&
device_events
,
self
);
}
static
void
wp_proxy_device_class_init
(
WpProxyDeviceClass
*
klass
)
{
GObjectClass
*
object_class
=
(
GObjectClass
*
)
klass
;
WpProxyClass
*
proxy_class
=
(
WpProxyClass
*
)
klass
;
object_class
->
finalize
=
wp_proxy_device_finalize
;
object_class
->
get_property
=
wp_proxy_device_get_property
;
proxy_class
->
pw_proxy_created
=
wp_proxy_device_pw_proxy_created
;
g_object_class_install_property
(
object_class
,
PROP_INFO
,
g_param_spec_pointer
(
"info"
,
"info"
,
"The struct pw_device_info *"
,
G_PARAM_READABLE
|
G_PARAM_STATIC_STRINGS
));
g_object_class_install_property
(
object_class
,
PROP_PROPERTIES
,
g_param_spec_boxed
(
"properties"
,
"properties"
,
"The pipewire properties of the proxy"
,
WP_TYPE_PROPERTIES
,
G_PARAM_READABLE
|
G_PARAM_STATIC_STRINGS
));
}
WpProperties
*
wp_proxy_device_get_properties
(
WpProxyDevice
*
self
)
{
return
wp_properties_new_wrap_dict
(
self
->
info
->
props
);
}
lib/wp/proxy-device.h
0 → 100644
View file @
55ff0a63
/* WirePlumber
*
* Copyright © 2019 Collabora Ltd.
* @author Julian Bouzas <julian.bouzas@collabora.com>
*
* SPDX-License-Identifier: MIT
*/
#ifndef __WIREPLUMBER_PROXY_DEVICE_H__
#define __WIREPLUMBER_PROXY_DEVICE_H__
#include "proxy.h"
G_BEGIN_DECLS
#define WP_TYPE_PROXY_DEVICE (wp_proxy_device_get_type ())
G_DECLARE_FINAL_TYPE
(
WpProxyDevice
,
wp_proxy_device
,
WP
,
PROXY_DEVICE
,
WpProxy
)
WpProperties
*
wp_proxy_device_get_properties
(
WpProxyDevice
*
self
);
G_END_DECLS
#endif
lib/wp/proxy.c
View file @
55ff0a63
...
...
@@ -15,6 +15,7 @@
#include "endpoint.h"
#include "proxy-client.h"
#include "proxy-device.h"
#include "proxy-link.h"
#include "proxy-node.h"
#include "proxy-port.h"
...
...
@@ -109,7 +110,7 @@ static struct {
{
PW_TYPE_INTERFACE_Link
,
0
,
wp_proxy_link_get_type
,
wp_proxy_link_quark
},
{
PW_TYPE_INTERFACE_Client
,
0
,
wp_proxy_client_get_type
,
wp_proxy_client_quark
},
{
PW_TYPE_INTERFACE_Module
,
0
,
wp_proxy_get_type
,
wp_proxy_module_quark
},
{
PW_TYPE_INTERFACE_Device
,
0
,
wp_proxy_get_type
,
wp_proxy_device_quark
},
{
PW_TYPE_INTERFACE_Device
,
0
,
wp_proxy_
device_
get_type
,
wp_proxy_device_quark
},
{
PW_TYPE_INTERFACE_Metadata
,
0
,
wp_proxy_get_type
,
wp_proxy_metadata_quark
},
{
PW_TYPE_INTERFACE_Session
,
0
,
wp_proxy_session_get_type
,
wp_proxy_session_quark
},
{
PW_TYPE_INTERFACE_Endpoint
,
0
,
wp_proxy_endpoint_get_type
,
wp_proxy_endpoint_quark
},
...
...
lib/wp/wp.h
View file @
55ff0a63
...
...
@@ -20,6 +20,7 @@
#include "properties.h"
#include "proxy.h"
#include "proxy-client.h"
#include "proxy-device.h"
#include "proxy-link.h"
#include "proxy-node.h"
#include "proxy-port.h"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment