diff options
Diffstat (limited to 'include/pipewire_audio.h')
-rw-r--r-- | include/pipewire_audio.h | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/include/pipewire_audio.h b/include/pipewire_audio.h index 1d37eb8..10d8c9b 100644 --- a/include/pipewire_audio.h +++ b/include/pipewire_audio.h @@ -9,8 +9,10 @@ #include <stdbool.h> #define GSR_PIPEWIRE_AUDIO_MAX_STREAM_NODES 128 -#define GSR_PIPEWIRE_AUDIO_MAX_PORTS 128 +#define GSR_PIPEWIRE_AUDIO_MAX_PORTS 256 +#define GSR_PIPEWIRE_AUDIO_MAX_LINKS 256 #define GSR_PIPEWIRE_AUDIO_MAX_REQUESTED_LINKS 32 +#define GSR_PIPEWIRE_AUDIO_MAX_VIRTUAL_SINKS 32 typedef enum { GSR_PIPEWIRE_AUDIO_NODE_TYPE_STREAM_OUTPUT, /* Application audio */ @@ -36,14 +38,31 @@ typedef struct { char *name; } gsr_pipewire_audio_port; +typedef struct { + uint32_t id; + uint32_t output_node_id; + uint32_t input_node_id; +} gsr_pipewire_audio_link; + typedef enum { GSR_PIPEWIRE_AUDIO_LINK_INPUT_TYPE_STREAM, /* Application */ GSR_PIPEWIRE_AUDIO_LINK_INPUT_TYPE_SINK /* Combined (virtual) sink */ } gsr_pipewire_audio_link_input_type; +typedef enum { + GSR_PIPEWIRE_AUDIO_REQUESTED_TYPE_STANDARD, + GSR_PIPEWIRE_AUDIO_REQUESTED_TYPE_DEFAULT_OUTPUT, + GSR_PIPEWIRE_AUDIO_REQUESTED_TYPE_DEFAULT_INPUT +} gsr_pipewire_audio_requested_type; + +typedef struct { + char *name; + gsr_pipewire_audio_requested_type type; +} gsr_pipewire_audio_requested_output; + typedef struct { - char **output_names; - int num_output_names; + gsr_pipewire_audio_requested_output *outputs; + int num_outputs; char *input_name; bool inverted; gsr_pipewire_audio_node_type output_type; @@ -59,19 +78,33 @@ typedef struct { struct spa_hook registry_listener; int server_version_sync; + struct pw_proxy *metadata_proxy; + struct spa_hook metadata_listener; + struct spa_hook metadata_proxy_listener; + char default_output_device_name[128]; + char default_input_device_name[128]; + gsr_pipewire_audio_node stream_nodes[GSR_PIPEWIRE_AUDIO_MAX_STREAM_NODES]; int num_stream_nodes; gsr_pipewire_audio_port ports[GSR_PIPEWIRE_AUDIO_MAX_PORTS]; int num_ports; + gsr_pipewire_audio_link links[GSR_PIPEWIRE_AUDIO_MAX_LINKS]; + int num_links; + gsr_pipewire_audio_requested_link requested_links[GSR_PIPEWIRE_AUDIO_MAX_REQUESTED_LINKS]; int num_requested_links; + + struct pw_proxy *virtual_sink_proxies[GSR_PIPEWIRE_AUDIO_MAX_VIRTUAL_SINKS]; + int num_virtual_sink_proxies; } gsr_pipewire_audio; bool gsr_pipewire_audio_init(gsr_pipewire_audio *self); void gsr_pipewire_audio_deinit(gsr_pipewire_audio *self); +bool gsr_pipewire_audio_create_virtual_sink(gsr_pipewire_audio *self, const char *name); + /* This function links audio source outputs from applications that match the name |app_names| to the input that matches the name |stream_name_input|. @@ -112,6 +145,8 @@ bool gsr_pipewire_audio_add_link_from_apps_to_sink_inverted(gsr_pipewire_audio * If a device or a new device starts outputting audio after this function is called and the device name matches then it will automatically link the audio sources. |source_names| and |sink_name_input| are case-insensitive matches. + |source_names| can include "default_output" or "default_input" to use the default output/input + and it will automatically switch when the default output/input is changed in system audio settings. */ bool gsr_pipewire_audio_add_link_from_sources_to_sink(gsr_pipewire_audio *self, const char **source_names, int num_source_names, const char *sink_name_input); |