murphyif: Free the connect timer when unloading
[profile/ivi/pulseaudio-module-murphy-ivi.git] / murphy / constrain.h
1 /*
2  * module-murphy-ivi -- PulseAudio module for providing audio routing support
3  * Copyright (c) 2012, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU Lesser General Public License,
7  * version 2.1, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.
12  * See the GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston,
17  * MA 02110-1301 USA.
18  *
19  */
20 #ifndef foomirconstrainfoo
21 #define foomirconstrainfoo
22
23 #include <sys/types.h>
24
25 #include "userdata.h"
26 #include "list.h"
27
28 typedef bool (*mir_constrain_func_t)(struct userdata *, mir_constr_def *,
29                                           mir_node *, mir_node *);
30
31 struct pa_constrain {
32     pa_hashmap *defs;
33 };
34
35
36 struct mir_constr_link {
37     mir_dlist       link;
38     mir_dlist       nodchain;
39     mir_constr_def *def;
40     mir_node       *node;
41 };
42
43
44 struct mir_constr_def {
45     char                 *key;
46     char                 *name;  /**< constrain name */
47     mir_constrain_func_t  func;  /**< constrain enforcement function */
48     mir_dlist             nodes; /**< listhead of mir_cstrlink's  */
49 };
50
51
52
53 pa_constrain *pa_constrain_init(struct userdata *);
54 void pa_constrain_done(struct userdata *);
55
56 mir_constr_def *mir_constrain_create(struct userdata *, const char *,
57                                      mir_constrain_func_t, const char *);
58 void mir_constrain_destroy(struct userdata *, const char *);
59 mir_constr_def *mir_constrain_find(struct userdata *, const char *);
60
61 void mir_constrain_add_node(struct userdata *, mir_constr_def *, mir_node *);
62 void mir_constrain_remove_node(struct userdata *, mir_node *);
63
64 void mir_constrain_apply(struct userdata *, mir_node *, uint32_t);
65
66 int mir_constrain_print(mir_node *, char *, int);
67
68
69 bool mir_constrain_port(struct userdata *, mir_constr_def *,
70                              mir_node *, mir_node *);
71 bool mir_constrain_profile(struct userdata *, mir_constr_def *,
72                                 mir_node *, mir_node *);
73
74
75
76 #endif  /* foomirconstrainfoo */
77
78
79 /*
80  * Local Variables:
81  * c-basic-offset: 4
82  * indent-tabs-mode: nil
83  * End:
84  *
85  */