From fa4811089c30cbc8cae11b401446b33685252e2e Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Mon, 8 Jun 2020 23:10:10 +0900 Subject: [PATCH] seq: event: dismiss ALSASeqEvent Signed-off-by: Takashi Sakamoto --- doc/reference/seq/alsaseq-docs.xml | 1 - doc/reference/seq/alsaseq.types | 1 - src/seq/event.c | 251 ----------------------------- src/seq/event.h | 55 ------- src/seq/meson.build | 2 - src/seq/privates.h | 3 - src/seq/user-client.h | 1 - tests/alsaseq-event | 28 ---- tests/meson.build | 1 - 9 files changed, 343 deletions(-) delete mode 100644 src/seq/event.c delete mode 100644 src/seq/event.h delete mode 100644 tests/alsaseq-event diff --git a/doc/reference/seq/alsaseq-docs.xml b/doc/reference/seq/alsaseq-docs.xml index 58ab9d4..df38e55 100644 --- a/doc/reference/seq/alsaseq-docs.xml +++ b/doc/reference/seq/alsaseq-docs.xml @@ -41,7 +41,6 @@ - diff --git a/doc/reference/seq/alsaseq.types b/doc/reference/seq/alsaseq.types index d1cac7a..5982da0 100644 --- a/doc/reference/seq/alsaseq.types +++ b/doc/reference/seq/alsaseq.types @@ -7,7 +7,6 @@ alsaseq_event_data_ctl_get_type alsaseq_event_data_note_get_type alsaseq_event_data_queue_get_type alsaseq_event_data_result_get_type -alsaseq_event_get_type alsaseq_event_length_mode_get_type alsaseq_event_priority_mode_get_type alsaseq_event_time_mode_get_type diff --git a/src/seq/event.c b/src/seq/event.c deleted file mode 100644 index 6ad2999..0000000 --- a/src/seq/event.c +++ /dev/null @@ -1,251 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -#include "privates.h" - -#include - -/** - * SECTION: event - * @Title: ALSASeqEvent - * @Short_description: A GObject-derived abstract object to represent any event - * - * A #ALSASeqEvent is a GObject-derived abstract object to represent common - * properties and method for any event. Applications can use derived object; - * #ALSASeqEventFixed and #ALSASeqEventVariable. - * - * The object wraps 'struct snd_seq_event' in UAPI of Linux sound subsystem. - */ -struct _ALSASeqEventPrivate { - struct snd_seq_event ev; -}; -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(ALSASeqEvent, alsaseq_event, G_TYPE_OBJECT) - -enum seq_event_prop_type { - SEQ_EVENT_PROP_EVENT_TYPE = 1, - SEQ_EVENT_PROP_MODE_TIMESTAMP, - SEQ_EVENT_PROP_MODE_TIME, - SEQ_EVENT_PROP_MODE_LENGTH, - SEQ_EVENT_PROP_MODE_PRIORITY, - SEQ_EVENT_PROP_TAG, - SEQ_EVENT_PROP_QUEUE_ID, - SEQ_EVENT_PROP_TSTAMP, - SEQ_EVENT_PROP_SRC_ADDR, - SEQ_EVENT_PROP_DST_ADDR, - SEQ_EVENT_PROP_COUNT, -}; -static GParamSpec *seq_event_props[SEQ_EVENT_PROP_COUNT] = { NULL, }; - -static void seq_event_set_property(GObject *obj, guint id, const GValue *val, - GParamSpec *spec) -{ - ALSASeqEvent *self = ALSASEQ_EVENT(obj); - ALSASeqEventPrivate *priv = alsaseq_event_get_instance_private(self); - struct snd_seq_event *ev = &priv->ev; - - switch (id) { - case SEQ_EVENT_PROP_EVENT_TYPE: - ev->type = (snd_seq_event_type_t)g_value_get_enum(val); - break; - case SEQ_EVENT_PROP_MODE_TIMESTAMP: - ev->flags &= ~SNDRV_SEQ_TIME_STAMP_MASK; - ev->flags |= (unsigned char)g_value_get_enum(val); - break; - case SEQ_EVENT_PROP_MODE_TIME: - ev->flags &= ~SNDRV_SEQ_TIME_MODE_MASK; - ev->flags |= (unsigned char)g_value_get_enum(val); - break; - case SEQ_EVENT_PROP_MODE_LENGTH: - ev->flags &= ~SNDRV_SEQ_EVENT_LENGTH_MASK; - ev->flags |= (unsigned char)g_value_get_enum(val); - break; - case SEQ_EVENT_PROP_MODE_PRIORITY: - ev->flags &= ~SNDRV_SEQ_PRIORITY_MASK; - ev->flags |= (unsigned char)g_value_get_enum(val); - break; - case SEQ_EVENT_PROP_TAG: - ev->tag = g_value_get_schar(val); - break; - case SEQ_EVENT_PROP_QUEUE_ID: - ev->queue = g_value_get_uchar(val); - break; - case SEQ_EVENT_PROP_TSTAMP: - { - ALSASeqTstamp *tstamp = g_value_get_boxed(val); - if (tstamp != NULL) - ev->time = *tstamp; - break; - } - case SEQ_EVENT_PROP_SRC_ADDR: - { - ALSASeqAddr *addr = g_value_get_boxed(val); - if (addr != NULL) - ev->source = *addr; - break; - } - case SEQ_EVENT_PROP_DST_ADDR: - { - ALSASeqAddr *addr = g_value_get_boxed(val); - if (addr != NULL) - ev->dest = *addr; - break; - } - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, spec); - break; - } -} - -static void seq_event_get_property(GObject *obj, guint id, GValue *val, - GParamSpec *spec) -{ - ALSASeqEvent *self = ALSASEQ_EVENT(obj); - ALSASeqEventPrivate *priv = alsaseq_event_get_instance_private(self); - struct snd_seq_event *ev = &priv->ev; - - switch (id) { - case SEQ_EVENT_PROP_EVENT_TYPE: - g_value_set_enum(val, (ALSASeqEventType)ev->type); - break; - case SEQ_EVENT_PROP_MODE_TIMESTAMP: - { - ALSASeqEventTimestampMode entry; - entry = ev->flags & SNDRV_SEQ_TIME_STAMP_MASK; - g_value_set_enum(val, entry); - break; - } - case SEQ_EVENT_PROP_MODE_TIME: - { - ALSASeqEventTimeMode entry; - entry = ev->flags & SNDRV_SEQ_TIME_MODE_MASK; - g_value_set_enum(val, entry); - break; - } - case SEQ_EVENT_PROP_MODE_LENGTH: - { - ALSASeqEventLengthMode entry; - entry = ev->flags & SNDRV_SEQ_EVENT_LENGTH_MASK; - g_value_set_enum(val, entry); - break; - } - case SEQ_EVENT_PROP_MODE_PRIORITY: - { - ALSASeqEventPriorityMode entry; - entry = ev->flags & SNDRV_SEQ_PRIORITY_MASK; - g_value_set_enum(val, entry); - break; - } - case SEQ_EVENT_PROP_TAG: - g_value_set_schar(val, ev->tag); - break; - case SEQ_EVENT_PROP_QUEUE_ID: - g_value_set_uchar(val, ev->queue); - break; - case SEQ_EVENT_PROP_TSTAMP: - g_value_set_static_boxed(val, &ev->time); - break; - case SEQ_EVENT_PROP_SRC_ADDR: - g_value_set_static_boxed(val, &ev->source); - break; - case SEQ_EVENT_PROP_DST_ADDR: - g_value_set_static_boxed(val, &ev->dest); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, id, spec); - break; - } -} - -static void alsaseq_event_class_init(ALSASeqEventClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS(klass); - - gobject_class->set_property = seq_event_set_property; - gobject_class->get_property = seq_event_get_property; - - seq_event_props[SEQ_EVENT_PROP_EVENT_TYPE] = - g_param_spec_enum("type", "type", - "The type of event, one of ALSASeqEventType.", - ALSASEQ_TYPE_EVENT_TYPE, - ALSASEQ_EVENT_TYPE_NONE, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); - - seq_event_props[SEQ_EVENT_PROP_MODE_TIMESTAMP] = - g_param_spec_enum("timestamp-mode", "timestamp-mode", - "The mode of timestamp for the event, one of " - "ALSASeqEventTimestampMode", - ALSASEQ_TYPE_EVENT_TIMESTAMP_MODE, - ALSASEQ_EVENT_TIMESTAMP_MODE_TICK, - G_PARAM_READWRITE); - - seq_event_props[SEQ_EVENT_PROP_MODE_TIME] = - g_param_spec_enum("time-mode", "time-mode", - "The mode of time for the event, one of " - "ALSASeqEventTimeMode", - ALSASEQ_TYPE_EVENT_TIME_MODE, - ALSASEQ_EVENT_TIME_MODE_ABS, - G_PARAM_READWRITE); - - seq_event_props[SEQ_EVENT_PROP_MODE_LENGTH] = - g_param_spec_enum("length-mode", "length-mode", - "The mode of length for the event, one of " - "ALSASeqEventLengthMode", - ALSASEQ_TYPE_EVENT_LENGTH_MODE, - ALSASEQ_EVENT_LENGTH_MODE_FIXED, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY); - - seq_event_props[SEQ_EVENT_PROP_MODE_PRIORITY] = - g_param_spec_enum("priority-mode", "priority-mode", - "The mode of priority for the event, one of " - "ALSASeqEventPriorityMode", - ALSASEQ_TYPE_EVENT_PRIORITY_MODE, - ALSASEQ_EVENT_PRIORITY_MODE_NORMAL, - G_PARAM_READWRITE); - - seq_event_props[SEQ_EVENT_PROP_TAG] = - g_param_spec_char("tag", "tag", - "The arbitrary tag associated to the event.", - G_MININT8, G_MAXINT8, - 0, - G_PARAM_READWRITE); - - seq_event_props[SEQ_EVENT_PROP_QUEUE_ID] = - g_param_spec_uchar("queue-id", "queue-id", - "The numerical ID of queue to deliver the event. " - "One of ALSASeqSpecificQueueId is available as well.", - 0, G_MAXUINT8, - 0, - G_PARAM_READWRITE); - - seq_event_props[SEQ_EVENT_PROP_TSTAMP] = - g_param_spec_boxed("tstamp", "tstamp", - "The timestamp for the event. The content is " - "decided according to timestamp-mode property.", - ALSASEQ_TYPE_TSTAMP, - G_PARAM_READWRITE); - - seq_event_props[SEQ_EVENT_PROP_SRC_ADDR] = - g_param_spec_boxed("src-addr", "src-addr", - "The address of source for the event.", - ALSASEQ_TYPE_ADDR, - G_PARAM_READWRITE); - - seq_event_props[SEQ_EVENT_PROP_DST_ADDR] = - g_param_spec_boxed("dst-addr", "dst-addr", - "The address of destination for the event.", - ALSASEQ_TYPE_ADDR, - G_PARAM_READWRITE); - - g_object_class_install_properties(gobject_class, - SEQ_EVENT_PROP_COUNT, - seq_event_props); -} - -static void alsaseq_event_init(ALSASeqEvent *self) -{ - return; -} - -void seq_event_refer_private(ALSASeqEvent *self, struct snd_seq_event **ev) -{ - ALSASeqEventPrivate *priv = alsaseq_event_get_instance_private(self); - *ev = &priv->ev; -} diff --git a/src/seq/event.h b/src/seq/event.h deleted file mode 100644 index 7553d15..0000000 --- a/src/seq/event.h +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: LGPL-3.0-or-later -#ifndef __ALSA_GOBJECT_ALSASEQ_EVENT__H__ -#define __ALSA_GOBJECT_ALSASEQ_EVENT__H__ - -#include -#include - -#include -#include - -#include - -G_BEGIN_DECLS - -#define ALSASEQ_TYPE_EVENT (alsaseq_event_get_type()) - -#define ALSASEQ_EVENT(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - ALSASEQ_TYPE_EVENT, \ - ALSASeqEvent)) -#define ALSASEQ_IS_EVENT(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), \ - ALSASEQ_TYPE_EVENT)) - -#define ALSASEQ_EVENT_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - ALSASEQ_TYPE_EVENT, \ - ALSASeqEventClass)) -#define ALSASEQ_IS_EVENT_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), \ - ALSASEQ_TYPE_EVENT)) -#define ALSASEQ_EVENT_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - ALSASEQ_TYPE_EVENT, \ - ALSASeqEventClass)) - -typedef struct _ALSASeqEvent ALSASeqEvent; -typedef struct _ALSASeqEventClass ALSASeqEventClass; -typedef struct _ALSASeqEventPrivate ALSASeqEventPrivate; - -struct _ALSASeqEvent { - GObject parent_instance; - - ALSASeqEventPrivate *priv; -}; - -struct _ALSASeqEventClass { - GObjectClass parent_class; -}; - -GType alsaseq_event_get_type() G_GNUC_CONST; - -G_END_DECLS - -#endif diff --git a/src/seq/meson.build b/src/seq/meson.build index 25f3f73..57927ad 100644 --- a/src/seq/meson.build +++ b/src/seq/meson.build @@ -17,7 +17,6 @@ sources = files( 'port-info.c', 'client-pool.c', 'tstamp.c', - 'event.c', 'event-data-result.c', 'event-data-note.c', 'event-data-ctl.c', @@ -42,7 +41,6 @@ headers = files( 'port-info.h', 'client-pool.h', 'tstamp.h', - 'event.h', 'event-data-result.h', 'event-data-note.h', 'event-data-ctl.h', diff --git a/src/seq/privates.h b/src/seq/privates.h index 5129374..7ed2030 100644 --- a/src/seq/privates.h +++ b/src/seq/privates.h @@ -11,7 +11,6 @@ #include "client-info.h" #include "port-info.h" #include "client-pool.h" -#include "event.h" #include "subscribe-data.h" #include "queue-info.h" #include "queue-status.h" @@ -41,8 +40,6 @@ void seq_port_info_refer_private(ALSASeqPortInfo *self, void seq_client_pool_refer_private(ALSASeqClientPool *self, struct snd_seq_client_pool **pool); -void seq_event_refer_private(ALSASeqEvent *self, struct snd_seq_event **ev); - void seq_subscribe_data_refer_private(ALSASeqSubscribeData *self, struct snd_seq_port_subscribe **data); diff --git a/src/seq/user-client.h b/src/seq/user-client.h index 298448e..e2ea8a8 100644 --- a/src/seq/user-client.h +++ b/src/seq/user-client.h @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/alsaseq-event b/tests/alsaseq-event deleted file mode 100644 index 986b05b..0000000 --- a/tests/alsaseq-event +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python3 - -from sys import exit -from errno import ENXIO - -from helper import test - -import gi -gi.require_version('ALSASeq', '0.0') -from gi.repository import ALSASeq - -target = ALSASeq.Event -props = ( - 'type', - 'timestamp-mode', - 'time-mode', - 'priority-mode', - 'tag', - 'queue-id', - 'tstamp', - 'src-addr', - 'dst-addr', -) -methods = () -signals = () - -if not test(target, props, methods, signals): - exit(ENXIO) diff --git a/tests/meson.build b/tests/meson.build index 602e02e..1a74b73 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -35,7 +35,6 @@ tests = { 'alsaseq-user-client', 'alsaseq-port-info', 'alsaseq-client-pool', - 'alsaseq-event', 'alsaseq-subscribe-data', 'alsaseq-queue-info', 'alsaseq-queue-status', -- 2.47.3