summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Ratajsky <[email protected]>2014-08-29 00:01:41 +0200
committerMichal Ratajsky <[email protected]>2014-08-29 00:01:41 +0200
commit652eb260c2574312664c35acd10893d7a6460426 (patch)
treee396e048aabc82c589c020f8f2099c27d38ec93d
parente67e02993cb8c1827659e1b3ddd693d347b8cf96 (diff)
downloadlibmatemixer-652eb260c2574312664c35acd10893d7a6460426.tar.bz2
libmatemixer-652eb260c2574312664c35acd10893d7a6460426.tar.xz
Include backend flags in backend info and add a flag indicating stored controls support
-rw-r--r--backends/alsa/alsa-backend.c10
-rw-r--r--backends/null/null-backend.c10
-rw-r--r--backends/oss/oss-backend.c10
-rw-r--r--backends/pulse/pulse-backend.c18
-rw-r--r--libmatemixer/matemixer-backend-module.h1
-rw-r--r--libmatemixer/matemixer-backend.c16
-rw-r--r--libmatemixer/matemixer-backend.h3
-rw-r--r--libmatemixer/matemixer-context.c5
-rw-r--r--libmatemixer/matemixer-enums.h23
9 files changed, 46 insertions, 50 deletions
diff --git a/backends/alsa/alsa-backend.c b/backends/alsa/alsa-backend.c
index 2493d45..0b7895e 100644
--- a/backends/alsa/alsa-backend.c
+++ b/backends/alsa/alsa-backend.c
@@ -28,6 +28,7 @@
#define BACKEND_NAME "ALSA"
#define BACKEND_PRIORITY 20
+#define BACKEND_FLAGS MATE_MIXER_BACKEND_NO_FLAGS
#define ALSA_DEVICE_GET_ID(d) \
(g_object_get_data (G_OBJECT (d), "__matemixer_alsa_device_id"))
@@ -97,10 +98,11 @@ backend_module_init (GTypeModule *module)
{
alsa_backend_register_type (module);
- info.name = BACKEND_NAME;
- info.priority = BACKEND_PRIORITY;
- info.g_type = ALSA_TYPE_BACKEND;
- info.backend_type = MATE_MIXER_BACKEND_ALSA;
+ info.name = BACKEND_NAME;
+ info.priority = BACKEND_PRIORITY;
+ info.g_type = ALSA_TYPE_BACKEND;
+ info.backend_flags = BACKEND_FLAGS;
+ info.backend_type = MATE_MIXER_BACKEND_ALSA;
}
const MateMixerBackendInfo *backend_module_get_info (void)
diff --git a/backends/null/null-backend.c b/backends/null/null-backend.c
index ee0ad2e..a061428 100644
--- a/backends/null/null-backend.c
+++ b/backends/null/null-backend.c
@@ -24,6 +24,7 @@
#define BACKEND_NAME "Null"
#define BACKEND_PRIORITY 0
+#define BACKEND_FLAGS MATE_MIXER_BACKEND_NO_FLAGS
static void null_backend_class_init (NullBackendClass *klass);
static void null_backend_class_finalize (NullBackendClass *klass);
@@ -43,10 +44,11 @@ backend_module_init (GTypeModule *module)
{
null_backend_register_type (module);
- info.name = BACKEND_NAME;
- info.priority = BACKEND_PRIORITY;
- info.g_type = NULL_TYPE_BACKEND;
- info.backend_type = MATE_MIXER_BACKEND_NULL;
+ info.name = BACKEND_NAME;
+ info.priority = BACKEND_PRIORITY;
+ info.g_type = NULL_TYPE_BACKEND;
+ info.backend_flags = BACKEND_FLAGS;
+ info.backend_type = MATE_MIXER_BACKEND_NULL;
}
const MateMixerBackendInfo *backend_module_get_info (void)
diff --git a/backends/oss/oss-backend.c b/backends/oss/oss-backend.c
index bf9a694..78ed69b 100644
--- a/backends/oss/oss-backend.c
+++ b/backends/oss/oss-backend.c
@@ -33,6 +33,7 @@
#define BACKEND_NAME "OSS"
#define BACKEND_PRIORITY 10
+#define BACKEND_FLAGS MATE_MIXER_BACKEND_NO_FLAGS
#if !defined(__linux__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
/* At least on systems based on FreeBSD we will need to read device names
@@ -114,10 +115,11 @@ backend_module_init (GTypeModule *module)
{
oss_backend_register_type (module);
- info.name = BACKEND_NAME;
- info.priority = BACKEND_PRIORITY;
- info.g_type = OSS_TYPE_BACKEND;
- info.backend_type = MATE_MIXER_BACKEND_OSS;
+ info.name = BACKEND_NAME;
+ info.priority = BACKEND_PRIORITY;
+ info.g_type = OSS_TYPE_BACKEND;
+ info.backend_flags = BACKEND_FLAGS;
+ info.backend_type = MATE_MIXER_BACKEND_OSS;
}
const MateMixerBackendInfo *backend_module_get_info (void)
diff --git a/backends/pulse/pulse-backend.c b/backends/pulse/pulse-backend.c
index 0d9c39c..4c0697a 100644
--- a/backends/pulse/pulse-backend.c
+++ b/backends/pulse/pulse-backend.c
@@ -38,6 +38,10 @@
#define BACKEND_NAME "PulseAudio"
#define BACKEND_PRIORITY 100
+#define BACKEND_FLAGS (MATE_MIXER_BACKEND_HAS_APPLICATION_CONTROLS | \
+ MATE_MIXER_BACKEND_HAS_STORED_CONTROLS | \
+ MATE_MIXER_BACKEND_CAN_SET_DEFAULT_INPUT_STREAM | \
+ MATE_MIXER_BACKEND_CAN_SET_DEFAULT_OUTPUT_STREAM)
struct _PulseBackendPrivate
{
@@ -209,10 +213,11 @@ backend_module_init (GTypeModule *module)
{
pulse_backend_register_type (module);
- info.name = BACKEND_NAME;
- info.priority = BACKEND_PRIORITY;
- info.g_type = PULSE_TYPE_BACKEND;
- info.backend_type = MATE_MIXER_BACKEND_PULSEAUDIO;
+ info.name = BACKEND_NAME;
+ info.priority = BACKEND_PRIORITY;
+ info.g_type = PULSE_TYPE_BACKEND;
+ info.backend_flags = BACKEND_FLAGS;
+ info.backend_type = MATE_MIXER_BACKEND_PULSEAUDIO;
}
const MateMixerBackendInfo *backend_module_get_info (void)
@@ -432,11 +437,6 @@ pulse_backend_open (MateMixerBackend *backend)
return FALSE;
}
- _mate_mixer_backend_set_flags (backend,
- MATE_MIXER_BACKEND_HAS_APPLICATION_CONTROLS |
- MATE_MIXER_BACKEND_CAN_SET_DEFAULT_INPUT_STREAM |
- MATE_MIXER_BACKEND_CAN_SET_DEFAULT_OUTPUT_STREAM);
-
pulse->priv->connection = connection;
return TRUE;
}
diff --git a/libmatemixer/matemixer-backend-module.h b/libmatemixer/matemixer-backend-module.h
index dc95633..be2f7d1 100644
--- a/libmatemixer/matemixer-backend-module.h
+++ b/libmatemixer/matemixer-backend-module.h
@@ -61,6 +61,7 @@ struct _MateMixerBackendInfo
gchar *name;
guint priority;
GType g_type;
+ MateMixerBackendFlags backend_flags;
MateMixerBackendType backend_type;
};
diff --git a/libmatemixer/matemixer-backend.c b/libmatemixer/matemixer-backend.c
index b8177e3..4201e4a 100644
--- a/libmatemixer/matemixer-backend.c
+++ b/libmatemixer/matemixer-backend.c
@@ -356,14 +356,6 @@ mate_mixer_backend_get_state (MateMixerBackend *backend)
return backend->priv->state;
}
-MateMixerBackendFlags
-mate_mixer_backend_get_flags (MateMixerBackend *backend)
-{
- g_return_val_if_fail (MATE_MIXER_IS_BACKEND (backend), MATE_MIXER_BACKEND_NO_FLAGS);
-
- return backend->priv->flags;
-}
-
MateMixerDevice *
mate_mixer_backend_get_device (MateMixerBackend *backend, const gchar *name)
{
@@ -612,14 +604,6 @@ _mate_mixer_backend_set_state (MateMixerBackend *backend, MateMixerState state)
}
void
-_mate_mixer_backend_set_flags (MateMixerBackend *backend, MateMixerBackendFlags flags)
-{
- g_return_if_fail (MATE_MIXER_IS_BACKEND (backend));
-
- backend->priv->flags = flags;
-}
-
-void
_mate_mixer_backend_set_default_input_stream (MateMixerBackend *backend,
MateMixerStream *stream)
{
diff --git a/libmatemixer/matemixer-backend.h b/libmatemixer/matemixer-backend.h
index 41ffb40..06082f9 100644
--- a/libmatemixer/matemixer-backend.h
+++ b/libmatemixer/matemixer-backend.h
@@ -99,7 +99,6 @@ gboolean mate_mixer_backend_open (MateMixerB
void mate_mixer_backend_close (MateMixerBackend *backend);
MateMixerState mate_mixer_backend_get_state (MateMixerBackend *backend);
-MateMixerBackendFlags mate_mixer_backend_get_flags (MateMixerBackend *backend);
MateMixerDevice * mate_mixer_backend_get_device (MateMixerBackend *backend,
const gchar *name);
@@ -123,8 +122,6 @@ gboolean mate_mixer_backend_set_default_output_stream (MateMixerB
/* Protected functions */
void _mate_mixer_backend_set_state (MateMixerBackend *backend,
MateMixerState state);
-void _mate_mixer_backend_set_flags (MateMixerBackend *backend,
- MateMixerBackendFlags flags);
void _mate_mixer_backend_set_default_input_stream (MateMixerBackend *backend,
MateMixerStream *stream);
diff --git a/libmatemixer/matemixer-context.c b/libmatemixer/matemixer-context.c
index bf31eb3..bb24416 100644
--- a/libmatemixer/matemixer-context.c
+++ b/libmatemixer/matemixer-context.c
@@ -1180,7 +1180,10 @@ mate_mixer_context_get_backend_flags (MateMixerContext *context)
{
g_return_val_if_fail (MATE_MIXER_IS_CONTEXT (context), MATE_MIXER_BACKEND_NO_FLAGS);
- return mate_mixer_backend_get_flags (context->priv->backend);
+ if (context->priv->backend_chosen == FALSE)
+ return MATE_MIXER_BACKEND_NO_FLAGS;
+
+ return mate_mixer_backend_module_get_info (context->priv->module)->backend_flags;
}
static void
diff --git a/libmatemixer/matemixer-enums.h b/libmatemixer/matemixer-enums.h
index 3f2fa44..601dc86 100644
--- a/libmatemixer/matemixer-enums.h
+++ b/libmatemixer/matemixer-enums.h
@@ -79,21 +79,26 @@ typedef enum {
* @MATE_MIXER_BACKEND_NO_FLAGS:
* No flags.
* @MATE_MIXER_BACKEND_HAS_APPLICATION_CONTROLS:
- * The backend includes support for application stream controls.
+ * The sound system backend includes support for application stream controls.
+ * @MATE_MIXER_BACKEND_HAS_STORED_CONTROLS:
+ * The sound system backend includes support for stored controls. The presence
+ * of this flag does not guarantee that this feature is enabled in the sound
+ * system's configuration.
* @MATE_MIXER_BACKEND_CAN_SET_DEFAULT_INPUT_STREAM:
- * The backend is able to change the current default input stream using
- * the mate_mixer_context_set_default_input_stream() function.
+ * The sound system backend is able to change the current default input stream
+ * using the mate_mixer_context_set_default_input_stream() function.
* @MATE_MIXER_BACKEND_CAN_SET_DEFAULT_OUTPUT_STREAM:
- * The backend is able to change the current default output stream using
- * the mate_mixer_context_set_default_output_stream() function.
+ * The sound system backend is able to change the current default output stream
+ * using the mate_mixer_context_set_default_output_stream() function.
*
* Flags describing capabilities of a sound system.
*/
typedef enum { /*< flags >*/
- MATE_MIXER_BACKEND_NO_FLAGS = 0,
- MATE_MIXER_BACKEND_HAS_APPLICATION_CONTROLS = 1 << 0,
- MATE_MIXER_BACKEND_CAN_SET_DEFAULT_INPUT_STREAM = 1 << 1,
- MATE_MIXER_BACKEND_CAN_SET_DEFAULT_OUTPUT_STREAM = 1 << 2
+ MATE_MIXER_BACKEND_NO_FLAGS = 0,
+ MATE_MIXER_BACKEND_HAS_APPLICATION_CONTROLS = 1 << 0,
+ MATE_MIXER_BACKEND_HAS_STORED_CONTROLS = 1 << 1,
+ MATE_MIXER_BACKEND_CAN_SET_DEFAULT_INPUT_STREAM = 1 << 2,
+ MATE_MIXER_BACKEND_CAN_SET_DEFAULT_OUTPUT_STREAM = 1 << 3
} MateMixerBackendFlags;
/**