mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-11 13:30:02 -05:00
actually create pa_card object in module-alsa-card
This commit is contained in:
parent
c560aea4c9
commit
c06e43d7ff
3 changed files with 165 additions and 14 deletions
|
|
@ -36,13 +36,14 @@
|
|||
|
||||
#include "card.h"
|
||||
|
||||
pa_card_profile *pa_card_profile_new(const char *name) {
|
||||
pa_card_profile *pa_card_profile_new(const char *name, const char *description, size_t extra) {
|
||||
pa_card_profile *c;
|
||||
|
||||
pa_assert(name);
|
||||
|
||||
c = pa_xnew0(pa_card_profile, 1);
|
||||
c = pa_xmalloc(PA_ALIGN(sizeof(pa_card_profile)) + extra);
|
||||
c->name = pa_xstrdup(name);
|
||||
c->description = pa_xstrdup(description);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
@ -51,6 +52,7 @@ void pa_card_profile_free(pa_card_profile *c) {
|
|||
pa_assert(c);
|
||||
|
||||
pa_xfree(c->name);
|
||||
pa_xfree(c->description);
|
||||
pa_xfree(c);
|
||||
}
|
||||
|
||||
|
|
@ -122,7 +124,9 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
|
|||
|
||||
c->profiles = data->profiles;
|
||||
data->profiles = NULL;
|
||||
c->active_profile = data->active_profile;
|
||||
if (!(c->active_profile = data->active_profile))
|
||||
if (c->profiles)
|
||||
c->active_profile = pa_hashmap_first(c->profiles);
|
||||
data->active_profile = NULL;
|
||||
|
||||
c->userdata = NULL;
|
||||
|
|
@ -189,6 +193,9 @@ int pa_card_set_profile(pa_card *c, const char *name) {
|
|||
if (!(profile = pa_hashmap_get(c->profiles, name)))
|
||||
return -1;
|
||||
|
||||
if (c->active_profile == profile)
|
||||
return 0;
|
||||
|
||||
if (c->set_profile(c, profile) < 0)
|
||||
return -1;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,17 +31,20 @@ typedef struct pa_card pa_card;
|
|||
|
||||
typedef struct pa_card_profile {
|
||||
char *name;
|
||||
char *description;
|
||||
|
||||
pa_bool_t optical_sink:1;
|
||||
pa_bool_t optical_source:1;
|
||||
|
||||
/* We probably want to have different properties later on here */
|
||||
unsigned n_sinks;
|
||||
unsigned n_sources;
|
||||
|
||||
unsigned max_sink_channels;
|
||||
unsigned max_source_channels;
|
||||
|
||||
/* .. followed by some implementation specific data */
|
||||
} pa_card_profile;
|
||||
|
||||
#define PA_CARD_PROFILE_DATA(d) ((void*) ((uint8_t*) d + PA_ALIGN(sizeof(pa_card_profile))))
|
||||
|
||||
struct pa_card {
|
||||
uint32_t index;
|
||||
pa_core *core;
|
||||
|
|
@ -65,6 +68,7 @@ struct pa_card {
|
|||
|
||||
typedef struct pa_card_new_data {
|
||||
char *name;
|
||||
char *description;
|
||||
|
||||
pa_proplist *proplist;
|
||||
const char *driver;
|
||||
|
|
@ -76,7 +80,7 @@ typedef struct pa_card_new_data {
|
|||
pa_bool_t namereg_fail:1;
|
||||
} pa_card_new_data;
|
||||
|
||||
pa_card_profile *pa_card_profile_new(const char *name);
|
||||
pa_card_profile *pa_card_profile_new(const char *name, const char *description, size_t extra);
|
||||
void pa_card_profile_free(pa_card_profile *c);
|
||||
|
||||
pa_card_new_data *pa_card_new_data_init(pa_card_new_data *data);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue