浏览代码

obs-ffmpeg: Move ffmpeg-mux to executable dir

Instead of having ffmpeg-mux stored in a data directory, install it to
the primary binary directory.  On windows, this fixes ffmpeg-mux
potentially accessing the wrong FFmpeg libraries (some programs install
them to system32, foolishly), and instead ensures that it uses the ones
that come with the program.  On Linux, ensures that a binary is in its
appropriate directory (/usr/bin or /usr/local/bin rather than a subset
of /usr/share or /usr/local/share).
jp9000 6 年之前
父节点
当前提交
0677fe2b21
共有 2 个文件被更改,包括 11 次插入21 次删除
  1. 8 14
      plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt
  2. 3 7
      plugins/obs-ffmpeg/obs-ffmpeg-mux.c

+ 8 - 14
plugins/obs-ffmpeg/ffmpeg-mux/CMakeLists.txt

@@ -1,26 +1,20 @@
-project(ffmpeg-mux)
+project(obs-ffmpeg-mux)
 
 find_package(FFmpeg REQUIRED
 	COMPONENTS avcodec avutil avformat)
 include_directories(${FFMPEG_INCLUDE_DIRS})
 
-set(ffmpeg-mux_SOURCES
+set(obs-ffmpeg-mux_SOURCES
 	ffmpeg-mux.c)
 
-set(ffmpeg-mux_HEADERS
+set(obs-ffmpeg-mux_HEADERS
 	ffmpeg-mux.h)
 
-add_executable(ffmpeg-mux
-	${ffmpeg-mux_SOURCES}
-	${ffmpeg-mux_HEADERS})
+add_executable(obs-ffmpeg-mux
+	${obs-ffmpeg-mux_SOURCES}
+	${obs-ffmpeg-mux_HEADERS})
 
-target_link_libraries(ffmpeg-mux
+target_link_libraries(obs-ffmpeg-mux
 	${FFMPEG_LIBRARIES})
 
-if(WIN32)
-	set_target_properties(ffmpeg-mux
-		PROPERTIES
-			OUTPUT_NAME "ffmpeg-mux${_output_suffix}")
-endif()
-
-install_obs_datatarget(ffmpeg-mux "obs-plugins/obs-ffmpeg")
+install_obs_core(obs-ffmpeg-mux)

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

@@ -113,13 +113,9 @@ static void *ffmpeg_mux_create(obs_data_t *settings, obs_output_t *output)
 }
 
 #ifdef _WIN32
-#ifdef _WIN64
-#define FFMPEG_MUX "ffmpeg-mux64.exe"
+#define FFMPEG_MUX "obs-ffmpeg-mux.exe"
 #else
-#define FFMPEG_MUX "ffmpeg-mux32.exe"
-#endif
-#else
-#define FFMPEG_MUX "ffmpeg-mux"
+#define FFMPEG_MUX "obs-ffmpeg-mux"
 #endif
 
 static inline bool capturing(struct ffmpeg_muxer *stream)
@@ -241,7 +237,7 @@ static void build_command_line(struct ffmpeg_muxer *stream, struct dstr *cmd,
 		num_tracks++;
 	}
 
-	dstr_init_move_array(cmd, obs_module_file(FFMPEG_MUX));
+	dstr_init_move_array(cmd, os_get_executable_path_ptr(FFMPEG_MUX));
 	dstr_insert_ch(cmd, 0, '\"');
 	dstr_cat(cmd, "\" \"");