improve properties on stream and filter

This commit is contained in:
Wim Taymans 2019-12-06 22:12:38 +01:00
parent ed8dadca15
commit a8c3dc6a8a
5 changed files with 27 additions and 11 deletions

View file

@ -286,6 +286,8 @@ static struct pw_core_proxy *core_proxy_new(struct pw_core *core,
if (properties == NULL)
goto error_properties;
pw_fill_connect_properties(core, properties);
p->proxy.core_proxy = p;
p->core = core;
p->properties = properties;

View file

@ -896,7 +896,7 @@ static const struct pw_core_proxy_events core_events = {
static struct filter *
filter_new(struct pw_core *core, const char *name,
struct pw_properties *props, struct pw_properties *extra)
struct pw_properties *props, const struct pw_properties *extra)
{
struct filter *impl;
struct pw_filter *this;
@ -964,9 +964,9 @@ struct pw_filter * pw_filter_new(struct pw_core_proxy *core_proxy, const char *n
{
struct filter *impl;
struct pw_filter *this;
struct pw_core *core = pw_core_proxy_get_core(core_proxy);
struct pw_core *core = core_proxy->core;
impl = filter_new(core, name, props, NULL);
impl = filter_new(core, name, props, core_proxy->properties);
if (impl == NULL)
return NULL;
@ -992,9 +992,16 @@ pw_filter_new_simple(struct pw_loop *loop,
struct pw_core *core;
int res;
if (props == NULL)
props = pw_properties_new(NULL, NULL);
if (props == NULL)
return NULL;
core = pw_core_new(loop, NULL, 0);
impl = filter_new(core, name, props, NULL);
pw_fill_connect_properties(core, props);
impl = filter_new(core, name, props, props);
if (impl == NULL) {
res = -errno;
goto error_cleanup;

View file

@ -496,15 +496,15 @@ const char *pw_get_client_name(void)
}
}
/** Fill remote properties
/** Fill connectremote properties
* \param properties a \ref pw_properties
*
* Fill \a properties with a set of default remote properties.
* Fill \a properties with a set of default properties for connecting to a PipeWire instance.
*
* \memberof pw_pipewire
*/
SPA_EXPORT
void pw_fill_remote_properties(struct pw_core *core, struct pw_properties *properties)
void pw_fill_connect_properties(struct pw_core *core, struct pw_properties *properties)
{
const char *val;

View file

@ -129,7 +129,7 @@ const char *
pw_get_client_name(void);
void
pw_fill_remote_properties(struct pw_core *core, struct pw_properties *properties);
pw_fill_connect_properties(struct pw_core *core, struct pw_properties *properties);
void
pw_fill_stream_properties(struct pw_core *core, struct pw_properties *properties);

View file

@ -1014,7 +1014,7 @@ static const struct pw_core_proxy_events core_events = {
static struct stream *
stream_new(struct pw_core *core, const char *name,
struct pw_properties *props, struct pw_properties *extra)
struct pw_properties *props, const struct pw_properties *extra)
{
struct stream *impl;
struct pw_stream *this;
@ -1083,9 +1083,9 @@ struct pw_stream * pw_stream_new(struct pw_core_proxy *core_proxy, const char *n
{
struct stream *impl;
struct pw_stream *this;
struct pw_core *core = pw_core_proxy_get_core(core_proxy);
struct pw_core *core = core_proxy->core;
impl = stream_new(core, name, props, NULL);
impl = stream_new(core, name, props, core_proxy->properties);
if (impl == NULL)
return NULL;
@ -1111,8 +1111,15 @@ pw_stream_new_simple(struct pw_loop *loop,
struct pw_core *core;
int res;
if (props == NULL)
props = pw_properties_new(NULL, NULL);
if (props == NULL)
return NULL;
core = pw_core_new(loop, NULL, 0);
pw_fill_connect_properties(core, props);
impl = stream_new(core, name, props, NULL);
if (impl == NULL) {
res = -errno;