mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	Move listeners to spa and rename to hooks
The listeners are generally useful in spa, move it there and rename to hooks. Implement loop hooks with it. Fix some cleanup issues in stream and remote
This commit is contained in:
		
							parent
							
								
									6b6b827a3b
								
							
						
					
					
						commit
						600055bd68
					
				
					 55 changed files with 428 additions and 383 deletions
				
			
		| 
						 | 
				
			
			@ -203,7 +203,7 @@ struct pw_protocol_native_connection *pw_protocol_native_connection_new(int fd)
 | 
			
		|||
	pw_log_debug("connection %p: new", this);
 | 
			
		||||
 | 
			
		||||
	this->fd = fd;
 | 
			
		||||
	pw_listener_list_init(&this->listener_list);
 | 
			
		||||
	spa_hook_list_init(&this->listener_list);
 | 
			
		||||
 | 
			
		||||
	impl->out.buffer_data = malloc(MAX_BUFFER_SIZE);
 | 
			
		||||
	impl->out.buffer_maxsize = MAX_BUFFER_SIZE;
 | 
			
		||||
| 
						 | 
				
			
			@ -235,7 +235,7 @@ void pw_protocol_native_connection_destroy(struct pw_protocol_native_connection
 | 
			
		|||
 | 
			
		||||
	pw_log_debug("connection %p: destroy", conn);
 | 
			
		||||
 | 
			
		||||
	pw_listener_list_emit(&conn->listener_list, struct pw_protocol_native_connection_events, destroy);
 | 
			
		||||
	spa_hook_list_call(&conn->listener_list, struct pw_protocol_native_connection_events, destroy);
 | 
			
		||||
 | 
			
		||||
	free(impl->out.buffer_data);
 | 
			
		||||
	free(impl->in.buffer_data);
 | 
			
		||||
| 
						 | 
				
			
			@ -430,7 +430,7 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
 | 
			
		|||
		printf(">>>>>>>>> out:\n");
 | 
			
		||||
	        spa_debug_pod((struct spa_pod *)p);
 | 
			
		||||
	}
 | 
			
		||||
	pw_listener_list_emit(&conn->listener_list, struct pw_protocol_native_connection_events, need_flush);
 | 
			
		||||
	spa_hook_list_call(&conn->listener_list, struct pw_protocol_native_connection_events, need_flush);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Flush the connection object
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,7 @@ extern "C" {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
#include <spa/defs.h>
 | 
			
		||||
#include <pipewire/listener.h>
 | 
			
		||||
#include <spa/hook.h>
 | 
			
		||||
 | 
			
		||||
struct pw_protocol_native_connection_events {
 | 
			
		||||
#define PW_VERSION_PROTOCOL_NATIVE_CONNECTION_EVENTS	0
 | 
			
		||||
| 
						 | 
				
			
			@ -44,16 +44,16 @@ struct pw_protocol_native_connection_events {
 | 
			
		|||
struct pw_protocol_native_connection {
 | 
			
		||||
	int fd;	/**< the socket */
 | 
			
		||||
 | 
			
		||||
	struct pw_listener_list listener_list;
 | 
			
		||||
	struct spa_hook_list listener_list;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static inline void
 | 
			
		||||
pw_protocol_native_connection_add_listener(struct pw_protocol_native_connection *conn,
 | 
			
		||||
					   struct pw_listener *listener,
 | 
			
		||||
					   struct spa_hook *listener,
 | 
			
		||||
					   const struct pw_protocol_native_connection_events *events,
 | 
			
		||||
					   void *data)
 | 
			
		||||
{
 | 
			
		||||
	pw_listener_list_add(&conn->listener_list, listener, events, data);
 | 
			
		||||
	spa_hook_list_append(&conn->listener_list, listener, events, data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct pw_protocol_native_connection *
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue