Compare commits

...

4 Commits
4.3.2 ... 4.3.3

3 changed files with 40 additions and 40 deletions

View File

@@ -1,4 +1,4 @@
project('gpu-screen-recorder', ['c', 'cpp'], version : '4.3.2', default_options : ['warning_level=2'])
project('gpu-screen-recorder', ['c', 'cpp'], version : '4.3.3', default_options : ['warning_level=2'])
add_project_arguments('-Wshadow', language : ['c', 'cpp'])
if get_option('buildtype') == 'debug'

View File

@@ -1,7 +1,7 @@
[package]
name = "gpu-screen-recorder"
type = "executable"
version = "4.3.2"
version = "4.3.3"
platforms = ["posix"]
[config]

View File

@@ -1106,13 +1106,11 @@ static void usage_full() {
fprintf(stderr, " Multiple audio sources can be merged into one audio track by using \"|\" as a separator into one -a argument, for example: -a \"alsa_output1|alsa_output2\".\n");
fprintf(stderr, " The audio device can also be \"default_output\" in which case the default output device is used, or \"default_input\" in which case the default input device is used.\n");
fprintf(stderr, " The audio name can also be prefixed with \"device:\", for example: -a \"device:alsa_output.pci-0000_00_1b.0.analog-stereo.monitor\".\n");
#ifdef GSR_APP_AUDIO
fprintf(stderr, " To record audio from an application then prefix the audio name with \"app:\", for example: -a \"app:Brave\".\n");
fprintf(stderr, " To record audio from all applications except the provided use prefix the audio name with \"app-inverse:\", for example: -a \"app-inverse:Brave\".\n");
fprintf(stderr, " \"app:\" and \"app-inverse:\" can't be mixed in one audio track.\n");
fprintf(stderr, " One audio track can contain both audio devices and application audio, for example: -a \"default_output|device:alsa_output.pci-0000_00_1b.0.analog-stereo.monitor|app:Brave\".\n");
fprintf(stderr, " Recording application audio is only possible when the sound server on the system is PipeWire.\n");
#endif
fprintf(stderr, " If the audio name is an empty string then the argument is ignored.\n");
fprintf(stderr, " Optional, no audio track is added by default.\n");
fprintf(stderr, " Run GPU Screen Recorder with the --list-audio-devices option to list valid audio device names.\n");
@@ -1211,14 +1209,12 @@ static void usage_full() {
fprintf(stderr, " alsa_output.pci-0000_0c_00.4.iec958-stereo|Monitor of Starship/Matisse HD Audio Controller Digital Stereo (IEC958)\n");
fprintf(stderr, " The <audio_device_name> is the name that can be passed to GPU Screen Recorder with the -a option.\n");
fprintf(stderr, "\n");
#ifdef GSR_APP_AUDIO
fprintf(stderr, " --list-application-audio\n");
fprintf(stderr, " Lists application that you can record from (with the -aa or -aai option) (prints them to stdout and exits), for example:\n");
fprintf(stderr, " firefox\n");
fprintf(stderr, " csgo\n");
fprintf(stderr, " These names are the application audio names that can be passed to GPU Screen Recorder with the -aa option.\n");
fprintf(stderr, "\n");
#endif
fprintf(stderr, " --version\n");
fprintf(stderr, " Print version (%s) and exit\n", GSR_VERSION);
fprintf(stderr, "\n");
@@ -1245,11 +1241,9 @@ static void usage_full() {
fprintf(stderr, " %s -w screen -f 60 -a default_output -c mkv -sc script.sh -r 60 -o \"$HOME/Videos\"\n", program_name);
fprintf(stderr, " %s -w portal -f 60 -a default_output -restore-portal-session yes -o \"$HOME/Videos/video.mp4\"\n", program_name);
fprintf(stderr, " %s -w screen -f 60 -a default_output -bm cbr -q 15000 -o \"$HOME/Videos/video.mp4\"\n", program_name);
#ifdef GSR_APP_AUDIO
fprintf(stderr, " %s -w screen -f 60 -a \"app:firefox|app:csgo\" -o \"$HOME/Videos/video.mp4\"\n", program_name);
fprintf(stderr, " %s -w screen -f 60 -a \"app-inverse:firefox|app-inverse:csgo\" -o \"$HOME/Videos/video.mp4\"\n", program_name);
fprintf(stderr, " %s -w screen -f 60 -a \"default-input|app-inverse:Brave\" -o \"$HOME/Videos/video.mp4\"\n", program_name);
#endif
//fprintf(stderr, " gpu-screen-recorder -w screen -f 60 -q ultra -pixfmt yuv444 -o video.mp4\n");
_exit(1);
}
@@ -1916,11 +1910,13 @@ static void list_system_info(bool wayland) {
bool supports_app_audio = false;
#ifdef GSR_APP_AUDIO
supports_app_audio = pulseaudio_server_is_pipewire();
gsr_pipewire_audio audio;
if(gsr_pipewire_audio_init(&audio))
gsr_pipewire_audio_deinit(&audio);
else
supports_app_audio = false;
if(supports_app_audio) {
gsr_pipewire_audio audio;
if(gsr_pipewire_audio_init(&audio))
gsr_pipewire_audio_deinit(&audio);
else
supports_app_audio = false;
}
#endif
printf("supports_app_audio|%s\n", supports_app_audio ? "yes" : "no");
}
@@ -2057,22 +2053,24 @@ static void output_monitor_info(const gsr_monitor *monitor, void *userdata) {
}
}
static void list_supported_capture_options(gsr_egl *egl, bool wayland) {
static void list_supported_capture_options(gsr_egl *egl, bool wayland, bool list_monitors) {
if(!wayland) {
puts("window");
puts("focused");
}
capture_options_callback options;
options.wayland = wayland;
options.egl = egl;
if(monitor_capture_use_drm(egl, wayland)) {
const bool is_x11 = gsr_egl_get_display_server(egl) == GSR_DISPLAY_SERVER_X11;
const gsr_connection_type connection_type = is_x11 ? GSR_CONNECTION_X11 : GSR_CONNECTION_DRM;
for_each_active_monitor_output(egl, connection_type, output_monitor_info, &options);
} else {
puts("screen"); // All monitors in one, only available on Nvidia X11
for_each_active_monitor_output(egl, GSR_CONNECTION_X11, output_monitor_info, &options);
if(list_monitors) {
capture_options_callback options;
options.wayland = wayland;
options.egl = egl;
if(monitor_capture_use_drm(egl, wayland)) {
const bool is_x11 = gsr_egl_get_display_server(egl) == GSR_DISPLAY_SERVER_X11;
const gsr_connection_type connection_type = is_x11 ? GSR_CONNECTION_X11 : GSR_CONNECTION_DRM;
for_each_active_monitor_output(egl, connection_type, output_monitor_info, &options);
} else {
puts("screen"); // All monitors in one, only available on Nvidia X11
for_each_active_monitor_output(egl, GSR_CONNECTION_X11, output_monitor_info, &options);
}
}
#ifdef GSR_PORTAL
@@ -2121,12 +2119,13 @@ static void info_command() {
_exit(22);
}
bool list_monitors = true;
egl.card_path[0] = '\0';
if(monitor_capture_use_drm(&egl, wayland)) {
// TODO: Allow specifying another card, and in other places
if(!gsr_get_valid_card_path(&egl, egl.card_path, false)) {
if(!gsr_get_valid_card_path(&egl, egl.card_path, true)) {
fprintf(stderr, "Error: no /dev/dri/cardX device found. Make sure that you have at least one monitor connected\n");
_exit(23);
list_monitors = false;
}
}
@@ -2143,7 +2142,7 @@ static void info_command() {
puts("section=video_codecs");
list_supported_video_codecs(&egl, wayland);
puts("section=capture_options");
list_supported_capture_options(&egl, wayland);
list_supported_capture_options(&egl, wayland, list_monitors);
fflush(stdout);
@@ -2179,10 +2178,12 @@ static bool app_audio_query_callback(const char *app_name, void*) {
static void list_application_audio_command() {
#ifdef GSR_APP_AUDIO
gsr_pipewire_audio audio;
if(gsr_pipewire_audio_init(&audio)) {
gsr_pipewire_audio_for_each_app(&audio, app_audio_query_callback, NULL);
gsr_pipewire_audio_deinit(&audio);
if(pulseaudio_server_is_pipewire()) {
gsr_pipewire_audio audio;
if(gsr_pipewire_audio_init(&audio)) {
gsr_pipewire_audio_for_each_app(&audio, app_audio_query_callback, NULL);
gsr_pipewire_audio_deinit(&audio);
}
}
#endif
@@ -2218,17 +2219,18 @@ static void list_capture_options_command() {
_exit(1);
}
bool list_monitors = true;
egl.card_path[0] = '\0';
if(monitor_capture_use_drm(&egl, wayland)) {
// TODO: Allow specifying another card, and in other places
if(!gsr_get_valid_card_path(&egl, egl.card_path, false)) {
if(!gsr_get_valid_card_path(&egl, egl.card_path, true)) {
fprintf(stderr, "Error: no /dev/dri/cardX device found. Make sure that you have at least one monitor connected\n");
_exit(23);
list_monitors = false;
}
}
av_log_set_level(AV_LOG_FATAL);
list_supported_capture_options(&egl, wayland);
list_supported_capture_options(&egl, wayland, list_monitors);
fflush(stdout);
@@ -3018,10 +3020,8 @@ int main(int argc, char **argv) {
{ "-f", Arg { {}, false, false } },
{ "-s", Arg { {}, true, false } },
{ "-a", Arg { {}, true, true } },
#ifdef GSR_APP_AUDIO
{ "-aa", Arg { {}, true, true } }, // TODO: Remove soon since this is deprecated. User should use -a with app: instead
{ "-aai", Arg { {}, true, true } }, // TODO: Remove soon since this is deprecated. User should use -a with app-inverse: instead
#endif
{ "-q", Arg { {}, true, false } },
{ "-o", Arg { {}, true, false } },
{ "-r", Arg { {}, true, false } },
@@ -3301,13 +3301,13 @@ int main(int argc, char **argv) {
gsr_pipewire_audio pipewire_audio;
memset(&pipewire_audio, 0, sizeof(pipewire_audio));
if(uses_app_audio) {
if(!gsr_pipewire_audio_init(&pipewire_audio)) {
fprintf(stderr, "gsr error: failed to setup PipeWire audio for application audio capture. The likely reason for this failure is that your sound server is not PipeWire. Application audio is only available when running PipeWire audio server.\n");
if(!pulseaudio_server_is_pipewire()) {
fprintf(stderr, "gsr error: your sound server is not PipeWire. Application audio is only available when running PipeWire audio server\n");
_exit(2);
}
if(!pulseaudio_server_is_pipewire()) {
fprintf(stderr, "gsr error: your sound server is not PipeWire. Application audio is only available when running PipeWire audio server.\n");
if(!gsr_pipewire_audio_init(&pipewire_audio)) {
fprintf(stderr, "gsr error: failed to setup PipeWire audio for application audio capture\n");
_exit(2);
}