mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	resource: add function to send error to another resource
Make a function to send an error to another resource. This can be used to send errors to proxies that now have a resource associated with them, like in error cases.
This commit is contained in:
		
							parent
							
								
									1ab6167f35
								
							
						
					
					
						commit
						278cc9f90a
					
				
					 2 changed files with 20 additions and 5 deletions
				
			
		| 
						 | 
					@ -225,16 +225,30 @@ uint32_t pw_resource_get_bound_id(struct pw_resource *resource)
 | 
				
			||||||
	return resource->bound_id;
 | 
						return resource->bound_id;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void SPA_PRINTF_FUNC(4, 0)
 | 
				
			||||||
 | 
					pw_resource_errorv_id(struct pw_resource *resource, uint32_t id, int res, const char *error, va_list ap)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						struct pw_impl_client *client = resource->client;
 | 
				
			||||||
 | 
						if (client->core_resource != NULL)
 | 
				
			||||||
 | 
							pw_core_resource_errorv(client->core_resource,
 | 
				
			||||||
 | 
									id, client->recv_seq, res, error, ap);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
void pw_resource_errorf(struct pw_resource *resource, int res, const char *error, ...)
 | 
					void pw_resource_errorf(struct pw_resource *resource, int res, const char *error, ...)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	va_list ap;
 | 
						va_list ap;
 | 
				
			||||||
	struct pw_impl_client *client = resource->client;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	va_start(ap, error);
 | 
						va_start(ap, error);
 | 
				
			||||||
	if (client->core_resource != NULL)
 | 
						pw_resource_errorv_id(resource, resource->id, res, error, ap);
 | 
				
			||||||
		pw_core_resource_errorv(client->core_resource,
 | 
						va_end(ap);
 | 
				
			||||||
				resource->id, client->recv_seq, res, error, ap);
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SPA_EXPORT
 | 
				
			||||||
 | 
					void pw_resource_errorf_id(struct pw_resource *resource, uint32_t id, int res, const char *error, ...)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						va_list ap;
 | 
				
			||||||
 | 
						va_start(ap, error);
 | 
				
			||||||
 | 
						pw_resource_errorv_id(resource, id, res, error, ap);
 | 
				
			||||||
	va_end(ap);
 | 
						va_end(ap);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -134,6 +134,7 @@ uint32_t pw_resource_get_bound_id(struct pw_resource *resource);
 | 
				
			||||||
/** Generate an error for a resource */
 | 
					/** Generate an error for a resource */
 | 
				
			||||||
void pw_resource_error(struct pw_resource *resource, int res, const char *error);
 | 
					void pw_resource_error(struct pw_resource *resource, int res, const char *error);
 | 
				
			||||||
void pw_resource_errorf(struct pw_resource *resource, int res, const char *error, ...) SPA_PRINTF_FUNC(3, 4);
 | 
					void pw_resource_errorf(struct pw_resource *resource, int res, const char *error, ...) SPA_PRINTF_FUNC(3, 4);
 | 
				
			||||||
 | 
					void pw_resource_errorf_id(struct pw_resource *resource, uint32_t id, int res, const char *error, ...) SPA_PRINTF_FUNC(4, 5);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** Get the list of object listeners from a resource */
 | 
					/** Get the list of object listeners from a resource */
 | 
				
			||||||
struct spa_hook_list *pw_resource_get_object_listeners(struct pw_resource *resource);
 | 
					struct spa_hook_list *pw_resource_get_object_listeners(struct pw_resource *resource);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue