1 /*
2  * Copyright (C) 2014 Michal Ratajsky <michal.ratajsky@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the licence, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef MATEMIXER_CONTEXT_H
19 #define MATEMIXER_CONTEXT_H
20 
21 #include <glib.h>
22 #include <glib-object.h>
23 
24 #include <libmatemixer/matemixer-enums.h>
25 #include <libmatemixer/matemixer-types.h>
26 
27 G_BEGIN_DECLS
28 
29 #define MATE_MIXER_TYPE_CONTEXT                 \
30         (mate_mixer_context_get_type ())
31 #define MATE_MIXER_CONTEXT(o)                   \
32         (G_TYPE_CHECK_INSTANCE_CAST ((o), MATE_MIXER_TYPE_CONTEXT, MateMixerContext))
33 #define MATE_MIXER_IS_CONTEXT(o)                \
34         (G_TYPE_CHECK_INSTANCE_TYPE ((o), MATE_MIXER_TYPE_CONTEXT))
35 #define MATE_MIXER_CONTEXT_CLASS(k)             \
36         (G_TYPE_CHECK_CLASS_CAST ((k), MATE_MIXER_TYPE_CONTEXT, MateMixerContextClass))
37 #define MATE_MIXER_IS_CONTEXT_CLASS(k)          \
38         (G_TYPE_CHECK_CLASS_TYPE ((k), MATE_MIXER_TYPE_CONTEXT))
39 #define MATE_MIXER_CONTEXT_GET_CLASS(o)         \
40         (G_TYPE_INSTANCE_GET_CLASS ((o), MATE_MIXER_TYPE_CONTEXT, MateMixerContextClass))
41 
42 typedef struct _MateMixerContextClass    MateMixerContextClass;
43 typedef struct _MateMixerContextPrivate  MateMixerContextPrivate;
44 
45 /**
46  * MateMixerContext:
47  *
48  * The #MateMixerContext structure contains only private data and should only
49  * be accessed using the provided API.
50  */
51 struct _MateMixerContext
52 {
53     GObject parent;
54 
55     /*< private >*/
56     MateMixerContextPrivate *priv;
57 };
58 
59 /**
60  * MateMixerContextClass:
61  * @parent_class: The parent class.
62  *
63  * The class structure for #MateMixerContext.
64  */
65 struct _MateMixerContextClass
66 {
67     GObjectClass parent_class;
68 
69     /*< private >*/
70     void (*device_added)           (MateMixerContext *context,
71                                     const gchar      *name);
72     void (*device_removed)         (MateMixerContext *context,
73                                     const gchar      *name);
74     void (*stream_added)           (MateMixerContext *context,
75                                     const gchar      *name);
76     void (*stream_removed)         (MateMixerContext *context,
77                                     const gchar      *name);
78     void (*stored_control_added)   (MateMixerContext *context,
79                                     const gchar      *name);
80     void (*stored_control_removed) (MateMixerContext *context,
81                                     const gchar      *name);
82 };
83 
84 GType                   mate_mixer_context_get_type                  (void) G_GNUC_CONST;
85 
86 MateMixerContext *      mate_mixer_context_new                       (void);
87 
88 gboolean                mate_mixer_context_set_backend_type          (MateMixerContext     *context,
89                                                                       MateMixerBackendType  backend_type);
90 gboolean                mate_mixer_context_set_app_name              (MateMixerContext     *context,
91                                                                       const gchar          *app_name);
92 gboolean                mate_mixer_context_set_app_id                (MateMixerContext     *context,
93                                                                       const gchar          *app_id);
94 gboolean                mate_mixer_context_set_app_version           (MateMixerContext     *context,
95                                                                       const gchar          *app_version);
96 gboolean                mate_mixer_context_set_app_icon              (MateMixerContext     *context,
97                                                                       const gchar          *app_icon);
98 gboolean                mate_mixer_context_set_server_address        (MateMixerContext     *context,
99                                                                       const gchar          *address);
100 
101 gboolean                mate_mixer_context_open                      (MateMixerContext     *context);
102 void                    mate_mixer_context_close                     (MateMixerContext     *context);
103 
104 MateMixerState          mate_mixer_context_get_state                 (MateMixerContext     *context);
105 
106 MateMixerDevice *       mate_mixer_context_get_device                (MateMixerContext     *context,
107                                                                       const gchar          *name);
108 MateMixerStream *       mate_mixer_context_get_stream                (MateMixerContext     *context,
109                                                                       const gchar          *name);
110 MateMixerStoredControl *mate_mixer_context_get_stored_control        (MateMixerContext     *context,
111                                                                       const gchar          *name);
112 
113 const GList *           mate_mixer_context_list_devices              (MateMixerContext     *context);
114 const GList *           mate_mixer_context_list_streams              (MateMixerContext     *context);
115 const GList *           mate_mixer_context_list_stored_controls      (MateMixerContext     *context);
116 
117 MateMixerStream *       mate_mixer_context_get_default_input_stream  (MateMixerContext     *context);
118 gboolean                mate_mixer_context_set_default_input_stream  (MateMixerContext     *context,
119                                                                       MateMixerStream      *stream);
120 
121 MateMixerStream *       mate_mixer_context_get_default_output_stream (MateMixerContext     *context);
122 gboolean                mate_mixer_context_set_default_output_stream (MateMixerContext     *context,
123                                                                       MateMixerStream      *stream);
124 
125 const gchar *           mate_mixer_context_get_backend_name          (MateMixerContext     *context);
126 MateMixerBackendType    mate_mixer_context_get_backend_type          (MateMixerContext     *context);
127 MateMixerBackendFlags   mate_mixer_context_get_backend_flags         (MateMixerContext     *context);
128 
129 G_END_DECLS
130 
131 #endif /* MATEMIXER_CONTEXT_H */
132