alsa-gobject: seq: tstamp: use wrapper structure instead of union
GitHub pull_request - opened
github at alsa-project.org
Mon Apr 13 09:15:04 CEST 2020
alsa-project/alsa-gobject pull request #17 was opened from takaswie:
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 necessarily 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>
...
```
Request URL : https://github.com/alsa-project/alsa-gobject/pull/17
Patch URL : https://github.com/alsa-project/alsa-gobject/pull/17.patch
Repository URL: https://github.com/alsa-project/alsa-gobject
More information about the Alsa-devel
mailing list