Browse Source

win-dshow: Move module loading to separate file

The main module code was originally all packed in to the win-dshow.cpp
file, which isn't exactly ideal or clean if one wants to add other
things to the module as a whole.
jp9000 11 years ago
parent
commit
bbff0eeeb9

+ 1 - 0
plugins/win-dshow/CMakeLists.txt

@@ -9,6 +9,7 @@ set(win-dshow_HEADERS
 
 set(win-dshow_SOURCES
 	win-dshow.cpp
+	dshow-plugin.cpp
 	ffmpeg-decode.c)
 
 set(libdshowcapture_SOURCES

+ 12 - 0
plugins/win-dshow/dshow-plugin.cpp

@@ -0,0 +1,12 @@
+#include <obs-module.h>
+
+OBS_DECLARE_MODULE()
+OBS_MODULE_USE_DEFAULT_LOCALE("win-dshow", "en-US")
+
+extern void RegisterDShowSource();
+
+bool obs_module_load(void)
+{
+	RegisterDShowSource();
+	return true;
+}

+ 1 - 6
plugins/win-dshow/win-dshow.cpp

@@ -1538,9 +1538,6 @@ static obs_properties_t *GetDShowProperties(void *)
 	return ppts;
 }
 
-OBS_DECLARE_MODULE()
-OBS_MODULE_USE_DEFAULT_LOCALE("win-dshow", "en-US")
-
 void DShowModuleLogCallback(LogType type, const wchar_t *msg, void *param)
 {
 	int obs_type = LOG_DEBUG;
@@ -1560,7 +1557,7 @@ void DShowModuleLogCallback(LogType type, const wchar_t *msg, void *param)
 	UNUSED_PARAMETER(param);
 }
 
-bool obs_module_load(void)
+void RegisterDShowSource()
 {
 	SetLogCallback(DShowModuleLogCallback, nullptr);
 
@@ -1577,6 +1574,4 @@ bool obs_module_load(void)
 	info.get_defaults    = GetDShowDefaults;
 	info.get_properties  = GetDShowProperties;
 	obs_register_source(&info);
-
-	return true;
 }