Browse Source

obs-ffmpeg, UI: Allow slash in recording names

Automatically generate directories if slashes are present in a recording
name format set in advanced settings or in the replay buffer
prefix/suffix settings.

Fixes obsproject/obs-studio#2416
Closes obsproject/obs-studio#2858
jp9000 5 years ago
parent
commit
002886bbac
2 changed files with 8 additions and 2 deletions
  1. 1 2
      UI/window-basic-main-outputs.cpp
  2. 7 0
      plugins/obs-ffmpeg/obs-ffmpeg-mux.c

+ 1 - 2
UI/window-basic-main-outputs.cpp

@@ -837,8 +837,7 @@ bool SimpleOutput::StartStreaming(obs_service_t *service)
 
 
 static void remove_reserved_file_characters(string &s)
 static void remove_reserved_file_characters(string &s)
 {
 {
-	replace(s.begin(), s.end(), '/', '_');
-	replace(s.begin(), s.end(), '\\', '_');
+	replace(s.begin(), s.end(), '\\', '/');
 	replace(s.begin(), s.end(), '*', '_');
 	replace(s.begin(), s.end(), '*', '_');
 	replace(s.begin(), s.end(), '?', '_');
 	replace(s.begin(), s.end(), '?', '_');
 	replace(s.begin(), s.end(), '"', '_');
 	replace(s.begin(), s.end(), '"', '_');

+ 7 - 0
plugins/obs-ffmpeg/obs-ffmpeg-mux.c

@@ -863,6 +863,13 @@ static void replay_buffer_save(struct ffmpeg_muxer *stream)
 		dstr_cat_ch(&stream->path, '/');
 		dstr_cat_ch(&stream->path, '/');
 	dstr_cat(&stream->path, filename);
 	dstr_cat(&stream->path, filename);
 
 
+	char *slash = strrchr(stream->path.array, '/');
+	if (slash) {
+		*slash = 0;
+		os_mkdirs(stream->path.array);
+		*slash = '/';
+	}
+
 	bfree(filename);
 	bfree(filename);
 	obs_data_release(settings);
 	obs_data_release(settings);