device: add free signal

This commit is contained in:
Wim Taymans 2019-05-27 15:58:50 +02:00
parent 891bb49dfb
commit 973a92b49d
3 changed files with 4 additions and 0 deletions

View file

@ -115,6 +115,7 @@ void pw_device_destroy(struct pw_device *device)
spa_hook_remove(&device->global_listener); spa_hook_remove(&device->global_listener);
pw_global_destroy(device->global); pw_global_destroy(device->global);
} }
pw_device_emit_free(device);
free((char *)device->info.name); free((char *)device->info.name);
pw_properties_free(device->properties); pw_properties_free(device->properties);

View file

@ -56,6 +56,8 @@ struct pw_device_events {
/** the device is destroyed */ /** the device is destroyed */
void (*destroy) (void *data); void (*destroy) (void *data);
/** the device is freed */
void (*free) (void *data);
/** the device info changed */ /** the device info changed */
void (*info_changed) (void *data, const struct pw_device_info *info); void (*info_changed) (void *data, const struct pw_device_info *info);

View file

@ -294,6 +294,7 @@ static inline void free_allocation(struct allocation *alloc)
#define pw_device_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_device_events, m, v, ##__VA_ARGS__) #define pw_device_emit(o,m,v,...) spa_hook_list_call(&o->listener_list, struct pw_device_events, m, v, ##__VA_ARGS__)
#define pw_device_emit_destroy(m) pw_device_emit(m, destroy, 0) #define pw_device_emit_destroy(m) pw_device_emit(m, destroy, 0)
#define pw_device_emit_free(m) pw_device_emit(m, free, 0)
#define pw_device_emit_info_changed(n,i) pw_device_emit(n, info_changed, 0, i) #define pw_device_emit_info_changed(n,i) pw_device_emit(n, info_changed, 0, i)
struct pw_device { struct pw_device {