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

@ -42,12 +42,14 @@ struct _snd_rawmidi {
snd_rawmidi_type_t type;
snd_rawmidi_stream_t stream;
int mode;
int version;
int poll_fd;
const snd_rawmidi_ops_t *ops;
void *private_data;
size_t buffer_size;
size_t avail_min;
unsigned int no_active_sensing: 1;
int params_mode;
};
int snd_rawmidi_hw_open(snd_rawmidi_t **input, snd_rawmidi_t **output,