aboutsummaryrefslogtreecommitdiff
path: root/include/sound.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-10 23:54:36 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-10 23:54:39 +0100
commit4240f0e334b235f4e17f266550db28c3a01b26bf (patch)
tree5271201090fc268756866357e9b06b2c19227c1f /include/sound.hpp
parentf1b49793658d42cc7dd53be757f34ec6437d0517 (diff)
Add -aa and -aai options to record audio only from selected applications
Use the --list-application-audio option to list available applications to record from.
Diffstat (limited to 'include/sound.hpp')
-rw-r--r--include/sound.hpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/include/sound.hpp b/include/sound.hpp
index 7bcc120..018ff4a 100644
--- a/include/sound.hpp
+++ b/include/sound.hpp
@@ -26,6 +26,11 @@ typedef struct {
unsigned int frames;
} SoundDevice;
+enum class AudioInputType {
+ DEVICE,
+ APPLICATION
+};
+
struct AudioInput {
std::string name;
std::string description;
@@ -37,8 +42,14 @@ struct AudioDevices {
std::vector<AudioInput> audio_inputs;
};
+struct ApplicationAudio {
+ std::string name;
+};
+
struct MergedAudioInputs {
std::vector<AudioInput> audio_inputs;
+ AudioInputType type = AudioInputType::DEVICE;
+ bool inverted = false;
};
typedef enum {
@@ -48,12 +59,15 @@ typedef enum {
} AudioFormat;
/*
- Get a sound device by name, returning the device into the @device parameter.
- The device should be closed with @sound_device_close after it has been used
- to clean up internal resources.
+ Get a sound device by name, returning the device into the |device| parameter.
Returns 0 on success, or a negative value on failure.
*/
int sound_device_get_by_name(SoundDevice *device, const char *device_name, const char *description, unsigned int num_channels, unsigned int period_frame_size, AudioFormat audio_format);
+/*
+ Creates a module-combine-sink and connects to it for recording, returning the device into the |device| parameter.
+ Returns 0 on success, or a negative value on failure.
+*/
+int sound_device_create_combined_sink_connect(SoundDevice *device, const char *combined_sink_name, unsigned int num_channels, unsigned int period_frame_size, AudioFormat audio_format);
void sound_device_close(SoundDevice *device);
@@ -64,5 +78,6 @@ void sound_device_close(SoundDevice *device);
int sound_device_read_next_chunk(SoundDevice *device, void **buffer, double timeout_sec, double *latency_seconds);
AudioDevices get_pulseaudio_inputs();
+std::vector<ApplicationAudio> get_pulseaudio_applications();
#endif /* GPU_SCREEN_RECORDER_H */