mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	improve properties on stream and filter
This commit is contained in:
		
							parent
							
								
									ed8dadca15
								
							
						
					
					
						commit
						a8c3dc6a8a
					
				
					 5 changed files with 27 additions and 11 deletions
				
			
		| 
						 | 
					@ -286,6 +286,8 @@ static struct pw_core_proxy *core_proxy_new(struct pw_core *core,
 | 
				
			||||||
	if (properties == NULL)
 | 
						if (properties == NULL)
 | 
				
			||||||
		goto error_properties;
 | 
							goto error_properties;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_fill_connect_properties(core, properties);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p->proxy.core_proxy = p;
 | 
						p->proxy.core_proxy = p;
 | 
				
			||||||
	p->core = core;
 | 
						p->core = core;
 | 
				
			||||||
	p->properties = properties;
 | 
						p->properties = properties;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -896,7 +896,7 @@ static const struct pw_core_proxy_events core_events = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct filter *
 | 
					static struct filter *
 | 
				
			||||||
filter_new(struct pw_core *core, const char *name,
 | 
					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 filter *impl;
 | 
				
			||||||
	struct pw_filter *this;
 | 
						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 filter *impl;
 | 
				
			||||||
	struct pw_filter *this;
 | 
						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)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -992,9 +992,16 @@ pw_filter_new_simple(struct pw_loop *loop,
 | 
				
			||||||
	struct pw_core *core;
 | 
						struct pw_core *core;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (props == NULL)
 | 
				
			||||||
 | 
							props = pw_properties_new(NULL, NULL);
 | 
				
			||||||
 | 
						if (props == NULL)
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	core = pw_core_new(loop, NULL, 0);
 | 
						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) {
 | 
						if (impl == NULL) {
 | 
				
			||||||
		res = -errno;
 | 
							res = -errno;
 | 
				
			||||||
		goto error_cleanup;
 | 
							goto error_cleanup;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -496,15 +496,15 @@ const char *pw_get_client_name(void)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Fill remote properties
 | 
					/** Fill connectremote properties
 | 
				
			||||||
 * \param properties a \ref pw_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
 | 
					 * \memberof pw_pipewire
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
SPA_EXPORT
 | 
					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;
 | 
						const char *val;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -129,7 +129,7 @@ const char *
 | 
				
			||||||
pw_get_client_name(void);
 | 
					pw_get_client_name(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
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
 | 
					void
 | 
				
			||||||
pw_fill_stream_properties(struct pw_core *core, struct pw_properties *properties);
 | 
					pw_fill_stream_properties(struct pw_core *core, struct pw_properties *properties);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1014,7 +1014,7 @@ static const struct pw_core_proxy_events core_events = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct stream *
 | 
					static struct stream *
 | 
				
			||||||
stream_new(struct pw_core *core, const char *name,
 | 
					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 stream *impl;
 | 
				
			||||||
	struct pw_stream *this;
 | 
						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 stream *impl;
 | 
				
			||||||
	struct pw_stream *this;
 | 
						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)
 | 
						if (impl == NULL)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1111,8 +1111,15 @@ pw_stream_new_simple(struct pw_loop *loop,
 | 
				
			||||||
	struct pw_core *core;
 | 
						struct pw_core *core;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (props == NULL)
 | 
				
			||||||
 | 
							props = pw_properties_new(NULL, NULL);
 | 
				
			||||||
 | 
						if (props == NULL)
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	core = pw_core_new(loop, NULL, 0);
 | 
						core = pw_core_new(loop, NULL, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_fill_connect_properties(core, props);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = stream_new(core, name, props, NULL);
 | 
						impl = stream_new(core, name, props, NULL);
 | 
				
			||||||
	if (impl == NULL) {
 | 
						if (impl == NULL) {
 | 
				
			||||||
		res = -errno;
 | 
							res = -errno;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue