mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-05-06 23:06:22 +09:00
Do not create output directory when live streaming
This commit is contained in:
44
src/main.cpp
44
src/main.cpp
@@ -1921,28 +1921,37 @@ int main(int argc, char **argv) {
|
|||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_livestream = false;
|
||||||
const char *filename = args["-o"].value();
|
const char *filename = args["-o"].value();
|
||||||
if(filename) {
|
if(filename) {
|
||||||
if(replay_buffer_size_secs == -1) {
|
is_livestream = is_livestream_path(filename);
|
||||||
char directory_buf[PATH_MAX];
|
if(is_livestream) {
|
||||||
strcpy(directory_buf, filename);
|
if(replay_buffer_size_secs != -1) {
|
||||||
char *directory = dirname(directory_buf);
|
fprintf(stderr, "Error: replay mode is not applicable to live streaming\n");
|
||||||
if(strcmp(directory, ".") != 0 && strcmp(directory, "/") != 0) {
|
_exit(1);
|
||||||
if(create_directory_recursive(directory) != 0) {
|
|
||||||
fprintf(stderr, "Error: failed to create directory for output file: %s\n", filename);
|
|
||||||
_exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!container_format) {
|
if(replay_buffer_size_secs == -1) {
|
||||||
fprintf(stderr, "Error: option -c is required when using option -r\n");
|
char directory_buf[PATH_MAX];
|
||||||
usage();
|
strcpy(directory_buf, filename);
|
||||||
}
|
char *directory = dirname(directory_buf);
|
||||||
|
if(strcmp(directory, ".") != 0 && strcmp(directory, "/") != 0) {
|
||||||
|
if(create_directory_recursive(directory) != 0) {
|
||||||
|
fprintf(stderr, "Error: failed to create directory for output file: %s\n", filename);
|
||||||
|
_exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(!container_format) {
|
||||||
|
fprintf(stderr, "Error: option -c is required when using option -r\n");
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
if(stat(filename, &buf) != -1 && !S_ISDIR(buf.st_mode)) {
|
if(stat(filename, &buf) != -1 && !S_ISDIR(buf.st_mode)) {
|
||||||
fprintf(stderr, "Error: File \"%s\" exists but it's not a directory\n", filename);
|
fprintf(stderr, "Error: File \"%s\" exists but it's not a directory\n", filename);
|
||||||
usage();
|
usage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -2134,7 +2143,6 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
gsr_capture *capture = create_capture_impl(window_str, screen_region, wayland, egl.gpu_info, egl, fps, overclock, video_codec, color_range);
|
gsr_capture *capture = create_capture_impl(window_str, screen_region, wayland, egl.gpu_info, egl, fps, overclock, video_codec, color_range);
|
||||||
|
|
||||||
const bool is_livestream = is_livestream_path(filename);
|
|
||||||
// (Some?) livestreaming services require at least one audio track to work.
|
// (Some?) livestreaming services require at least one audio track to work.
|
||||||
// If not audio is provided then create one silent audio track.
|
// If not audio is provided then create one silent audio track.
|
||||||
if(is_livestream && requested_audio_inputs.empty()) {
|
if(is_livestream && requested_audio_inputs.empty()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user