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 PULSE_CONNECTION_H 19 #define PULSE_CONNECTION_H 20 21 #include <glib.h> 22 #include <glib-object.h> 23 24 #include <pulse/pulseaudio.h> 25 #include <pulse/ext-stream-restore.h> 26 27 #include "pulse-enums.h" 28 #include "pulse-types.h" 29 30 G_BEGIN_DECLS 31 32 #define PULSE_TYPE_CONNECTION \ 33 (pulse_connection_get_type ()) 34 #define PULSE_CONNECTION(o) \ 35 (G_TYPE_CHECK_INSTANCE_CAST ((o), PULSE_TYPE_CONNECTION, PulseConnection)) 36 #define PULSE_IS_CONNECTION(o) \ 37 (G_TYPE_CHECK_INSTANCE_TYPE ((o), PULSE_TYPE_CONNECTION)) 38 #define PULSE_CONNECTION_CLASS(k) \ 39 (G_TYPE_CHECK_CLASS_CAST ((k), PULSE_TYPE_CONNECTION, PulseConnectionClass)) 40 #define PULSE_IS_CONNECTION_CLASS(k) \ 41 (G_TYPE_CHECK_CLASS_TYPE ((k), PULSE_TYPE_CONNECTION)) 42 #define PULSE_CONNECTION_GET_CLASS(o) \ 43 (G_TYPE_INSTANCE_GET_CLASS ((o), PULSE_TYPE_CONNECTION, PulseConnectionClass)) 44 45 typedef struct _PulseConnectionClass PulseConnectionClass; 46 typedef struct _PulseConnectionPrivate PulseConnectionPrivate; 47 48 struct _PulseConnection 49 { 50 GObject parent; 51 52 /*< private >*/ 53 PulseConnectionPrivate *priv; 54 }; 55 56 struct _PulseConnectionClass 57 { 58 GObjectClass parent_class; 59 60 /*< private >*/ 61 void (*server_info) (PulseConnection *connection, 62 const pa_server_info *info); 63 64 void (*card_info) (PulseConnection *connection, 65 const pa_card_info *info); 66 void (*card_removed) (PulseConnection *connection, 67 guint32 index); 68 69 void (*sink_info) (PulseConnection *connection, 70 const pa_sink_info *info); 71 void (*sink_removed) (PulseConnection *connection, 72 guint32 index); 73 74 void (*sink_input_info) (PulseConnection *connection, 75 const pa_sink_input_info *info); 76 void (*sink_input_removed) (PulseConnection *connection, 77 guint32 index); 78 79 void (*source_info) (PulseConnection *connection, 80 const pa_source_info *info); 81 void (*source_removed) (PulseConnection *connection, 82 guint32 index); 83 84 void (*source_output_info) (PulseConnection *connection, 85 const pa_source_output_info *info); 86 void (*source_output_removed) (PulseConnection *connection, 87 guint32 index); 88 89 void (*ext_stream_loading) (PulseConnection *connection); 90 void (*ext_stream_loaded) (PulseConnection *connection); 91 void (*ext_stream_info) (PulseConnection *connection, 92 const pa_ext_stream_restore_info *info); 93 }; 94 95 GType pulse_connection_get_type (void) G_GNUC_CONST; 96 97 PulseConnection * pulse_connection_new (const gchar *app_name, 98 const gchar *app_id, 99 const gchar *app_version, 100 const gchar *app_icon, 101 const gchar *server_address); 102 103 gboolean pulse_connection_connect (PulseConnection *connection, 104 gboolean wait_for_daemon); 105 void pulse_connection_disconnect (PulseConnection *connection); 106 107 PulseConnectionState pulse_connection_get_state (PulseConnection *connection); 108 109 gboolean pulse_connection_load_server_info (PulseConnection *connection); 110 111 gboolean pulse_connection_load_card_info (PulseConnection *connection, 112 guint32 index); 113 gboolean pulse_connection_load_card_info_name (PulseConnection *connection, 114 const gchar *name); 115 116 gboolean pulse_connection_load_sink_info (PulseConnection *connection, 117 guint32 index); 118 gboolean pulse_connection_load_sink_info_name (PulseConnection *connection, 119 const gchar *name); 120 121 gboolean pulse_connection_load_sink_input_info (PulseConnection *connection, 122 guint32 index); 123 124 gboolean pulse_connection_load_source_info (PulseConnection *connection, 125 guint32 index); 126 gboolean pulse_connection_load_source_info_name (PulseConnection *connection, 127 const gchar *name); 128 129 gboolean pulse_connection_load_source_output_info (PulseConnection *connection, 130 guint32 index); 131 132 gboolean pulse_connection_load_ext_stream_info (PulseConnection *connection); 133 134 PulseMonitor * pulse_connection_create_monitor (PulseConnection *connection, 135 guint32 index_source, 136 guint32 index_sink_input); 137 138 gboolean pulse_connection_set_default_sink (PulseConnection *connection, 139 const gchar *name); 140 gboolean pulse_connection_set_default_source (PulseConnection *connection, 141 const gchar *name); 142 143 gboolean pulse_connection_set_card_profile (PulseConnection *connection, 144 const gchar *device, 145 const gchar *profile); 146 147 gboolean pulse_connection_set_sink_mute (PulseConnection *connection, 148 guint32 index, 149 gboolean mute); 150 gboolean pulse_connection_set_sink_volume (PulseConnection *connection, 151 guint32 index, 152 const pa_cvolume *volume); 153 gboolean pulse_connection_set_sink_port (PulseConnection *connection, 154 guint32 index, 155 const gchar *port); 156 157 gboolean pulse_connection_set_sink_input_mute (PulseConnection *connection, 158 guint32 index, 159 gboolean mute); 160 gboolean pulse_connection_set_sink_input_volume (PulseConnection *connection, 161 guint32 index, 162 const pa_cvolume *volume); 163 164 gboolean pulse_connection_set_source_mute (PulseConnection *connection, 165 guint32 index, 166 gboolean mute); 167 gboolean pulse_connection_set_source_volume (PulseConnection *connection, 168 guint32 index, 169 const pa_cvolume *volume); 170 gboolean pulse_connection_set_source_port (PulseConnection *connection, 171 guint32 index, 172 const gchar *port); 173 174 gboolean pulse_connection_set_source_output_mute (PulseConnection *connection, 175 guint32 index, 176 gboolean mute); 177 gboolean pulse_connection_set_source_output_volume (PulseConnection *connection, 178 guint32 index, 179 const pa_cvolume *volume); 180 181 gboolean pulse_connection_suspend_sink (PulseConnection *connection, 182 guint32 index, 183 gboolean suspend); 184 gboolean pulse_connection_suspend_source (PulseConnection *connection, 185 guint32 index, 186 gboolean suspend); 187 188 gboolean pulse_connection_move_sink_input (PulseConnection *connection, 189 guint32 index, 190 guint32 sink_index); 191 gboolean pulse_connection_move_source_output (PulseConnection *connection, 192 guint32 index, 193 guint32 source_index); 194 195 gboolean pulse_connection_kill_sink_input (PulseConnection *connection, 196 guint32 index); 197 gboolean pulse_connection_kill_source_output (PulseConnection *connection, 198 guint32 index); 199 200 gboolean pulse_connection_write_ext_stream (PulseConnection *connection, 201 const pa_ext_stream_restore_info *info); 202 gboolean pulse_connection_delete_ext_stream (PulseConnection *connection, 203 const gchar *name); 204 205 G_END_DECLS 206 207 #endif /* PULSE_CONNECTION_H */ 208