diff --git a/obs/CMakeLists.txt b/obs/CMakeLists.txt index 58908dde8..af05ba263 100644 --- a/obs/CMakeLists.txt +++ b/obs/CMakeLists.txt @@ -30,6 +30,7 @@ link_libraries(${wxWidgets_LIBRARIES}) add_executable(obs window-obs-basic.cpp window-subclass.cpp + wx-wrappers.cpp obs-app.cpp OBSWindows.cpp) diff --git a/obs/makefile.am b/obs/makefile.am index ce6071c85..fc156f412 100644 --- a/obs/makefile.am +++ b/obs/makefile.am @@ -13,4 +13,5 @@ obs_PROGRAMS = obs obs_SOURCES = window-obs-basic.cpp \ window-subclass.cpp \ obs-app.cpp \ + wx-wrappers.cpp \ OBSWindows.cpp diff --git a/obs/obs-app.cpp b/obs/obs-app.cpp index 23c3040f8..eacf301e7 100644 --- a/obs/obs-app.cpp +++ b/obs/obs-app.cpp @@ -19,6 +19,7 @@ #include "obs-app.hpp" #include "window-obs-basic.hpp" #include "obs-wrappers.hpp" +#include "wx-wrappers.hpp" IMPLEMENT_APP(OBSApp) @@ -47,12 +48,7 @@ bool OBSApp::OnInit() ovi.output_format = VIDEO_FORMAT_RGBA; ovi.output_width = rc.width; ovi.output_height = rc.height; - -#ifdef __WXCOCOA__ - ovi.window.view = preview->GetHandle(); -#elif _WIN32 - ovi.window.hwnd = preview->GetHandle(); -#endif + ovi.window = WxToGSWindow(preview); if (!obs_reset_video(&ovi)) return false; diff --git a/obs/obs-wrappers.hpp b/obs/obs-wrappers.hpp index a2c6d2691..0567ce641 100644 --- a/obs/obs-wrappers.hpp +++ b/obs/obs-wrappers.hpp @@ -17,6 +17,8 @@ #pragma once +#include + class OBSSource { obs_source_t source; diff --git a/obs/wx-wrappers.cpp b/obs/wx-wrappers.cpp new file mode 100644 index 000000000..a744fd6b1 --- /dev/null +++ b/obs/wx-wrappers.cpp @@ -0,0 +1,33 @@ +/****************************************************************************** + Copyright (C) 2013 by Hugh Bailey + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +******************************************************************************/ + +#include +#include +#include "wx-wrappers.hpp" + +gs_window WxToGSWindow(const wxWindow *wxwin) +{ + gs_window window; +#ifdef __WXCOCOA__ + window.view = wxwin->GetHandle(); +#elif _WIN32 + window.hwnd = wxwin->GetHandle(); +#else + /* TODO: linux stuff */ +#endif + return window; +} diff --git a/obs/wx-wrappers.hpp b/obs/wx-wrappers.hpp new file mode 100644 index 000000000..6eacc72a6 --- /dev/null +++ b/obs/wx-wrappers.hpp @@ -0,0 +1,23 @@ +/****************************************************************************** + Copyright (C) 2013 by Hugh Bailey + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +******************************************************************************/ + +#pragma once + +struct gs_window; +class wxWindow; + +gs_window WxToGSWindow(const wxWindow *window); diff --git a/vs/2010/OBS/OBS.vcxproj b/vs/2010/OBS/OBS.vcxproj index f0eaadb5c..dd566eeaa 100644 --- a/vs/2010/OBS/OBS.vcxproj +++ b/vs/2010/OBS/OBS.vcxproj @@ -171,6 +171,7 @@ + @@ -178,6 +179,7 @@ + diff --git a/vs/2010/OBS/OBS.vcxproj.filters b/vs/2010/OBS/OBS.vcxproj.filters index 2052c55a2..f1bba6d5b 100644 --- a/vs/2010/OBS/OBS.vcxproj.filters +++ b/vs/2010/OBS/OBS.vcxproj.filters @@ -27,6 +27,9 @@ Source Files + + Source Files + @@ -44,5 +47,8 @@ Header Files + + Header Files + \ No newline at end of file