1
0
Эх сурвалжийг харах

win-mf: Deprecate plugin

The windows media foundation H264 encoders have been deprecated for over
a year, and microsoft's media foundation AAC encoder has had a continued
issue with occasional random audio glitches.  The FFmpeg AAC encoder has
had recent development, and is more than sufficient to be able to handle
the task of encoding in terms of both quality and performance, so it's
better just to use the FFmpeg encoder from here on out.

As this plugin is no longer needed, for the next year or two it'll still
be compiled and included, but as a blank plugin that does nothing.  The
reason why it's still being included as a blank no-operation plugin is
to overwrite older versions of the plugin.  That way if a user installs
a newer OBS version over an older one, it won't load up the older win-mf
plugin where the encoders still were enabled.

This also fixes some rarely reported media foundation crashes that can
happen on startup.
jp9000 8 жил өмнө
parent
commit
26595b58b9

+ 48 - 22
plugins/win-mf/CMakeLists.txt

@@ -1,32 +1,58 @@
 project(win-mf)
 
-set(win-mf_SOURCES
-	mf-plugin.cpp
-	mf-aac.cpp
-	mf-aac-encoder.cpp
-	mf-common.cpp
-	mf-encoder-descriptor.cpp
-	mf-h264.cpp
-	mf-h264-encoder.cpp)
-
-set(win-mf_HEADERS
-	mf-common.hpp
-	mf-encoder-descriptor.hpp
-	mf-aac-encoder.hpp
-	mf-h264-encoder.hpp)
+set(ENABLE_WINMF FALSE CACHE BOOL "Enables the now deprecated win-mf plugin")
+
+configure_file(
+	"${CMAKE_CURRENT_SOURCE_DIR}/mf-config.hpp.in"
+	"${CMAKE_CURRENT_BINARY_DIR}/mf-config.hpp")
+
+set(win-mf_config_HEADERS
+	"${CMAKE_CURRENT_BINARY_DIR}/mf-config.hpp")
+
+if(ENABLE_WINMF)
+	set(win-mf_SOURCES
+		mf-plugin.cpp
+		mf-aac.cpp
+		mf-aac-encoder.cpp
+		mf-common.cpp
+		mf-encoder-descriptor.cpp
+		mf-h264.cpp
+		mf-h264-encoder.cpp)
+
+	set(win-mf_HEADERS
+		mf-common.hpp
+		mf-encoder-descriptor.hpp
+		mf-aac-encoder.hpp
+		mf-h264-encoder.hpp)
+
+	set(win-mf_DEPS
+		d3d9
+		dxva2
+		uuid
+		mfplat
+		mfuuid
+		mf
+		wmcodecdspuuid)
+else()
+	set(win-mf_SOURCES
+		mf-plugin.cpp)
+endif()
 
 add_library(win-mf MODULE
+	${win-mf_config_HEADERS}
 	${win-mf_SOURCES}
 	${win-mf_HEADERS})
 
 target_link_libraries(win-mf
-	d3d9
-	dxva2
-	uuid
-	mfplat
-	mfuuid
-	mf
-	wmcodecdspuuid
+	${win-mf_DEPS}
 	libobs)
 
-install_obs_plugin_with_data(win-mf data)
+target_include_directories(win-mf
+	PUBLIC
+	"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
+
+if(ENABLE_WINMF)
+	install_obs_plugin_with_data(win-mf data)
+else()
+	install_obs_plugin(win-mf)
+endif()

+ 17 - 0
plugins/win-mf/mf-config.hpp.in

@@ -0,0 +1,17 @@
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef ON
+#define ON 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef OFF
+#define OFF 0
+#endif
+
+#define ENABLE_WINMF @ENABLE_WINMF@

+ 11 - 1
plugins/win-mf/mf-plugin.cpp

@@ -1,26 +1,36 @@
 #include <obs-module.h>
-#include <util/profiler.h>
+#include "mf-config.hpp"
 
+#if ENABLE_WINMF
+#include <util/profiler.h>
 #include "mf-common.hpp"
 
 extern "C" extern void RegisterMFAACEncoder();
 extern void RegisterMFH264Encoders();
+#endif
 
 
 extern "C" bool obs_module_load(void)
 {
+#if ENABLE_WINMF
 	MFStartup(MF_VERSION, MFSTARTUP_FULL);
 
 	RegisterMFAACEncoder();
 	RegisterMFH264Encoders();
+#endif
 
 	return true;
 }
 
 extern "C" void obs_module_unload(void)
 {
+#if ENABLE_WINMF
 	MFShutdown();
+#endif
 }
 
 OBS_DECLARE_MODULE()
+
+#if ENABLE_WINMF
 OBS_MODULE_USE_DEFAULT_LOCALE("win-mf", "en-US")
+#endif