]> git.alsa-project.org Git - alsa-gobject.git/commit
seq: tstamp: use wrapper structure instead of union
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 13 Apr 2020 06:28:27 +0000 (15:28 +0900)
committer坂本 貴史 <o-takashi@sakamocchi.jp>
Mon, 13 Apr 2020 11:45:01 +0000 (20:45 +0900)
commit20fdc2d893ccba609cc786ebac733bf6914f9874
tree9a169b755de591fd309498c05a08b122ddb67249
parent120a6b66bab5f4a5dc7577e0ec0313296fdc52b1
seq: tstamp: use wrapper structure instead of union

In UAPI for ALSA Sequencer, snd_seq_timestamp is union with
snd_seq_tick_time_t and struct snd_seq_real_time types. The
libalsaseq has GLib Boxed object for the union, named as
ALSASeqTstamp.

```
$ cat build/src/seq/ALSASeq-0.0.gir
    ...
    <union name="Tstamp"
           c:type="ALSASeqTstamp"
           glib:type-name="ALSASeqTstamp"
           glib:get-type="alsaseq_tstamp_get_type"
           c:symbol-prefix="tstamp">
      <source-position filename="../src/seq/tstamp.h" line="14"/>
      ...
    </union>
    ...
```

Although this is valid in a view of GObject
Introspection, it's not nesessarily convenient to language
bindings because some programming language doesn't support
union type. In this case, the type is not available.

This commit adds an alternative structure to wrap the union.
As a result, ALSASeqTstamp is GLib Boxed object for the
wrapper structure.

```
$ cat build/src/seq/ALSASeq-0.0.gir
    ...
    <record name="Tstamp"
            c:type="ALSASeqTstamp"
            glib:type-name="ALSASeqTstamp"
            glib:get-type="alsaseq_tstamp_get_type"
            c:symbol-prefix="tstamp">
      <source-position filename="../src/seq/tstamp.h" line="18"/>
      <field name="tstamp" writable="1">
        <type name="gpointer" c:type="snd_seq_timestamp"/>
      </field>
      ...
    </record>
    ...
```

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/seq/event-data-queue.c
src/seq/event-fixed.c
src/seq/event.c
src/seq/tstamp.c
src/seq/tstamp.h