diff options
author | Manuel Bachmann <manuel.bachmann@iot.bzh> | 2016-06-14 11:44:45 +0200 |
---|---|---|
committer | Yannick Gicquel <yannick.gicquel@iot.bzh> | 2016-10-11 17:09:07 +0200 |
commit | acb229813f5845e8b38bea56870211319887f3b4 (patch) | |
tree | 207d1aaffe0e2a0444e035d02311a326e60bc94a | |
parent | 9dc64e1e291d6518da0a918105c5bf7b1c603dd5 (diff) |
Rename all internal pa_ definitions to agl_
The plugin often uses "pa_" for its internal structures
and functions, which is misleading because this prefix is
also used by PulseAudio itself. Thus, reading the code can
be confusing.
Rename everything to "agl_".
Change-Id: Iadd03daf528ec0cbed1cb526aeb3bada757a211f
Signed-off-by: Manuel Bachmann <manuel.bachmann@iot.bzh>
-rw-r--r-- | audiomgr.c | 12 | ||||
-rw-r--r-- | audiomgr.h | 4 | ||||
-rw-r--r-- | classify.c | 2 | ||||
-rw-r--r-- | classify.h | 2 | ||||
-rw-r--r-- | config.c | 8 | ||||
-rw-r--r-- | config.h | 6 | ||||
-rw-r--r-- | discover.c | 114 | ||||
-rw-r--r-- | discover.h | 32 | ||||
-rw-r--r-- | loopback.c | 24 | ||||
-rw-r--r-- | loopback.h | 30 | ||||
-rw-r--r-- | module.c | 59 | ||||
-rw-r--r-- | node.c | 18 | ||||
-rw-r--r-- | node.h | 25 | ||||
-rw-r--r-- | router.c | 22 | ||||
-rw-r--r-- | router.h | 14 | ||||
-rw-r--r-- | routerif.h | 6 | ||||
-rw-r--r-- | socketif.c | 18 | ||||
-rw-r--r-- | switch.c | 10 | ||||
-rw-r--r-- | tracker.c | 33 | ||||
-rw-r--r-- | tracker.h | 6 | ||||
-rw-r--r-- | userdata.h | 40 | ||||
-rw-r--r-- | utils.c | 46 | ||||
-rw-r--r-- | utils.h | 36 | ||||
-rw-r--r-- | zone.c | 12 | ||||
-rw-r--r-- | zone.h | 4 |
25 files changed, 291 insertions, 292 deletions
@@ -41,20 +41,20 @@ typedef struct { link_t *links; } routes_t; -struct pa_audiomgr { +struct agl_audiomgr { domain_t domain; pa_hashmap *nodes; /**< nodes ie. sinks and sources */ pa_hashmap *conns; /**< connections */ routes_t defrts; /**< default routes */ }; -struct pa_audiomgr *pa_audiomgr_init (struct userdata *u) +struct agl_audiomgr *agl_audiomgr_init (struct userdata *u) { - pa_audiomgr *am; + agl_audiomgr *am; pa_assert (u); - am = pa_xnew0 (pa_audiomgr, 1); + am = pa_xnew0 (agl_audiomgr, 1); am->domain.id = AM_ID_INVALID; am->domain.state = DS_DOWN; am->nodes = pa_hashmap_new (pa_idxset_trivial_hash_func, @@ -64,9 +64,9 @@ struct pa_audiomgr *pa_audiomgr_init (struct userdata *u) return am; } -void pa_audiomgr_done (struct userdata *u) +void agl_audiomgr_done (struct userdata *u) { - pa_audiomgr *am; + agl_audiomgr *am; if (u && (am = u->audiomgr)) { //if (u->routerif && am->domain.id != AM_ID_INVALID) @@ -24,7 +24,7 @@ #include "userdata.h" -pa_audiomgr *pa_audiomgr_init (struct userdata *); -void pa_audiomgr_done (struct userdata *); +agl_audiomgr *agl_audiomgr_init (struct userdata *); +void agl_audiomgr_done (struct userdata *); #endif @@ -24,7 +24,7 @@ #include "classify.h" -agl_node_type pa_classify_guess_stream_node_type (struct userdata *u, pa_proplist *pl) +agl_node_type agl_classify_guess_stream_node_type (struct userdata *u, pa_proplist *pl) { agl_node_type type; const char *role; @@ -3,6 +3,6 @@ #include "userdata.h" -agl_node_type pa_classify_guess_stream_node_type (struct userdata *, pa_proplist *); +agl_node_type agl_classify_guess_stream_node_type (struct userdata *, pa_proplist *); #endif @@ -21,7 +21,7 @@ */ #include "config.h" -const char *pa_config_file_get_path (const char *dir, const char *file, char *buf, size_t len) +const char *agl_config_file_get_path (const char *dir, const char *file, char *buf, size_t len) { pa_assert (file); pa_assert (buf); @@ -32,7 +32,7 @@ const char *pa_config_file_get_path (const char *dir, const char *file, char *bu return buf; } -bool pa_config_parse_file (struct userdata *u, const char *path) +bool agl_config_parse_file (struct userdata *u, const char *path) { bool success; @@ -42,7 +42,7 @@ bool pa_config_parse_file (struct userdata *u, const char *path) return false; else { pa_log_info ("parsing configuration file '%s'", path); - success = pa_config_dofile (u, path); + success = agl_config_dofile (u, path); } if (!success) { @@ -53,7 +53,7 @@ bool pa_config_parse_file (struct userdata *u, const char *path) return success; } -bool pa_config_dofile (struct userdata *u, const char *path) +bool agl_config_dofile (struct userdata *u, const char *path) { /* TODO */ return false; @@ -58,8 +58,8 @@ typedef struct { int priority; } prior_def; -const char *pa_config_file_get_path (const char *, const char *, char *, size_t); -bool pa_config_parse_file (struct userdata *, const char *); -bool pa_config_dofile (struct userdata *, const char *); +const char *agl_config_file_get_path (const char *, const char *, char *, size_t); +bool agl_config_parse_file (struct userdata *, const char *); +bool agl_config_dofile (struct userdata *, const char *); #endif @@ -42,9 +42,9 @@ static const char *node_key (struct userdata *, agl_direction, void *, pa_device_port *, char *, size_t); static agl_node *create_node (struct userdata *, agl_node *, bool *); -struct pa_discover *pa_discover_init (struct userdata *u) +struct agl_discover *agl_discover_init (struct userdata *u) { - pa_discover *discover = pa_xnew0 (pa_discover, 1); + agl_discover *discover = pa_xnew0 (agl_discover, 1); discover->chmin = 1; discover->chmax = 2; discover->selected = true; @@ -56,9 +56,9 @@ struct pa_discover *pa_discover_init (struct userdata *u) return discover; } -void pa_discover_done (struct userdata *u) +void agl_discover_done (struct userdata *u) { - pa_discover *discover; + agl_discover *discover; void *state; agl_node *node; @@ -73,27 +73,27 @@ void pa_discover_done (struct userdata *u) } } -void pa_discover_add_card (struct userdata *u, pa_card *card) +void agl_discover_add_card (struct userdata *u, pa_card *card) { const char *bus; pa_assert(u); pa_assert(card); - if (!(bus = pa_utils_get_card_bus (card))) { + if (!(bus = agl_utils_get_card_bus (card))) { pa_log_debug ("ignoring card '%s' due to lack of '%s' property", - pa_utils_get_card_name (card), PA_PROP_DEVICE_BUS); + agl_utils_get_card_name (card), PA_PROP_DEVICE_BUS); return; } if (pa_streq(bus, "pci") || pa_streq(bus, "usb") || pa_streq(bus, "platform")) { pa_log_debug ("adding card '%s' thanks to its '%s' property", - pa_utils_get_card_name (card), PA_PROP_DEVICE_BUS); + agl_utils_get_card_name (card), PA_PROP_DEVICE_BUS); pa_log_debug ("card type is '%s'", bus); handle_alsa_card (u, card); return; } -/* this never happens, because "pa_utils_get_card_bus()" never returns "bluetooth", +/* this never happens, because "agl_utils_get_card_bus()" never returns "bluetooth", * but have this here as a reminder */ #if 0 else if (pa_streq(bus, "bluetooth")) { @@ -103,13 +103,13 @@ void pa_discover_add_card (struct userdata *u, pa_card *card) #endif pa_log_debug ("ignoring card '%s' due to unsupported bus type '%s'", - pa_utils_get_card_name (card), bus); + agl_utils_get_card_name (card), bus); } -void pa_discover_remove_card (struct userdata *u, pa_card *card) +void agl_discover_remove_card (struct userdata *u, pa_card *card) { const char *bus; - pa_discover *discover; + agl_discover *discover; agl_node *node; void *state; @@ -117,7 +117,7 @@ void pa_discover_remove_card (struct userdata *u, pa_card *card) pa_assert (card); pa_assert_se (discover = u->discover); - if (!(bus = pa_utils_get_card_bus(card))) + if (!(bus = agl_utils_get_card_bus(card))) bus = "<unknown>"; /*PA_HASHMAP_FOREACH(node, discover->nodes.byname, state) { @@ -130,7 +130,7 @@ void pa_discover_remove_card (struct userdata *u, pa_card *card) destroy_node(u, node); }*/ - /* this never happens, because "pa_utils_get_card_bus()" never returns "bluetooth", + /* this never happens, because "agl_utils_get_card_bus()" never returns "bluetooth", * but have this here as a reminder */ #if 0 if (pa_streq(bus, "bluetooth")) @@ -138,12 +138,12 @@ void pa_discover_remove_card (struct userdata *u, pa_card *card) #endif } -void pa_discover_add_sink (struct userdata *u, pa_sink *sink, bool route) +void agl_discover_add_sink (struct userdata *u, pa_sink *sink, bool route) { pa_core *core; - pa_discover *discover; pa_module *module; pa_card *card; + agl_discover *discover; char kbf[256]; const char *key; agl_node *node; @@ -162,7 +162,7 @@ void pa_discover_add_sink (struct userdata *u, pa_sink *sink, bool route) key = node_key (u, agl_output, sink, NULL, kbf, sizeof(kbf)); if (!key) return; pa_log_debug ("Sink key: %s", key); - node = pa_discover_find_node_by_key (u, key); + node = agl_discover_find_node_by_key (u, key); if (!node) { /* ALWAYS NULL, IF CALL "handle_card_ports" FROM "handle_alsa_card" !!! */ if (u->state.profile) pa_log_debug ("can't find node for sink (key '%s')", key); @@ -176,12 +176,12 @@ void pa_discover_add_sink (struct userdata *u, pa_sink *sink, bool route) node->paname, node->key); node->paidx = sink->index; node->available = true; - pa_discover_add_node_to_ptr_hash (u, sink, node); + agl_discover_add_node_to_ptr_hash (u, sink, node); #if 0 /* loopback part : it is a device node, use "module-loopback" to make its */ if (node->implement == agl_device) { - null_source = pa_utils_get_null_source (u); + null_source = agl_utils_get_null_source (u); if (!null_source) { pa_log ("Can't load loopback module: no initial null source"); return; @@ -201,14 +201,14 @@ static void handle_alsa_card (struct userdata *u, pa_card *card) const char *udd; /* managed by udev ("1" = yes) */ memset (&data, 0, sizeof(data)); - data.zone = pa_utils_get_zone (card->proplist, NULL); + data.zone = agl_utils_get_zone (card->proplist, NULL); data.visible = true; data.amid = AM_ID_INVALID; data.implement = agl_device; /* this node is a physical device */ data.paidx = PA_IDXSET_INVALID; - data.stamp = pa_utils_get_stamp (); /* each time incremented by one */ + data.stamp = agl_utils_get_stamp (); /* each time incremented by one */ - cnam = pa_utils_get_card_name (card); /* PulseAudio name */ + cnam = agl_utils_get_card_name (card); /* PulseAudio name */ cid = cnam + 10; /* PulseAudio short name, with "alsa_card." prefix removed */ alsanam = pa_proplist_gets (card->proplist, "alsa.card_name"); /* ALSA name */ udd = pa_proplist_gets (card->proplist, "module-udev-detect.discovered"); @@ -234,7 +234,7 @@ static void handle_alsa_card (struct userdata *u, pa_card *card) ; static void handle_alsa_card_sinks_and_sources (struct userdata *u, pa_card *card, agl_node *data, const char *cardid) { - pa_discover *discover; /* discovery restrictions (max channels...) */ + agl_discover *discover; /* discovery restrictions (max channels...) */ pa_card_profile *prof; void *state; char *sinks[MAX_CARD_TARGET+1]; /* discovered sinks array */ @@ -384,7 +384,7 @@ static void handle_card_ports (struct userdata *u, agl_node *data, pa_card *card printf ("Key : %s\n", key); /* this is needed to fill the "port->type" field */ - //pa_classify_node_by_card (data, card, prof, port); + //agl_classify_node_by_card (data, card, prof, port); /* this is needed to complete the "pa_discover_add_sink" first pass */ node = create_node (u, data, &created); @@ -414,14 +414,14 @@ static const char *node_key (struct userdata *u, agl_direction direction, if (direction == agl_output) { pa_sink *sink = data; type = pa_xstrdup ("sink"); - name = pa_utils_get_sink_name (sink); + name = agl_utils_get_sink_name (sink); card = sink->card; if (!port) port = sink->active_port; } else { pa_source *source = data; type = pa_xstrdup ("source"); - name = pa_utils_get_source_name (source); + name = agl_utils_get_source_name (source); card = source->card; if (!port) port = source->active_port; @@ -443,9 +443,9 @@ static const char *node_key (struct userdata *u, agl_direction direction, profile_name = u->state.profile; } - if (!(bus = pa_utils_get_card_bus (card))) { + if (!(bus = agl_utils_get_card_bus (card))) { pa_log_debug ("ignoring card '%s' due to lack of '%s' property", - pa_utils_get_card_name (card), PA_PROP_DEVICE_BUS); + agl_utils_get_card_name (card), PA_PROP_DEVICE_BUS); return NULL; } @@ -464,9 +464,9 @@ static const char *node_key (struct userdata *u, agl_direction direction, return (const char *)key; } -agl_node *pa_discover_find_node_by_key (struct userdata *u, const char *key) +agl_node *agl_discover_find_node_by_key (struct userdata *u, const char *key) { - pa_discover *discover; + agl_discover *discover; agl_node *node; pa_assert (u); @@ -480,9 +480,9 @@ agl_node *pa_discover_find_node_by_key (struct userdata *u, const char *key) return node; } -void pa_discover_add_node_to_ptr_hash (struct userdata *u, void *ptr, agl_node *node) +void agl_discover_add_node_to_ptr_hash (struct userdata *u, void *ptr, agl_node *node) { - pa_discover *discover; + agl_discover *discover; pa_assert (u); pa_assert (ptr); @@ -494,7 +494,7 @@ void pa_discover_add_node_to_ptr_hash (struct userdata *u, void *ptr, agl_node * static agl_node *create_node (struct userdata *u, agl_node *data, bool *created_ret) { - pa_discover *discover; + agl_discover *discover; agl_node *node; bool created; @@ -526,14 +526,14 @@ static agl_node *create_node (struct userdata *u, agl_node *data, bool *created_ return node; } -void pa_discover_add_source (struct userdata *u, pa_source *source) +void agl_discover_add_source (struct userdata *u, pa_source *source) { - static pa_nodeset_resdef def_resdef = {0, {0, 0}}; + static agl_nodeset_resdef def_resdef = {0, {0, 0}}; pa_core *core; - pa_discover *discover; pa_module *module; pa_card *card; + agl_discover *discover; const char *key; char kbf[256]; agl_node *node; @@ -551,7 +551,7 @@ void pa_discover_add_source (struct userdata *u, pa_source *source) key = node_key (u, agl_input, source, NULL, kbf, sizeof(kbf)); if (!key) return; pa_log_debug ("Source key: %s", key); - node = pa_discover_find_node_by_key (u, key); + node = agl_discover_find_node_by_key (u, key); if (!node) { /* VERIFY IF THIS WORKS */ if (u->state.profile) pa_log_debug ("can't find node for source (key '%s')", key); @@ -565,17 +565,17 @@ void pa_discover_add_source (struct userdata *u, pa_source *source) node->paname, node->key); node->paidx = source->index; node->available = true; - pa_discover_add_node_to_ptr_hash (u, source, node); + agl_discover_add_node_to_ptr_hash (u, source, node); } } -bool pa_discover_preroute_sink_input(struct userdata *u, pa_sink_input_new_data *data) +bool agl_discover_preroute_sink_input(struct userdata *u, pa_sink_input_new_data *data) { pa_core *core; pa_sink *sink; pa_source *source; - pa_discover *discover; - pa_nodeset *nodeset; + agl_discover *discover; + agl_nodeset *nodeset; pa_proplist *pl; agl_node *node; @@ -598,7 +598,7 @@ bool pa_discover_preroute_sink_input(struct userdata *u, pa_sink_input_new_data node = agl_node_create (u, NULL); node->direction = agl_input; node->implement = agl_stream; - node->type = pa_classify_guess_stream_node_type (u, pl); + node->type = agl_classify_guess_stream_node_type (u, pl); node->visible = true; node->available = true; node->ignore = true; /* gets ignored initially */ @@ -610,12 +610,12 @@ bool pa_discover_preroute_sink_input(struct userdata *u, pa_sink_input_new_data /* create NULL sink */ if (!node->nullsink) - node->nullsink = pa_utils_create_null_sink (u, u->nsnam); + node->nullsink = agl_utils_create_null_sink (u, u->nsnam); if (!node->nullsink) return false; /* redirect sink input to NULL sink */ - sink = pa_utils_get_null_sink (u, node->nullsink); + sink = agl_utils_get_null_sink (u, node->nullsink); if (pa_sink_input_new_data_set_sink (data, sink, false)) pa_log_debug ("set sink %u for new sink-input", sink->index); @@ -625,11 +625,11 @@ bool pa_discover_preroute_sink_input(struct userdata *u, pa_sink_input_new_data return true; } -void pa_discover_register_sink_input (struct userdata *u, pa_sink_input *sinp) +void agl_discover_register_sink_input (struct userdata *u, pa_sink_input *sinp) { pa_core *core; - pa_discover *discover; pa_proplist *pl, *client_proplist; + agl_discover *discover; const char *media; const char *name; const char *role; @@ -651,7 +651,7 @@ void pa_discover_register_sink_input (struct userdata *u, pa_sink_input *sinp) /* return; */ } - name = pa_utils_get_sink_input_name (sinp); + name = agl_utils_get_sink_input_name (sinp); client_proplist = sinp->client ? sinp->client->proplist : NULL; pa_log_debug ("registering input stream '%s'", name); @@ -668,7 +668,7 @@ void pa_discover_register_sink_input (struct userdata *u, pa_sink_input *sinp) * #define PA_PROP_ROUTING_CLASS_NAME "routing.class.name" * #define PA_PROP_ROUTING_CLASS_ID "routing.class.id" * #define PA_PROP_ROUTING_METHOD "routing.method" */ - pa_utils_set_stream_routing_properties (pl, type, NULL); + agl_utils_set_stream_routing_properties (pl, type, NULL); /* we now create a new node for this sink */ memset (&node_data, 0, sizeof(node_data)); @@ -677,7 +677,7 @@ void pa_discover_register_sink_input (struct userdata *u, pa_sink_input *sinp) node_data.implement = agl_stream; node_data.channels = sinp->channel_map.channels; node_data.type = type; - node_data.zone = pa_utils_get_zone (sinp->proplist, client_proplist); + node_data.zone = agl_utils_get_zone (sinp->proplist, client_proplist); node_data.visible = true; node_data.available = true; node_data.amname = pa_proplist_gets (pl, "resource.set.appid"); @@ -693,7 +693,7 @@ void pa_discover_register_sink_input (struct userdata *u, pa_sink_input *sinp) node = create_node (u, &node_data, NULL); pa_assert (node); - pa_discover_add_node_to_ptr_hash (u, sinp, node); + agl_discover_add_node_to_ptr_hash (u, sinp, node); /* if (sink && target) { pa_log_debug ("move stream to sink %u (%s)", sink->index, sink->name); @@ -705,11 +705,11 @@ void pa_discover_register_sink_input (struct userdata *u, pa_sink_input *sinp) }*/ } -void pa_discover_register_source_output (struct userdata *u, pa_source_output *sout) +void agl_discover_register_source_output (struct userdata *u, pa_source_output *sout) { pa_core *core; - pa_discover *discover; pa_proplist *pl, *client_proplist; + agl_discover *discover; const char *media; const char *name; const char *role; @@ -731,17 +731,17 @@ void pa_discover_register_source_output (struct userdata *u, pa_source_output *s /* return; */ } - /* TODO : contrary to "pa_discover_register_sink_input", this function is always called + /* TODO : contrary to "agl_discover_register_sink_input", this function is always called * even if we do not find PA_PROP_MEDIA_NAME (see above). */ - //pa_utils_set_stream_routing_properties (pl, type, NULL); + //agl_utils_set_stream_routing_properties (pl, type, NULL); - name = pa_utils_get_source_output_name (sout); + name = agl_utils_get_source_output_name (sout); client_proplist = sout->client ? sout->client->proplist : NULL; pa_log_debug("registering output stream '%s'", name); } -void pa_discover_add_sink_input (struct userdata *u, pa_sink_input *sinp) +void agl_discover_add_sink_input (struct userdata *u, pa_sink_input *sinp) { pa_core *core; agl_node *node; @@ -761,7 +761,7 @@ void pa_discover_add_sink_input (struct userdata *u, pa_sink_input *sinp) agl_router_register_node (u, node); } -void pa_discover_remove_sink_input (struct userdata *u, pa_sink_input *sinp) +void agl_discover_remove_sink_input (struct userdata *u, pa_sink_input *sinp) { pa_core *core; agl_node *node; @@ -24,7 +24,7 @@ #include "userdata.h" -struct pa_discover { +struct agl_discover { /* criteria for filtering sinks and sources */ unsigned chmin; /**< minimum of max channels */ unsigned chmax; /**< maximum of max channels */ @@ -37,22 +37,22 @@ struct pa_discover { } nodes; }; -struct pa_discover *pa_discover_init (struct userdata *); -void pa_discover_done (struct userdata *); +struct agl_discover *agl_discover_init (struct userdata *); +void agl_discover_done (struct userdata *); -void pa_discover_add_card (struct userdata *, pa_card *); -void pa_discover_remove_card (struct userdata *, pa_card *); -void pa_discover_add_sink (struct userdata *, pa_sink *, bool); -void pa_discover_remove_sink (struct userdata *, pa_sink *); -void pa_discover_add_source (struct userdata *, pa_source *); -void pa_discover_remove_source (struct userdata *, pa_source *); -void pa_discover_add_sink_input (struct userdata *, pa_sink_input *); -void pa_discover_remove_sink_input (struct userdata *, pa_sink_input *); -bool pa_discover_preroute_sink_input (struct userdata *, pa_sink_input_new_data *); -void pa_discover_register_sink_input (struct userdata *, pa_sink_input *); -void pa_discover_register_source_output (struct userdata *, pa_source_output *); +void agl_discover_add_card (struct userdata *, pa_card *); +void agl_discover_remove_card (struct userdata *, pa_card *); +void agl_discover_add_sink (struct userdata *, pa_sink *, bool); +void agl_discover_remove_sink (struct userdata *, pa_sink *); +void agl_discover_add_source (struct userdata *, pa_source *); +void agl_discover_remove_source (struct userdata *, pa_source *); +void agl_discover_add_sink_input (struct userdata *, pa_sink_input *); +void agl_discover_remove_sink_input (struct userdata *, pa_sink_input *); +bool agl_discover_preroute_sink_input (struct userdata *, pa_sink_input_new_data *); +void agl_discover_register_sink_input (struct userdata *, pa_sink_input *); +void agl_discover_register_source_output (struct userdata *, pa_source_output *); -agl_node *pa_discover_find_node_by_key (struct userdata *, const char *); -void pa_discover_add_node_to_ptr_hash (struct userdata *, void *, agl_node *); +agl_node *agl_discover_find_node_by_key (struct userdata *, const char *); +void agl_discover_add_node_to_ptr_hash (struct userdata *, void *, agl_node *); #endif @@ -23,27 +23,27 @@ #include "utils.h" #include "list.h" -pa_loopback *pa_loopback_init (void) +agl_loopback *agl_loopback_init (void) { - pa_loopback *loopback = pa_xnew0 (pa_loopback, 1); + agl_loopback *loopback = pa_xnew0 (agl_loopback, 1); return loopback; } -void pa_loopback_done (struct userdata *u, pa_loopback *loopback) +void agl_loopback_done (struct userdata *u, agl_loopback *loopback) { - pa_loopnode *loop, *n; + agl_loopnode *loop, *n; pa_core *core; pa_assert_se (core = u->core); PA_LLIST_FOREACH_SAFE(loop, n, loopback->loopnodes) { - pa_module_unload_by_index(core, loop->module_index, false); + pa_module_unload_by_index (core, loop->module_index, false); } } -pa_loopnode *pa_loopnode_create (struct userdata *u, pa_loopnode_type type, - uint32_t node_index, uint32_t source_index, uint32_t sink_index) +agl_loopnode *agl_loopnode_create (struct userdata *u, agl_loopnode_type type, + uint32_t node_index, uint32_t source_index, uint32_t sink_index) { pa_core *core; pa_module *module; @@ -53,7 +53,7 @@ pa_loopnode *pa_loopnode_create (struct userdata *u, pa_loopnode_type type, const char *sinam; pa_source_output *sout; pa_sink_input *sinp; - pa_loopnode *loopnode; + agl_loopnode *loopnode; int idx; char args[256]; @@ -61,9 +61,9 @@ pa_loopnode *pa_loopnode_create (struct userdata *u, pa_loopnode_type type, pa_assert_se (core = u->core); source = pa_idxset_get_by_index (core->sources, source_index); - sonam = pa_utils_get_source_name (source); sink = pa_idxset_get_by_index (core->sinks, sink_index); - sinam = pa_utils_get_sink_name (sink); + sonam = agl_utils_get_source_name (source); + sinam = agl_utils_get_sink_name (sink); snprintf (args, sizeof(args), "source=\"%s\" sink=\"%s\"", sonam, sinam); module = pa_module_load (core, "module-loopback", args); @@ -89,7 +89,7 @@ pa_loopnode *pa_loopnode_create (struct userdata *u, pa_loopnode_type type, return NULL; } - loopnode = pa_xnew0 (pa_loopnode, 1); + loopnode = pa_xnew0 (agl_loopnode, 1); loopnode->module_index = module->index; loopnode->source_output_index = sout->index; loopnode->sink_input_index = sinp->index; @@ -97,7 +97,7 @@ pa_loopnode *pa_loopnode_create (struct userdata *u, pa_loopnode_type type, return loopnode; } -void pa_loopnode_destroy (struct userdata *u, pa_loopnode *loopnode) +void agl_loopnode_destroy (struct userdata *u, agl_loopnode *loopnode) { pa_core *core; pa_module *module; @@ -29,30 +29,30 @@ #include "userdata.h" -typedef struct pa_loopnode pa_loopnode; -struct pa_loopnode { - PA_LLIST_FIELDS(pa_loopnode); +typedef struct agl_loopnode agl_loopnode; +struct agl_loopnode { + PA_LLIST_FIELDS(agl_loopnode); uint32_t module_index; uint32_t node_index; uint32_t sink_input_index; uint32_t source_output_index; }; -typedef struct pa_loopback { - PA_LLIST_HEAD(pa_loopnode, loopnodes); -} pa_loopback; +typedef struct agl_loopback { + PA_LLIST_HEAD(agl_loopnode, loopnodes); +} agl_loopback; typedef enum { - PA_LOOPNODE_TYPE_UNKNOWN = 0, - PA_LOOPNODE_SOURCE, - PA_LOOPNODE_SINK, -} pa_loopnode_type; + AGL_LOOPNODE_TYPE_UNKNOWN = 0, + AGL_LOOPNODE_SOURCE, + AGL_LOOPNODE_SINK, +} agl_loopnode_type; -pa_loopback *pa_loopback_init (void); -void pa_loopback_done (struct userdata *, pa_loopback *); +agl_loopback *agl_loopback_init (void); +void agl_loopback_done (struct userdata *, agl_loopback *); -pa_loopnode *pa_loopnode_create (struct userdata *, pa_loopnode_type, - uint32_t, uint32_t, uint32_t); -void pa_loopnode_destroy (struct userdata *, pa_loopnode *); +agl_loopnode *agl_loopnode_create (struct userdata *, agl_loopnode_type, + uint32_t, uint32_t, uint32_t); +void agl_loopnode_destroy (struct userdata *, agl_loopnode *); #endif @@ -34,16 +34,16 @@ $ pactl load-module mypamodule #include <pulsecore/modargs.h> /* for "pa_modargs" */ #include "userdata.h" /* for "struct userdata" */ -#include "config.h" /* for "pa_config_...()" */ -#include "utils.h" /* for "struct pa_null_sink", "pa_utils_create_null_sink()"... */ -#include "loopback.h" /* for "struct pa_loopback/loopnode" */ -#include "zone.h" /* for "struct pa_zoneset" */ -#include "node.h" /* for "struct pa_nodeset" */ -#include "audiomgr.h" /* for "struct pa_audiomgr" */ -#include "routerif.h" /* for "struct pa_routerif" */ -#include "discover.h" /* for "struct pa_discover" */ -#include "tracker.h" /* for "struct pa_tracker" */ -#include "router.h" /* for "struct pa_router" */ +#include "config.h" /* for "agl_config_...()" */ +#include "utils.h" /* for "struct agl_null_sink", "agl_utils_create_null_sink()"... */ +#include "loopback.h" /* for "struct agl_loopback/loopnode" */ +#include "zone.h" /* for "struct agl_zoneset" */ +#include "node.h" /* for "struct agl_nodeset" */ +#include "audiomgr.h" /* for "struct agl_audiomgr" */ +#include "routerif.h" /* for "struct agl_routerif" */ +#include "router.h" /* for "struct agl_router" */ +#include "discover.h" /* for "struct agl_discover" */ +#include "tracker.h" /* for "struct agl_tracker" */ #ifndef DEFAULT_CONFIG_DIR #define DEFAULT_CONFIG_DIR "/etc/pulse" @@ -100,7 +100,9 @@ int pa__init (pa_module *m) pa_log ("cfgdir : %s", cfgdir); pa_log ("cfgfile : %s", cfgfile); - pa_utils_init_stamp (); + /* initialize "stamp" incremental integer to 0 */ + + agl_utils_init_stamp (); /* initialize userdata */ @@ -108,28 +110,28 @@ int pa__init (pa_module *m) u->core = m->core; u->module = m; u->nsnam = pa_xstrdup (nsnam) ; - u->zoneset = pa_zoneset_init (u); - u->nodeset = pa_nodeset_init (u); - u->audiomgr = pa_audiomgr_init (u); - u->routerif = pa_routerif_init (u, amsocktype, amaddr, amport); - u->router = pa_router_init (u); - u->discover = pa_discover_init (u); - u->tracker = pa_tracker_init (u); + u->zoneset = agl_zoneset_init (u); + u->nodeset = agl_nodeset_init (u); + u->audiomgr = agl_audiomgr_init (u); + u->routerif = agl_routerif_init (u, amsocktype, amaddr, amport); + u->router = agl_router_init (u); + u->discover = agl_discover_init (u); + u->tracker = agl_tracker_init (u); m->userdata = u; /* apply the config file */ - cfgpath = pa_config_file_get_path (cfgdir, cfgfile, buf, sizeof(buf)); - pa_config_parse_file (u, cfgpath); + cfgpath = agl_config_file_get_path (cfgdir, cfgfile, buf, sizeof(buf)); + agl_config_parse_file (u, cfgpath); /* really initialize the module's core logic */ - pa_tracker_synchronize (u); + agl_tracker_synchronize (u); /* end */ - pa_modargs_free(ma); + pa_modargs_free (ma); return 0; } @@ -145,12 +147,13 @@ void pa__done (pa_module *m) pa_assert (m); if (u = m->userdata) { - pa_tracker_done (u); - pa_discover_done (u); - pa_routerif_done (u); - pa_audiomgr_done (u); - pa_nodeset_done (u); - pa_zoneset_done (u); + agl_tracker_done (u); + agl_discover_done (u); + agl_router_done (u); + agl_routerif_done (u); + agl_audiomgr_done (u); + agl_nodeset_done (u); + agl_zoneset_done (u); pa_xfree (u->nsnam); pa_xfree (u); } @@ -23,13 +23,13 @@ #include <pulsecore/idxset.h> -pa_nodeset *pa_nodeset_init (struct userdata *u) +agl_nodeset *agl_nodeset_init (struct userdata *u) { - pa_nodeset *ns; + agl_nodeset *ns; pa_assert (u); - ns = pa_xnew0 (pa_nodeset, 1); + ns = pa_xnew0 (agl_nodeset, 1); ns->nodes = pa_idxset_new (pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); ns->roles = pa_hashmap_new (pa_idxset_string_hash_func, @@ -39,10 +39,10 @@ pa_nodeset *pa_nodeset_init (struct userdata *u) return ns; } -void pa_nodeset_done(struct userdata *u) +void agl_nodeset_done(struct userdata *u) { - pa_nodeset *ns; - pa_nodeset_map *role, *binary; + agl_nodeset *ns; + agl_nodeset_map *role, *binary; void *state; int i; @@ -70,7 +70,7 @@ void pa_nodeset_done(struct userdata *u) agl_node *agl_node_create (struct userdata *u, agl_node *data) { - pa_nodeset *ns; + agl_nodeset *ns; agl_node *node; pa_assert (u); @@ -136,7 +136,7 @@ agl_node *agl_node_get_from_data (struct userdata *u, agl_direction type, void * { pa_sink_input_new_data *sinp_data; pa_source_output_new_data *sout_data; - pa_nodeset *nodeset; + agl_nodeset *nodeset; agl_node *node; uint32_t index; @@ -162,7 +162,7 @@ agl_node *agl_node_get_from_data (struct userdata *u, agl_direction type, void * agl_node *agl_node_get_from_client (struct userdata *u, pa_client *client) { - pa_nodeset *nodeset; + agl_nodeset *nodeset; agl_node *node; uint32_t index; @@ -31,14 +31,14 @@ #define APCLASS_DIM (agl_application_class_end - agl_application_class_begin + 1) -struct pa_nodeset { +struct agl_nodeset { pa_idxset *nodes; pa_hashmap *roles; pa_hashmap *binaries; const char *class_name[APCLASS_DIM]; /* as much elements as app.classes (see in "userdata.h") */ }; -struct pa_nodeset_resdef { +struct agl_nodeset_resdef { uint32_t priority; struct { uint32_t rset; @@ -46,19 +46,19 @@ struct pa_nodeset_resdef { } flags; }; -struct pa_nodeset_map { +struct agl_nodeset_map { const char *name; agl_node_type type; const char *role; - pa_nodeset_resdef *resdef; + agl_nodeset_resdef *resdef; }; -struct pa_node_card { +struct agl_node_card { uint32_t index; char *profile; }; -struct pa_node_rset { +struct agl_node_rset { char *id; /**< resource set id, if any */ bool grant; /**< permission to play/render etc */ }; @@ -69,8 +69,8 @@ struct agl_node { agl_direction direction; /**< agl_input | agl_output */ agl_implement implement; /**< agl_device | agl_stream */ pa_client *client; /**< matching client pointer (for agl_input nodes only) */ - pa_null_sink *nullsink; /**< associated null sink (for agl_input nodes only) */ - pa_loopnode *loopnode; /**< associated loopback */ + agl_null_sink *nullsink; /**< associated null sink (for agl_input nodes only) */ + agl_loopnode *loopnode; /**< associated loopback */ uint32_t channels; /**< number of channels (eg. 1=mono, 2=stereo) */ agl_location location; /**< mir_internal | mir_external */ agl_privacy privacy; /**< mir_public | mir_private */ @@ -85,22 +85,21 @@ struct agl_node { uint16_t amid; /**< handle to audiomanager, if any */ const char *paname; /**< sink|source|sink_input|source_output name */ uint32_t paidx; /**< sink|source|sink_input|source_output index*/ - pa_node_card pacard; /**< pulse card related data, if any */ + agl_node_card pacard; /**< pulse card related data, if any */ const char *paport; /**< sink or source port if applies */ /*pa_muxnode *mux;*/ /**< for multiplexable input streams only */ - /*pa_loopnode *loop;*/ /**< for looped back sources only */ agl_dlist rtentries; /**< in device nodes: listhead of nodchain */ agl_dlist rtprilist; /**< in stream nodes: priority link (head is in pa_router)*/ agl_dlist constrains; /**< listhead of constrains */ /*mir_vlim vlim;*/ /**< volume limit */ - pa_node_rset rset; /**< resource set info if applies */ + agl_node_rset rset; /**< resource set info if applies */ uint32_t stamp; /*scripting_node *scripting;*/ /** scripting data, if any */ }; -pa_nodeset *pa_nodeset_init (struct userdata *); -void pa_nodeset_done (struct userdata *); +agl_nodeset *agl_nodeset_init (struct userdata *); +void agl_nodeset_done (struct userdata *); agl_node *agl_node_create (struct userdata *, agl_node *); const char *agl_node_type_str (agl_node_type); @@ -23,14 +23,14 @@ #include "switch.h" #include "utils.h" -pa_router *pa_router_init (struct userdata *u) +agl_router *agl_router_init (struct userdata *u) { - pa_router *router; + agl_router *router; size_t num_classes; num_classes = agl_application_class_end; - router = pa_xnew0 (pa_router, 1); + router = pa_xnew0 (agl_router, 1); router->rtgroups.input = pa_hashmap_new (pa_idxset_string_hash_func, pa_idxset_string_compare_func); router->rtgroups.output = pa_hashmap_new (pa_idxset_string_hash_func, @@ -44,9 +44,9 @@ pa_router *pa_router_init (struct userdata *u) return router; } -void pa_router_done (struct userdata *u) +void agl_router_done (struct userdata *u) { - pa_router *router; + agl_router *router; agl_node *e,*n; agl_connection *conn, *c; agl_rtgroup *rtg; @@ -113,7 +113,7 @@ void agl_router_register_node (struct userdata *u, agl_node *node) pa_assert (u); pa_assert (node); - implement_default_route (u, node, NULL, pa_utils_new_stamp ()); + implement_default_route (u, node, NULL, agl_utils_new_stamp ()); } void agl_router_unregister_node (struct userdata *u, agl_node *node) @@ -121,12 +121,12 @@ void agl_router_unregister_node (struct userdata *u, agl_node *node) pa_assert (u); pa_assert (node); - remove_routes (u, node, NULL, pa_utils_new_stamp ()); + remove_routes (u, node, NULL, agl_utils_new_stamp ()); } agl_node *agl_router_make_prerouting (struct userdata *u, agl_node *data) { - pa_router *router; + agl_router *router; int priority; static bool done_prerouting; uint32_t stamp; @@ -141,7 +141,7 @@ agl_node *agl_router_make_prerouting (struct userdata *u, agl_node *data) done_prerouting = false; target = NULL; - stamp = pa_utils_new_stamp (); + stamp = agl_utils_new_stamp (); //make_explicit_routes (u, stamp); @@ -181,7 +181,7 @@ agl_node *agl_router_make_prerouting (struct userdata *u, agl_node *data) void agl_router_make_routing (struct userdata *u) { - pa_router *router; + agl_router *router; static bool ongoing_routing; /* true while we are actively routing */ uint32_t stamp; agl_node *start, *end; @@ -192,7 +192,7 @@ void agl_router_make_routing (struct userdata *u) if (ongoing_routing) /* already routing, canceling */ return; ongoing_routing = true; - stamp = pa_utils_new_stamp (); + stamp = agl_utils_new_stamp (); pa_log_debug("stamp for routing: %d", stamp); @@ -41,17 +41,17 @@ struct agl_rtgroup { typedef struct { pa_hashmap *input; pa_hashmap *output; -} pa_rtgroup_hash; +} agl_rtgroup_hash; typedef struct { agl_rtgroup **input[AGL_ZONE_MAX]; agl_rtgroup **output[AGL_ZONE_MAX]; -} pa_rtgroup_classmap; +} agl_rtgroup_classmap; -struct pa_router { - pa_rtgroup_hash rtgroups; +struct agl_router { + agl_rtgroup_hash rtgroups; size_t maplen; /**< length of the class */ - pa_rtgroup_classmap classmap; /**< map device node types to rtgroups */ + agl_rtgroup_classmap classmap; /**< map device node types to rtgroups */ int *priormap; /**< stream node priorities */ agl_dlist nodlist; /**< priorized list of the stream nodes (entry in node: rtprilist) */ @@ -67,8 +67,8 @@ struct agl_connection { uint32_t stream; /**< index of the sink-input to be routed */ }; -pa_router *pa_router_init (struct userdata *); -void pa_router_done (struct userdata *); +agl_router *agl_router_init (struct userdata *); +void agl_router_done (struct userdata *); bool agl_router_default_accept (struct userdata *, agl_rtgroup *, agl_node *); bool agl_router_phone_accept (struct userdata *, agl_rtgroup *, agl_node *); @@ -3,8 +3,8 @@ #include "userdata.h" -pa_routerif *pa_routerif_init (struct userdata *, const char *, - const char *, const char *); -void pa_routerif_done (struct userdata *); +agl_routerif *agl_routerif_init (struct userdata *, const char *, + const char *, const char *); +void agl_routerif_done (struct userdata *); #endif @@ -21,27 +21,27 @@ */ #include "routerif.h" -struct pa_routerif { +struct agl_routerif { int sock; }; -pa_routerif *pa_routerif_init (struct userdata *u, - const char *socktyp, - const char *addr, - const char *port) +agl_routerif *agl_routerif_init (struct userdata *u, + const char *socktyp, + const char *addr, + const char *port) { pa_module *m = u->module; - pa_routerif *routerif = NULL; + agl_routerif *routerif = NULL; - routerif = pa_xnew0 (pa_routerif, 1); + routerif = pa_xnew0 (agl_routerif, 1); routerif->sock = -1; return routerif; } -void pa_routerif_done (struct userdata *u) +void agl_routerif_done (struct userdata *u) { - pa_routerif *routerif; + agl_routerif *routerif; if (u && (routerif = u->routerif)) { if (routerif->sock >= 0) @@ -147,10 +147,10 @@ bool agl_switch_setup_link (struct userdata *u, agl_node *from, agl_node *to, bo return false; } - sink = pa_utils_get_primary_alsa_sink (u); - source = pa_utils_get_null_source (u, from->nullsink); + sink = agl_utils_get_primary_alsa_sink (u); + source = agl_utils_get_null_source (u, from->nullsink); - from->loopnode = pa_loopnode_create (u, PA_LOOPNODE_SINK, from->index, source->index, sink->index); + from->loopnode = agl_loopnode_create (u, AGL_LOOPNODE_SINK, from->index, source->index, sink->index); } } @@ -181,9 +181,9 @@ bool agl_switch_teardown_link (struct userdata *u, agl_node *from, agl_node *to) } /* (the rest supposes "from->implement == agl_stream") */ if (from->loopnode) - pa_loopnode_destroy (u, from->loopnode); + agl_loopnode_destroy (u, from->loopnode); if (from->nullsink) - pa_utils_destroy_null_sink (u, from->nullsink); + agl_utils_destroy_null_sink (u, from->nullsink); } //pa_log_debug("link %s => %s is torn down", from->amname, to->amname); @@ -58,7 +58,7 @@ struct pa_source_output_hooks { pa_hook_slot *unlink; }; -struct pa_tracker { +struct agl_tracker { pa_card_hooks card; pa_port_hooks port; pa_sink_hooks sink; @@ -91,11 +91,11 @@ static pa_hook_result_t source_output_put (void *, void *, void *); static pa_hook_result_t source_output_unlink (void *, void *, void *); -pa_tracker *pa_tracker_init (struct userdata *u) +agl_tracker *agl_tracker_init (struct userdata *u) { pa_core *core; pa_hook *hooks; - pa_tracker *tracker; + agl_tracker *tracker; pa_card_hooks *card; pa_port_hooks *port; pa_sink_hooks *sink; @@ -107,7 +107,7 @@ pa_tracker *pa_tracker_init (struct userdata *u) pa_assert_se (core = u->core); pa_assert_se (hooks = core->hooks); - tracker = pa_xnew0 (pa_tracker, 1); + tracker = pa_xnew0 (agl_tracker, 1); card = &tracker->card; port = &tracker->port; sink = &tracker->sink; @@ -162,9 +162,9 @@ pa_tracker *pa_tracker_init (struct userdata *u) return tracker; } -void pa_tracker_done (struct userdata *u) +void agl_tracker_done (struct userdata *u) { - pa_tracker *tracker; + agl_tracker *tracker; pa_card_hooks *card; pa_port_hooks *port; pa_sink_hooks *sink; @@ -203,7 +203,7 @@ void pa_tracker_done (struct userdata *u) } /* main logic initialization function */ -void pa_tracker_synchronize (struct userdata *u) +void agl_tracker_synchronize (struct userdata *u) { pa_core *core; pa_card *card; @@ -216,28 +216,25 @@ void pa_tracker_synchronize (struct userdata *u) pa_assert (u); pa_assert_se (core = u->core); - /* initialize "stamp" incremental card property to 0 */ - pa_utils_init_stamp (); - /* discover.c : add each valid USB/PCI/Platform ALSA sound card */ PA_IDXSET_FOREACH (card, core->cards, index) { - pa_discover_add_card (u, card); + agl_discover_add_card (u, card); } PA_IDXSET_FOREACH (sink, core->sinks, index) { - pa_discover_add_sink (u, sink, false); + agl_discover_add_sink (u, sink, false); } PA_IDXSET_FOREACH (source, core->sources, index) { - pa_discover_add_source (u, source); + agl_discover_add_source (u, source); } PA_IDXSET_FOREACH(sinp, core->sink_inputs, index) { - pa_discover_register_sink_input (u, sinp); + agl_discover_register_sink_input (u, sinp); } PA_IDXSET_FOREACH(sout, core->source_outputs, index) { - pa_discover_register_source_output (u, sout); + agl_discover_register_source_output (u, sout); } agl_router_make_routing (u); @@ -324,7 +321,7 @@ static pa_hook_result_t sink_input_new (void *hook_data, struct userdata *u = (struct userdata *)slot_data; bool success; - success = pa_discover_preroute_sink_input (u, data); + success = agl_discover_preroute_sink_input (u, data); return success ? PA_HOOK_OK : PA_HOOK_CANCEL; } @@ -337,7 +334,7 @@ static pa_hook_result_t sink_input_put (void *hook_data, pa_sink_input *sinp = (pa_sink_input *)call_data; struct userdata *u = (struct userdata *)slot_data; - pa_discover_add_sink_input (u, sinp); + agl_discover_add_sink_input (u, sinp); return PA_HOOK_OK; } @@ -350,7 +347,7 @@ static pa_hook_result_t sink_input_unlink (void *hook_data, pa_sink_input *sinp = (pa_sink_input *)call_data; struct userdata *u = (struct userdata *)slot_data; - pa_discover_remove_sink_input (u, sinp); + agl_discover_remove_sink_input (u, sinp); return PA_HOOK_OK; } @@ -3,9 +3,9 @@ #include "userdata.h" -pa_tracker *pa_tracker_init (struct userdata *); -void pa_tracker_done (struct userdata *); +agl_tracker *agl_tracker_init (struct userdata *); +void agl_tracker_done (struct userdata *); -void pa_tracker_synchronize(struct userdata *); +void agl_tracker_synchronize(struct userdata *); #endif @@ -29,19 +29,19 @@ #define AM_ID_INVALID 65535 /* invalid state in several places */ -typedef struct pa_null_sink pa_null_sink; -typedef struct pa_zoneset pa_zoneset; -typedef struct pa_nodeset pa_nodeset; -typedef struct pa_audiomgr pa_audiomgr; -typedef struct pa_routerif pa_routerif; -typedef struct pa_discover pa_discover; -typedef struct pa_tracker pa_tracker; -typedef struct pa_router pa_router; - -typedef struct pa_nodeset_resdef pa_nodeset_resdef; -typedef struct pa_nodeset_map pa_nodeset_map; -typedef struct pa_node_card pa_node_card; -typedef struct pa_node_rset pa_node_rset; +typedef struct agl_null_sink agl_null_sink; +typedef struct agl_zoneset agl_zoneset; +typedef struct agl_nodeset agl_nodeset; +typedef struct agl_audiomgr agl_audiomgr; +typedef struct agl_routerif agl_routerif; +typedef struct agl_router agl_router; +typedef struct agl_discover agl_discover; +typedef struct agl_tracker agl_tracker; + +typedef struct agl_nodeset_resdef agl_nodeset_resdef; +typedef struct agl_nodeset_map agl_nodeset_map; +typedef struct agl_node_card agl_node_card; +typedef struct agl_node_rset agl_node_rset; typedef struct pa_card_hooks pa_card_hooks; typedef struct pa_port_hooks pa_port_hooks; @@ -65,13 +65,13 @@ struct userdata { pa_core *core; pa_module *module; char *nsnam; - pa_zoneset *zoneset; - pa_nodeset *nodeset; - pa_audiomgr *audiomgr; - pa_routerif *routerif; - pa_router *router; - pa_discover *discover; - pa_tracker *tracker; + agl_zoneset *zoneset; + agl_nodeset *nodeset; + agl_audiomgr *audiomgr; + agl_routerif *routerif; + agl_router *router; + agl_discover *discover; + agl_tracker *tracker; pa_agl_state state; }; @@ -38,18 +38,18 @@ static uint32_t stamp; -struct pa_null_sink { +struct agl_null_sink { char *name; uint32_t module_index; uint32_t sink_index; }; -pa_null_sink *pa_utils_create_null_sink (struct userdata *u, const char *name) +agl_null_sink *agl_utils_create_null_sink (struct userdata *u, const char *name) { pa_core *core; pa_module *module; - pa_null_sink *ns; pa_sink *s, *sink; + agl_null_sink *ns; uint32_t idx; char args[256]; @@ -59,7 +59,7 @@ pa_null_sink *pa_utils_create_null_sink (struct userdata *u, const char *name) if (!name) name = DEFAULT_NULL_SINK_NAME; /* default is "null.agl" */ - snprintf (args, sizeof(args), "sink_name=\"%s.%d\" channels=2", name, pa_utils_new_stamp ()); + snprintf (args, sizeof(args), "sink_name=\"%s.%d\" channels=2", name, agl_utils_new_stamp ()); module = pa_module_load (core, "module-null-sink", args); sink = NULL; @@ -76,7 +76,7 @@ pa_null_sink *pa_utils_create_null_sink (struct userdata *u, const char *name) } } - ns = pa_xnew0 (pa_null_sink, 1); + ns = pa_xnew0 (agl_null_sink, 1); ns->name = pa_xstrdup (name); ns->module_index = module ? module->index : PA_IDXSET_INVALID; ns->sink_index = sink ? sink->index : PA_IDXSET_INVALID; @@ -84,7 +84,7 @@ pa_null_sink *pa_utils_create_null_sink (struct userdata *u, const char *name) return ns; } -void pa_utils_destroy_null_sink (struct userdata *u, pa_null_sink *ns) +void agl_utils_destroy_null_sink (struct userdata *u, agl_null_sink *ns) { pa_core *core; pa_module *module; @@ -100,7 +100,7 @@ void pa_utils_destroy_null_sink (struct userdata *u, pa_null_sink *ns) } } -pa_sink *pa_utils_get_null_sink (struct userdata *u, struct pa_null_sink *ns) +pa_sink *agl_utils_get_null_sink (struct userdata *u, struct agl_null_sink *ns) { pa_core *core; pa_sink *sink; @@ -111,28 +111,28 @@ pa_sink *pa_utils_get_null_sink (struct userdata *u, struct pa_null_sink *ns) return pa_idxset_get_by_index (core->sinks, ns->sink_index); } -pa_source *pa_utils_get_null_source (struct userdata *u, struct pa_null_sink *ns) +pa_source *agl_utils_get_null_source (struct userdata *u, struct agl_null_sink *ns) { pa_sink *sink; - sink = pa_utils_get_null_sink (u, ns); + sink = agl_utils_get_null_sink (u, ns); return sink ? sink->monitor_source : NULL; } -const char *pa_utils_get_card_name (pa_card *card) +const char *agl_utils_get_card_name (pa_card *card) { return (card && card->name) ? card->name : "<unknown>"; } -const char *pa_utils_get_card_bus (pa_card *card) +const char *agl_utils_get_card_bus (pa_card *card) { const char *bus = NULL; const char *name; if (card && !(bus = pa_proplist_gets (card->proplist,PA_PROP_DEVICE_BUS))) { - name = pa_utils_get_card_name (card); + name = agl_utils_get_card_name (card); if (!strncmp (name, "alsa_card.", 10)) { if (!strncmp (name + 10, "pci-", 4)) bus = "pci"; @@ -146,17 +146,17 @@ const char *pa_utils_get_card_bus (pa_card *card) return (char *)bus; } -const char *pa_utils_get_sink_name (pa_sink *sink) +const char *agl_utils_get_sink_name (pa_sink *sink) { return (sink && sink->name) ? sink->name : "<unknown>"; } -const char *pa_utils_get_source_name (pa_source *source) +const char *agl_utils_get_source_name (pa_source *source) { return (source && source->name) ? source->name : "<unknown>"; } -const char *pa_utils_get_sink_input_name (pa_sink_input *sinp) +const char *agl_utils_get_sink_input_name (pa_sink_input *sinp) { char *name = NULL; @@ -171,7 +171,7 @@ const char *pa_utils_get_sink_input_name (pa_sink_input *sinp) return (const char *)name; } -const char *pa_utils_get_source_output_name (pa_source_output *sout) +const char *agl_utils_get_source_output_name (pa_source_output *sout) { char *name = NULL; @@ -186,7 +186,7 @@ const char *pa_utils_get_source_output_name (pa_source_output *sout) return (const char *)name; } -pa_sink *pa_utils_get_primary_alsa_sink (struct userdata *u) +pa_sink *agl_utils_get_primary_alsa_sink (struct userdata *u) { pa_core *core; pa_sink *sink; @@ -203,24 +203,24 @@ pa_sink *pa_utils_get_primary_alsa_sink (struct userdata *u) return NULL; } -void pa_utils_init_stamp (void) +void agl_utils_init_stamp (void) { stamp = 0; } -uint32_t pa_utils_new_stamp (void) +uint32_t agl_utils_new_stamp (void) { return ++stamp; } -uint32_t pa_utils_get_stamp (void) +uint32_t agl_utils_get_stamp (void) { return stamp; } -char *pa_utils_get_zone (pa_proplist *pl, pa_proplist *client_props) +char *agl_utils_get_zone (pa_proplist *pl, pa_proplist *client_props) { const char *zone; @@ -237,7 +237,7 @@ char *pa_utils_get_zone (pa_proplist *pl, pa_proplist *client_props) return (char *)zone; } -bool pa_utils_set_stream_routing_properties (pa_proplist *pl, int styp, void *target) +bool agl_utils_set_stream_routing_properties (pa_proplist *pl, int styp, void *target) { const char *clnam; /* will become "agl_player" e.g. */ char clid[32]; /* will become "1" e.g. */ @@ -261,7 +261,7 @@ bool pa_utils_set_stream_routing_properties (pa_proplist *pl, int styp, void *ta return true; } -bool pa_utils_unset_stream_routing_properties (pa_proplist *pl) +bool agl_utils_unset_stream_routing_properties (pa_proplist *pl) { pa_assert (pl); @@ -26,28 +26,28 @@ #include "userdata.h" -struct pa_null_sink; +struct agl_null_sink; -struct pa_null_sink *pa_utils_create_null_sink (struct userdata *, const char *); -void pa_utils_destroy_null_sink (struct userdata *, struct pa_null_sink *); -pa_sink *pa_utils_get_null_sink (struct userdata *, struct pa_null_sink *); -pa_source *pa_utils_get_null_source (struct userdata *, struct pa_null_sink *); +struct agl_null_sink *agl_utils_create_null_sink (struct userdata *, const char *); +void agl_utils_destroy_null_sink (struct userdata *, struct agl_null_sink *); +pa_sink *agl_utils_get_null_sink (struct userdata *, struct agl_null_sink *); +pa_source *agl_utils_get_null_source (struct userdata *, struct agl_null_sink *); /* general helper functions */ -const char *pa_utils_get_card_name (pa_card *); -const char *pa_utils_get_card_bus (pa_card *); -const char *pa_utils_get_sink_name (pa_sink *); -const char *pa_utils_get_source_name (pa_source *); -const char *pa_utils_get_sink_input_name (pa_sink_input *); -const char *pa_utils_get_source_output_name (pa_source_output *); -pa_sink *pa_utils_get_primary_alsa_sink (struct userdata *); -void pa_utils_init_stamp (void); -uint32_t pa_utils_new_stamp (void); -uint32_t pa_utils_get_stamp (void); +const char *agl_utils_get_card_name (pa_card *); +const char *agl_utils_get_card_bus (pa_card *); +const char *agl_utils_get_sink_name (pa_sink *); +const char *agl_utils_get_source_name (pa_source *); +const char *agl_utils_get_sink_input_name (pa_sink_input *); +const char *agl_utils_get_source_output_name (pa_source_output *); +pa_sink *agl_utils_get_primary_alsa_sink (struct userdata *); +void agl_utils_init_stamp (void); +uint32_t agl_utils_new_stamp (void); +uint32_t agl_utils_get_stamp (void); /* AM-oriented helper functions */ -char *pa_utils_get_zone (pa_proplist *, pa_proplist *); -bool pa_utils_set_stream_routing_properties (pa_proplist *, int, void *); -bool pa_utils_unset_stream_routing_properties (pa_proplist *); +char *agl_utils_get_zone (pa_proplist *, pa_proplist *); +bool agl_utils_set_stream_routing_properties (pa_proplist *, int, void *); +bool agl_utils_unset_stream_routing_properties (pa_proplist *); #endif @@ -21,29 +21,29 @@ */ #include "zone.h" -struct pa_zoneset { +struct agl_zoneset { struct { pa_hashmap *hash; agl_zone *index[AGL_ZONE_MAX]; } zones; }; -pa_zoneset *pa_zoneset_init (struct userdata *u) +agl_zoneset *agl_zoneset_init (struct userdata *u) { - pa_zoneset *zs; + agl_zoneset *zs; pa_assert (u); - zs = pa_xnew0 (pa_zoneset, 1); + zs = pa_xnew0 (agl_zoneset, 1); zs->zones.hash = pa_hashmap_new (pa_idxset_string_hash_func, pa_idxset_string_compare_func); return zs; } -void pa_zoneset_done (struct userdata *u) +void agl_zoneset_done (struct userdata *u) { - pa_zoneset *zs; + agl_zoneset *zs; void *state; agl_zone *zone; @@ -31,7 +31,7 @@ struct agl_zone { uint32_t index; }; -pa_zoneset *pa_zoneset_init (struct userdata *); -void pa_zoneset_done (struct userdata *); +agl_zoneset *agl_zoneset_init (struct userdata *); +void agl_zoneset_done (struct userdata *); #endif |