2020-04-02 22:39:36 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 2020 dec05eba
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-03-29 07:10:24 +00:00
|
|
|
#ifndef GPU_SCREEN_RECORDER_H
|
|
|
|
#define GPU_SCREEN_RECORDER_H
|
|
|
|
|
2022-09-30 20:02:23 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
2020-03-29 07:10:24 +00:00
|
|
|
typedef struct {
|
|
|
|
void *handle;
|
|
|
|
unsigned int frames;
|
|
|
|
} SoundDevice;
|
|
|
|
|
2022-09-30 20:02:23 +00:00
|
|
|
struct AudioInput {
|
|
|
|
std::string name;
|
|
|
|
std::string description;
|
|
|
|
};
|
|
|
|
|
2023-02-16 22:39:02 +00:00
|
|
|
struct MergedAudioInputs {
|
|
|
|
std::vector<AudioInput> audio_inputs;
|
|
|
|
};
|
|
|
|
|
2023-03-04 11:57:30 +00:00
|
|
|
typedef enum {
|
|
|
|
S16,
|
|
|
|
S32
|
|
|
|
} AudioFormat;
|
|
|
|
|
2020-03-29 07:10:24 +00:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
Returns 0 on success, or a negative value on failure.
|
|
|
|
*/
|
2023-03-04 11:57:30 +00:00
|
|
|
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);
|
2020-03-29 07:10:24 +00:00
|
|
|
|
2020-03-29 15:48:17 +00:00
|
|
|
void sound_device_close(SoundDevice *device);
|
2020-03-29 07:10:24 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
Returns the next chunk of audio into @buffer.
|
2020-04-01 17:25:16 +00:00
|
|
|
Returns the number of frames read, or a negative value on failure.
|
2020-03-29 07:10:24 +00:00
|
|
|
*/
|
2020-04-01 17:25:16 +00:00
|
|
|
int sound_device_read_next_chunk(SoundDevice *device, void **buffer);
|
|
|
|
|
2022-09-30 20:02:23 +00:00
|
|
|
std::vector<AudioInput> get_pulseaudio_inputs();
|
|
|
|
|
2020-03-29 07:10:24 +00:00
|
|
|
#endif /* GPU_SCREEN_RECORDER_H */
|