mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	Revert "card: Support adding ports dynamically"
This reverts commita9c3f2fb0f. It has been recently agreed that ports should somehow have some physical meaning, leading to the port merge in module-bluetooth-device. With this assumption in mind, it is very unlikely that a card would add or remove ports dynamically. Therefore, the core can be simplified by removing the support for this. The revert affects the code added to module-card-restore in commita1a0ad1af2, which can now be partially removed. Conflicts: src/pulsecore/card.c src/pulsecore/core.h
This commit is contained in:
		
							parent
							
								
									e2cb872120
								
							
						
					
					
						commit
						3d65e9c49e
					
				
					 4 changed files with 0 additions and 64 deletions
				
			
		| 
						 | 
					@ -65,7 +65,6 @@ struct userdata {
 | 
				
			||||||
    pa_hook_slot *card_new_hook_slot;
 | 
					    pa_hook_slot *card_new_hook_slot;
 | 
				
			||||||
    pa_hook_slot *card_put_hook_slot;
 | 
					    pa_hook_slot *card_put_hook_slot;
 | 
				
			||||||
    pa_hook_slot *card_profile_hook_slot;
 | 
					    pa_hook_slot *card_profile_hook_slot;
 | 
				
			||||||
    pa_hook_slot *port_new_hook_slot;
 | 
					 | 
				
			||||||
    pa_hook_slot *port_offset_hook_slot;
 | 
					    pa_hook_slot *port_offset_hook_slot;
 | 
				
			||||||
    pa_time_event *save_time_event;
 | 
					    pa_time_event *save_time_event;
 | 
				
			||||||
    pa_database *database;
 | 
					    pa_database *database;
 | 
				
			||||||
| 
						 | 
					@ -127,15 +126,6 @@ static struct port_info *port_info_new(pa_device_port *port) {
 | 
				
			||||||
    return p_info;
 | 
					    return p_info;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void port_info_update(struct port_info *p_info, pa_device_port *port) {
 | 
					 | 
				
			||||||
    pa_assert(p_info);
 | 
					 | 
				
			||||||
    pa_assert(port);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pa_xfree(p_info->name);
 | 
					 | 
				
			||||||
    p_info->name = pa_xstrdup(port->name);
 | 
					 | 
				
			||||||
    p_info->offset = port->latency_offset;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void port_info_free(struct port_info *p_info) {
 | 
					static void port_info_free(struct port_info *p_info) {
 | 
				
			||||||
    pa_assert(p_info);
 | 
					    pa_assert(p_info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -413,37 +403,6 @@ static pa_hook_result_t card_profile_change_callback(pa_core *c, pa_card *card,
 | 
				
			||||||
    return PA_HOOK_OK;
 | 
					    return PA_HOOK_OK;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static pa_hook_result_t card_port_add_callback(pa_core *c, pa_device_port *port, struct userdata *u) {
 | 
					 | 
				
			||||||
    struct entry *entry;
 | 
					 | 
				
			||||||
    pa_card *card;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pa_assert(port);
 | 
					 | 
				
			||||||
    card = port->card;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if ((entry = entry_read(u, card->name))) {
 | 
					 | 
				
			||||||
        struct port_info *p_info;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if ((p_info = pa_hashmap_get(entry->ports, port->name)))
 | 
					 | 
				
			||||||
            port_info_update(p_info, port);
 | 
					 | 
				
			||||||
        else {
 | 
					 | 
				
			||||||
            p_info = port_info_new(port);
 | 
					 | 
				
			||||||
            pa_assert_se(pa_hashmap_put(entry->ports, p_info->name, p_info) >= 0);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        pa_log_info("Storing port info for port %s on card %s.", port->name, card->name);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
        entry = entry_from_card(card);
 | 
					 | 
				
			||||||
        show_full_info(card);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (entry_write(u, card->name, entry))
 | 
					 | 
				
			||||||
        trigger_save(u);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    entry_free(entry);
 | 
					 | 
				
			||||||
    return PA_HOOK_OK;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static pa_hook_result_t port_offset_change_callback(pa_core *c, pa_device_port *port, struct userdata *u) {
 | 
					static pa_hook_result_t port_offset_change_callback(pa_core *c, pa_device_port *port, struct userdata *u) {
 | 
				
			||||||
    struct entry *entry;
 | 
					    struct entry *entry;
 | 
				
			||||||
    pa_card *card;
 | 
					    pa_card *card;
 | 
				
			||||||
| 
						 | 
					@ -529,7 +488,6 @@ int pa__init(pa_module*m) {
 | 
				
			||||||
    u->card_new_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_CARD_NEW], PA_HOOK_EARLY, (pa_hook_cb_t) card_new_hook_callback, u);
 | 
					    u->card_new_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_CARD_NEW], PA_HOOK_EARLY, (pa_hook_cb_t) card_new_hook_callback, u);
 | 
				
			||||||
    u->card_put_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_CARD_PUT], PA_HOOK_NORMAL, (pa_hook_cb_t) card_put_hook_callback, u);
 | 
					    u->card_put_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_CARD_PUT], PA_HOOK_NORMAL, (pa_hook_cb_t) card_put_hook_callback, u);
 | 
				
			||||||
    u->card_profile_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) card_profile_change_callback, u);
 | 
					    u->card_profile_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_CARD_PROFILE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) card_profile_change_callback, u);
 | 
				
			||||||
    u->port_new_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_PORT_ADDED], PA_HOOK_NORMAL, (pa_hook_cb_t) card_port_add_callback, u);
 | 
					 | 
				
			||||||
    u->port_offset_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) port_offset_change_callback, u);
 | 
					    u->port_offset_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) port_offset_change_callback, u);
 | 
				
			||||||
    u->hooks_connected = true;
 | 
					    u->hooks_connected = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -569,7 +527,6 @@ void pa__done(pa_module*m) {
 | 
				
			||||||
        pa_hook_slot_free(u->card_new_hook_slot);
 | 
					        pa_hook_slot_free(u->card_new_hook_slot);
 | 
				
			||||||
        pa_hook_slot_free(u->card_put_hook_slot);
 | 
					        pa_hook_slot_free(u->card_put_hook_slot);
 | 
				
			||||||
        pa_hook_slot_free(u->card_profile_hook_slot);
 | 
					        pa_hook_slot_free(u->card_profile_hook_slot);
 | 
				
			||||||
        pa_hook_slot_free(u->port_new_hook_slot);
 | 
					 | 
				
			||||||
        pa_hook_slot_free(u->port_offset_hook_slot);
 | 
					        pa_hook_slot_free(u->port_offset_hook_slot);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -114,25 +114,6 @@ void pa_card_add_profile(pa_card *c, pa_card_profile *profile) {
 | 
				
			||||||
    pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CARD_PROFILE_ADDED], profile);
 | 
					    pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_CARD_PROFILE_ADDED], profile);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void pa_card_add_ports(pa_card *c, pa_hashmap *ports) {
 | 
					 | 
				
			||||||
    pa_device_port *p;
 | 
					 | 
				
			||||||
    void *state;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pa_assert(c);
 | 
					 | 
				
			||||||
    pa_assert(ports);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* take ownership of the ports */
 | 
					 | 
				
			||||||
    PA_HASHMAP_FOREACH(p, ports, state) {
 | 
					 | 
				
			||||||
        p->card = c;
 | 
					 | 
				
			||||||
        pa_assert_se(pa_hashmap_put(c->ports, p->name, p) >= 0);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, c->index);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    while ((p = pa_hashmap_steal_first(ports)) != NULL)
 | 
					 | 
				
			||||||
        pa_hook_fire(&c->core->hooks[PA_CORE_HOOK_PORT_ADDED], p);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void pa_card_new_data_set_profile(pa_card_new_data *data, const char *profile) {
 | 
					void pa_card_new_data_set_profile(pa_card_new_data *data, const char *profile) {
 | 
				
			||||||
    pa_assert(data);
 | 
					    pa_assert(data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -114,7 +114,6 @@ pa_card *pa_card_new(pa_core *c, pa_card_new_data *data);
 | 
				
			||||||
void pa_card_free(pa_card *c);
 | 
					void pa_card_free(pa_card *c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void pa_card_add_profile(pa_card *c, pa_card_profile *profile);
 | 
					void pa_card_add_profile(pa_card *c, pa_card_profile *profile);
 | 
				
			||||||
void pa_card_add_ports(pa_card *c, pa_hashmap *ports);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
int pa_card_set_profile(pa_card *c, const char *name, pa_bool_t save);
 | 
					int pa_card_set_profile(pa_card *c, const char *name, pa_bool_t save);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -116,7 +116,6 @@ typedef enum pa_core_hook {
 | 
				
			||||||
    PA_CORE_HOOK_CARD_PROFILE_ADDED,
 | 
					    PA_CORE_HOOK_CARD_PROFILE_ADDED,
 | 
				
			||||||
    PA_CORE_HOOK_CARD_PROFILE_AVAILABLE_CHANGED,
 | 
					    PA_CORE_HOOK_CARD_PROFILE_AVAILABLE_CHANGED,
 | 
				
			||||||
    PA_CORE_HOOK_PORT_AVAILABLE_CHANGED,
 | 
					    PA_CORE_HOOK_PORT_AVAILABLE_CHANGED,
 | 
				
			||||||
    PA_CORE_HOOK_PORT_ADDED,
 | 
					 | 
				
			||||||
    PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED,
 | 
					    PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED,
 | 
				
			||||||
    PA_CORE_HOOK_MAX
 | 
					    PA_CORE_HOOK_MAX
 | 
				
			||||||
} pa_core_hook_t;
 | 
					} pa_core_hook_t;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue