summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/pulse/pulse-device.c72
-rw-r--r--docs/reference/libmatemixer-docs.xml2
-rw-r--r--docs/reference/libmatemixer-sections.txt45
-rw-r--r--docs/reference/libmatemixer.types6
-rw-r--r--examples/monitor.c22
-rw-r--r--libmatemixer/Makefile.am4
-rw-r--r--libmatemixer/matemixer-device-profile.c272
-rw-r--r--libmatemixer/matemixer-device-profile.h72
-rw-r--r--libmatemixer/matemixer-device.c6
-rw-r--r--libmatemixer/matemixer-device.h38
-rw-r--r--libmatemixer/matemixer-profile.c212
-rw-r--r--libmatemixer/matemixer-profile.h68
-rw-r--r--libmatemixer/matemixer-stream.c16
-rw-r--r--libmatemixer/matemixer.h2
14 files changed, 458 insertions, 379 deletions
diff --git a/backends/pulse/pulse-device.c b/backends/pulse/pulse-device.c
index 70ec204..368d85b 100644
--- a/backends/pulse/pulse-device.c
+++ b/backends/pulse/pulse-device.c
@@ -20,9 +20,9 @@
#include <string.h>
#include <libmatemixer/matemixer-device.h>
+#include <libmatemixer/matemixer-device-profile.h>
#include <libmatemixer/matemixer-enums.h>
#include <libmatemixer/matemixer-port.h>
-#include <libmatemixer/matemixer-profile.h>
#include <pulse/pulseaudio.h>
@@ -31,16 +31,16 @@
struct _PulseDevicePrivate
{
- guint32 index;
- gchar *name;
- gchar *description;
- GList *profiles;
- GList *ports;
- GList *streams;
- gboolean streams_sorted;
- gchar *icon;
- PulseConnection *connection;
- MateMixerProfile *profile;
+ guint32 index;
+ gchar *name;
+ gchar *description;
+ GList *profiles;
+ GList *ports;
+ GList *streams;
+ gboolean streams_sorted;
+ gchar *icon;
+ PulseConnection *connection;
+ MateMixerDeviceProfile *profile;
};
enum
@@ -78,24 +78,24 @@ G_DEFINE_TYPE_WITH_CODE (PulseDevice, pulse_device, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (MATE_MIXER_TYPE_DEVICE,
mate_mixer_device_interface_init))
-static const gchar * device_get_name (MateMixerDevice *device);
-static const gchar * device_get_description (MateMixerDevice *device);
-static const gchar * device_get_icon (MateMixerDevice *device);
+static const gchar * device_get_name (MateMixerDevice *device);
+static const gchar * device_get_description (MateMixerDevice *device);
+static const gchar * device_get_icon (MateMixerDevice *device);
-static const GList * device_list_ports (MateMixerDevice *device);
-static const GList * device_list_profiles (MateMixerDevice *device);
+static const GList * device_list_ports (MateMixerDevice *device);
+static const GList * device_list_profiles (MateMixerDevice *device);
-static MateMixerProfile *device_get_active_profile (MateMixerDevice *device);
-static gboolean device_set_active_profile (MateMixerDevice *device,
- const gchar *profile);
+static MateMixerDeviceProfile *device_get_active_profile (MateMixerDevice *device);
+static gboolean device_set_active_profile (MateMixerDevice *device,
+ const gchar *profile);
-static gint device_compare_ports (gconstpointer a,
- gconstpointer b);
-static gint device_compare_profiles (gconstpointer a,
- gconstpointer b);
+static gint device_compare_ports (gconstpointer a,
+ gconstpointer b);
+static gint device_compare_profiles (gconstpointer a,
+ gconstpointer b);
-static void device_free_ports (PulseDevice *device);
-static void device_free_profiles (PulseDevice *device);
+static void device_free_ports (PulseDevice *device);
+static void device_free_profiles (PulseDevice *device);
static void
mate_mixer_device_interface_init (MateMixerDeviceInterface *iface)
@@ -352,7 +352,7 @@ pulse_device_update (PulseDevice *device, const pa_card_info *info)
device_free_profiles (device);
for (i = 0; i < info->n_profiles; i++) {
- MateMixerProfile *profile;
+ MateMixerDeviceProfile *profile;
#if PA_CHECK_VERSION(5, 0, 0)
pa_card_profile_info2 *p_info = info->profiles2[i];
@@ -366,10 +366,12 @@ pulse_device_update (PulseDevice *device, const pa_card_info *info)
/* The old profile list is an array of structs, not pointers */
pa_card_profile_info *p_info = &info->profiles[i];
#endif
- profile = mate_mixer_profile_new (
+ profile = mate_mixer_device_profile_new (
p_info->name,
p_info->description,
- p_info->priority);
+ p_info->priority,
+ p_info->n_sources,
+ p_info->n_sinks);
if (device->priv->profile == NULL) {
#if PA_CHECK_VERSION(5, 0, 0)
@@ -447,7 +449,7 @@ device_list_profiles (MateMixerDevice *device)
return (const GList *) PULSE_DEVICE (device)->priv->profiles;
}
-static MateMixerProfile *
+static MateMixerDeviceProfile *
device_get_active_profile (MateMixerDevice *device)
{
g_return_val_if_fail (PULSE_IS_DEVICE (device), NULL);
@@ -484,16 +486,16 @@ device_compare_ports (gconstpointer a, gconstpointer b)
static gint
device_compare_profiles (gconstpointer a, gconstpointer b)
{
- MateMixerProfile *p1 = MATE_MIXER_PROFILE (a);
- MateMixerProfile *p2 = MATE_MIXER_PROFILE (b);
+ MateMixerDeviceProfile *p1 = MATE_MIXER_DEVICE_PROFILE (a);
+ MateMixerDeviceProfile *p2 = MATE_MIXER_DEVICE_PROFILE (b);
- gint ret = (gint) (mate_mixer_profile_get_priority (p2) -
- mate_mixer_profile_get_priority (p1));
+ gint ret = (gint) (mate_mixer_device_profile_get_priority (p2) -
+ mate_mixer_device_profile_get_priority (p1));
if (ret != 0)
return ret;
else
- return strcmp (mate_mixer_profile_get_name (p1),
- mate_mixer_profile_get_name (p2));
+ return strcmp (mate_mixer_device_profile_get_name (p1),
+ mate_mixer_device_profile_get_name (p2));
}
static void
diff --git a/docs/reference/libmatemixer-docs.xml b/docs/reference/libmatemixer-docs.xml
index 15af1aa..708ca6e 100644
--- a/docs/reference/libmatemixer-docs.xml
+++ b/docs/reference/libmatemixer-docs.xml
@@ -19,8 +19,8 @@
<xi:include href="xml/matemixer-client-stream.xml"/>
<xi:include href="xml/matemixer-control.xml"/>
<xi:include href="xml/matemixer-device.xml"/>
+ <xi:include href="xml/matemixer-device-profile.xml"/>
<xi:include href="xml/matemixer-port.xml"/>
- <xi:include href="xml/matemixer-profile.xml"/>
<xi:include href="xml/matemixer-stream.xml"/>
</chapter>
<index id="api-index-full">
diff --git a/docs/reference/libmatemixer-sections.txt b/docs/reference/libmatemixer-sections.txt
index 69e60e1..dd2d1ce 100644
--- a/docs/reference/libmatemixer-sections.txt
+++ b/docs/reference/libmatemixer-sections.txt
@@ -2,6 +2,7 @@
<FILE>matemixer</FILE>
mate_mixer_init
mate_mixer_deinit
+mate_mixer_is_initialized
LIBMATEMIXER_CHECK_VERSION
</SECTION>
@@ -85,6 +86,29 @@ mate_mixer_device_get_type
</SECTION>
<SECTION>
+<FILE>matemixer-device-profile</FILE>
+<TITLE>MateMixerDeviceProfile</TITLE>
+MateMixerDeviceProfile
+mate_mixer_device_profile_new
+mate_mixer_device_profile_get_name
+mate_mixer_device_profile_get_description
+mate_mixer_device_profile_get_priority
+mate_mixer_device_profile_get_num_input_streams
+mate_mixer_device_profile_get_num_output_streams
+<SUBSECTION Standard>
+MateMixerDeviceProfileClass
+MATE_MIXER_IS_DEVICE_PROFILE
+MATE_MIXER_IS_DEVICE_PROFILE_CLASS
+MATE_MIXER_DEVICE_PROFILE
+MATE_MIXER_DEVICE_PROFILE_CLASS
+MATE_MIXER_DEVICE_PROFILE_GET_CLASS
+MATE_MIXER_TYPE_DEVICE_PROFILE
+mate_mixer_device_profile_get_type
+<SUBSECTION Private>
+MateMixerDeviceProfilePrivate
+</SECTION>
+
+<SECTION>
<FILE>matemixer-port</FILE>
<TITLE>MateMixerPort</TITLE>
MateMixerPortFlags
@@ -109,27 +133,6 @@ MateMixerPortPrivate
</SECTION>
<SECTION>
-<FILE>matemixer-profile</FILE>
-<TITLE>MateMixerProfile</TITLE>
-MateMixerProfile
-mate_mixer_profile_new
-mate_mixer_profile_get_name
-mate_mixer_profile_get_description
-mate_mixer_profile_get_priority
-<SUBSECTION Standard>
-MateMixerProfileClass
-MATE_MIXER_IS_PROFILE
-MATE_MIXER_IS_PROFILE_CLASS
-MATE_MIXER_PROFILE
-MATE_MIXER_PROFILE_CLASS
-MATE_MIXER_PROFILE_GET_CLASS
-MATE_MIXER_TYPE_PROFILE
-mate_mixer_profile_get_type
-<SUBSECTION Private>
-MateMixerProfilePrivate
-</SECTION>
-
-<SECTION>
<FILE>matemixer-stream</FILE>
<TITLE>MateMixerStream</TITLE>
MateMixerChannelPosition
diff --git a/docs/reference/libmatemixer.types b/docs/reference/libmatemixer.types
new file mode 100644
index 0000000..714c773
--- /dev/null
+++ b/docs/reference/libmatemixer.types
@@ -0,0 +1,6 @@
+mate_mixer_client_stream_get_type
+mate_mixer_control_get_type
+mate_mixer_device_get_type
+mate_mixer_device_profile_get_type
+mate_mixer_port_get_type
+mate_mixer_stream_get_type
diff --git a/examples/monitor.c b/examples/monitor.c
index ba0458d..e3ab0d6 100644
--- a/examples/monitor.c
+++ b/examples/monitor.c
@@ -79,10 +79,10 @@ create_volume_bar (MateMixerStream *stream, double *percent)
static void
print_devices (void)
{
- const GList *devices;
- const GList *ports;
- const GList *profiles;
- MateMixerProfile *active_profile;
+ const GList *devices;
+ const GList *ports;
+ const GList *profiles;
+ MateMixerDeviceProfile *active_profile;
devices = mate_mixer_control_list_devices (control);
@@ -117,17 +117,21 @@ print_devices (void)
active_profile = mate_mixer_device_get_active_profile (device);
while (profiles) {
- MateMixerProfile *profile = MATE_MIXER_PROFILE (profiles->data);
+ MateMixerDeviceProfile *profile = MATE_MIXER_DEVICE_PROFILE (profiles->data);
g_print (" |%c| Profile %s\n"
" |-| Description : %s\n"
- " |-| Priority : %lu\n\n",
+ " |-| Priority : %u\n"
+ " |-| Inputs : %u\n"
+ " |-| Outputs : %u\n\n",
(profile == active_profile)
? 'A'
: '-',
- mate_mixer_profile_get_name (profile),
- mate_mixer_profile_get_description (profile),
- mate_mixer_profile_get_priority (profile));
+ mate_mixer_device_profile_get_name (profile),
+ mate_mixer_device_profile_get_description (profile),
+ mate_mixer_device_profile_get_priority (profile),
+ mate_mixer_device_profile_get_num_input_streams (profile),
+ mate_mixer_device_profile_get_num_output_streams (profile));
profiles = profiles->next;
}
diff --git a/libmatemixer/Makefile.am b/libmatemixer/Makefile.am
index 9d79e9d..538592f 100644
--- a/libmatemixer/Makefile.am
+++ b/libmatemixer/Makefile.am
@@ -13,9 +13,9 @@ libmatemixer_include_HEADERS = \
matemixer-client-stream.h \
matemixer-control.h \
matemixer-device.h \
+ matemixer-device-profile.h \
matemixer-enums.h \
matemixer-port.h \
- matemixer-profile.h \
matemixer-stream.h \
matemixer-version.h
@@ -31,10 +31,10 @@ libmatemixer_la_SOURCES = \
matemixer-client-stream.c \
matemixer-control.c \
matemixer-device.c \
+ matemixer-device-profile.c \
matemixer-enum-types.c \
matemixer-enum-types.h \
matemixer-port.c \
- matemixer-profile.c \
matemixer-stream.c
libmatemixer_la_LIBADD = $(GLIB_LIBS)
diff --git a/libmatemixer/matemixer-device-profile.c b/libmatemixer/matemixer-device-profile.c
new file mode 100644
index 0000000..e229b6a
--- /dev/null
+++ b/libmatemixer/matemixer-device-profile.c
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glib.h>
+#include <glib-object.h>
+
+#include "matemixer-device-profile.h"
+
+/**
+ * SECTION:matemixer-device-profile
+ * @include: libmatemixer/matemixer.h
+ */
+
+struct _MateMixerDeviceProfilePrivate
+{
+ gchar *name;
+ gchar *description;
+ guint priority;
+ guint num_input_streams;
+ guint num_output_streams;
+};
+
+enum {
+ PROP_0,
+ PROP_NAME,
+ PROP_DESCRIPTION,
+ PROP_PRIORITY,
+ PROP_NUM_INPUT_STREAMS,
+ PROP_NUM_OUTPUT_STREAMS,
+ N_PROPERTIES
+};
+
+static GParamSpec *properties[N_PROPERTIES] = { NULL, };
+
+static void mate_mixer_device_profile_class_init (MateMixerDeviceProfileClass *klass);
+
+static void mate_mixer_device_profile_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void mate_mixer_device_profile_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec);
+
+static void mate_mixer_device_profile_init (MateMixerDeviceProfile *profile);
+static void mate_mixer_device_profile_finalize (GObject *object);
+
+G_DEFINE_TYPE (MateMixerDeviceProfile, mate_mixer_device_profile, G_TYPE_OBJECT);
+
+static void
+mate_mixer_device_profile_class_init (MateMixerDeviceProfileClass *klass)
+{
+ GObjectClass *object_class;
+
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = mate_mixer_device_profile_finalize;
+ object_class->get_property = mate_mixer_device_profile_get_property;
+ object_class->set_property = mate_mixer_device_profile_set_property;
+
+ properties[PROP_NAME] =
+ g_param_spec_string ("name",
+ "Name",
+ "Name of the profile",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_DESCRIPTION] =
+ g_param_spec_string ("description",
+ "Description",
+ "Description of the profile",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_PRIORITY] =
+ g_param_spec_uint ("priority",
+ "Priority",
+ "Priority of the profile",
+ 0,
+ G_MAXUINT,
+ 0,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_NUM_INPUT_STREAMS] =
+ g_param_spec_uint ("num-input-streams",
+ "Number of input streams",
+ "Number of input streams in the profile",
+ 0,
+ G_MAXUINT,
+ 0,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ properties[PROP_NUM_OUTPUT_STREAMS] =
+ g_param_spec_uint ("num-output-streams",
+ "Number of output streams",
+ "Number of output streams in the profile",
+ 0,
+ G_MAXUINT,
+ 0,
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class, N_PROPERTIES, properties);
+
+ g_type_class_add_private (object_class, sizeof (MateMixerDeviceProfilePrivate));
+}
+
+static void
+mate_mixer_device_profile_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ MateMixerDeviceProfile *profile;
+
+ profile = MATE_MIXER_DEVICE_PROFILE (object);
+
+ switch (param_id) {
+ case PROP_NAME:
+ g_value_set_string (value, profile->priv->name);
+ break;
+ case PROP_DESCRIPTION:
+ g_value_set_string (value, profile->priv->description);
+ break;
+ case PROP_PRIORITY:
+ g_value_set_uint (value, profile->priv->priority);
+ break;
+ case PROP_NUM_INPUT_STREAMS:
+ g_value_set_uint (value, profile->priv->num_input_streams);
+ break;
+ case PROP_NUM_OUTPUT_STREAMS:
+ g_value_set_uint (value, profile->priv->num_output_streams);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+mate_mixer_device_profile_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ MateMixerDeviceProfile *profile;
+
+ profile = MATE_MIXER_DEVICE_PROFILE (object);
+
+ switch (param_id) {
+ case PROP_NAME:
+ /* Construct-only string */
+ profile->priv->name = g_strdup (g_value_get_string (value));
+ break;
+ case PROP_DESCRIPTION:
+ /* Construct-only string */
+ profile->priv->description = g_strdup (g_value_get_string (value));
+ break;
+ case PROP_PRIORITY:
+ profile->priv->priority = g_value_get_uint (value);
+ break;
+ case PROP_NUM_INPUT_STREAMS:
+ profile->priv->num_input_streams = g_value_get_uint (value);
+ break;
+ case PROP_NUM_OUTPUT_STREAMS:
+ profile->priv->num_output_streams = g_value_get_uint (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+mate_mixer_device_profile_init (MateMixerDeviceProfile *profile)
+{
+ profile->priv = G_TYPE_INSTANCE_GET_PRIVATE (profile,
+ MATE_MIXER_TYPE_DEVICE_PROFILE,
+ MateMixerDeviceProfilePrivate);
+}
+
+static void
+mate_mixer_device_profile_finalize (GObject *object)
+{
+ MateMixerDeviceProfile *profile;
+
+ profile = MATE_MIXER_DEVICE_PROFILE (object);
+
+ g_free (profile->priv->name);
+ g_free (profile->priv->description);
+
+ G_OBJECT_CLASS (mate_mixer_device_profile_parent_class)->finalize (object);
+}
+
+MateMixerDeviceProfile *
+mate_mixer_device_profile_new (const gchar *name,
+ const gchar *description,
+ guint priority,
+ guint input_streams,
+ guint output_streams)
+{
+ return g_object_new (MATE_MIXER_TYPE_DEVICE_PROFILE,
+ "name", name,
+ "description", description,
+ "priority", priority,
+ "num-input-streams", input_streams,
+ "num-output-streams", output_streams,
+ NULL);
+}
+
+const gchar *
+mate_mixer_device_profile_get_name (MateMixerDeviceProfile *profile)
+{
+ g_return_val_if_fail (MATE_MIXER_IS_DEVICE_PROFILE (profile), NULL);
+
+ return profile->priv->name;
+}
+
+const gchar *
+mate_mixer_device_profile_get_description (MateMixerDeviceProfile *profile)
+{
+ g_return_val_if_fail (MATE_MIXER_IS_DEVICE_PROFILE (profile), NULL);
+
+ return profile->priv->description;
+}
+
+guint
+mate_mixer_device_profile_get_priority (MateMixerDeviceProfile *profile)
+{
+ g_return_val_if_fail (MATE_MIXER_IS_DEVICE_PROFILE (profile), 0);
+
+ return profile->priv->priority;
+}
+
+guint
+mate_mixer_device_profile_get_num_input_streams (MateMixerDeviceProfile *profile)
+{
+ g_return_val_if_fail (MATE_MIXER_IS_DEVICE_PROFILE (profile), 0);
+
+ return profile->priv->num_input_streams;
+}
+
+guint
+mate_mixer_device_profile_get_num_output_streams (MateMixerDeviceProfile *profile)
+{
+ g_return_val_if_fail (MATE_MIXER_IS_DEVICE_PROFILE (profile), 0);
+
+ return profile->priv->num_output_streams;
+}
diff --git a/libmatemixer/matemixer-device-profile.h b/libmatemixer/matemixer-device-profile.h
new file mode 100644
index 0000000..6a4368b
--- /dev/null
+++ b/libmatemixer/matemixer-device-profile.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2014 Michal Ratajsky <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the licence, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MATEMIXER_DEVICE_PROFILE_H
+#define MATEMIXER_DEVICE_PROFILE_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MATE_MIXER_TYPE_DEVICE_PROFILE \
+ (mate_mixer_device_profile_get_type ())
+#define MATE_MIXER_DEVICE_PROFILE(o) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((o), MATE_MIXER_TYPE_DEVICE_PROFILE, MateMixerDeviceProfile))
+#define MATE_MIXER_IS_DEVICE_PROFILE(o) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((o), MATE_MIXER_TYPE_DEVICE_PROFILE))
+#define MATE_MIXER_DEVICE_PROFILE_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_CAST ((k), MATE_MIXER_TYPE_DEVICE_PROFILE, MateMixerDeviceProfileClass))
+#define MATE_MIXER_IS_DEVICE_PROFILE_CLASS(k) \
+ (G_TYPE_CHECK_CLASS_TYPE ((k), MATE_MIXER_TYPE_DEVICE_PROFILE))
+#define MATE_MIXER_DEVICE_PROFILE_GET_CLASS(o) \
+ (G_TYPE_INSTANCE_GET_CLASS ((o), MATE_MIXER_TYPE_DEVICE_PROFILE, MateMixerDeviceProfileClass))
+
+typedef struct _MateMixerDeviceProfile MateMixerDeviceProfile;
+typedef struct _MateMixerDeviceProfileClass MateMixerDeviceProfileClass;
+typedef struct _MateMixerDeviceProfilePrivate MateMixerDeviceProfilePrivate;
+
+struct _MateMixerDeviceProfile
+{
+ GObject parent;
+
+ /*< private >*/
+ MateMixerDeviceProfilePrivate *priv;
+};
+
+struct _MateMixerDeviceProfileClass
+{
+ GObjectClass parent_class;
+};
+
+GType mate_mixer_device_profile_get_type (void) G_GNUC_CONST;
+
+MateMixerDeviceProfile *mate_mixer_device_profile_new (const gchar *name,
+ const gchar *description,
+ guint priority,
+ guint input_streams,
+ guint output_streams);
+
+const gchar * mate_mixer_device_profile_get_name (MateMixerDeviceProfile *profile);
+const gchar * mate_mixer_device_profile_get_description (MateMixerDeviceProfile *profile);
+guint mate_mixer_device_profile_get_priority (MateMixerDeviceProfile *profile);
+guint mate_mixer_device_profile_get_num_input_streams (MateMixerDeviceProfile *profile);
+guint mate_mixer_device_profile_get_num_output_streams (MateMixerDeviceProfile *profile);
+
+G_END_DECLS
+
+#endif /* MATEMIXER_DEVICE_PROFILE_H */
diff --git a/libmatemixer/matemixer-device.c b/libmatemixer/matemixer-device.c
index e74dc23..00a848a 100644
--- a/libmatemixer/matemixer-device.c
+++ b/libmatemixer/matemixer-device.c
@@ -19,7 +19,7 @@
#include <glib-object.h>
#include "matemixer-device.h"
-#include "matemixer-profile.h"
+#include "matemixer-device-profile.h"
/**
* SECTION:matemixer-device
@@ -73,7 +73,7 @@ mate_mixer_device_default_init (MateMixerDeviceInterface *iface)
g_param_spec_object ("active-profile",
"Active profile",
"The currently active profile of the sound device",
- MATE_MIXER_TYPE_PROFILE,
+ MATE_MIXER_TYPE_DEVICE_PROFILE,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
}
@@ -146,7 +146,7 @@ mate_mixer_device_list_profiles (MateMixerDevice *device)
return NULL;
}
-MateMixerProfile *
+MateMixerDeviceProfile *
mate_mixer_device_get_active_profile (MateMixerDevice *device)
{
MateMixerDeviceInterface *iface;
diff --git a/libmatemixer/matemixer-device.h b/libmatemixer/matemixer-device.h
index a1422e3..ef283f1 100644
--- a/libmatemixer/matemixer-device.h
+++ b/libmatemixer/matemixer-device.h
@@ -21,7 +21,7 @@
#include <glib.h>
#include <glib-object.h>
-#include <libmatemixer/matemixer-profile.h>
+#include <libmatemixer/matemixer-device-profile.h>
G_BEGIN_DECLS
@@ -42,29 +42,29 @@ struct _MateMixerDeviceInterface
GTypeInterface parent_iface;
/*< private >*/
- const gchar *(*get_name) (MateMixerDevice *device);
- const gchar *(*get_description) (MateMixerDevice *device);
- const gchar *(*get_icon) (MateMixerDevice *device);
- const GList *(*list_streams) (MateMixerDevice *device);
- const GList *(*list_ports) (MateMixerDevice *device);
- const GList *(*list_profiles) (MateMixerDevice *device);
- MateMixerProfile *(*get_active_profile) (MateMixerDevice *device);
- gboolean (*set_active_profile) (MateMixerDevice *device,
- const gchar *profile);
+ const gchar *(*get_name) (MateMixerDevice *device);
+ const gchar *(*get_description) (MateMixerDevice *device);
+ const gchar *(*get_icon) (MateMixerDevice *device);
+ const GList *(*list_streams) (MateMixerDevice *device);
+ const GList *(*list_ports) (MateMixerDevice *device);
+ const GList *(*list_profiles) (MateMixerDevice *device);
+ MateMixerDeviceProfile *(*get_active_profile) (MateMixerDevice *device);
+ gboolean (*set_active_profile) (MateMixerDevice *device,
+ const gchar *profile);
};
-GType mate_mixer_device_get_type (void) G_GNUC_CONST;
+GType mate_mixer_device_get_type (void) G_GNUC_CONST;
-const gchar * mate_mixer_device_get_name (MateMixerDevice *device);
-const gchar * mate_mixer_device_get_description (MateMixerDevice *device);
-const gchar * mate_mixer_device_get_icon (MateMixerDevice *device);
+const gchar * mate_mixer_device_get_name (MateMixerDevice *device);
+const gchar * mate_mixer_device_get_description (MateMixerDevice *device);
+const gchar * mate_mixer_device_get_icon (MateMixerDevice *device);
-const GList * mate_mixer_device_list_ports (MateMixerDevice *device);
-const GList * mate_mixer_device_list_profiles (MateMixerDevice *device);
+const GList * mate_mixer_device_list_ports (MateMixerDevice *device);
+const GList * mate_mixer_device_list_profiles (MateMixerDevice *device);
-MateMixerProfile *mate_mixer_device_get_active_profile (MateMixerDevice *device);
-gboolean mate_mixer_device_set_active_profile (MateMixerDevice *device,
- const gchar *profile);
+MateMixerDeviceProfile *mate_mixer_device_get_active_profile (MateMixerDevice *device);
+gboolean mate_mixer_device_set_active_profile (MateMixerDevice *device,
+ const gchar *profile);
G_END_DECLS
diff --git a/libmatemixer/matemixer-profile.c b/libmatemixer/matemixer-profile.c
deleted file mode 100644
index c98af30..0000000
--- a/libmatemixer/matemixer-profile.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (C) 2014 Michal Ratajsky <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the licence, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include "matemixer-profile.h"
-
-/**
- * SECTION:matemixer-profile
- * @include: libmatemixer/matemixer.h
- */
-
-struct _MateMixerProfilePrivate
-{
- gchar *name;
- gchar *description;
- gulong priority;
-};
-
-enum {
- PROP_0,
- PROP_NAME,
- PROP_DESCRIPTION,
- PROP_PRIORITY,
- N_PROPERTIES
-};
-
-static GParamSpec *properties[N_PROPERTIES] = { NULL, };
-
-static void mate_mixer_profile_class_init (MateMixerProfileClass *klass);
-
-static void mate_mixer_profile_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec);
-static void mate_mixer_profile_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec);
-
-static void mate_mixer_profile_init (MateMixerProfile *profile);
-static void mate_mixer_profile_finalize (GObject *object);
-
-G_DEFINE_TYPE (MateMixerProfile, mate_mixer_profile, G_TYPE_OBJECT);
-
-static void
-mate_mixer_profile_class_init (MateMixerProfileClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
- object_class->finalize = mate_mixer_profile_finalize;
- object_class->get_property = mate_mixer_profile_get_property;
- object_class->set_property = mate_mixer_profile_set_property;
-
- properties[PROP_NAME] =
- g_param_spec_string ("name",
- "Name",
- "Name of the profile",
- NULL,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- properties[PROP_DESCRIPTION] =
- g_param_spec_string ("description",
- "Description",
- "Description of the profile",
- NULL,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- properties[PROP_PRIORITY] =
- g_param_spec_ulong ("priority",
- "Priority",
- "Priority of the profile",
- 0,
- G_MAXULONG,
- 0,
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_READWRITE |
- G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties (object_class, N_PROPERTIES, properties);
-
- g_type_class_add_private (object_class, sizeof (MateMixerProfilePrivate));
-}
-
-static void
-mate_mixer_profile_get_property (GObject *object,
- guint param_id,
- GValue *value,
- GParamSpec *pspec)
-{
- MateMixerProfile *profile;
-
- profile = MATE_MIXER_PROFILE (object);
-
- switch (param_id) {
- case PROP_NAME:
- g_value_set_string (value, profile->priv->name);
- break;
- case PROP_DESCRIPTION:
- g_value_set_string (value, profile->priv->description);
- break;
- case PROP_PRIORITY:
- g_value_set_ulong (value, profile->priv->priority);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-mate_mixer_profile_set_property (GObject *object,
- guint param_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- MateMixerProfile *profile;
-
- profile = MATE_MIXER_PROFILE (object);
-
- switch (param_id) {
- case PROP_NAME:
- /* Construct-only string */
- profile->priv->name = g_strdup (g_value_get_string (value));
- break;
- case PROP_DESCRIPTION:
- /* Construct-only string */
- profile->priv->description = g_strdup (g_value_get_string (value));
- break;
- case PROP_PRIORITY:
- profile->priv->priority = g_value_get_ulong (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
- break;
- }
-}
-
-static void
-mate_mixer_profile_init (MateMixerProfile *profile)
-{
- profile->priv = G_TYPE_INSTANCE_GET_PRIVATE (profile,
- MATE_MIXER_TYPE_PROFILE,
- MateMixerProfilePrivate);
-}
-
-static void
-mate_mixer_profile_finalize (GObject *object)
-{
- MateMixerProfile *profile;
-
- profile = MATE_MIXER_PROFILE (object);
-
- g_free (profile->priv->name);
- g_free (profile->priv->description);
-
- G_OBJECT_CLASS (mate_mixer_profile_parent_class)->finalize (object);
-}
-
-MateMixerProfile *
-mate_mixer_profile_new (const gchar *name, const gchar *description, gulong priority)
-{
- return g_object_new (MATE_MIXER_TYPE_PROFILE,
- "name", name,
- "description", description,
- "priority", priority,
- NULL);
-}
-
-const gchar *
-mate_mixer_profile_get_name (MateMixerProfile *profile)
-{
- g_return_val_if_fail (MATE_MIXER_IS_PROFILE (profile), NULL);
-
- return profile->priv->name;
-}
-
-const gchar *
-mate_mixer_profile_get_description (MateMixerProfile *profile)
-{
- g_return_val_if_fail (MATE_MIXER_IS_PROFILE (profile), NULL);
-
- return profile->priv->description;
-}
-
-gulong
-mate_mixer_profile_get_priority (MateMixerProfile *profile)
-{
- g_return_val_if_fail (MATE_MIXER_IS_PROFILE (profile), 0);
-
- return profile->priv->priority;
-}
diff --git a/libmatemixer/matemixer-profile.h b/libmatemixer/matemixer-profile.h
deleted file mode 100644
index b652085..0000000
--- a/libmatemixer/matemixer-profile.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2014 Michal Ratajsky <[email protected]>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the licence, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MATEMIXER_PROFILE_H
-#define MATEMIXER_PROFILE_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define MATE_MIXER_TYPE_PROFILE \
- (mate_mixer_profile_get_type ())
-#define MATE_MIXER_PROFILE(o) \
- (G_TYPE_CHECK_INSTANCE_CAST ((o), MATE_MIXER_TYPE_PROFILE, MateMixerProfile))
-#define MATE_MIXER_IS_PROFILE(o) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((o), MATE_MIXER_TYPE_PROFILE))
-#define MATE_MIXER_PROFILE_CLASS(k) \
- (G_TYPE_CHECK_CLASS_CAST ((k), MATE_MIXER_TYPE_PROFILE, MateMixerProfileClass))
-#define MATE_MIXER_IS_PROFILE_CLASS(k) \
- (G_TYPE_CHECK_CLASS_TYPE ((k), MATE_MIXER_TYPE_PROFILE))
-#define MATE_MIXER_PROFILE_GET_CLASS(o) \
- (G_TYPE_INSTANCE_GET_CLASS ((o), MATE_MIXER_TYPE_PROFILE, MateMixerProfileClass))
-
-typedef struct _MateMixerProfile MateMixerProfile;
-typedef struct _MateMixerProfileClass MateMixerProfileClass;
-typedef struct _MateMixerProfilePrivate MateMixerProfilePrivate;
-
-struct _MateMixerProfile
-{
- GObject parent;
-
- /*< private >*/
- MateMixerProfilePrivate *priv;
-};
-
-struct _MateMixerProfileClass
-{
- GObjectClass parent_class;
-};
-
-GType mate_mixer_profile_get_type (void) G_GNUC_CONST;
-
-MateMixerProfile *mate_mixer_profile_new (const gchar *name,
- const gchar *description,
- gulong priority);
-
-const gchar * mate_mixer_profile_get_name (MateMixerProfile *profile);
-const gchar * mate_mixer_profile_get_description (MateMixerProfile *profile);
-gulong mate_mixer_profile_get_priority (MateMixerProfile *profile);
-
-G_END_DECLS
-
-#endif /* MATEMIXER_PROFILE_H */
diff --git a/libmatemixer/matemixer-stream.c b/libmatemixer/matemixer-stream.c
index 5400357..b4da26f 100644
--- a/libmatemixer/matemixer-stream.c
+++ b/libmatemixer/matemixer-stream.c
@@ -102,14 +102,14 @@ mate_mixer_stream_default_init (MateMixerStreamInterface *iface)
G_PARAM_STATIC_STRINGS));
g_object_interface_install_property (iface,
- g_param_spec_int64 ("volume",
- "Volume",
- "Volume of the stream",
- G_MININT64,
- G_MAXINT64,
- 0,
- G_PARAM_READABLE |
- G_PARAM_STATIC_STRINGS));
+ g_param_spec_uint ("volume",
+ "Volume",
+ "Volume of the stream",
+ 0,
+ G_MAXUINT,
+ 0,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS));
g_object_interface_install_property (iface,
g_param_spec_float ("balance",
diff --git a/libmatemixer/matemixer.h b/libmatemixer/matemixer.h
index f5c1a78..36a3d39 100644
--- a/libmatemixer/matemixer.h
+++ b/libmatemixer/matemixer.h
@@ -24,9 +24,9 @@
#include <libmatemixer/matemixer-client-stream.h>
#include <libmatemixer/matemixer-control.h>
#include <libmatemixer/matemixer-device.h>
+#include <libmatemixer/matemixer-device-profile.h>
#include <libmatemixer/matemixer-enums.h>
#include <libmatemixer/matemixer-port.h>
-#include <libmatemixer/matemixer-profile.h>
#include <libmatemixer/matemixer-stream.h>
#include <libmatemixer/matemixer-version.h>