Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wireplumber
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
wireplumber
Commits
012b2c73
Commit
012b2c73
authored
4 years ago
by
George Kiagiadakis
Browse files
Options
Downloads
Patches
Plain Diff
endpoint-stream: improve impl
parent
fe82ce9f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/wp/endpoint-stream.c
+52
-51
52 additions, 51 deletions
lib/wp/endpoint-stream.c
with
52 additions
and
51 deletions
lib/wp/endpoint-stream.c
+
52
−
51
View file @
012b2c73
...
...
@@ -472,6 +472,11 @@ G_DEFINE_TYPE (WpImplEndpointStream, wp_impl_endpoint_stream, WP_TYPE_ENDPOINT_S
#define pw_endpoint_stream_emit_param(hooks,...) \
pw_endpoint_stream_emit(hooks, param, 0, ##__VA_ARGS__)
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
)
};
static
int
impl_add_listener
(
void
*
object
,
struct
spa_hook
*
listener
,
...
...
@@ -482,7 +487,12 @@ impl_add_listener(void *object,
struct
spa_hook_list
save
;
spa_hook_list_isolate
(
&
self
->
hooks
,
&
save
,
listener
,
events
,
data
);
self
->
info
.
change_mask
=
PW_ENDPOINT_STREAM_CHANGE_MASK_ALL
&
~
PW_ENDPOINT_STREAM_CHANGE_MASK_LINK_PARAMS
;
pw_endpoint_stream_emit_info
(
&
self
->
hooks
,
&
self
->
info
);
self
->
info
.
change_mask
=
0
;
spa_hook_list_join
(
&
self
->
hooks
,
&
save
);
return
0
;
}
...
...
@@ -584,44 +594,30 @@ static const struct pw_endpoint_stream_methods impl_endpoint_stream = {
};
static
void
populate_
endpoint_stream_info
(
WpImplEndpointStream
*
self
,
guint32
change_mask
)
populate_
properties
(
WpImplEndpointStream
*
self
,
WpProperties
*
global_props
)
{
/* remove link params to avoid crashing the remote side;
we don't make use of that yet */
change_mask
&=
~
PW_ENDPOINT_STREAM_CHANGE_MASK_LINK_PARAMS
;
self
->
info
.
change_mask
=
change_mask
&
PW_ENDPOINT_STREAM_CHANGE_MASK_ALL
;
if
(
change_mask
&
PW_ENDPOINT_STREAM_CHANGE_MASK_PROPS
)
{
WpEndpointStreamPrivate
*
priv
=
wp_endpoint_stream_get_instance_private
(
WP_ENDPOINT_STREAM
(
self
));
g_clear_pointer
(
&
priv
->
properties
,
wp_properties_unref
);
priv
->
properties
=
wp_si_stream_get_properties
(
self
->
item
);
self
->
info
.
props
=
priv
->
properties
?
(
struct
spa_dict
*
)
wp_properties_peek_dict
(
priv
->
properties
)
:
NULL
;
g_object_notify
(
G_OBJECT
(
self
),
"properties"
);
}
WpEndpointStreamPrivate
*
priv
=
wp_endpoint_stream_get_instance_private
(
WP_ENDPOINT_STREAM
(
self
));
if
(
change_mask
&
PW_ENDPOINT_STREAM_CHANGE_MASK_PARAMS
)
{
static
struct
spa_param_info
param_info
[]
=
{
SPA_PARAM_INFO
(
SPA_PARAM_Props
,
SPA_PARAM_INFO_READWRITE
),
SPA_PARAM_INFO
(
SPA_PARAM_PropInfo
,
SPA_PARAM_INFO_READ
)
};
g_clear_pointer
(
&
priv
->
properties
,
wp_properties_unref
);
priv
->
properties
=
wp_si_stream_get_properties
(
self
->
item
);
priv
->
properties
=
wp_properties_ensure_unique_owner
(
priv
->
properties
);
wp_properties_update
(
priv
->
properties
,
global_props
);
self
->
info
.
params
=
param_info
;
self
->
info
.
n_params
=
SPA_N_ELEMENTS
(
param_info
);
}
self
->
info
.
props
=
priv
->
properties
?
(
struct
spa_dict
*
)
wp_properties_peek_dict
(
priv
->
properties
)
:
NULL
;
g_object_notify
(
G_OBJECT
(
self
),
"
info
"
);
g_object_notify
(
G_OBJECT
(
self
),
"
properties
"
);
}
static
void
on_si_stream_properties_changed
(
WpSiStream
*
item
,
WpImplEndpointStream
*
self
)
{
populate_endpoint_stream_info
(
self
,
PW_ENDPOINT_STREAM_CHANGE_MASK_PROPS
);
populate_properties
(
self
,
wp_proxy_get_global_properties
(
WP_PROXY
(
self
)));
self
->
info
.
change_mask
=
PW_ENDPOINT_STREAM_CHANGE_MASK_PROPS
;
pw_endpoint_stream_emit_info
(
&
self
->
hooks
,
&
self
->
info
);
self
->
info
.
change_mask
=
0
;
}
static
void
...
...
@@ -710,38 +706,43 @@ wp_impl_endpoint_stream_augment (WpProxy * proxy, WpProxyFeatures features)
const
gchar
*
key
,
*
value
;
g_autoptr
(
WpProxy
)
endpoint
=
NULL
;
/* initialize info struct */
priv
->
info
=
&
self
->
info
;
self
->
info
.
version
=
PW_VERSION_ENDPOINT_STREAM_INFO
;
/* get info from the interface */
info
=
wp_si_stream_get_registration_info
(
self
->
item
);
g_variant_get
(
info
,
"(sa{ss})"
,
&
self
->
info
.
name
,
&
immutable_props
);
g_variant_get
(
info
,
"(sa{ss})"
,
&
self
->
info
.
name
,
&
immutable_props
);
/* construct export properties (these will come back through
the registry and appear in wp_proxy_get_global_properties) */
props
=
wp_properties_new
(
PW_KEY_ENDPOINT_STREAM_NAME
,
self
->
info
.
name
,
NULL
);
/* associate with the endpoint */
endpoint
=
wp_session_item_get_associated_proxy
(
WP_SESSION_ITEM
(
self
->
item
),
WP_TYPE_ENDPOINT
);
self
->
info
.
endpoint_id
=
endpoint
?
wp_proxy_get_bound_id
(
endpoint
)
:
SPA_ID_INVALID
;
if
(
endpoint
)
{
self
->
info
.
endpoint_id
=
wp_proxy_get_bound_id
(
endpoint
);
wp_properties_setf
(
props
,
PW_KEY_ENDPOINT_ID
,
"%u"
,
self
->
info
.
endpoint_id
);
}
else
{
self
->
info
.
endpoint_id
=
SPA_ID_INVALID
;
}
/* populate immutable (global) properties */
while
(
g_variant_iter_next
(
immutable_props
,
"{&s&s}"
,
&
key
,
&
value
))
wp_properties_set
(
props
,
key
,
value
);
populate_endpoint_stream_info
(
self
,
PW_ENDPOINT_STREAM_CHANGE_MASK_ALL
);
/* populate standard properties */
populate_properties
(
self
,
props
);
/* subscribe to changes */
g_signal_connect_object
(
self
->
item
,
"stream-properties-changed"
,
G_CALLBACK
(
on_si_stream_properties_changed
),
self
,
0
);
/* construct export properties (these will come back through
the registry and appear in wp_proxy_get_global_properties) */
props
=
wp_properties_new
(
PW_KEY_ENDPOINT_STREAM_NAME
,
self
->
info
.
name
,
NULL
);
if
(
self
->
info
.
endpoint_id
!=
SPA_ID_INVALID
)
{
wp_properties_setf
(
props
,
PW_KEY_ENDPOINT_ID
,
"%u"
,
self
->
info
.
endpoint_id
);
}
while
(
g_variant_iter_next
(
immutable_props
,
"{&s&s}"
,
&
key
,
&
value
))
{
wp_properties_set
(
props
,
key
,
value
);
}
/* finalize info struct */
self
->
info
.
version
=
PW_VERSION_ENDPOINT_STREAM_INFO
;
self
->
info
.
params
=
impl_param_info
;
self
->
info
.
n_params
=
SPA_N_ELEMENTS
(
impl_param_info
);
priv
->
info
=
&
self
->
info
;
g_object_notify
(
G_OBJECT
(
self
),
"info"
);
wp_proxy_set_feature_ready
(
WP_PROXY
(
self
),
WP_PROXY_FEATURE_INFO
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment