rename card config to card profile

This commit is contained in:
Lennart Poettering 2009-01-15 23:44:46 +01:00
parent d4bda31ba1
commit 33c22b0102
2 changed files with 35 additions and 35 deletions

View file

@ -36,18 +36,18 @@
#include "card.h" #include "card.h"
pa_card_config *pa_card_config_new(const char *name) { pa_card_profile *pa_card_profile_new(const char *name) {
pa_card_config *c; pa_card_profile *c;
pa_assert(name); pa_assert(name);
c = pa_xnew0(pa_card_config, 1); c = pa_xnew0(pa_card_profile, 1);
c->name = pa_xstrdup(name); c->name = pa_xstrdup(name);
return c; return c;
} }
void pa_card_config_free(pa_card_config *c) { void pa_card_profile_free(pa_card_profile *c) {
pa_assert(c); pa_assert(c);
pa_xfree(c->name); pa_xfree(c->name);
@ -76,13 +76,13 @@ void pa_card_new_data_done(pa_card_new_data *data) {
pa_proplist_free(data->proplist); pa_proplist_free(data->proplist);
if (data->configs) { if (data->profiles) {
pa_card_config *c; pa_card_profile *c;
while ((c = pa_hashmap_steal_first(data->configs))) while ((c = pa_hashmap_steal_first(data->profiles)))
pa_card_config_free(c); pa_card_profile_free(c);
pa_hashmap_free(data->configs, NULL, NULL); pa_hashmap_free(data->profiles, NULL, NULL);
} }
pa_xfree(data->name); pa_xfree(data->name);
@ -120,13 +120,13 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
c->sinks = pa_idxset_new(NULL, NULL); c->sinks = pa_idxset_new(NULL, NULL);
c->sources = pa_idxset_new(NULL, NULL); c->sources = pa_idxset_new(NULL, NULL);
c->configs = data->configs; c->profiles = data->profiles;
data->configs = NULL; data->profiles = NULL;
c->active_config = data->active_config; c->active_profile = data->active_profile;
data->active_config = NULL; data->active_profile = NULL;
c->userdata = NULL; c->userdata = NULL;
c->set_config = NULL; c->set_profile = NULL;
pa_assert_se(pa_idxset_put(core->cards, c, &c->index) >= 0); pa_assert_se(pa_idxset_put(core->cards, c, &c->index) >= 0);
@ -139,7 +139,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
void pa_card_free(pa_card *c) { void pa_card_free(pa_card *c) {
pa_core *core; pa_core *core;
pa_card_config *config; pa_card_profile *profile;
pa_assert(c); pa_assert(c);
pa_assert(c->core); pa_assert(c->core);
@ -161,10 +161,10 @@ void pa_card_free(pa_card *c) {
pa_assert(pa_idxset_isempty(c->sources)); pa_assert(pa_idxset_isempty(c->sources));
pa_idxset_free(c->sources, NULL, NULL); pa_idxset_free(c->sources, NULL, NULL);
while ((config = pa_hashmap_steal_first(c->configs))) while ((profile = pa_hashmap_steal_first(c->profiles)))
pa_card_config_free(config); pa_card_profile_free(profile);
pa_hashmap_free(c->configs, NULL, NULL); pa_hashmap_free(c->profiles, NULL, NULL);
pa_proplist_free(c->proplist); pa_proplist_free(c->proplist);
pa_xfree(c->driver); pa_xfree(c->driver);
@ -174,22 +174,22 @@ void pa_card_free(pa_card *c) {
pa_core_check_idle(core); pa_core_check_idle(core);
} }
int pa_card_set_config(pa_card *c, const char *name) { int pa_card_set_profile(pa_card *c, const char *name) {
pa_card_config *config; pa_card_profile *profile;
pa_assert(c); pa_assert(c);
if (!c->set_config) { if (!c->set_profile) {
pa_log_warn("set_config() operation not implemented for card %u", c->index); pa_log_warn("set_profile() operation not implemented for card %u", c->index);
return -1; return -1;
} }
if (!c->configs) if (!c->profiles)
return -1; return -1;
if (!(config = pa_hashmap_get(c->configs, name))) if (!(profile = pa_hashmap_get(c->profiles, name)))
return -1; return -1;
if (c->set_config(c, config) < 0) if (c->set_profile(c, profile) < 0)
return -1; return -1;
pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, c->index); pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, c->index);

View file

@ -29,7 +29,7 @@ typedef struct pa_card pa_card;
#include <pulsecore/module.h> #include <pulsecore/module.h>
#include <pulsecore/idxset.h> #include <pulsecore/idxset.h>
typedef struct pa_card_config { typedef struct pa_card_profile {
char *name; char *name;
pa_bool_t optical_sink:1; pa_bool_t optical_sink:1;
@ -40,7 +40,7 @@ typedef struct pa_card_config {
unsigned max_sink_channels; unsigned max_sink_channels;
unsigned max_source_channels; unsigned max_source_channels;
} pa_card_config; } pa_card_profile;
struct pa_card { struct pa_card {
uint32_t index; uint32_t index;
@ -55,12 +55,12 @@ struct pa_card {
pa_idxset *sinks; pa_idxset *sinks;
pa_idxset *sources; pa_idxset *sources;
pa_hashmap *configs; pa_hashmap *profiles;
pa_card_config *active_config; pa_card_profile *active_profile;
void *userdata; void *userdata;
int (*set_config)(pa_card *c, pa_card_config *config); int (*set_profile)(pa_card *c, pa_card_profile *profile);
}; };
typedef struct pa_card_new_data { typedef struct pa_card_new_data {
@ -70,14 +70,14 @@ typedef struct pa_card_new_data {
const char *driver; const char *driver;
pa_module *module; pa_module *module;
pa_hashmap *configs; pa_hashmap *profiles;
pa_card_config *active_config; pa_card_profile *active_profile;
pa_bool_t namereg_fail:1; pa_bool_t namereg_fail:1;
} pa_card_new_data; } pa_card_new_data;
pa_card_config *pa_card_config_new(const char *name); pa_card_profile *pa_card_profile_new(const char *name);
void pa_card_config_free(pa_card_config *c); void pa_card_profile_free(pa_card_profile *c);
pa_card_new_data *pa_card_new_data_init(pa_card_new_data *data); pa_card_new_data *pa_card_new_data_init(pa_card_new_data *data);
void pa_card_new_data_set_name(pa_card_new_data *data, const char *name); void pa_card_new_data_set_name(pa_card_new_data *data, const char *name);
@ -86,6 +86,6 @@ void pa_card_new_data_done(pa_card_new_data *data);
pa_card *pa_card_new(pa_core *c, pa_card_new_data *data); 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);
int pa_card_set_config(pa_card *c, const char *name); int pa_card_set_profile(pa_card *c, const char *name);
#endif #endif