1 /* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2 /*
3    Copyright (C) 2010 Red Hat, Inc.
4 
5    This library is free software; you can redistribute it and/or
6    modify it under the terms of the GNU Lesser General Public
7    License as published by the Free Software Foundation; either
8    version 2.1 of the License, or (at your option) any later version.
9 
10    This library is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    Lesser General Public License for more details.
14 
15    You should have received a copy of the GNU Lesser General Public
16    License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef __SPICE_CLIENT_AUDIO_H__
19 #define __SPICE_CLIENT_AUDIO_H__
20 
21 #if !defined(__SPICE_CLIENT_H_INSIDE__) && !defined(SPICE_COMPILATION)
22 #warning "Only <spice-client.h> can be included directly"
23 #endif
24 
25 #include <glib-object.h>
26 #include <gio/gio.h>
27 #include "spice-util.h"
28 #include "spice-session.h"
29 #include "channel-main.h"
30 
31 G_BEGIN_DECLS
32 
33 #define SPICE_TYPE_AUDIO spice_audio_get_type()
34 
35 #define SPICE_AUDIO(obj)					\
36     (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPICE_TYPE_AUDIO, SpiceAudio))
37 
38 #define SPICE_AUDIO_CLASS(klass)				\
39     (G_TYPE_CHECK_CLASS_CAST ((klass), SPICE_TYPE_AUDIO, SpiceAudioClass))
40 
41 #define SPICE_IS_AUDIO(obj)                                     \
42     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SPICE_TYPE_AUDIO))
43 
44 #define SPICE_IS_AUDIO_CLASS(klass)                             \
45     (G_TYPE_CHECK_CLASS_TYPE ((klass), SPICE_TYPE_AUDIO))
46 
47 #define SPICE_AUDIO_GET_CLASS(obj)				\
48     (G_TYPE_INSTANCE_GET_CLASS ((obj), SPICE_TYPE_AUDIO, SpiceAudioClass))
49 
50 typedef struct _SpiceAudio SpiceAudio;
51 typedef struct _SpiceAudioClass SpiceAudioClass;
52 typedef struct _SpiceAudioPrivate SpiceAudioPrivate;
53 
54 /**
55  * SpiceAudio:
56  *
57  * The #SpiceAudio struct is opaque and should not be accessed directly.
58  */
59 struct _SpiceAudio {
60     GObject parent;
61 
62     SpiceAudioPrivate *priv;
63 };
64 
65 /**
66  * SpiceAudioClass:
67  * @parent_class: Parent class.
68  *
69  * Class structure for #SpiceAudio.
70  */
71 struct _SpiceAudioClass {
72     GObjectClass parent_class;
73 
74     /*< private >*/
75     gboolean (*connect_channel)(SpiceAudio *audio, SpiceChannel *channel);
76     void (*get_playback_volume_info_async)(SpiceAudio *audio,
77                                            GCancellable *cancellable,
78                                            SpiceMainChannel *main_channel,
79                                            GAsyncReadyCallback callback,
80                                            gpointer user_data);
81     gboolean (*get_playback_volume_info_finish)(SpiceAudio *audio,
82                                                 GAsyncResult *res,
83                                                 gboolean *mute,
84                                                 guint8 *nchannels,
85                                                 guint16 **volume,
86                                                 GError **error);
87     void (*get_record_volume_info_async)(SpiceAudio *audio,
88                                          GCancellable *cancellable,
89                                          SpiceMainChannel *main_channel,
90                                          GAsyncReadyCallback callback,
91                                          gpointer user_data);
92     gboolean (*get_record_volume_info_finish)(SpiceAudio *audio,
93                                               GAsyncResult *res,
94                                               gboolean *mute,
95                                               guint8 *nchannels,
96                                               guint16 **volume,
97                                               GError **error);
98 
99     gchar _spice_reserved[SPICE_RESERVED_PADDING - 4 * sizeof(void *)];
100 };
101 
102 GType spice_audio_get_type(void);
103 
104 SpiceAudio* spice_audio_get(SpiceSession *session, GMainContext *context);
105 
106 #ifndef SPICE_DISABLE_DEPRECATED
107 G_DEPRECATED_FOR(spice_audio_get)
108 SpiceAudio* spice_audio_new(SpiceSession *session, GMainContext *context, const char *name);
109 #endif
110 
111 G_END_DECLS
112 
113 #endif /* __SPICE_CLIENT_AUDIO_H__ */
114