rawmidi: Add rawmidi framing API

Optionally, incoming rawmidi bytes can be put inside a frame of type
snd_rawmidi_framing_tstamp_t.
The main current benefit is that can enable in-kernel timestamping of
incoming bytes, and that timestamp is likely to be more precise than
what userspace can offer.

Tstamp type framing requires a kernel >= 5.14 and a buffer size that
is a multiple of sizeof(snd_rawmidi_framing_tstamp_t). It is only
available on input streams.

Signed-off-by: David Henningsson <coding@diwic.se>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
David Henningsson 2021-08-17 16:21:12 +02:00 committed by Takashi Iwai
parent 23a191a82c
commit 95eb312fad
5 changed files with 153 additions and 2 deletions

View file

@ -285,6 +285,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
rmidi->poll_fd = fd;
rmidi->ops = &snd_rawmidi_hw_ops;
rmidi->private_data = hw;
rmidi->version = ver;
hw->open++;
*inputp = rmidi;
}
@ -300,6 +301,7 @@ int snd_rawmidi_hw_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
rmidi->poll_fd = fd;
rmidi->ops = &snd_rawmidi_hw_ops;
rmidi->private_data = hw;
rmidi->version = ver;
hw->open++;
*outputp = rmidi;
}