*entries = list;
*entry_count = count;
}
+
+/**
+ * alsaseq_get_queue_info_by_id:
+ * @queue_id: The numerical ID of queue, except for one of
+ * ALSASeqSpecificQueueId.
+ * @queue_info: (out): The information of queue.
+ * @error: A #GError.
+ *
+ * Get the information of queue, according to the numerical ID.
+ */
+void alsaseq_get_queue_info_by_id(guint queue_id, ALSASeqQueueInfo **queue_info,
+ GError **error)
+{
+ struct snd_seq_queue_info *info;
+ char *devnode;
+ int fd;
+
+ alsaseq_get_seq_devnode(&devnode, error);
+ if (*error != NULL)
+ return;
+
+ fd = open(devnode, O_RDONLY);
+ g_free(devnode);
+ if (fd < 0) {
+ generate_error(error, errno);
+ return;
+ }
+
+ *queue_info = g_object_new(ALSASEQ_TYPE_QUEUE_INFO, NULL);
+ seq_queue_info_refer_private(*queue_info, &info);
+
+ info->queue = queue_id;
+ if (ioctl(fd, SNDRV_SEQ_IOCTL_GET_QUEUE_INFO, info) < 0) {
+ generate_error(error, errno);
+ close(fd);
+ g_object_unref(*queue_info);
+ return;
+ }
+
+ close(fd);
+}
+
+/**
+ * alsaseq_get_queue_info_by_name:
+ * @name: The name string of queue to query.
+ * @queue_info: (out): The information of queue.
+ * @error: A #GError.
+ *
+ * Get the information of queue, according to the name string.
+ */
+void alsaseq_get_queue_info_by_name(const gchar *name,
+ ALSASeqQueueInfo **queue_info,
+ GError **error)
+{
+ struct snd_seq_queue_info *info;
+ char *devnode;
+ int fd;
+
+ alsaseq_get_seq_devnode(&devnode, error);
+ if (*error != NULL)
+ return;
+
+ fd = open(devnode, O_RDONLY);
+ g_free(devnode);
+ if (fd < 0) {
+ generate_error(error, errno);
+ return;
+ }
+
+ *queue_info = g_object_new(ALSASEQ_TYPE_QUEUE_INFO, NULL);
+ seq_queue_info_refer_private(*queue_info, &info);
+
+ strncpy(info->name, name, sizeof(info->name));
+ if (ioctl(fd, SNDRV_SEQ_IOCTL_GET_NAMED_QUEUE, info) < 0) {
+ generate_error(error, errno);
+ close(fd);
+ g_object_unref(*queue_info);
+ return;
+ }
+
+ close(fd);
+}
#include <seq/port-info.h>
#include <seq/client-pool.h>
#include <seq/subscribe-data.h>
+#include <seq/queue-info.h>
G_BEGIN_DECLS
void alsaseq_get_queue_id_list(guint **entries, gsize *entry_count,
GError **error);
+void alsaseq_get_queue_info_by_id(guint queue_id, ALSASeqQueueInfo **queue_info,
+ GError **error);
+void alsaseq_get_queue_info_by_name(const gchar *name,
+ ALSASeqQueueInfo **queue_info,
+ GError **error);
+
G_END_DECLS
#endif
// SPDX-License-Identifier: LGPL-3.0-or-later
-#include "queue-info.h"
-
-#include <sound/asequencer.h>
+#include "privates.h"
struct _ALSASeqQueueInfoPrivate {
struct snd_seq_queue_info info;
{
return g_object_new(ALSASEQ_TYPE_QUEUE_INFO, NULL);
}
+
+void seq_queue_info_refer_private(ALSASeqQueueInfo *self,
+ struct snd_seq_queue_info **info)
+{
+ ALSASeqQueueInfoPrivate *priv =
+ alsaseq_queue_info_get_instance_private(self);
+
+ *info = &priv->info;
+}