[client] audio: add transport provider interface
Some checks failed
build / client (Debug, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Debug, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:clang cxx:clang++], xdg-shell) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], libdecor) (push) Has been cancelled
build / client (Release, map[cc:gcc cxx:g++], xdg-shell) (push) Has been cancelled
build / module (push) Has been cancelled
build / host-linux (push) Has been cancelled
build / host-windows-cross (push) Has been cancelled
build / host-windows-native (push) Has been cancelled
build / idd (push) Has been cancelled
build / obs (clang) (push) Has been cancelled
build / obs (gcc) (push) Has been cancelled
build / docs (push) Has been cancelled

Route audio through a provider interface. Connected transports take
priority while SPICE remains the fallback.

Carry explicit sample formats, rates, channel layouts, and source clocks
through playback and recording. Add optional presentation clock feedback
for active synchronization.
This commit is contained in:
Geoffrey McRae
2026-08-09 16:37:39 +10:00
parent 40d6342d46
commit 0da4bfa8dd
12 changed files with 2441 additions and 485 deletions

View File

@@ -25,6 +25,8 @@
#include <stdint.h>
#include <stddef.h>
#include "interface/audio.h"
typedef int (*LG_AudioPullFn)(uint8_t * dst, int frames);
typedef void (*LG_AudioPushFn)(uint8_t * src, int frames);
@@ -50,14 +52,14 @@ struct LG_AudioDevOps
* stream.
* Note: the pull function returns f32 samples
*/
bool (*setup)(int channels, int sampleRate, int requestedPeriodFrames,
bool (*setup)(const LG_AudioFormat * format, int requestedPeriodFrames,
bool requestResampler, bool * resamplerEnabled,
int * maxPeriodFrames, int * startFrames, LG_AudioPullFn pullFn);
/* called when there is data available to start playback */
void (*start)(void);
/* called when SPICE reports the audio stream has stopped */
/* called when the source reports the audio stream has stopped */
void (*stop)(void);
/* [optional] called to set the volume of the channels */
@@ -77,12 +79,10 @@ struct LG_AudioDevOps
struct
{
/* start the record stream
* Note: currently SPICE only supports S16 samples so always assume so
*/
void (*start)(int channels, int sampleRate, LG_AudioPushFn pushFn);
/* start the record stream using the requested interleaved format */
void (*start)(const LG_AudioFormat * format, LG_AudioPushFn pushFn);
/* called when SPICE reports the audio stream has stopped */
/* called when the source reports the audio stream has stopped */
void (*stop)(void);
/* [optional] called to set the volume of the channels */