]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: user_client: add APIs to set/get memory pool in client
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 1 Apr 2020 09:13:28 +0000 (18:13 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Fri, 3 Apr 2020 13:06:25 +0000 (22:06 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/seq/alsaseq.map
src/seq/user-client.c
src/seq/user-client.h
tests/alsaseq-user-client

index cf6cddd23aa120adfd8503c7cc52d5f902538d55..b05a34839779208ec75d26811b88704e57ef4d17 100644 (file)
@@ -40,6 +40,8 @@ ALSA_GOBJECT_0_0_0 {
     "alsaseq_user_client_create_port";
     "alsaseq_user_client_update_port";
     "alsaseq_user_client_delete_port";
+    "alsaseq_user_client_set_pool";
+    "alsaseq_user_client_get_pool";
 
     "alsaseq_addr_get_type";
     "alsaseq_addr_new";
index d33bd444db67804003c83bba85db1db68baf9775..fb3fd509916b96cdd4d015b2d0c10140c898c123 100644 (file)
@@ -261,3 +261,54 @@ void alsaseq_user_client_delete_port(ALSASeqUserClient *self,
     if (ioctl(priv->fd, SNDRV_SEQ_IOCTL_DELETE_PORT, info) < 0)
         generate_error(error, errno);
 }
+
+/**
+ * alsaseq_user_client_set_pool:
+ * @self: A #ALSASeqUserClient.
+ * @client_pool: A #ALSASeqClientPool to be configured for the client.
+ * @error: A #GError.
+ *
+ * Configure memory pool in the client.
+ */
+void alsaseq_user_client_set_pool(ALSASeqUserClient *self,
+                                  ALSASeqClientPool *client_pool,
+                                  GError **error)
+{
+    ALSASeqUserClientPrivate *priv;
+    struct snd_seq_client_pool *pool;
+
+    g_return_if_fail(ALSASEQ_IS_USER_CLIENT(self));
+    g_return_if_fail(ALSASEQ_IS_CLIENT_POOL(client_pool));
+    priv = alsaseq_user_client_get_instance_private(self);
+
+    seq_client_pool_refer_private(client_pool, &pool);
+    pool->client = priv->client_id;
+    if (ioctl(priv->fd, SNDRV_SEQ_IOCTL_SET_CLIENT_POOL, pool) < 0)
+        generate_error(error, errno);
+}
+
+/**
+ * alsaseq_user_client_get_pool:
+ * @self: A #ALSASeqUserClient.
+ * @client_pool: (inout): A #ALSASeqClientPool to be configured for the client.
+ * @error: A #GError.
+ *
+ * Get information of memory pool in the client.
+ */
+void alsaseq_user_client_get_pool(ALSASeqUserClient *self,
+                                  ALSASeqClientPool *const *client_pool,
+                                  GError **error)
+{
+    ALSASeqUserClientPrivate *priv;
+    struct snd_seq_client_pool *pool;
+
+    g_return_if_fail(ALSASEQ_IS_USER_CLIENT(self));
+    g_return_if_fail(*client_pool != NULL);
+    g_return_if_fail(ALSASEQ_IS_CLIENT_POOL(*client_pool));
+    priv = alsaseq_user_client_get_instance_private(self);
+
+    seq_client_pool_refer_private(*client_pool, &pool);
+    pool->client = priv->client_id;
+    if (ioctl(priv->fd, SNDRV_SEQ_IOCTL_GET_CLIENT_POOL, pool) < 0)
+        generate_error(error, errno);
+}
index 1bbe191b052a2a7f93bea5c8091d557d79378cb4..fa98f3575e4722604c23b6074237f0d9505a335e 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <seq/client-info.h>
 #include <seq/port-info.h>
+#include <seq/client-pool.h>
 
 G_BEGIN_DECLS
 
@@ -72,6 +73,14 @@ void alsaseq_user_client_delete_port(ALSASeqUserClient *self,
                                      ALSASeqPortInfo *port_info,
                                      guint8 port_id, GError **error);
 
+void alsaseq_user_client_set_pool(ALSASeqUserClient *self,
+                                  ALSASeqClientPool *client_pool,
+                                  GError **error);
+
+void alsaseq_user_client_get_pool(ALSASeqUserClient *self,
+                                  ALSASeqClientPool *const *client_pool,
+                                  GError **error);
+
 G_END_DECLS
 
 #endif
index 72d79005e890f00f847cb74a0264742cdfb60989..90960efcdf4dace6fac990a17fc2571cc4d516b2 100644 (file)
@@ -21,6 +21,8 @@ methods = (
     'create_port',
     'update_port',
     'delete_port',
+    'set_pool',
+    'get_pool',
 )
 signals = ()