mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	jack: implement monitor requests
This commit is contained in:
		
							parent
							
								
									b1d2b9fb39
								
							
						
					
					
						commit
						89ce3eac35
					
				
					 1 changed files with 34 additions and 9 deletions
				
			
		| 
						 | 
					@ -107,6 +107,7 @@ struct object {
 | 
				
			||||||
			uint32_t type_id;
 | 
								uint32_t type_id;
 | 
				
			||||||
			uint32_t node_id;
 | 
								uint32_t node_id;
 | 
				
			||||||
			uint32_t port_id;
 | 
								uint32_t port_id;
 | 
				
			||||||
 | 
								uint32_t monitor_requests;
 | 
				
			||||||
			jack_latency_range_t capture_latency;
 | 
								jack_latency_range_t capture_latency;
 | 
				
			||||||
			jack_latency_range_t playback_latency;
 | 
								jack_latency_range_t playback_latency;
 | 
				
			||||||
		} port;
 | 
							} port;
 | 
				
			||||||
| 
						 | 
					@ -1495,7 +1496,6 @@ static int client_node_port_set_io(void *object,
 | 
				
			||||||
		pw_memmap_free(mm);
 | 
							pw_memmap_free(mm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (mem_id == SPA_ID_INVALID) {
 | 
					        if (mem_id == SPA_ID_INVALID) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                mm = ptr = NULL;
 | 
					                mm = ptr = NULL;
 | 
				
			||||||
                size = 0;
 | 
					                size = 0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -2996,30 +2996,55 @@ int jack_port_get_aliases (const jack_port_t *port, char* const aliases[2])
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
int jack_port_request_monitor (jack_port_t *port, int onoff)
 | 
					int jack_port_request_monitor (jack_port_t *port, int onoff)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pw_log_warn("not implemented %p %d", port, onoff);
 | 
						struct object *o = (struct object *) port;
 | 
				
			||||||
	return -ENOTSUP;
 | 
						if (onoff)
 | 
				
			||||||
 | 
							o->port.monitor_requests++;
 | 
				
			||||||
 | 
						else if (o->port.monitor_requests > 0)
 | 
				
			||||||
 | 
							o->port.monitor_requests--;
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
int jack_port_request_monitor_by_name (jack_client_t *client,
 | 
					int jack_port_request_monitor_by_name (jack_client_t *client,
 | 
				
			||||||
                                       const char *port_name, int onoff)
 | 
					                                       const char *port_name, int onoff)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pw_log_warn(NAME" %p: not implemented %s %d", client, port_name, onoff);
 | 
						struct client *c = (struct client *) client;
 | 
				
			||||||
	return -ENOTSUP;
 | 
						struct object *p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_thread_loop_lock(c->context.loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						p = find_port(c, port_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_thread_loop_unlock(c->context.loop);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (p == NULL) {
 | 
				
			||||||
 | 
							pw_log_error(NAME" %p: jack_port_request_monitor_by_name called"
 | 
				
			||||||
 | 
									" with an incorrect port %s", client, port_name);
 | 
				
			||||||
 | 
							return -1;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return jack_port_request_monitor((jack_port_t*)p, onoff);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
int jack_port_ensure_monitor (jack_port_t *port, int onoff)
 | 
					int jack_port_ensure_monitor (jack_port_t *port, int onoff)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pw_log_warn("not implemented %p %d", port, onoff);
 | 
						struct object *o = (struct object *) port;
 | 
				
			||||||
	return -ENOTSUP;
 | 
						if (onoff) {
 | 
				
			||||||
 | 
							if (o->port.monitor_requests == 0)
 | 
				
			||||||
 | 
								o->port.monitor_requests++;
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							if (o->port.monitor_requests > 0)
 | 
				
			||||||
 | 
								o->port.monitor_requests = 0;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
int jack_port_monitoring_input (jack_port_t *port)
 | 
					int jack_port_monitoring_input (jack_port_t *port)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pw_log_warn("not implemented %p", port);
 | 
						struct object *o = (struct object *) port;
 | 
				
			||||||
	return -ENOTSUP;
 | 
						return o->port.monitor_requests > 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue