]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
seq: user_client: use ALSASeqEventCntr to parse read data
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 8 Jun 2020 14:10:10 +0000 (23:10 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Tue, 9 Jun 2020 00:16:09 +0000 (09:16 +0900)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/seq/event-cntr.c
src/seq/privates.h
src/seq/user-client.c
src/seq/user-client.h

index 9c5b0ea213833d27c786a24b3fefb4aab270ca1e..43db2d75e390202fb4ac3a44002229bf1058319d 100644 (file)
@@ -1546,3 +1546,12 @@ void alsaseq_event_cntr_set_result_data(ALSASeqEventCntr *self, gsize index,
 
     ev->data.result = *(struct snd_seq_result *)data;
 }
+
+void seq_event_cntr_set_buf(ALSASeqEventCntr *self, guint8 *buf,
+                              gsize length)
+{
+    ALSASeqEventCntrPrivate *priv =
+                                alsaseq_event_cntr_get_instance_private(self);
+    priv->buf = buf;
+    priv->length = length;
+}
index ff07c7b62794cc544735eb229a9d8a4187c6064d..f07ef34157eaf4120f88cb465a988d46bef55fb7 100644 (file)
@@ -58,6 +58,9 @@ void seq_queue_tempo_refer_private(ALSASeqQueueTempo *self,
 void seq_queue_timer_refer_private(ALSASeqQueueTimer *self,
                                    struct snd_seq_queue_timer **timer);
 
+void seq_event_cntr_set_buf(ALSASeqEventCntr *self, guint8 *buf,
+                              gsize length);
+
 G_END_DECLS
 
 #endif
index b60ecf2d4d34520672632fa8fa2d3cf1051418b8..e0d8273ab36ff3862978f5b92e4c8ab97e0518b5 100644 (file)
@@ -40,6 +40,7 @@ typedef struct {
     size_t buf_len;
     ALSASeqEventFixed *ev_fixed;
     ALSASeqEventVariable *ev_var;
+    ALSASeqEventCntr *ev_cntr;
 } UserClientSource;
 
 enum seq_user_client_prop_type {
@@ -453,6 +454,8 @@ static gboolean seq_user_client_dispatch_src(GSource *gsrc, GSourceFunc cb,
         return G_SOURCE_REMOVE;
     }
 
+    seq_event_cntr_set_buf(src->ev_cntr, src->buf, len);
+
     buf = src->buf;
     while (len >= sizeof(*event)) {
         struct snd_seq_event *data_ptr;
@@ -511,6 +514,7 @@ static void seq_user_client_finalize_src(GSource *gsrc)
 
     g_object_unref(src->ev_fixed);
     g_object_unref(src->ev_var);
+    g_object_unref(src->ev_cntr);
 
     g_free(src->buf);
     g_object_unref(src->self);
@@ -556,6 +560,7 @@ void alsaseq_user_client_create_source(ALSASeqUserClient *self,
 
     src->ev_fixed = g_object_new(ALSASEQ_TYPE_EVENT_FIXED, NULL);
     src->ev_var = g_object_new(ALSASEQ_TYPE_EVENT_VARIABLE, NULL);
+    src->ev_cntr = g_object_new(ALSASEQ_TYPE_EVENT_CNTR, NULL);
 
     g_source_set_name(*gsrc, "ALSASeqUserClient");
     g_source_set_priority(*gsrc, G_PRIORITY_HIGH_IDLE);
index 7b703be2996a3f27a2b59a494c4f44caeafde1e5..6125195d638a1b192a0e934a47ea87d55e187ad9 100644 (file)
@@ -17,6 +17,7 @@
 #include <seq/queue-timer.h>
 #include <seq/queue-timer-alsa.h>
 #include <seq/remove-filter.h>
+#include <seq/event-cntr.h>
 
 G_BEGIN_DECLS