mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	bluetooth: Create infrastrucure for bluetooth hooks
Create a pa_bluetooth_hook enum type and API to get pa_hooks from the opaque pa_bluetooth_discovery struct.
This commit is contained in:
		
							parent
							
								
									dcc28a23f9
								
							
						
					
					
						commit
						19a23cef10
					
				
					 2 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
					@ -44,8 +44,16 @@ struct pa_bluetooth_discovery {
 | 
				
			||||||
    pa_dbus_connection *connection;
 | 
					    pa_dbus_connection *connection;
 | 
				
			||||||
    bool filter_added;
 | 
					    bool filter_added;
 | 
				
			||||||
    bool matches_added;
 | 
					    bool matches_added;
 | 
				
			||||||
 | 
					    pa_hook hooks[PA_BLUETOOTH_HOOK_MAX];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook) {
 | 
				
			||||||
 | 
					    pa_assert(y);
 | 
				
			||||||
 | 
					    pa_assert(PA_REFCNT_VALUE(y) > 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return &y->hooks[hook];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *userdata) {
 | 
					static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *userdata) {
 | 
				
			||||||
    pa_bluetooth_discovery *y;
 | 
					    pa_bluetooth_discovery *y;
 | 
				
			||||||
    DBusError err;
 | 
					    DBusError err;
 | 
				
			||||||
| 
						 | 
					@ -93,6 +101,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
 | 
				
			||||||
    pa_bluetooth_discovery *y;
 | 
					    pa_bluetooth_discovery *y;
 | 
				
			||||||
    DBusError err;
 | 
					    DBusError err;
 | 
				
			||||||
    DBusConnection *conn;
 | 
					    DBusConnection *conn;
 | 
				
			||||||
 | 
					    unsigned i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((y = pa_shared_get(c, "bluetooth-discovery")))
 | 
					    if ((y = pa_shared_get(c, "bluetooth-discovery")))
 | 
				
			||||||
        return pa_bluetooth_discovery_ref(y);
 | 
					        return pa_bluetooth_discovery_ref(y);
 | 
				
			||||||
| 
						 | 
					@ -101,6 +110,9 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
 | 
				
			||||||
    PA_REFCNT_INIT(y);
 | 
					    PA_REFCNT_INIT(y);
 | 
				
			||||||
    y->core = c;
 | 
					    y->core = c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (i = 0; i < PA_BLUETOOTH_HOOK_MAX; i++)
 | 
				
			||||||
 | 
					        pa_hook_init(&y->hooks[i], y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_shared_set(c, "bluetooth-discovery", y);
 | 
					    pa_shared_set(c, "bluetooth-discovery", y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    dbus_error_init(&err);
 | 
					    dbus_error_init(&err);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,6 +26,12 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct pa_bluetooth_discovery pa_bluetooth_discovery;
 | 
					typedef struct pa_bluetooth_discovery pa_bluetooth_discovery;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef enum pa_bluetooth_hook {
 | 
				
			||||||
 | 
					    PA_BLUETOOTH_HOOK_MAX
 | 
				
			||||||
 | 
					} pa_bluetooth_hook_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *core);
 | 
					pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *core);
 | 
				
			||||||
pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y);
 | 
					pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y);
 | 
				
			||||||
void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y);
 | 
					void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue