aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-20 19:09:40 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-20 19:09:42 +0100
commitcbf4cba5a97ed7ed9303627ceb644aff9c1fbf4e (patch)
tree38978d5c503ea54e100c660cd716c5bc6dd7d6b2 /include
parent6e0f5413d922f4c1d24bf236f98c9ead3ab0a447 (diff)
Allow recording app audio with -a, deprecate -aa and -aai
Use -a "app:brave" instead of -aa "brave". Use -a "app-inverse:brave" instead of -aai "brave". This now allows merging audio devices and app audio into the same audio track.
Diffstat (limited to 'include')
-rw-r--r--include/pipewire_audio.h58
-rw-r--r--include/sound.hpp4
2 files changed, 36 insertions, 26 deletions
diff --git a/include/pipewire_audio.h b/include/pipewire_audio.h
index 8cfb2d2..1d37eb8 100644
--- a/include/pipewire_audio.h
+++ b/include/pipewire_audio.h
@@ -8,14 +8,14 @@
#include <stdbool.h>
-#define GSR_PIPEWIRE_AUDIO_MAX_STREAM_NODES 64
-#define GSR_PIPEWIRE_AUDIO_MAX_PORTS 64
+#define GSR_PIPEWIRE_AUDIO_MAX_STREAM_NODES 128
+#define GSR_PIPEWIRE_AUDIO_MAX_PORTS 128
#define GSR_PIPEWIRE_AUDIO_MAX_REQUESTED_LINKS 32
typedef enum {
GSR_PIPEWIRE_AUDIO_NODE_TYPE_STREAM_OUTPUT, /* Application audio */
GSR_PIPEWIRE_AUDIO_NODE_TYPE_STREAM_INPUT, /* Audio recording input */
- GSR_PIPEWIRE_AUDIO_NODE_TYPE_SINK
+ GSR_PIPEWIRE_AUDIO_NODE_TYPE_SINK_OR_SOURCE /* Audio output or input device or combined (virtual) sink */
} gsr_pipewire_audio_node_type;
typedef struct {
@@ -37,16 +37,17 @@ typedef struct {
} gsr_pipewire_audio_port;
typedef enum {
- GSR_PIPEWIRE_AUDIO_LINK_OUTPUT_TYPE_STREAM,
- GSR_PIPEWIRE_AUDIO_LINK_OUTPUT_TYPE_SINK
-} gsr_pipewire_audio_link_output_type;
+ 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 struct {
- char **app_names;
- int num_app_names;
- char *output_name;
+ char **output_names;
+ int num_output_names;
+ char *input_name;
bool inverted;
- gsr_pipewire_audio_link_output_type output_type;
+ gsr_pipewire_audio_node_type output_type;
+ gsr_pipewire_audio_link_input_type input_type;
} gsr_pipewire_audio_requested_link;
typedef struct {
@@ -72,38 +73,47 @@ bool gsr_pipewire_audio_init(gsr_pipewire_audio *self);
void gsr_pipewire_audio_deinit(gsr_pipewire_audio *self);
/*
- This function links audio source outputs from applications that match the name |app_names_output| to the input
+ This function links audio source outputs from applications that match the name |app_names| to the input
that matches the name |stream_name_input|.
If an application or a new application starts outputting audio after this function is called and the app name matches
then it will automatically link the audio sources.
- |app_names_output| and |stream_name_input| are case-insensitive matches.
+ |app_names| and |stream_name_input| are case-insensitive matches.
*/
-bool gsr_pipewire_audio_add_link_from_apps_to_stream(gsr_pipewire_audio *self, const char **app_names_output, int num_app_names_output, const char *stream_name_input);
+bool gsr_pipewire_audio_add_link_from_apps_to_stream(gsr_pipewire_audio *self, const char **app_names, int num_app_names, const char *stream_name_input);
/*
- This function links audio source outputs from all applications except the ones that match the name |app_names_output| to the input
+ This function links audio source outputs from all applications except the ones that match the name |app_names| to the input
that matches the name |stream_name_input|.
- If an application or a new application starts outputting audio after this function is called and the app name doesn't matche
+ If an application or a new application starts outputting audio after this function is called and the app name doesn't match
then it will automatically link the audio sources.
- |app_names_output| and |stream_name_input| are case-insensitive matches.
+ |app_names| and |stream_name_input| are case-insensitive matches.
*/
-bool gsr_pipewire_audio_add_link_from_apps_to_stream_inverted(gsr_pipewire_audio *self, const char **app_names_output, int num_app_names_output, const char *stream_name_input);
+bool gsr_pipewire_audio_add_link_from_apps_to_stream_inverted(gsr_pipewire_audio *self, const char **app_names, int num_app_names, const char *stream_name_input);
/*
- This function links audio source outputs from applications that match the name |app_names_output| to the input
+ This function links audio source outputs from applications that match the name |app_names| to the input
that matches the name |sink_name_input|.
If an application or a new application starts outputting audio after this function is called and the app name matches
then it will automatically link the audio sources.
- |app_names_output| and |sink_name_input| are case-insensitive matches.
+ |app_names| and |sink_name_input| are case-insensitive matches.
*/
-bool gsr_pipewire_audio_add_link_from_apps_to_sink(gsr_pipewire_audio *self, const char **app_names_output, int num_app_names_output, const char *sink_name_input);
+bool gsr_pipewire_audio_add_link_from_apps_to_sink(gsr_pipewire_audio *self, const char **app_names, int num_app_names, const char *sink_name_input);
/*
- This function links audio source outputs from all applications except the ones that match the name |app_names_output| to the input
+ This function links audio source outputs from all applications except the ones that match the name |app_names| to the input
that matches the name |sink_name_input|.
- If an application or a new application starts outputting audio after this function is called and the app name doesn't matche
+ If an application or a new application starts outputting audio after this function is called and the app name doesn't match
then it will automatically link the audio sources.
- |app_names_output| and |sink_name_input| are case-insensitive matches.
+ |app_names| and |sink_name_input| are case-insensitive matches.
*/
-bool gsr_pipewire_audio_add_link_from_apps_to_sink_inverted(gsr_pipewire_audio *self, const char **app_names_output, int num_app_names_output, const char *sink_name_input);
+bool gsr_pipewire_audio_add_link_from_apps_to_sink_inverted(gsr_pipewire_audio *self, const char **app_names, int num_app_names, const char *sink_name_input);
+
+/*
+ This function links audio source outputs from devices that match the name |source_names| to the input
+ that matches the name |sink_name_input|.
+ 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.
+*/
+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);
/* Return true to continue */
typedef bool (*gsr_pipewire_audio_app_query_callback)(const char *app_name, void *userdata);
diff --git a/include/sound.hpp b/include/sound.hpp
index f71b84d..b3e34cc 100644
--- a/include/sound.hpp
+++ b/include/sound.hpp
@@ -34,6 +34,8 @@ enum class AudioInputType {
struct AudioInput {
std::string name;
std::string description;
+ AudioInputType type = AudioInputType::DEVICE;
+ bool inverted = false;
};
struct AudioDevices {
@@ -44,8 +46,6 @@ struct AudioDevices {
struct MergedAudioInputs {
std::vector<AudioInput> audio_inputs;
- AudioInputType type = AudioInputType::DEVICE;
- bool inverted = false;
};
typedef enum {