config: fixup type for demo effect
[staging/agl-audio-plugin.git] / router.h
index 93b29d8..1a139b5 100644 (file)
--- a/router.h
+++ b/router.h
 
 #define AGL_ZONE_MAX 8 /* max 8 zones, demo is using 5 */ /* DEFINED IN MURPHY */
 
-/*typedef bool (*agl_rtgroup_accept_t)(struct userdata *, agl_rtgroup *, agl_node *);*/
-/*typedef int (*agl_rtgroup_compare_t)(struct userdata *, agl_rtgroup *, agl_node *, agl_node *);*/
+typedef bool (*agl_rtgroup_accept_t)(struct userdata *, agl_rtgroup *, agl_node *);
+typedef int (*agl_rtgroup_effect_t)(struct userdata *, agl_rtgroup *, agl_node *, bool new);
 
 struct agl_rtgroup {
-       char *name;      /**< name of the rtgroup */
+       char *name;          /**< name of the rtgroup */
        agl_dlist entries;   /**< listhead of ordered rtentries */
-       /*agl_rtgroup_accept_t accept;*/ /**< function pointer, whether to accept a node or not */
-       /*agl_rtgroup_compare_t compare;*/ /**< function pointer, comparision for ordering */
-       /*scripting_rtgroup *scripting;*/ /**< data for scripting, if any */
+       agl_node *node;      /**< final node */
+       agl_rtgroup_accept_t accept; /**< function pointer, whether to accept a node or not */
+       agl_rtgroup_effect_t effect; /**< function pointer, custom action such as volume up, down */
 };
 
 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) */
@@ -68,8 +68,21 @@ 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 *);
+int agl_router_default_effect (struct userdata *, agl_rtgroup *, agl_node *, bool);
+int agl_router_phone_effect (struct userdata *, agl_rtgroup *, agl_node *, bool);
+
+agl_rtgroup *agl_router_create_rtgroup (struct userdata *, agl_direction, const char *, const char *, agl_rtgroup_accept_t, agl_rtgroup_effect_t);
+void agl_router_destroy_rtgroup (struct userdata *, agl_direction, const char *);
+bool agl_router_assign_class_to_rtgroup (struct userdata *, agl_node_type, uint32_t, agl_direction, const char *);
+agl_rtgroup * agl_router_get_rtgroup_from_class (struct userdata *u, agl_node_type class, uint32_t zone, agl_direction type);
+void agl_router_assign_class_priority (struct userdata *, agl_node_type, int);
+int agl_router_get_node_priority (struct userdata *, agl_node *);
+bool agl_router_apply_node_priority_effect (struct userdata *, agl_node *, bool);
 
 void agl_router_register_node (struct userdata *, agl_node *);
 void agl_router_unregister_node (struct userdata *, agl_node *);