o Rewrite transform API\r
* Current transforms api is both ugly and unspecified, e.g. what should happen if you have simultanous tweens o nthe same layer?\r
\r
-o Factor out gpu specific stuff\r
+o Factor out ogl specific stuff\r
* We want to have a cpu fallback.\r
\r
o Replace AMCP with new OSC based implemention (throw out protocol project)\r
--- /dev/null
+/*\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG (www.casparcg.com).\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+* Author: Robert Nagy, ronag89@gmail.com\r
+*/\r
+\r
+#include "stdafx.h"
\ No newline at end of file
--- /dev/null
+/*\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG (www.casparcg.com).\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+* Author: Robert Nagy, ronag89@gmail.com\r
+*/\r
+\r
+#pragma once\r
+\r
+#ifdef _DEBUG\r
+#include <crtdbg.h>\r
+#endif\r
+\r
+#define NOMINMAX\r
+#define WIN32_LEAN_AND_MEAN\r
+\r
+#include <GL/glew.h>\r
+\r
+#include <algorithm>\r
+#include <array>\r
+#include <functional>\r
+#include <deque>\r
+#include <map>\r
+#include <memory>\r
+#include <queue>\r
+#include <string>\r
+#include <vector>\r
+\r
+#include <tbb/atomic.h>\r
+#include <tbb/concurrent_queue.h>\r
+#include <tbb/concurrent_unordered_map.h>\r
+\r
+#include <boost/assign.hpp>\r
+#include <boost/circular_buffer.hpp>\r
+#include <boost/timer.hpp>\r
+#include <boost/filesystem.hpp>\r
+#include <boost/foreach.hpp>\r
+#include <boost/range.hpp>\r
+#include <boost/range/adaptors.hpp>\r
+#include <boost/range/algorithm.hpp>\r
+#include <boost/thread.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
+#include <boost/property_tree/xml_parser.hpp>\r
+\r
+#include <common/assert.h>\r
+#include <common/utf.h>\r
+#include <common/spl/memory.h>\r
+//#include "../common/concurrency/executor.h" // Can't include this due to MSVC lambda bug\r
+\r
+#include <common/log.h>\r
+#include <common/except.h>\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup Label="ProjectConfigurations">\r
+ <ProjectConfiguration Include="Debug|x64">\r
+ <Configuration>Debug</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Release|x64">\r
+ <Configuration>Release</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ </ItemGroup>\r
+ <PropertyGroup Label="Globals">\r
+ <ProjectGuid>{8493D01A-F642-454C-8C44-88B38E2A3EF8}</ProjectGuid>\r
+ <RootNamespace>Server</RootNamespace>\r
+ <Keyword>Win32Proj</Keyword>\r
+ <ProjectName>accelerator</ProjectName>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+ <ConfigurationType>StaticLibrary</ConfigurationType>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+ <ConfigurationType>StaticLibrary</ConfigurationType>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+ <ImportGroup Label="ExtensionSettings">\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />\r
+ </ImportGroup>\r
+ <PropertyGroup Label="UserMacros" />\r
+ <PropertyGroup>\r
+ <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\r
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)tmp\$(Configuration)\</IntDir>\r
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)tmp\$(Configuration)\</IntDir>\r
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\;..\dependencies64\boost\;..\dependencies64\tbb\include\;..\dependencies64\sfml\include\;..\dependencies64\glew\include\;..\dependencies64\asmlib\;$(IncludePath)</IncludePath>\r
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\;..\dependencies64\boost\;..\dependencies64\tbb\include\;..\dependencies64\sfml\include\;..\dependencies64\glew\include\;..\dependencies64\asmlib\;$(IncludePath)</IncludePath>\r
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)bin\$(Configuration)\</OutDir>\r
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)bin\$(Configuration)\</OutDir>\r
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)</TargetName>\r
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)</TargetName>\r
+ </PropertyGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <PreBuildEvent>\r
+ <Command>\r
+ </Command>\r
+ </PreBuildEvent>\r
+ <ClCompile>\r
+ <Optimization>Disabled</Optimization>\r
+ <AdditionalIncludeDirectories>../;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <MinimalRebuild>false</MinimalRebuild>\r
+ <ExceptionHandling>Async</ExceptionHandling>\r
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
+ <SmallerTypeCheck>false</SmallerTypeCheck>\r
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
+ <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>\r
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>\r
+ <PrecompiledHeader>Use</PrecompiledHeader>\r
+ <BrowseInformation>true</BrowseInformation>\r
+ <WarningLevel>Level4</WarningLevel>\r
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
+ <PreprocessorDefinitions>TBB_USE_CAPTURED_EXCEPTION=0;TBB_USE_ASSERT=1;TBB_USE_DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <TreatWarningAsError>true</TreatWarningAsError>\r
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
+ <FloatingPointModel>Fast</FloatingPointModel>\r
+ <ForcedIncludeFiles>common/compiler/vs/disable_silly_warnings.h</ForcedIncludeFiles>\r
+ </ClCompile>\r
+ <PostBuildEvent>\r
+ <Command>\r
+ </Command>\r
+ </PostBuildEvent>\r
+ <Lib />\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <PreBuildEvent>\r
+ <Command>\r
+ </Command>\r
+ </PreBuildEvent>\r
+ <ClCompile>\r
+ <Optimization>MaxSpeed</Optimization>\r
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\r
+ <IntrinsicFunctions>true</IntrinsicFunctions>\r
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\r
+ <AdditionalIncludeDirectories>../;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <ExceptionHandling>Async</ExceptionHandling>\r
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\r
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>\r
+ <PrecompiledHeader>Use</PrecompiledHeader>\r
+ <WarningLevel>Level4</WarningLevel>\r
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
+ <PreprocessorDefinitions>TBB_USE_CAPTURED_EXCEPTION=0;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <TreatWarningAsError>true</TreatWarningAsError>\r
+ <OmitFramePointers>true</OmitFramePointers>\r
+ <FloatingPointModel>Fast</FloatingPointModel>\r
+ <ForcedIncludeFiles>common/compiler/vs/disable_silly_warnings.h</ForcedIncludeFiles>\r
+ </ClCompile>\r
+ <PostBuildEvent>\r
+ <Command>\r
+ </Command>\r
+ </PostBuildEvent>\r
+ <Lib>\r
+ <LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>\r
+ </Lib>\r
+ </ItemDefinitionGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="image\blending_glsl.h" />\r
+ <ClInclude Include="image\image_kernel.h" />\r
+ <ClInclude Include="image\image_mixer.h" />\r
+ <ClInclude Include="image\image_shader.h" />\r
+ <ClInclude Include="ogl\context.h" />\r
+ <ClInclude Include="ogl\device_buffer.h" />\r
+ <ClInclude Include="ogl\host_buffer.h" />\r
+ <ClInclude Include="ogl\shader.h" />\r
+ <ClInclude Include="ogl\write_frame.h" />\r
+ <ClInclude Include="StdAfx.h" />\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ProjectReference Include="..\common\common.vcxproj">\r
+ <Project>{02308602-7fe0-4253-b96e-22134919f56a}</Project>\r
+ </ProjectReference>\r
+ <ProjectReference Include="..\core\core.vcxproj">\r
+ <Project>{79388c20-6499-4bf6-b8b9-d8c33d7d4ddd}</Project>\r
+ </ProjectReference>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="image\image_kernel.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
+ <ClCompile Include="image\image_mixer.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
+ <ClCompile Include="image\image_shader.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
+ <ClCompile Include="ogl\context.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
+ <ClCompile Include="ogl\device_buffer.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
+ <ClCompile Include="ogl\host_buffer.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
+ <ClCompile Include="ogl\shader.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
+ <ClCompile Include="ogl\write_frame.cpp">\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
+ </ClCompile>\r
+ <ClCompile Include="StdAfx.cpp">\r
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>\r
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+ <ImportGroup Label="ExtensionTargets">\r
+ </ImportGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup>\r
+ <Filter Include="source">\r
+ <UniqueIdentifier>{34e95782-44c6-42ea-9eb3-ef56fa1f8068}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="source\ogl">\r
+ <UniqueIdentifier>{dbb5f22a-c188-4ab8-af04-3ec2b12d2e27}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="source\image">\r
+ <UniqueIdentifier>{1e686392-8f55-4919-8eee-026f3e8d2e9a}</UniqueIdentifier>\r
+ </Filter>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="ogl\device_buffer.h">\r
+ <Filter>source\ogl</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="ogl\host_buffer.h">\r
+ <Filter>source\ogl</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="ogl\shader.h">\r
+ <Filter>source\ogl</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="ogl\write_frame.h">\r
+ <Filter>source\ogl</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="StdAfx.h" />\r
+ <ClInclude Include="image\blending_glsl.h">\r
+ <Filter>source\image</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="image\image_kernel.h">\r
+ <Filter>source\image</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="image\image_mixer.h">\r
+ <Filter>source\image</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="image\image_shader.h">\r
+ <Filter>source\image</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="ogl\context.h">\r
+ <Filter>source\ogl</Filter>\r
+ </ClInclude>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="ogl\device_buffer.cpp">\r
+ <Filter>source\ogl</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="ogl\host_buffer.cpp">\r
+ <Filter>source\ogl</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="ogl\shader.cpp">\r
+ <Filter>source\ogl</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="ogl\write_frame.cpp">\r
+ <Filter>source\ogl</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="StdAfx.cpp" />\r
+ <ClCompile Include="image\image_kernel.cpp">\r
+ <Filter>source\image</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="image\image_mixer.cpp">\r
+ <Filter>source\image</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="image\image_shader.cpp">\r
+ <Filter>source\image</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="ogl\context.cpp">\r
+ <Filter>source\ogl</Filter>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+</Project>
\ No newline at end of file
* Author: Robert Nagy, ronag89@gmail.com\r
*/\r
\r
-#include "../../../stdafx.h"\r
+#include "../stdafx.h"\r
\r
#include "image_kernel.h"\r
\r
#include "image_shader.h"\r
#include "blending_glsl.h"\r
\r
-#include "../shader.h"\r
-#include "../device_buffer.h"\r
-#include "../accelerator.h"\r
+#include "../ogl/shader.h"\r
+#include "../ogl/device_buffer.h"\r
+#include "../ogl/context.h"\r
\r
#include <common/except.h>\r
#include <common/gl/gl_check.h>\r
\r
#include <boost/noncopyable.hpp>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
GLubyte upper_pattern[] = {\r
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,\r
\r
struct image_kernel::impl : boost::noncopyable\r
{ \r
- spl::shared_ptr<accelerator> ogl_;\r
+ spl::shared_ptr<context> ogl_;\r
spl::shared_ptr<shader> shader_;\r
bool blend_modes_;\r
\r
- impl(const spl::shared_ptr<accelerator>& ogl)\r
+ impl(const spl::shared_ptr<context>& ogl)\r
: ogl_(ogl)\r
, shader_(ogl_->invoke([&]{return get_image_shader(*ogl, blend_modes_);}))\r
{\r
// Setup blend_func\r
\r
if(params.transform.is_key)\r
- params.blend_mode = blend_mode::normal;\r
+ params.blend_mode = core::blend_mode::normal;\r
\r
if(blend_modes_)\r
{\r
}\r
};\r
\r
-image_kernel::image_kernel(const spl::shared_ptr<accelerator>& ogl) : impl_(new impl(ogl)){}\r
+image_kernel::image_kernel(const spl::shared_ptr<context>& ogl) : impl_(new impl(ogl)){}\r
void image_kernel::draw(draw_params&& params)\r
{\r
impl_->draw(std::move(params));\r
\r
#pragma once\r
\r
-#include "../../image/blend_modes.h"\r
+#include <core/mixer/image/blend_modes.h>\r
\r
#include <common/enum_class.h>\r
#include <common/spl/memory.h>\r
\r
#include <boost/noncopyable.hpp>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
struct keyer_def\r
{\r
\r
struct draw_params sealed\r
{\r
- pixel_format_desc pix_desc;\r
+ core::pixel_format_desc pix_desc;\r
std::vector<spl::shared_ptr<class device_buffer>> textures;\r
- frame_transform transform;\r
- blend_mode blend_mode;\r
- keyer keyer;\r
- std::shared_ptr<class device_buffer> background;\r
- std::shared_ptr<class device_buffer> local_key;\r
- std::shared_ptr<class device_buffer> layer_key;\r
+ core::frame_transform transform;\r
+ core::blend_mode blend_mode;\r
+ keyer keyer;\r
+ std::shared_ptr<class device_buffer> background;\r
+ std::shared_ptr<class device_buffer> local_key;\r
+ std::shared_ptr<class device_buffer> layer_key;\r
\r
draw_params() \r
- : pix_desc(pixel_format::invalid)\r
- , blend_mode(blend_mode::normal)\r
+ : pix_desc(core::pixel_format::invalid)\r
+ , blend_mode(core::blend_mode::normal)\r
, keyer(keyer::linear)\r
{\r
}\r
class image_kernel sealed : boost::noncopyable\r
{\r
public:\r
- image_kernel(const spl::shared_ptr<class accelerator>& ogl);\r
+ image_kernel(const spl::shared_ptr<class context>& ogl);\r
void draw(draw_params&& params);\r
private:\r
struct impl;\r
* Author: Robert Nagy, ronag89@gmail.com\r
*/\r
\r
-#include "../../../stdafx.h"\r
+#include "../stdafx.h"\r
\r
#include "image_mixer.h"\r
\r
#include "image_kernel.h"\r
\r
-#include "../write_frame.h"\r
-#include "../accelerator.h"\r
-#include "../host_buffer.h"\r
-#include "../device_buffer.h"\r
+#include "../ogl/write_frame.h"\r
+#include "../ogl/context.h"\r
+#include "../ogl/host_buffer.h"\r
+#include "../ogl/device_buffer.h"\r
\r
#include <common/gl/gl_check.h>\r
#include <common/concurrency/async.h>\r
\r
using namespace boost::assign;\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
struct item\r
{\r
- pixel_format_desc pix_desc;\r
+ core::pixel_format_desc pix_desc;\r
std::vector<boost::shared_future<spl::shared_ptr<device_buffer>>> textures;\r
- frame_transform transform;\r
+ core::frame_transform transform;\r
\r
item()\r
- : pix_desc(pixel_format::invalid)\r
+ : pix_desc(core::pixel_format::invalid)\r
{\r
}\r
};\r
\r
-typedef std::pair<blend_mode, std::vector<item>> layer;\r
+typedef std::pair<core::blend_mode, std::vector<item>> layer;\r
\r
class image_renderer\r
{\r
- spl::shared_ptr<accelerator> ogl_;\r
+ spl::shared_ptr<context> ogl_;\r
image_kernel kernel_; \r
public:\r
- image_renderer(const spl::shared_ptr<accelerator>& ogl)\r
+ image_renderer(const spl::shared_ptr<context>& ogl)\r
: ogl_(ogl)\r
, kernel_(ogl_)\r
{\r
}\r
\r
- boost::unique_future<boost::iterator_range<const uint8_t*>> operator()(std::vector<layer> layers, const video_format_desc& format_desc)\r
+ boost::unique_future<boost::iterator_range<const uint8_t*>> operator()(std::vector<layer> layers, const core::video_format_desc& format_desc)\r
{ \r
boost::shared_future<spl::shared_ptr<host_buffer>> buffer = ogl_->begin_invoke([=]() mutable -> spl::shared_ptr<host_buffer>\r
{\r
auto draw_buffer = create_mixer_buffer(4, format_desc);\r
\r
- if(format_desc.field_mode != field_mode::progressive)\r
+ if(format_desc.field_mode != core::field_mode::progressive)\r
{\r
auto upper = layers;\r
auto lower = std::move(layers);\r
BOOST_FOREACH(auto& layer, upper)\r
{\r
BOOST_FOREACH(auto& item, layer.second)\r
- item.transform.field_mode = static_cast<field_mode>(item.transform.field_mode & field_mode::upper);\r
+ item.transform.field_mode = static_cast<core::field_mode>(item.transform.field_mode & core::field_mode::upper);\r
}\r
\r
BOOST_FOREACH(auto& layer, lower)\r
{\r
BOOST_FOREACH(auto& item, layer.second)\r
- item.transform.field_mode = static_cast<field_mode>(item.transform.field_mode & field_mode::lower);\r
+ item.transform.field_mode = static_cast<core::field_mode>(item.transform.field_mode & core::field_mode::lower);\r
}\r
\r
draw(std::move(upper), draw_buffer, format_desc);\r
\r
private:\r
\r
- void draw(std::vector<layer>&& layers, \r
+ void draw(std::vector<layer>&& layers, \r
spl::shared_ptr<device_buffer>& draw_buffer, \r
- const video_format_desc& format_desc)\r
+ const core::video_format_desc& format_desc)\r
{\r
std::shared_ptr<device_buffer> layer_key_buffer;\r
\r
draw_layer(std::move(layer), draw_buffer, layer_key_buffer, format_desc);\r
}\r
\r
- void draw_layer(layer&& layer, \r
+ void draw_layer(layer&& layer, \r
spl::shared_ptr<device_buffer>& draw_buffer,\r
- std::shared_ptr<device_buffer>& layer_key_buffer,\r
- const video_format_desc& format_desc)\r
+ std::shared_ptr<device_buffer>& layer_key_buffer,\r
+ const core::video_format_desc& format_desc)\r
{ \r
- boost::remove_erase_if(layer.second, [](const item& item){return item.transform.field_mode == field_mode::empty;});\r
+ boost::remove_erase_if(layer.second, [](const item& item){return item.transform.field_mode == core::field_mode::empty;});\r
\r
if(layer.second.empty())\r
return;\r
std::shared_ptr<device_buffer> local_key_buffer;\r
std::shared_ptr<device_buffer> local_mix_buffer;\r
\r
- if(layer.first != blend_mode::normal)\r
+ if(layer.first != core::blend_mode::normal)\r
{\r
auto layer_draw_buffer = create_mixer_buffer(4, format_desc);\r
\r
BOOST_FOREACH(auto& item, layer.second)\r
draw_item(std::move(item), layer_draw_buffer, layer_key_buffer, local_key_buffer, local_mix_buffer, format_desc); \r
\r
- draw_mixer_buffer(layer_draw_buffer, std::move(local_mix_buffer), blend_mode::normal); \r
+ draw_mixer_buffer(layer_draw_buffer, std::move(local_mix_buffer), core::blend_mode::normal); \r
draw_mixer_buffer(draw_buffer, std::move(layer_draw_buffer), layer.first);\r
}\r
else // fast path\r
BOOST_FOREACH(auto& item, layer.second) \r
draw_item(std::move(item), draw_buffer, layer_key_buffer, local_key_buffer, local_mix_buffer, format_desc); \r
\r
- draw_mixer_buffer(draw_buffer, std::move(local_mix_buffer), blend_mode::normal);\r
+ draw_mixer_buffer(draw_buffer, std::move(local_mix_buffer), core::blend_mode::normal);\r
} \r
\r
layer_key_buffer = std::move(local_key_buffer);\r
}\r
\r
void draw_item(item&& item, \r
- spl::shared_ptr<device_buffer>& draw_buffer, \r
+ spl::shared_ptr<device_buffer>& draw_buffer, \r
std::shared_ptr<device_buffer>& layer_key_buffer, \r
std::shared_ptr<device_buffer>& local_key_buffer, \r
std::shared_ptr<device_buffer>& local_mix_buffer,\r
- const video_format_desc& format_desc)\r
+ const core::video_format_desc& format_desc)\r
{ \r
draw_params draw_params;\r
draw_params.pix_desc = std::move(item.pix_desc);\r
}\r
else\r
{\r
- draw_mixer_buffer(draw_buffer, std::move(local_mix_buffer), blend_mode::normal);\r
+ draw_mixer_buffer(draw_buffer, std::move(local_mix_buffer), core::blend_mode::normal);\r
\r
draw_params.background = draw_buffer;\r
draw_params.local_key = std::move(local_key_buffer);\r
} \r
}\r
\r
- void draw_mixer_buffer(spl::shared_ptr<device_buffer>& draw_buffer, \r
+ void draw_mixer_buffer(spl::shared_ptr<device_buffer>& draw_buffer, \r
std::shared_ptr<device_buffer>&& source_buffer, \r
- blend_mode blend_mode = blend_mode::normal)\r
+ core::blend_mode blend_mode = core::blend_mode::normal)\r
{\r
if(!source_buffer)\r
return;\r
\r
draw_params draw_params;\r
- draw_params.pix_desc.format = pixel_format::bgra;\r
- draw_params.pix_desc.planes = list_of(pixel_format_desc::plane(source_buffer->width(), source_buffer->height(), 4));\r
+ draw_params.pix_desc.format = core::pixel_format::bgra;\r
+ draw_params.pix_desc.planes = list_of(core::pixel_format_desc::plane(source_buffer->width(), source_buffer->height(), 4));\r
draw_params.textures = list_of(source_buffer);\r
- draw_params.transform = frame_transform();\r
+ draw_params.transform = core::frame_transform();\r
draw_params.blend_mode = blend_mode;\r
draw_params.background = draw_buffer;\r
\r
kernel_.draw(std::move(draw_params));\r
}\r
\r
- spl::shared_ptr<device_buffer> create_mixer_buffer(int stride, const video_format_desc& format_desc)\r
+ spl::shared_ptr<device_buffer> create_mixer_buffer(int stride, const core::video_format_desc& format_desc)\r
{\r
auto buffer = ogl_->create_device_buffer(format_desc.width, format_desc.height, stride);\r
ogl_->clear(*buffer);\r
\r
struct image_mixer::impl : boost::noncopyable\r
{ \r
- spl::shared_ptr<accelerator> ogl_;\r
- image_renderer renderer_;\r
- std::vector<frame_transform> transform_stack_;\r
- std::vector<layer> layers_; // layer/stream/items\r
+ spl::shared_ptr<context> ogl_;\r
+ image_renderer renderer_;\r
+ std::vector<core::frame_transform> transform_stack_;\r
+ std::vector<layer> layers_; // layer/stream/items\r
public:\r
- impl(const spl::shared_ptr<accelerator>& ogl) \r
+ impl(const spl::shared_ptr<context>& ogl) \r
: ogl_(ogl)\r
, renderer_(ogl)\r
, transform_stack_(1) \r
{\r
}\r
\r
- void begin_layer(blend_mode blend_mode)\r
+ void begin_layer(core::blend_mode blend_mode)\r
{\r
layers_.push_back(std::make_pair(blend_mode, std::vector<item>()));\r
}\r
\r
- void push(frame_transform& transform)\r
+ void push(core::frame_transform& transform)\r
{\r
transform_stack_.push_back(transform_stack_.back()*transform);\r
}\r
\r
- void visit(data_frame& frame2)\r
+ void visit(core::data_frame& frame2)\r
{ \r
write_frame* frame = dynamic_cast<write_frame*>(&frame2);\r
if(frame == nullptr)\r
{ \r
}\r
\r
- boost::unique_future<boost::iterator_range<const uint8_t*>> render(const video_format_desc& format_desc)\r
+ boost::unique_future<boost::iterator_range<const uint8_t*>> render(const core::video_format_desc& format_desc)\r
{\r
return renderer_(std::move(layers_), format_desc);\r
}\r
\r
- virtual spl::shared_ptr<gpu::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc)\r
+ virtual spl::shared_ptr<ogl::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc)\r
{\r
- return spl::make_shared<gpu::write_frame>(ogl_, tag, desc);\r
+ return spl::make_shared<ogl::write_frame>(ogl_, tag, desc);\r
}\r
};\r
\r
-image_mixer::image_mixer(const spl::shared_ptr<accelerator>& ogl) : impl_(new impl(ogl)){}\r
-void image_mixer::push(frame_transform& transform){impl_->push(transform);}\r
-void image_mixer::visit(data_frame& frame){impl_->visit(frame);}\r
+image_mixer::image_mixer(const spl::shared_ptr<context>& ogl) : impl_(new impl(ogl)){}\r
+void image_mixer::push(core::frame_transform& transform){impl_->push(transform);}\r
+void image_mixer::visit(core::data_frame& frame){impl_->visit(frame);}\r
void image_mixer::pop(){impl_->pop();}\r
-boost::unique_future<boost::iterator_range<const uint8_t*>> image_mixer::operator()(const video_format_desc& format_desc){return impl_->render(format_desc);}\r
-void image_mixer::begin_layer(blend_mode blend_mode){impl_->begin_layer(blend_mode);}\r
+boost::unique_future<boost::iterator_range<const uint8_t*>> image_mixer::operator()(const core::video_format_desc& format_desc){return impl_->render(format_desc);}\r
+void image_mixer::begin_layer(core::blend_mode blend_mode){impl_->begin_layer(blend_mode);}\r
void image_mixer::end_layer(){impl_->end_layer();}\r
-spl::shared_ptr<core::write_frame> image_mixer::create_frame(const void* tag, const pixel_format_desc& desc) {return impl_->create_frame(tag, desc);}\r
+spl::shared_ptr<core::write_frame> image_mixer::create_frame(const void* tag, const core::pixel_format_desc& desc) {return impl_->create_frame(tag, desc);}\r
\r
}}}
\ No newline at end of file
\r
#pragma once\r
\r
-#include "../../image/blend_modes.h"\r
-#include "../../image/image_mixer.h"\r
-\r
#include <common/forward.h>\r
#include <common/spl/memory.h>\r
\r
+#include <core/mixer/image/blend_modes.h>\r
+#include <core/mixer/image/image_mixer.h>\r
+\r
#include <core/frame/frame_visitor.h>\r
\r
FORWARD1(boost, template<typename> class unique_future);\r
FORWARD2(caspar, core, struct write_frame);\r
FORWARD2(caspar, core, struct pixel_format_desc);\r
+FORWARD2(caspar, core, struct video_format_desc);\r
+FORWARD2(caspar, core, struct data_Frame);\r
+FORWARD2(caspar, core, struct frame_transform);\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
class image_mixer sealed : public core::image_mixer\r
{\r
public:\r
- image_mixer(const spl::shared_ptr<class accelerator>& ogl);\r
+ image_mixer(const spl::shared_ptr<class context>& ogl);\r
\r
- virtual void push(struct frame_transform& frame);\r
- virtual void visit(struct data_frame& frame);\r
+ virtual void push(core::frame_transform& frame);\r
+ virtual void visit(core::data_frame& frame);\r
virtual void pop();\r
\r
- void begin_layer(blend_mode blend_mode);\r
+ void begin_layer(core::blend_mode blend_mode);\r
void end_layer();\r
\r
// NOTE: Content of return future is only valid while future is valid.\r
- virtual boost::unique_future<boost::iterator_range<const uint8_t*>> operator()(const struct video_format_desc& format_desc) override;\r
+ virtual boost::unique_future<boost::iterator_range<const uint8_t*>> operator()(const core::video_format_desc& format_desc) override;\r
\r
virtual spl::shared_ptr<core::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc) override;\r
private:\r
* Author: Robert Nagy, ronag89@gmail.com\r
*/\r
\r
-#include "../../../StdAfx.h"\r
+#include "../stdafx.h"\r
\r
#include "image_shader.h"\r
\r
-#include "../../gpu/shader.h"\r
-#include "../../gpu/accelerator.h"\r
+#include "../ogl/shader.h"\r
+#include "../ogl/context.h"\r
\r
#include "blending_glsl.h"\r
\r
\r
#include <tbb/mutex.h>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
std::shared_ptr<shader> g_shader;\r
tbb::mutex g_shader_mutex;\r
"} \n";\r
}\r
\r
-spl::shared_ptr<shader> get_image_shader(accelerator& ogl, bool& blend_modes)\r
+spl::shared_ptr<shader> get_image_shader(context& ogl, bool& blend_modes)\r
{\r
tbb::mutex::scoped_lock lock(g_shader_mutex);\r
\r
\r
#include <common/spl/memory.h>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
class shader;\r
-class accelerator;\r
+class context;\r
\r
struct texture_id\r
{\r
};\r
};\r
\r
-spl::shared_ptr<shader> get_image_shader(accelerator& ogl, bool& blend_modes);\r
+spl::shared_ptr<shader> get_image_shader(context& ogl, bool& blend_modes);\r
\r
\r
}}}
\ No newline at end of file
\r
// TODO: Smart GC\r
\r
-#include "../../stdafx.h"\r
+#include "../stdafx.h"\r
\r
-#include "accelerator.h"\r
+#include "context.h"\r
\r
#include "shader.h"\r
\r
\r
#include <gl/glew.h>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
-accelerator::accelerator() \r
- : executor_(L"accelerator")\r
+context::context() \r
+ : executor_(L"context")\r
{\r
CASPAR_LOG(info) << L"Initializing OpenGL Device.";\r
\r
});\r
}\r
\r
-accelerator::~accelerator()\r
+context::~context()\r
{\r
invoke([=]\r
{\r
});\r
}\r
\r
-spl::shared_ptr<device_buffer> accelerator::allocate_device_buffer(int width, int height, int stride)\r
+spl::shared_ptr<device_buffer> context::allocate_device_buffer(int width, int height, int stride)\r
{\r
std::shared_ptr<device_buffer> buffer;\r
try\r
return spl::make_shared_ptr(buffer);\r
}\r
\r
-spl::shared_ptr<device_buffer> accelerator::create_device_buffer(int width, int height, int stride)\r
+spl::shared_ptr<device_buffer> context::create_device_buffer(int width, int height, int stride)\r
{\r
CASPAR_VERIFY(stride > 0 && stride < 5);\r
CASPAR_VERIFY(width > 0 && height > 0);\r
});\r
}\r
\r
-spl::shared_ptr<host_buffer> accelerator::allocate_host_buffer(int size, host_buffer::usage usage)\r
+spl::shared_ptr<host_buffer> context::allocate_host_buffer(int size, host_buffer::usage usage)\r
{\r
std::shared_ptr<host_buffer> buffer;\r
\r
return spl::make_shared_ptr(buffer);\r
}\r
\r
-spl::shared_ptr<host_buffer> accelerator::create_host_buffer(int size, host_buffer::usage usage)\r
+spl::shared_ptr<host_buffer> context::create_host_buffer(int size, host_buffer::usage usage)\r
{\r
CASPAR_VERIFY(usage == host_buffer::usage::write_only || usage == host_buffer::usage::read_only);\r
CASPAR_VERIFY(size > 0);\r
});\r
}\r
\r
-spl::shared_ptr<accelerator> accelerator::create()\r
+spl::shared_ptr<context> context::create()\r
{\r
- return spl::shared_ptr<accelerator>(new accelerator());\r
+ return spl::shared_ptr<context>(new context());\r
}\r
\r
//template<typename T>\r
// pool.usage_count = 0;\r
//}\r
\r
-boost::unique_future<void> accelerator::gc()\r
+boost::unique_future<void> context::gc()\r
{ \r
return begin_invoke([=]\r
{\r
}, task_priority::high_priority);\r
}\r
\r
-std::wstring accelerator::version()\r
+std::wstring context::version()\r
{ \r
static std::wstring ver = L"Not found";\r
try\r
return ver;\r
}\r
\r
-void accelerator::attach(device_buffer& texture)\r
+void context::attach(device_buffer& texture)\r
{ \r
glBindFramebuffer(GL_FRAMEBUFFER, fbo_);\r
GL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + 0, GL_TEXTURE_2D, texture.id(), 0));\r
}\r
\r
-void accelerator::clear(device_buffer& texture)\r
+void context::clear(device_buffer& texture)\r
{ \r
attach(texture);\r
GL(glClear(GL_COLOR_BUFFER_BIT));\r
}\r
\r
-void accelerator::use(shader& shader)\r
+void context::use(shader& shader)\r
{ \r
GL(glUseProgramObjectARB(shader.id())); \r
}\r
\r
-boost::unique_future<spl::shared_ptr<device_buffer>> accelerator::copy_async(spl::shared_ptr<host_buffer>& source, int width, int height, int stride)\r
+boost::unique_future<spl::shared_ptr<device_buffer>> context::copy_async(spl::shared_ptr<host_buffer>& source, int width, int height, int stride)\r
{\r
return executor_.begin_invoke([=]() -> spl::shared_ptr<device_buffer>\r
{\r
#include <array>\r
#include <unordered_map>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
class shader;\r
\r
}\r
};\r
\r
-class accelerator : public std::enable_shared_from_this<accelerator>, boost::noncopyable\r
+class context : public std::enable_shared_from_this<context>, boost::noncopyable\r
{ \r
std::unique_ptr<sf::Context> context_;\r
\r
\r
executor executor_;\r
\r
- accelerator();\r
+ context();\r
public: \r
- static spl::shared_ptr<accelerator> create();\r
- ~accelerator();\r
+ static spl::shared_ptr<context> create();\r
+ ~context();\r
\r
void attach(device_buffer& texture);\r
void clear(device_buffer& texture); \r
* Author: Robert Nagy, ronag89@gmail.com\r
*/\r
\r
-#include "../../stdafx.h"\r
+#include "../stdafx.h"\r
\r
#include "device_buffer.h"\r
-#include "accelerator.h"\r
+#include "context.h"\r
\r
#include <common/except.h>\r
#include <common/gl/gl_check.h>\r
\r
#include <boost/thread/future.hpp>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
static GLenum FORMAT[] = {0, GL_RED, GL_RG, GL_BGR, GL_BGRA};\r
static GLenum INTERNAL_FORMAT[] = {0, GL_R8, GL_RG8, GL_RGB8, GL_RGBA8}; \r
\r
struct device_buffer::impl : boost::noncopyable\r
{\r
- std::weak_ptr<accelerator> parent_;\r
+ std::weak_ptr<context> parent_;\r
GLuint id_;\r
\r
const int width_;\r
const int height_;\r
const int stride_;\r
public:\r
- impl(std::weak_ptr<accelerator> parent, int width, int height, int stride) \r
+ impl(std::weak_ptr<context> parent, int width, int height, int stride) \r
: parent_(parent)\r
, width_(width)\r
, height_(height)\r
}\r
};\r
\r
-device_buffer::device_buffer(std::weak_ptr<accelerator> parent, int width, int height, int stride) : impl_(new impl(parent, width, height, stride)){}\r
+device_buffer::device_buffer(std::weak_ptr<context> parent, int width, int height, int stride) : impl_(new impl(parent, width, height, stride)){}\r
int device_buffer::stride() const { return impl_->stride_; }\r
int device_buffer::width() const { return impl_->width_; }\r
int device_buffer::height() const { return impl_->height_; }\r
\r
FORWARD1(boost, template<typename> class unique_future);\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
class host_buffer;\r
-class accelerator;\r
+class context;\r
\r
class device_buffer : boost::noncopyable\r
{\r
void copy_from(const spl::shared_ptr<host_buffer>& source);\r
void copy_to(const spl::shared_ptr<host_buffer>& dest);\r
private:\r
- friend class accelerator;\r
+ friend class context;\r
friend class image_kernel;\r
- device_buffer(std::weak_ptr<accelerator> parent, int width, int height, int stride);\r
+ device_buffer(std::weak_ptr<context> parent, int width, int height, int stride);\r
\r
void bind(int index);\r
void unbind();\r
* Author: Robert Nagy, ronag89@gmail.com\r
*/\r
\r
-#include "../../stdafx.h"\r
+#include "../stdafx.h"\r
\r
#include "host_buffer.h"\r
\r
#include "device_buffer.h"\r
-#include "accelerator.h"\r
+#include "context.h"\r
\r
#include <common/except.h>\r
#include <common/gl/gl_check.h>\r
\r
#include <tbb/atomic.h>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
static tbb::atomic<int> g_w_total_count;\r
static tbb::atomic<int> g_r_total_count;\r
tbb::atomic<void*> data_;\r
GLenum usage_;\r
GLenum target_;\r
- std::weak_ptr<accelerator> parent_;\r
+ std::weak_ptr<context> parent_;\r
\r
public:\r
- impl(std::weak_ptr<accelerator> parent, int size, host_buffer::usage usage) \r
+ impl(std::weak_ptr<context> parent, int size, host_buffer::usage usage) \r
: parent_(parent)\r
, size_(size)\r
, pbo_(0)\r
}\r
};\r
\r
-host_buffer::host_buffer(std::weak_ptr<accelerator> parent, int size, usage usage) : impl_(new impl(parent, size, usage)){}\r
+host_buffer::host_buffer(std::weak_ptr<context> parent, int size, usage usage) : impl_(new impl(parent, size, usage)){}\r
const void* host_buffer::data() const {return impl_->data_;}\r
void* host_buffer::data() {return impl_->data();}\r
void host_buffer::map(){impl_->map();}\r
\r
#include <boost/noncopyable.hpp>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
class host_buffer : boost::noncopyable\r
{\r
int size() const; \r
\r
private:\r
- friend class accelerator;\r
+ friend class context;\r
friend class device_buffer;\r
\r
void bind();\r
void map();\r
void unmap();\r
\r
- host_buffer(std::weak_ptr<accelerator> parent, int size, usage usage);\r
+ host_buffer(std::weak_ptr<context> parent, int size, usage usage);\r
\r
struct impl;\r
spl::shared_ptr<impl> impl_;\r
* Author: Robert Nagy, ronag89@gmail.com\r
*/\r
\r
-#include "../../stdafx.h"\r
+#include "../stdafx.h"\r
\r
#include "shader.h"\r
\r
\r
#include <unordered_map>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
struct shader::impl : boost::noncopyable\r
{\r
\r
#include <string>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
class shader : boost::noncopyable\r
{\r
void set(const std::string& name, float value);\r
void set(const std::string& name, double value);\r
private:\r
- friend class accelerator;\r
+ friend class context;\r
struct impl;\r
spl::shared_ptr<impl> impl_;\r
\r
* Author: Robert Nagy, ronag89@gmail.com\r
*/\r
\r
-#include "../../stdafx.h"\r
+#include "../stdafx.h"\r
\r
#include "write_frame.h"\r
\r
-#include "accelerator.h"\r
+#include "context.h"\r
#include "host_buffer.h"\r
#include "device_buffer.h"\r
\r
\r
#include <boost/lexical_cast.hpp>\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
struct write_frame::impl : boost::noncopyable\r
{ \r
- std::shared_ptr<gpu::accelerator> ogl_;\r
- std::vector<spl::shared_ptr<gpu::host_buffer>> buffers_;\r
- audio_buffer audio_data_;\r
- const core::pixel_format_desc desc_;\r
- const void* tag_;\r
+ std::shared_ptr<context> ogl_;\r
+ std::vector<spl::shared_ptr<ogl::host_buffer>> buffers_;\r
+ core::audio_buffer audio_data_;\r
+ const core::pixel_format_desc desc_;\r
+ const void* tag_;\r
\r
impl(const void* tag)\r
: desc_(core::pixel_format::invalid)\r
{\r
}\r
\r
- impl(const spl::shared_ptr<gpu::accelerator>& ogl, const void* tag, const core::pixel_format_desc& desc) \r
+ impl(const spl::shared_ptr<ogl::context>& ogl, const void* tag, const core::pixel_format_desc& desc) \r
: ogl_(ogl)\r
, desc_(desc)\r
, tag_(tag)\r
{\r
std::transform(desc.planes.begin(), desc.planes.end(), std::back_inserter(buffers_), [&](const core::pixel_format_desc::plane& plane)\r
{\r
- return ogl_->create_host_buffer(plane.size, gpu::host_buffer::usage::write_only);\r
+ return ogl_->create_host_buffer(plane.size, ogl::host_buffer::usage::write_only);\r
});\r
}\r
}\r
};\r
\r
write_frame::write_frame(const void* tag) : impl_(new impl(tag)){}\r
-write_frame::write_frame(const spl::shared_ptr<gpu::accelerator>& ogl, const void* tag, const core::pixel_format_desc& desc) \r
+write_frame::write_frame(const spl::shared_ptr<ogl::context>& ogl, const void* tag, const core::pixel_format_desc& desc) \r
: impl_(new impl(ogl, tag, desc)){}\r
write_frame::write_frame(write_frame&& other) : impl_(std::move(other.impl_)){}\r
write_frame& write_frame::operator=(write_frame&& other)\r
}\r
void write_frame::swap(write_frame& other){impl_.swap(other.impl_);}\r
void write_frame::accept(core::frame_visitor& visitor){impl_->accept(*this, visitor);}\r
-const pixel_format_desc& write_frame::get_pixel_format_desc() const{return impl_->desc_;}\r
+const core::pixel_format_desc& write_frame::get_pixel_format_desc() const{return impl_->desc_;}\r
const boost::iterator_range<const uint8_t*> write_frame::image_data(int index) const{return impl_->image_data(index);}\r
-const audio_buffer& write_frame::audio_data() const{return impl_->audio_data_;}\r
+const core::audio_buffer& write_frame::audio_data() const{return impl_->audio_data_;}\r
const boost::iterator_range<uint8_t*> write_frame::image_data(int index){return impl_->image_data(index);}\r
-audio_buffer& write_frame::audio_data(){return impl_->audio_data_;}\r
+core::audio_buffer& write_frame::audio_data(){return impl_->audio_data_;}\r
double write_frame::get_frame_rate() const{return 0.0;} // TODO: what's this?\r
int write_frame::width() const{return impl_->desc_.planes.at(0).width;}\r
int write_frame::height() const{return impl_->desc_.planes.at(0).height;} \r
const void* write_frame::tag() const{return impl_->tag_;} \r
-std::vector<spl::shared_ptr<gpu::host_buffer>> write_frame::get_buffers(){return impl_->buffers_;}\r
+std::vector<spl::shared_ptr<ogl::host_buffer>> write_frame::get_buffers(){return impl_->buffers_;}\r
\r
}}}
\ No newline at end of file
\r
#pragma once\r
\r
+#include "context.h"\r
+\r
#include <common/spl/memory.h>\r
#include <common/forward.h>\r
\r
#include <stdint.h>\r
#include <vector>\r
\r
-FORWARD3(caspar, core, gpu, class accelerator);\r
-FORWARD3(caspar, core, gpu, class host_buffer);\r
+FORWARD2(caspar, core, struct frame_visitor);\r
+FORWARD2(caspar, core, struct pixel_format_desc);\r
\r
-namespace caspar { namespace core { namespace gpu {\r
+namespace caspar { namespace accelerator { namespace ogl {\r
\r
class write_frame sealed : public core::write_frame\r
{\r
write_frame& operator=(const write_frame);\r
public: \r
explicit write_frame(const void* tag);\r
- explicit write_frame(const spl::shared_ptr<gpu::accelerator>& ogl, const void* tag, const struct pixel_format_desc& desc);\r
+ explicit write_frame(const spl::shared_ptr<class context>& ogl, const void* tag, const core::pixel_format_desc& desc);\r
\r
write_frame(write_frame&& other);\r
write_frame& operator=(write_frame&& other);\r
\r
// draw_frame\r
\r
- virtual void accept(struct frame_visitor& visitor) override;\r
+ virtual void accept(core::frame_visitor& visitor) override;\r
\r
// data_frame\r
\r
- virtual const struct pixel_format_desc& get_pixel_format_desc() const override;\r
+ virtual const core::pixel_format_desc& get_pixel_format_desc() const override;\r
\r
virtual const boost::iterator_range<const uint8_t*> image_data(int index) const override;\r
- virtual const audio_buffer& audio_data() const override;\r
+ virtual const core::audio_buffer& audio_data() const override;\r
\r
virtual const boost::iterator_range<uint8_t*> image_data(int index) override;\r
- virtual audio_buffer& audio_data() override;\r
+ virtual core::audio_buffer& audio_data() override;\r
\r
virtual double get_frame_rate() const override;\r
\r
\r
// write_frames\r
\r
- std::vector<spl::shared_ptr<gpu::host_buffer>> get_buffers();\r
+ std::vector<spl::shared_ptr<class host_buffer>> get_buffers();\r
private:\r
struct impl;\r
spl::shared_ptr<impl> impl_;\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "oal", "modules\oal\oal.vcxproj", "{82ED7ED6-8A15-40EC-A8AF-F5E712E0DA68}"\r
EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ogl", "modules\ogl\ogl.vcxproj", "{88F974F0-D09F-4788-8CF8-F563209E60C1}"\r
-EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "image", "modules\image\image.vcxproj", "{3E11FF65-A9DA-4F80-87F2-A7C6379ED5E2}"\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common\common.vcxproj", "{02308602-7FE0-4253-B96E-22134919F56A}"\r
EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "reroute", "modules\reroute\reroute.vcxproj", "{7D58BD57-FDD5-46E6-A23B-ED14B5314A0E}"\r
EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "accelerator", "accelerator\accelerator.vcxproj", "{8493D01A-F642-454C-8C44-88B38E2A3EF8}"\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "screen", "modules\screen\screen.vcxproj", "{88F974F0-D09F-4788-8CF8-F563209E60C1}"\r
+EndProject\r
Global\r
GlobalSection(SubversionScc) = preSolution\r
Svn-Managed = True\r
{82ED7ED6-8A15-40EC-A8AF-F5E712E0DA68}.Release|Win32.ActiveCfg = Release|x64\r
{82ED7ED6-8A15-40EC-A8AF-F5E712E0DA68}.Release|x64.ActiveCfg = Release|x64\r
{82ED7ED6-8A15-40EC-A8AF-F5E712E0DA68}.Release|x64.Build.0 = Release|x64\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1}.Debug|Mixed Platforms.ActiveCfg = Debug|x64\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1}.Debug|Mixed Platforms.Build.0 = Debug|x64\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1}.Debug|Win32.ActiveCfg = Debug|x64\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1}.Debug|x64.ActiveCfg = Debug|x64\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1}.Debug|x64.Build.0 = Debug|x64\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|Mixed Platforms.ActiveCfg = Release|x64\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|Mixed Platforms.Build.0 = Release|x64\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|Win32.ActiveCfg = Release|x64\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|x64.ActiveCfg = Release|x64\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|x64.Build.0 = Release|x64\r
{3E11FF65-A9DA-4F80-87F2-A7C6379ED5E2}.Debug|Mixed Platforms.ActiveCfg = Debug|x64\r
{3E11FF65-A9DA-4F80-87F2-A7C6379ED5E2}.Debug|Mixed Platforms.Build.0 = Debug|x64\r
{3E11FF65-A9DA-4F80-87F2-A7C6379ED5E2}.Debug|Win32.ActiveCfg = Debug|x64\r
{7D58BD57-FDD5-46E6-A23B-ED14B5314A0E}.Release|Win32.ActiveCfg = Release|x64\r
{7D58BD57-FDD5-46E6-A23B-ED14B5314A0E}.Release|x64.ActiveCfg = Release|x64\r
{7D58BD57-FDD5-46E6-A23B-ED14B5314A0E}.Release|x64.Build.0 = Release|x64\r
+ {8493D01A-F642-454C-8C44-88B38E2A3EF8}.Debug|Mixed Platforms.ActiveCfg = Debug|x64\r
+ {8493D01A-F642-454C-8C44-88B38E2A3EF8}.Debug|Mixed Platforms.Build.0 = Debug|x64\r
+ {8493D01A-F642-454C-8C44-88B38E2A3EF8}.Debug|Win32.ActiveCfg = Debug|x64\r
+ {8493D01A-F642-454C-8C44-88B38E2A3EF8}.Debug|x64.ActiveCfg = Debug|x64\r
+ {8493D01A-F642-454C-8C44-88B38E2A3EF8}.Debug|x64.Build.0 = Debug|x64\r
+ {8493D01A-F642-454C-8C44-88B38E2A3EF8}.Release|Mixed Platforms.ActiveCfg = Release|x64\r
+ {8493D01A-F642-454C-8C44-88B38E2A3EF8}.Release|Mixed Platforms.Build.0 = Release|x64\r
+ {8493D01A-F642-454C-8C44-88B38E2A3EF8}.Release|Win32.ActiveCfg = Release|x64\r
+ {8493D01A-F642-454C-8C44-88B38E2A3EF8}.Release|x64.ActiveCfg = Release|x64\r
+ {8493D01A-F642-454C-8C44-88B38E2A3EF8}.Release|x64.Build.0 = Release|x64\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1}.Debug|Mixed Platforms.ActiveCfg = Debug|x64\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1}.Debug|Mixed Platforms.Build.0 = Debug|x64\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1}.Debug|Win32.ActiveCfg = Debug|x64\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1}.Debug|x64.ActiveCfg = Debug|x64\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1}.Debug|x64.Build.0 = Debug|x64\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|Mixed Platforms.ActiveCfg = Release|x64\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|Mixed Platforms.Build.0 = Release|x64\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|Win32.ActiveCfg = Release|x64\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|x64.ActiveCfg = Release|x64\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1}.Release|x64.Build.0 = Release|x64\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
{F6223AF3-BE0B-4B61-8406-98922CE521C2} = {C54DA43E-4878-45DB-B76D-35970553672C}\r
{816DEABA-3757-4306-AFE0-C27CF96C4DEA} = {C54DA43E-4878-45DB-B76D-35970553672C}\r
{82ED7ED6-8A15-40EC-A8AF-F5E712E0DA68} = {C54DA43E-4878-45DB-B76D-35970553672C}\r
- {88F974F0-D09F-4788-8CF8-F563209E60C1} = {C54DA43E-4878-45DB-B76D-35970553672C}\r
{3E11FF65-A9DA-4F80-87F2-A7C6379ED5E2} = {C54DA43E-4878-45DB-B76D-35970553672C}\r
{7D58BD57-FDD5-46E6-A23B-ED14B5314A0E} = {C54DA43E-4878-45DB-B76D-35970553672C}\r
+ {88F974F0-D09F-4788-8CF8-F563209E60C1} = {C54DA43E-4878-45DB-B76D-35970553672C}\r
EndGlobalSection\r
EndGlobal\r
<ClInclude Include="frame\pixel_format.h" />\r
<ClInclude Include="frame\write_frame.h" />\r
<ClInclude Include="mixer\audio\audio_util.h" />\r
- <ClInclude Include="mixer\gpu\device_buffer.h" />\r
- <ClInclude Include="mixer\gpu\host_buffer.h" />\r
- <ClInclude Include="mixer\gpu\image\blending_glsl.h" />\r
- <ClInclude Include="mixer\gpu\image\image_kernel.h" />\r
- <ClInclude Include="mixer\gpu\image\image_mixer.h" />\r
- <ClInclude Include="mixer\gpu\image\image_shader.h" />\r
- <ClInclude Include="mixer\gpu\accelerator.h" />\r
- <ClInclude Include="mixer\gpu\shader.h" />\r
- <ClInclude Include="mixer\gpu\write_frame.h" />\r
<ClInclude Include="mixer\image\blend_modes.h" />\r
<ClInclude Include="video_channel.h" />\r
<ClInclude Include="consumer\output.h" />\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../StdAfx.h</PrecompiledHeaderFile>\r
</ClCompile>\r
- <ClCompile Include="mixer\gpu\device_buffer.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\host_buffer.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\image\image_kernel.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\image\image_mixer.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\image\image_shader.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\accelerator.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\shader.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\write_frame.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
<ClCompile Include="mixer\image\blend_modes.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../../StdAfx.h</PrecompiledHeaderFile>\r
<Filter Include="source\producer\separated">\r
<UniqueIdentifier>{cf834e89-32d6-47bc-8d5a-10e032f88e15}</UniqueIdentifier>\r
</Filter>\r
- <Filter Include="source\mixer\gpu">\r
- <UniqueIdentifier>{b2af87a2-9528-4f82-b3f1-b7409ca15acd}</UniqueIdentifier>\r
- </Filter>\r
- <Filter Include="source\mixer\gpu\image">\r
- <UniqueIdentifier>{d8d99a8a-42f9-48a3-b8a5-c07228226eab}</UniqueIdentifier>\r
- </Filter>\r
<Filter Include="source\frame">\r
<UniqueIdentifier>{b19721c1-8dd1-45fb-b9e3-212b548ebbb6}</UniqueIdentifier>\r
</Filter>\r
<ClInclude Include="producer\separated\separated_producer.h">\r
<Filter>source\producer\separated</Filter>\r
</ClInclude>\r
- <ClInclude Include="mixer\gpu\device_buffer.h">\r
- <Filter>source\mixer\gpu</Filter>\r
- </ClInclude>\r
- <ClInclude Include="mixer\gpu\host_buffer.h">\r
- <Filter>source\mixer\gpu</Filter>\r
- </ClInclude>\r
- <ClInclude Include="mixer\gpu\shader.h">\r
- <Filter>source\mixer\gpu</Filter>\r
- </ClInclude>\r
- <ClInclude Include="mixer\gpu\image\image_mixer.h">\r
- <Filter>source\mixer\gpu\image</Filter>\r
- </ClInclude>\r
- <ClInclude Include="mixer\gpu\image\image_kernel.h">\r
- <Filter>source\mixer\gpu\image</Filter>\r
- </ClInclude>\r
- <ClInclude Include="mixer\gpu\image\blending_glsl.h">\r
- <Filter>source\mixer\gpu\image</Filter>\r
- </ClInclude>\r
- <ClInclude Include="mixer\gpu\image\image_shader.h">\r
- <Filter>source\mixer\gpu\image</Filter>\r
- </ClInclude>\r
<ClInclude Include="mixer\image\blend_modes.h">\r
<Filter>source\mixer\image</Filter>\r
</ClInclude>\r
- <ClInclude Include="mixer\gpu\accelerator.h">\r
- <Filter>source\mixer\gpu</Filter>\r
- </ClInclude>\r
<ClInclude Include="frame\frame_factory.h">\r
<Filter>source\frame</Filter>\r
</ClInclude>\r
<ClInclude Include="frame\draw_frame.h">\r
<Filter>source\frame</Filter>\r
</ClInclude>\r
- <ClInclude Include="mixer\gpu\write_frame.h">\r
- <Filter>source\mixer\gpu</Filter>\r
- </ClInclude>\r
<ClInclude Include="consumer\cadence_guard.h">\r
<Filter>source\consumer</Filter>\r
</ClInclude>\r
<ClCompile Include="producer\frame_producer.cpp">\r
<Filter>source\producer</Filter>\r
</ClCompile>\r
- <ClCompile Include="mixer\gpu\device_buffer.cpp">\r
- <Filter>source\mixer\gpu</Filter>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\host_buffer.cpp">\r
- <Filter>source\mixer\gpu</Filter>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\shader.cpp">\r
- <Filter>source\mixer\gpu</Filter>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\image\image_shader.cpp">\r
- <Filter>source\mixer\gpu\image</Filter>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\image\image_mixer.cpp">\r
- <Filter>source\mixer\gpu\image</Filter>\r
- </ClCompile>\r
- <ClCompile Include="mixer\gpu\image\image_kernel.cpp">\r
- <Filter>source\mixer\gpu\image</Filter>\r
- </ClCompile>\r
<ClCompile Include="mixer\image\blend_modes.cpp">\r
<Filter>source\mixer\image</Filter>\r
</ClCompile>\r
- <ClCompile Include="mixer\gpu\accelerator.cpp">\r
- <Filter>source\mixer\gpu</Filter>\r
- </ClCompile>\r
<ClCompile Include="frame\frame_transform.cpp">\r
<Filter>source\frame</Filter>\r
</ClCompile>\r
<ClCompile Include="frame\data_frame.cpp">\r
<Filter>source\frame</Filter>\r
</ClCompile>\r
- <ClCompile Include="mixer\gpu\write_frame.cpp">\r
- <Filter>source\mixer\gpu</Filter>\r
- </ClCompile>\r
<ClCompile Include="consumer\cadence_guard.cpp">\r
<Filter>source\consumer</Filter>\r
</ClCompile>\r
\r
#include "audio_mixer.h"\r
\r
-#include <core/mixer/gpu/write_frame.h>\r
+#include <core/frame/write_frame.h>\r
#include <core/frame/frame_transform.h>\r
#include <common/diagnostics/graph.h>\r
\r
\r
#include <core/frame/frame_visitor.h>\r
\r
+#include <boost/range.hpp>\r
+\r
+#include <stdint.h>\r
+\r
FORWARD1(boost, template<typename> class unique_future);\r
FORWARD2(caspar, core, struct write_frame);\r
FORWARD2(caspar, core, struct pixel_format_desc);\r
virtual void end_layer() = 0;\r
\r
virtual boost::unique_future<boost::iterator_range<const uint8_t*>> operator()(const struct video_format_desc& format_desc) = 0;\r
- virtual spl::shared_ptr<core::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc) = 0;\r
+ virtual spl::shared_ptr<core::write_frame> create_frame(const void* tag, const struct pixel_format_desc& desc) = 0;\r
};\r
\r
}}
\ No newline at end of file
#include "audio/audio_mixer.h"\r
#include "image/image_mixer.h"\r
\r
-#include "gpu/image/image_mixer.h"\r
-#include "gpu/accelerator.h"\r
-#include "gpu/write_frame.h"\r
-\r
#include <common/env.h>\r
#include <common/concurrency/executor.h>\r
#include <common/diagnostics/graph.h>\r
};\r
\r
struct mixer::impl : boost::noncopyable\r
-{ \r
- spl::shared_ptr<gpu::accelerator> ogl_;\r
- \r
+{ \r
audio_mixer audio_mixer_;\r
- spl::shared_ptr<image_mixer> image_mixer_;\r
+ spl::shared_ptr<image_mixer> image_mixer_;\r
\r
std::unordered_map<int, blend_mode> blend_modes_;\r
\r
executor executor_;\r
\r
public:\r
- impl(const spl::shared_ptr<gpu::accelerator>& ogl) \r
- : ogl_(ogl)\r
- , audio_mixer_()\r
- , image_mixer_(spl::make_shared<gpu::image_mixer>(ogl_))\r
+ impl(spl::shared_ptr<image_mixer> image_mixer) \r
+ : audio_mixer_()\r
+ , image_mixer_(std::move(image_mixer))\r
, executor_(L"mixer")\r
{ \r
} \r
}\r
};\r
\r
-mixer::mixer(const spl::shared_ptr<gpu::accelerator>& ogl) \r
- : impl_(new impl(ogl)){}\r
+mixer::mixer(spl::shared_ptr<image_mixer> image_mixer) \r
+ : impl_(new impl(std::move(image_mixer))){}\r
void mixer::set_blend_mode(int index, blend_mode value){impl_->set_blend_mode(index, value);}\r
boost::unique_future<boost::property_tree::wptree> mixer::info() const{return impl_->info();}\r
spl::shared_ptr<const data_frame> mixer::operator()(std::map<int, spl::shared_ptr<draw_frame>> frames, const struct video_format_desc& format_desc){return (*impl_)(std::move(frames), format_desc);}\r
\r
FORWARD1(boost, template<typename> class unique_future);\r
FORWARD2(caspar, diagnostics, class graph);\r
-FORWARD3(caspar, core, gpu, class accelerator);\r
-FORWARD2(caspar, core, struct write_frame);\r
-FORWARD2(caspar, core, struct pixel_format_desc);\r
\r
namespace caspar { namespace core {\r
\r
class mixer sealed : boost::noncopyable\r
{\r
public: \r
- explicit mixer(const spl::shared_ptr<gpu::accelerator>& ogl);\r
+ explicit mixer(spl::shared_ptr<struct image_mixer> image_mixer);\r
\r
spl::shared_ptr<const struct data_frame> operator()(std::map<int, spl::shared_ptr<class draw_frame>> frames, const struct video_format_desc& format_desc);\r
\r
\r
boost::unique_future<boost::property_tree::wptree> info() const;\r
\r
- spl::shared_ptr<core::write_frame> create_frame(const void* tag, const core::pixel_format_desc& desc);\r
+ spl::shared_ptr<struct write_frame> create_frame(const void* tag, const struct pixel_format_desc& desc);\r
private:\r
struct impl;\r
spl::shared_ptr<impl> impl_;\r
#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/pixel_format.h>\r
-#include <core/mixer/gpu/write_frame.h>\r
+#include <core/frame/write_frame.h>\r
\r
#include <common/except.h>\r
\r
\r
#include "video_format.h"\r
\r
-#include "consumer/output.h"\r
+#include "producer/stage.h"\r
#include "mixer/mixer.h"\r
-#include "mixer/gpu/write_frame.h"\r
-#include "mixer/gpu/accelerator.h"\r
+#include "consumer/output.h"\r
#include "frame/data_frame.h"\r
-#include "producer/stage.h"\r
#include "frame/frame_factory.h"\r
\r
#include <common/diagnostics/graph.h>\r
#include <common/env.h>\r
#include <common/concurrency/lock.h>\r
+#include <common/concurrency/executor.h>\r
\r
#include <tbb/spin_mutex.h>\r
\r
struct video_channel::impl sealed : public frame_factory\r
{\r
reactive::basic_subject<spl::shared_ptr<const data_frame>> frame_subject_;\r
- const int index_;\r
\r
- mutable tbb::spin_mutex format_desc_mutex_;\r
- video_format_desc format_desc_;\r
+ const int index_;\r
+\r
+ mutable tbb::spin_mutex format_desc_mutex_;\r
+ video_format_desc format_desc_;\r
\r
- const spl::shared_ptr<gpu::accelerator> ogl_;\r
const spl::shared_ptr<diagnostics::graph> graph_;\r
\r
- const spl::shared_ptr<caspar::core::output> output_;\r
+ const spl::shared_ptr<caspar::core::output> output_;\r
const spl::shared_ptr<caspar::core::mixer> mixer_;\r
const spl::shared_ptr<caspar::core::stage> stage_; \r
\r
- boost::timer tick_timer_;\r
- boost::timer produce_timer_;\r
- boost::timer mix_timer_;\r
- boost::timer consume_timer_;\r
+ boost::timer tick_timer_;\r
+ boost::timer produce_timer_;\r
+ boost::timer mix_timer_;\r
+ boost::timer consume_timer_;\r
\r
- executor executor_;\r
+ executor executor_;\r
public:\r
- impl(int index, const video_format_desc& format_desc, const spl::shared_ptr<gpu::accelerator>& ogl) \r
+ impl(int index, const video_format_desc& format_desc, spl::shared_ptr<image_mixer> image_mixer) \r
: index_(index)\r
, format_desc_(format_desc)\r
- , ogl_(ogl)\r
, output_(new caspar::core::output(format_desc, index))\r
- , mixer_(new caspar::core::mixer(ogl))\r
+ , mixer_(new caspar::core::mixer(std::move(image_mixer)))\r
, stage_(new caspar::core::stage()) \r
, executor_(L"video_channel")\r
{\r
\r
void set_video_format_desc(const video_format_desc& format_desc)\r
{\r
- ogl_->gc();\r
lock(format_desc_mutex_, [&]\r
{\r
format_desc_ = format_desc;\r
}\r
};\r
\r
-video_channel::video_channel(int index, const video_format_desc& format_desc, const spl::shared_ptr<gpu::accelerator>& ogl) : impl_(new impl(index, format_desc, ogl)){}\r
+video_channel::video_channel(int index, const video_format_desc& format_desc, spl::shared_ptr<image_mixer> image_mixer) : impl_(new impl(index, format_desc, image_mixer)){}\r
spl::shared_ptr<stage> video_channel::stage() { return impl_->stage_;} \r
spl::shared_ptr<mixer> video_channel::mixer() { return impl_->mixer_;} \r
spl::shared_ptr<frame_factory> video_channel::frame_factory() { return impl_;} \r
\r
#include <boost/property_tree/ptree_fwd.hpp>\r
\r
-FORWARD3(caspar, core, gpu, class accelerator);\r
+FORWARD3(caspar, core, ogl, class accelerator);\r
\r
namespace caspar { namespace core {\r
\r
video_channel(const video_channel&);\r
video_channel& operator=(const video_channel&);\r
public:\r
- explicit video_channel(int index, const struct video_format_desc& format_desc, const spl::shared_ptr<gpu::accelerator>& ogl);\r
+ explicit video_channel(int index, const struct video_format_desc& format_desc, spl::shared_ptr<struct image_mixer> image_mixer);\r
\r
spl::shared_ptr<class stage> stage();\r
spl::shared_ptr<class mixer> mixer();\r
#include <common/log.h>\r
#include <common/param.h>\r
\r
-#include <core/mixer/gpu/write_frame.h>\r
+#include <core/frame/write_frame.h>\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/frame_factory.h>\r
\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/pixel_format.h>\r
#include <core/frame/frame_factory.h>\r
-#include <core/mixer/gpu/write_frame.h>\r
+#include <core/frame/write_frame.h>\r
\r
#include <common/env.h>\r
#include <common/except.h>\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/producer/frame_producer.h>\r
-#include <core/mixer/gpu/write_frame.h>\r
+#include <core/frame/write_frame.h>\r
\r
#include <common/except.h>\r
\r
{\r
if(FAILED(spFlash->put_WMode(TEXT("Transparent"))))\r
CASPAR_LOG(warning) << print_() << L" Failed to set flash container to transparent mode.";\r
- //spFlash->put_WMode(TEXT("GPU"));\r
+ //spFlash->put_WMode(TEXT("ogl"));\r
hResultQuality = spFlash->put_Quality2(TEXT("Best"));\r
}\r
if(SUCCEEDED(DispEventAdvise(spFlash, &DIID__IShockwaveFlashEvents)))\r
#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/pixel_format.h>\r
-#include <core/mixer/gpu/write_frame.h>\r
+#include <core/frame/write_frame.h>\r
\r
#include <common/env.h>\r
#include <common/concurrency/executor.h>\r
#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/pixel_format.h>\r
-#include <core/mixer/gpu/write_frame.h>\r
+#include <core/frame/write_frame.h>\r
\r
#include <common/env.h>\r
#include <common/log.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/frame_transform.h>\r
#include <core/frame/pixel_format.h>\r
-#include <core/mixer/gpu/write_frame.h>\r
+#include <core/frame/write_frame.h>\r
\r
#include <common/env.h>\r
#include <common/log.h>\r
#include <core/frame/draw_frame.h>\r
#include <core/frame/frame_factory.h>\r
#include <core/frame/pixel_format.h>\r
-#include <core/mixer/gpu/write_frame.h>\r
+#include <core/frame/write_frame.h>\r
#include <core/frame/data_frame.h>\r
\r
#include <common/except.h>\r
--- /dev/null
+/*\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG (www.casparcg.com).\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+* Author: Robert Nagy, ronag89@gmail.com\r
+*/\r
+\r
+#include "screen_consumer.h"\r
+\r
+#include <GL/glew.h>\r
+#include <SFML/Window.hpp>\r
+\r
+#include <common/diagnostics/graph.h>\r
+#include <common/gl/gl_check.h>\r
+#include <common/log.h>\r
+#include <common/spl/memory.h>\r
+#include <common/memory/memshfl.h>\r
+#include <common/utf.h>\r
+\r
+#include <ffmpeg/producer/filter/filter.h>\r
+\r
+#include <core/video_format.h>\r
+#include <core/frame/data_frame.h>\r
+#include <core/consumer/frame_consumer.h>\r
+\r
+#include <boost/timer.hpp>\r
+#include <boost/circular_buffer.hpp>\r
+#include <boost/foreach.hpp>\r
+#include <boost/thread.hpp>\r
+#include <boost/property_tree/ptree.hpp>\r
+\r
+#include <tbb/atomic.h>\r
+#include <tbb/concurrent_queue.h>\r
+\r
+#include <boost/assign.hpp>\r
+\r
+#include <asmlib.h>\r
+\r
+#include <algorithm>\r
+#include <vector>\r
+\r
+#if defined(_MSC_VER)\r
+#pragma warning (push)\r
+#pragma warning (disable : 4244)\r
+#endif\r
+extern "C" \r
+{\r
+ #define __STDC_CONSTANT_MACROS\r
+ #define __STDC_LIMIT_MACROS\r
+ #include <libavcodec/avcodec.h>\r
+ #include <libavutil/imgutils.h>\r
+}\r
+#if defined(_MSC_VER)\r
+#pragma warning (pop)\r
+#endif\r
+\r
+namespace caspar { namespace screen {\r
+ \r
+enum stretch\r
+{\r
+ none,\r
+ uniform,\r
+ fill,\r
+ uniform_to_fill\r
+};\r
+\r
+struct configuration\r
+{\r
+ enum aspect_ratio\r
+ {\r
+ aspect_4_3 = 0,\r
+ aspect_16_9,\r
+ aspect_invalid,\r
+ };\r
+ \r
+ std::wstring name;\r
+ int screen_index;\r
+ stretch stretch;\r
+ bool windowed;\r
+ bool auto_deinterlace;\r
+ bool key_only;\r
+ aspect_ratio aspect; \r
+ bool vsync;\r
+\r
+ configuration()\r
+ : name(L"ogl")\r
+ , screen_index(0)\r
+ , stretch(fill)\r
+ , windowed(true)\r
+ , auto_deinterlace(true)\r
+ , key_only(false)\r
+ , aspect(aspect_invalid)\r
+ , vsync(false)\r
+ {\r
+ }\r
+};\r
+\r
+struct screen_consumer : boost::noncopyable\r
+{ \r
+ const configuration config_;\r
+ core::video_format_desc format_desc_;\r
+ int channel_index_;\r
+\r
+ GLuint texture_;\r
+ std::vector<GLuint> pbos_;\r
+ \r
+ float width_;\r
+ float height_; \r
+ unsigned int screen_x_;\r
+ unsigned int screen_y_;\r
+ unsigned int screen_width_;\r
+ unsigned int screen_height_;\r
+ int square_width_;\r
+ int square_height_; \r
+ \r
+ sf::Window window_;\r
+ \r
+ spl::shared_ptr<diagnostics::graph> graph_;\r
+ boost::timer perf_timer_;\r
+ boost::timer tick_timer_;\r
+\r
+ tbb::concurrent_bounded_queue<std::shared_ptr<const core::data_frame>> frame_buffer_;\r
+\r
+ boost::thread thread_;\r
+ tbb::atomic<bool> is_running_;\r
+ \r
+ ffmpeg::filter filter_;\r
+public:\r
+ screen_consumer(const configuration& config, const core::video_format_desc& format_desc, int channel_index) \r
+ : config_(config)\r
+ , format_desc_(format_desc)\r
+ , channel_index_(channel_index)\r
+ , texture_(0)\r
+ , pbos_(2, 0) \r
+ , screen_width_(format_desc.width)\r
+ , screen_height_(format_desc.height)\r
+ , square_width_(format_desc.square_width)\r
+ , square_height_(format_desc.square_height)\r
+ , filter_(format_desc.field_mode == core::field_mode::progressive || !config.auto_deinterlace ? L"" : L"YADIF=0:-1", boost::assign::list_of(PIX_FMT_BGRA))\r
+ { \r
+ if(format_desc_.format == core::video_format::ntsc && config_.aspect == configuration::aspect_4_3)\r
+ {\r
+ // Use default values which are 4:3.\r
+ }\r
+ else\r
+ {\r
+ if(config_.aspect == configuration::aspect_16_9)\r
+ square_width_ = (format_desc.height*16)/9;\r
+ else if(config_.aspect == configuration::aspect_4_3)\r
+ square_width_ = (format_desc.height*4)/3;\r
+ }\r
+\r
+ frame_buffer_.set_capacity(2);\r
+ \r
+ graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f)); \r
+ graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));\r
+ graph_->set_color("dropped-frame", diagnostics::color(0.3f, 0.6f, 0.3f));\r
+ graph_->set_text(print());\r
+ diagnostics::register_graph(graph_);\r
+ \r
+ DISPLAY_DEVICE d_device = {sizeof(d_device), 0}; \r
+ std::vector<DISPLAY_DEVICE> displayDevices;\r
+ for(int n = 0; EnumDisplayDevices(NULL, n, &d_device, NULL); ++n)\r
+ displayDevices.push_back(d_device);\r
+\r
+ if(config_.screen_index >= displayDevices.size())\r
+ CASPAR_LOG(warning) << print() << L" Invalid screen-index: " << config_.screen_index;\r
+ \r
+ DEVMODE devmode = {};\r
+ if(!EnumDisplaySettings(displayDevices[config_.screen_index].DeviceName, ENUM_CURRENT_SETTINGS, &devmode))\r
+ CASPAR_LOG(warning) << print() << L" Could not find display settings for screen-index: " << config_.screen_index;\r
+ \r
+ screen_x_ = devmode.dmPosition.x;\r
+ screen_y_ = devmode.dmPosition.y;\r
+ screen_width_ = config_.windowed ? square_width_ : devmode.dmPelsWidth;\r
+ screen_height_ = config_.windowed ? square_height_ : devmode.dmPelsHeight;\r
+ \r
+ is_running_ = true;\r
+ thread_ = boost::thread([this]{run();});\r
+ }\r
+ \r
+ ~screen_consumer()\r
+ {\r
+ is_running_ = false;\r
+ frame_buffer_.try_push(core::data_frame::empty());\r
+ thread_.join();\r
+ }\r
+\r
+ void init()\r
+ {\r
+ if(!GLEW_VERSION_2_1)\r
+ BOOST_THROW_EXCEPTION(not_supported() << msg_info("Missing OpenGL 2.1 support."));\r
+\r
+ window_.Create(sf::VideoMode(screen_width_, screen_height_, 32), u8(print()), config_.windowed ? sf::Style::Resize | sf::Style::Close : sf::Style::Fullscreen);\r
+ window_.ShowMouseCursor(false);\r
+ window_.SetPosition(screen_x_, screen_y_);\r
+ window_.SetSize(screen_width_, screen_height_);\r
+ window_.SetActive();\r
+\r
+ GL(glEnable(GL_TEXTURE_2D));\r
+ GL(glDisable(GL_DEPTH_TEST)); \r
+ GL(glClearColor(0.0, 0.0, 0.0, 0.0));\r
+ GL(glViewport(0, 0, format_desc_.width, format_desc_.height));\r
+ GL(glLoadIdentity());\r
+ \r
+ calculate_aspect();\r
+ \r
+ GL(glGenTextures(1, &texture_));\r
+ GL(glBindTexture(GL_TEXTURE_2D, texture_));\r
+ GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));\r
+ GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));\r
+ GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP));\r
+ GL(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP));\r
+ GL(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, format_desc_.width, format_desc_.height, 0, GL_BGRA, GL_UNSIGNED_BYTE, 0));\r
+ GL(glBindTexture(GL_TEXTURE_2D, 0));\r
+ \r
+ GL(glGenBuffers(2, pbos_.data()));\r
+ \r
+ glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pbos_[0]);\r
+ glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, format_desc_.size, 0, GL_STREAM_DRAW_ARB);\r
+ glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pbos_[1]);\r
+ glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, format_desc_.size, 0, GL_STREAM_DRAW_ARB);\r
+ glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);\r
+ \r
+ if(config_.vsync)\r
+ {\r
+ auto wglSwapIntervalEXT = reinterpret_cast<void(APIENTRY*)(int)>(wglGetProcAddress("wglSwapIntervalEXT"));\r
+ if(wglSwapIntervalEXT)\r
+ {\r
+ wglSwapIntervalEXT(1);\r
+ CASPAR_LOG(info) << print() << " Successfully enabled vsync.";\r
+ }\r
+ else\r
+ CASPAR_LOG(info) << print() << " Failed to enable vsync.";\r
+ }\r
+\r
+ CASPAR_LOG(info) << print() << " Successfully Initialized.";\r
+ }\r
+\r
+ void uninit()\r
+ { \r
+ if(texture_)\r
+ glDeleteTextures(1, &texture_);\r
+\r
+ BOOST_FOREACH(auto& pbo, pbos_)\r
+ {\r
+ if(pbo)\r
+ glDeleteBuffers(1, &pbo);\r
+ }\r
+ }\r
+\r
+ void run()\r
+ {\r
+ try\r
+ {\r
+ init();\r
+\r
+ while(is_running_)\r
+ { \r
+ try\r
+ {\r
+ sf::Event e; \r
+ while(window_.GetEvent(e))\r
+ {\r
+ if(e.Type == sf::Event::Resized)\r
+ calculate_aspect();\r
+ else if(e.Type == sf::Event::Closed)\r
+ is_running_ = false;\r
+ }\r
+ \r
+ std::shared_ptr<const core::data_frame> frame;\r
+ frame_buffer_.pop(frame);\r
+ \r
+ perf_timer_.restart();\r
+ render(spl::make_shared_ptr(frame));\r
+ graph_->set_value("frame-time", perf_timer_.elapsed()*format_desc_.fps*0.5); \r
+\r
+ window_.Display();\r
+ \r
+ graph_->set_value("tick-time", tick_timer_.elapsed()*format_desc_.fps*0.5); \r
+ tick_timer_.restart();\r
+ }\r
+ catch(...)\r
+ {\r
+ CASPAR_LOG_CURRENT_EXCEPTION();\r
+ is_running_ = false;\r
+ }\r
+ }\r
+\r
+ uninit();\r
+ }\r
+ catch(...)\r
+ {\r
+ CASPAR_LOG_CURRENT_EXCEPTION();\r
+ }\r
+ }\r
+ \r
+ spl::shared_ptr<AVFrame> get_av_frame()\r
+ { \r
+ spl::shared_ptr<AVFrame> av_frame(avcodec_alloc_frame(), av_free); \r
+ avcodec_get_frame_defaults(av_frame.get());\r
+ \r
+ av_frame->linesize[0] = format_desc_.width*4; \r
+ av_frame->format = PIX_FMT_BGRA;\r
+ av_frame->width = format_desc_.width;\r
+ av_frame->height = format_desc_.height;\r
+ av_frame->interlaced_frame = format_desc_.field_mode != core::field_mode::progressive;\r
+ av_frame->top_field_first = format_desc_.field_mode == core::field_mode::upper ? 1 : 0;\r
+\r
+ return av_frame;\r
+ }\r
+\r
+ void render(const spl::shared_ptr<const core::data_frame>& frame)\r
+ { \r
+ if(static_cast<int>(frame->image_data().size()) != format_desc_.size)\r
+ return;\r
+ \r
+ auto av_frame = get_av_frame();\r
+ av_frame->data[0] = const_cast<uint8_t*>(frame->image_data().begin());\r
+\r
+ filter_.push(av_frame);\r
+ auto frames = filter_.poll_all();\r
+\r
+ if(frames.empty())\r
+ return;\r
+\r
+ av_frame = frames[0];\r
+\r
+ if(av_frame->linesize[0] != static_cast<int>(format_desc_.width*4))\r
+ {\r
+ const uint8_t *src_data[4] = {0};\r
+ A_memcpy(const_cast<uint8_t**>(&src_data[0]), av_frame->data, 4);\r
+ const int src_linesizes[4] = {0};\r
+ A_memcpy(const_cast<int*>(&src_linesizes[0]), av_frame->linesize, 4);\r
+\r
+ auto av_frame2 = get_av_frame();\r
+ av_image_alloc(av_frame2->data, av_frame2->linesize, av_frame2->width, av_frame2->height, PIX_FMT_BGRA, 16);\r
+ av_frame = spl::shared_ptr<AVFrame>(av_frame2.get(), [=](AVFrame*)\r
+ {\r
+ av_freep(&av_frame2->data[0]);\r
+ });\r
+\r
+ av_image_copy(av_frame2->data, av_frame2->linesize, src_data, src_linesizes, PIX_FMT_BGRA, av_frame2->width, av_frame2->height);\r
+ }\r
+\r
+ glBindTexture(GL_TEXTURE_2D, texture_);\r
+\r
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbos_[0]);\r
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, format_desc_.width, format_desc_.height, GL_BGRA, GL_UNSIGNED_BYTE, 0);\r
+\r
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbos_[1]);\r
+ glBufferData(GL_PIXEL_UNPACK_BUFFER, format_desc_.size, 0, GL_STREAM_DRAW);\r
+\r
+ auto ptr = glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY);\r
+ if(ptr)\r
+ {\r
+ if(config_.key_only)\r
+ aligned_memshfl(reinterpret_cast<char*>(ptr), av_frame->data[0], frame->image_data().size(), 0x0F0F0F0F, 0x0B0B0B0B, 0x07070707, 0x03030303);\r
+ else\r
+ A_memcpy(reinterpret_cast<char*>(ptr), av_frame->data[0], frame->image_data().size());\r
+\r
+ glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); // release the mapped buffer\r
+ }\r
+\r
+ glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);\r
+ \r
+ GL(glClear(GL_COLOR_BUFFER_BIT)); \r
+ glBegin(GL_QUADS);\r
+ glTexCoord2f(0.0f, 1.0f); glVertex2f(-width_, -height_);\r
+ glTexCoord2f(1.0f, 1.0f); glVertex2f( width_, -height_);\r
+ glTexCoord2f(1.0f, 0.0f); glVertex2f( width_, height_);\r
+ glTexCoord2f(0.0f, 0.0f); glVertex2f(-width_, height_);\r
+ glEnd();\r
+ \r
+ glBindTexture(GL_TEXTURE_2D, 0);\r
+\r
+ std::rotate(pbos_.begin(), pbos_.begin() + 1, pbos_.end());\r
+ }\r
+\r
+ bool send(const spl::shared_ptr<const core::data_frame>& frame)\r
+ {\r
+ if(!frame_buffer_.try_push(frame))\r
+ graph_->set_tag("dropped-frame");\r
+ return is_running_;\r
+ }\r
+ \r
+ std::wstring print() const\r
+ { \r
+ return config_.name + L"[" + boost::lexical_cast<std::wstring>(channel_index_) + L"|" + format_desc_.name + L"]";\r
+ }\r
+ \r
+ void calculate_aspect()\r
+ {\r
+ if(config_.windowed)\r
+ {\r
+ screen_height_ = window_.GetHeight();\r
+ screen_width_ = window_.GetWidth();\r
+ }\r
+ \r
+ GL(glViewport(0, 0, screen_width_, screen_height_));\r
+\r
+ std::pair<float, float> target_ratio = None();\r
+ if(config_.stretch == fill)\r
+ target_ratio = Fill();\r
+ else if(config_.stretch == uniform)\r
+ target_ratio = Uniform();\r
+ else if(config_.stretch == uniform_to_fill)\r
+ target_ratio = UniformToFill();\r
+\r
+ width_ = target_ratio.first;\r
+ height_ = target_ratio.second;\r
+ }\r
+ \r
+ std::pair<float, float> None()\r
+ {\r
+ float width = static_cast<float>(square_width_)/static_cast<float>(screen_width_);\r
+ float height = static_cast<float>(square_height_)/static_cast<float>(screen_height_);\r
+\r
+ return std::make_pair(width, height);\r
+ }\r
+\r
+ std::pair<float, float> Uniform()\r
+ {\r
+ float aspect = static_cast<float>(square_width_)/static_cast<float>(square_height_);\r
+ float width = std::min(1.0f, static_cast<float>(screen_height_)*aspect/static_cast<float>(screen_width_));\r
+ float height = static_cast<float>(screen_width_*width)/static_cast<float>(screen_height_*aspect);\r
+\r
+ return std::make_pair(width, height);\r
+ }\r
+\r
+ std::pair<float, float> Fill()\r
+ {\r
+ return std::make_pair(1.0f, 1.0f);\r
+ }\r
+\r
+ std::pair<float, float> UniformToFill()\r
+ {\r
+ float wr = static_cast<float>(square_width_)/static_cast<float>(screen_width_);\r
+ float hr = static_cast<float>(square_height_)/static_cast<float>(screen_height_);\r
+ float r_inv = 1.0f/std::min(wr, hr);\r
+\r
+ float width = wr*r_inv;\r
+ float height = hr*r_inv;\r
+\r
+ return std::make_pair(width, height);\r
+ }\r
+};\r
+\r
+\r
+struct screen_consumer_proxy : public core::frame_consumer\r
+{\r
+ const configuration config_;\r
+ std::unique_ptr<screen_consumer> consumer_;\r
+\r
+public:\r
+\r
+ screen_consumer_proxy(const configuration& config)\r
+ : config_(config){}\r
+ \r
+ ~screen_consumer_proxy()\r
+ {\r
+ if(consumer_)\r
+ {\r
+ auto str = print();\r
+ consumer_.reset();\r
+ CASPAR_LOG(info) << str << L" Successfully Uninitialized."; \r
+ }\r
+ }\r
+\r
+ // frame_consumer\r
+\r
+ virtual void initialize(const core::video_format_desc& format_desc, int channel_index) override\r
+ {\r
+ consumer_.reset();\r
+ consumer_.reset(new screen_consumer(config_, format_desc, channel_index));\r
+ CASPAR_LOG(info) << print() << L" Successfully Initialized."; \r
+ }\r
+ \r
+ virtual bool send(const spl::shared_ptr<const core::data_frame>& frame) override\r
+ {\r
+ return consumer_->send(frame);\r
+ }\r
+ \r
+ virtual std::wstring print() const override\r
+ {\r
+ return consumer_ ? consumer_->print() : L"[screen_consumer]";\r
+ }\r
+\r
+ virtual boost::property_tree::wptree info() const override\r
+ {\r
+ boost::property_tree::wptree info;\r
+ info.add(L"type", L"ogl-consumer");\r
+ info.add(L"key-only", config_.key_only);\r
+ info.add(L"windowed", config_.windowed);\r
+ info.add(L"auto-deinterlace", config_.auto_deinterlace);\r
+ return info;\r
+ }\r
+\r
+ virtual bool has_synchronization_clock() const override\r
+ {\r
+ return false;\r
+ }\r
+ \r
+ virtual int buffer_depth() const override\r
+ {\r
+ return 1;\r
+ }\r
+\r
+ virtual int index() const override\r
+ {\r
+ return 600;\r
+ }\r
+}; \r
+\r
+spl::shared_ptr<core::frame_consumer> create_consumer(const std::vector<std::wstring>& params)\r
+{\r
+ if(params.size() < 1 || params[0] != L"SCREEN")\r
+ return core::frame_consumer::empty();\r
+ \r
+ configuration config;\r
+ \r
+ auto device_it = std::find(params.begin(), params.end(), L"DEVICE");\r
+ if(device_it != params.end() && ++device_it != params.end())\r
+ config.screen_index = boost::lexical_cast<int>(*device_it);\r
+ \r
+ config.key_only = std::find(params.begin(), params.end(), L"WINDOWED") != params.end();\r
+ config.key_only = std::find(params.begin(), params.end(), L"KEY_ONLY") != params.end();\r
+\r
+ auto name_it = std::find(params.begin(), params.end(), L"NAME");\r
+ if(name_it != params.end() && ++name_it != params.end())\r
+ config.name = *name_it;\r
+\r
+ return spl::make_shared<screen_consumer_proxy>(config);\r
+}\r
+\r
+spl::shared_ptr<core::frame_consumer> create_consumer(const boost::property_tree::wptree& ptree) \r
+{\r
+ configuration config;\r
+ config.name = ptree.get(L"name", config.name);\r
+ config.screen_index = ptree.get(L"device", config.screen_index+1)-1;\r
+ config.windowed = ptree.get(L"windowed", config.windowed);\r
+ config.key_only = ptree.get(L"key-only", config.key_only);\r
+ config.auto_deinterlace = ptree.get(L"auto-deinterlace", config.auto_deinterlace);\r
+ config.vsync = ptree.get(L"vsync", config.vsync);\r
+ \r
+ auto stretch_str = ptree.get(L"stretch", L"default");\r
+ if(stretch_str == L"uniform")\r
+ config.stretch = stretch::uniform;\r
+ else if(stretch_str == L"uniform_to_fill")\r
+ config.stretch = stretch::uniform_to_fill;\r
+\r
+ auto aspect_str = ptree.get(L"aspect-ratio", L"default");\r
+ if(aspect_str == L"16:9")\r
+ config.aspect = configuration::aspect_16_9;\r
+ else if(aspect_str == L"4:3")\r
+ config.aspect = configuration::aspect_4_3;\r
+ \r
+ return spl::make_shared<screen_consumer_proxy>(config);\r
+}\r
+\r
+}}
\ No newline at end of file
--- /dev/null
+/*\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG (www.casparcg.com).\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+* Author: Robert Nagy, ronag89@gmail.com\r
+*/\r
+\r
+#pragma once\r
+\r
+#include <common/spl/memory.h>\r
+\r
+#include <vector>\r
+#include <boost/property_tree/ptree.hpp>\r
+\r
+namespace caspar { \r
+ \r
+namespace core {\r
+ struct frame_consumer;\r
+}\r
+\r
+namespace screen {\r
+\r
+\r
+spl::shared_ptr<core::frame_consumer> create_consumer(const std::vector<std::wstring>& params);\r
+spl::shared_ptr<core::frame_consumer> create_consumer(const boost::property_tree::wptree& ptree);\r
+\r
+}}
\ No newline at end of file
--- /dev/null
+/*\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG (www.casparcg.com).\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+* Author: Robert Nagy, ronag89@gmail.com\r
+*/\r
+\r
+#include "screen.h"\r
+\r
+#include "consumer/screen_consumer.h"\r
+\r
+#include <core/consumer/frame_consumer.h>\r
+\r
+namespace caspar { namespace screen {\r
+\r
+void init()\r
+{\r
+ caspar::core::register_consumer_factory([](const std::vector<std::wstring>& params){return create_consumer(params);});\r
+}\r
+\r
+}}
\ No newline at end of file
--- /dev/null
+/*\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
+*\r
+* This file is part of CasparCG (www.casparcg.com).\r
+*\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
+*\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
+*\r
+* Author: Robert Nagy, ronag89@gmail.com\r
+*/\r
+\r
+#pragma once\r
+\r
+namespace caspar { namespace screen {\r
+\r
+void init();\r
+\r
+}}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup Label="ProjectConfigurations">\r
+ <ProjectConfiguration Include="Debug|x64">\r
+ <Configuration>Debug</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ <ProjectConfiguration Include="Release|x64">\r
+ <Configuration>Release</Configuration>\r
+ <Platform>x64</Platform>\r
+ </ProjectConfiguration>\r
+ </ItemGroup>\r
+ <PropertyGroup Label="Globals">\r
+ <ProjectGuid>{88F974F0-D09F-4788-8CF8-F563209E60C1}</ProjectGuid>\r
+ <RootNamespace>screen</RootNamespace>\r
+ <Keyword>Win32Proj</Keyword>\r
+ <ProjectName>screen</ProjectName>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+ <ConfigurationType>StaticLibrary</ConfigurationType>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <UseDebugLibraries>false</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+ <ConfigurationType>StaticLibrary</ConfigurationType>\r
+ <CharacterSet>Unicode</CharacterSet>\r
+ <UseDebugLibraries>true</UseDebugLibraries>\r
+ </PropertyGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+ <ImportGroup Label="ExtensionSettings">\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />\r
+ </ImportGroup>\r
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">\r
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+ <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />\r
+ </ImportGroup>\r
+ <PropertyGroup Label="UserMacros" />\r
+ <PropertyGroup>\r
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)tmp\$(Configuration)\</IntDir>\r
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)tmp\$(Configuration)\</IntDir>\r
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\;..\..\dependencies64\bluefish\include\;..\..\dependencies64\boost\;..\..\dependencies64\tbb\include\;..\..\dependencies64\glew\include\;..\..\dependencies64\sfml\include\;..\..\dependencies64\ffmpeg\include\;..\..\dependencies64\asmlib\;$(IncludePath)</IncludePath>\r
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\;..\..\dependencies64\bluefish\include\;..\..\dependencies64\boost\;..\..\dependencies64\tbb\include\;..\..\dependencies64\glew\include\;..\..\dependencies64\sfml\include\;..\..\dependencies64\ffmpeg\include\;..\..\dependencies64\asmlib\;$(IncludePath)</IncludePath>\r
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)bin\$(Configuration)\</OutDir>\r
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)bin\$(Configuration)\</OutDir>\r
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)</TargetName>\r
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectName)</TargetName>\r
+ </PropertyGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+ <PreBuildEvent>\r
+ <Command>\r
+ </Command>\r
+ </PreBuildEvent>\r
+ <ClCompile>\r
+ <Optimization>Disabled</Optimization>\r
+ <AdditionalIncludeDirectories>../;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <MinimalRebuild>false</MinimalRebuild>\r
+ <ExceptionHandling>Async</ExceptionHandling>\r
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>\r
+ <SmallerTypeCheck>false</SmallerTypeCheck>\r
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>\r
+ <EnableEnhancedInstructionSet>NotSet</EnableEnhancedInstructionSet>\r
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>\r
+ <PrecompiledHeader>Use</PrecompiledHeader>\r
+ <BrowseInformation>true</BrowseInformation>\r
+ <WarningLevel>Level4</WarningLevel>\r
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
+ <PreprocessorDefinitions>TBB_USE_DEBUG;_SCL_SECURE_NO_WARNINGS;TBB_USE_CAPTURED_EXCEPTION=0;TBB_USE_ASSERT=1;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <TreatWarningAsError>true</TreatWarningAsError>\r
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
+ <FloatingPointModel>Fast</FloatingPointModel>\r
+ <ForcedIncludeFiles>common/compiler/vs/disable_silly_warnings.h</ForcedIncludeFiles>\r
+ </ClCompile>\r
+ <PostBuildEvent>\r
+ <Command>\r
+ </Command>\r
+ </PostBuildEvent>\r
+ <Lib />\r
+ </ItemDefinitionGroup>\r
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+ <PreBuildEvent>\r
+ <Command>\r
+ </Command>\r
+ </PreBuildEvent>\r
+ <ClCompile>\r
+ <Optimization>MaxSpeed</Optimization>\r
+ <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>\r
+ <IntrinsicFunctions>true</IntrinsicFunctions>\r
+ <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>\r
+ <AdditionalIncludeDirectories>../;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+ <ExceptionHandling>Async</ExceptionHandling>\r
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
+ <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\r
+ <RuntimeTypeInfo>true</RuntimeTypeInfo>\r
+ <PrecompiledHeader>Use</PrecompiledHeader>\r
+ <WarningLevel>Level4</WarningLevel>\r
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
+ <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
+ <PreprocessorDefinitions>_SCL_SECURE_NO_WARNINGS;TBB_USE_CAPTURED_EXCEPTION=0;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <WholeProgramOptimization>true</WholeProgramOptimization>\r
+ <TreatWarningAsError>true</TreatWarningAsError>\r
+ <OmitFramePointers>true</OmitFramePointers>\r
+ <FloatingPointModel>Fast</FloatingPointModel>\r
+ <ForcedIncludeFiles>common/compiler/vs/disable_silly_warnings.h</ForcedIncludeFiles>\r
+ </ClCompile>\r
+ <PreLinkEvent>\r
+ <Command>\r
+ </Command>\r
+ </PreLinkEvent>\r
+ <PostBuildEvent>\r
+ <Command>\r
+ </Command>\r
+ </PostBuildEvent>\r
+ <Lib>\r
+ <LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>\r
+ </Lib>\r
+ </ItemDefinitionGroup>\r
+ <ItemGroup>\r
+ <ProjectReference Include="..\..\common\common.vcxproj">\r
+ <Project>{02308602-7fe0-4253-b96e-22134919f56a}</Project>\r
+ </ProjectReference>\r
+ <ProjectReference Include="..\..\core\core.vcxproj">\r
+ <Project>{79388c20-6499-4bf6-b8b9-d8c33d7d4ddd}</Project>\r
+ </ProjectReference>\r
+ <ProjectReference Include="..\ffmpeg\ffmpeg.vcxproj">\r
+ <Project>{f6223af3-be0b-4b61-8406-98922ce521c2}</Project>\r
+ </ProjectReference>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="consumer\screen_consumer.cpp">\r
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>\r
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>\r
+ </ClCompile>\r
+ <ClCompile Include="screen.cpp">\r
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>\r
+ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="consumer\screen_consumer.h" />\r
+ <ClInclude Include="screen.h" />\r
+ </ItemGroup>\r
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+ <ImportGroup Label="ExtensionTargets">\r
+ </ImportGroup>\r
+</Project>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+ <ItemGroup>\r
+ <Filter Include="source">\r
+ <UniqueIdentifier>{17d30d8e-4f28-410d-b8f9-ce880259b11a}</UniqueIdentifier>\r
+ </Filter>\r
+ <Filter Include="source\consumer">\r
+ <UniqueIdentifier>{013ef3ed-0241-481f-b887-a54e4749045f}</UniqueIdentifier>\r
+ </Filter>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClCompile Include="consumer\screen_consumer.cpp">\r
+ <Filter>source\consumer</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="screen.cpp">\r
+ <Filter>source</Filter>\r
+ </ClCompile>\r
+ </ItemGroup>\r
+ <ItemGroup>\r
+ <ClInclude Include="consumer\screen_consumer.h">\r
+ <Filter>source\consumer</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="screen.h">\r
+ <Filter>source</Filter>\r
+ </ClInclude>\r
+ </ItemGroup>\r
+</Project>
\ No newline at end of file
#include <modules/flash/producer/cg_producer.h>\r
#include <modules/ffmpeg/producer/util/util.h>\r
#include <modules/image/image.h>\r
-#include <modules/ogl/ogl.h>\r
+#include <modules/screen/screen.h>\r
#include <modules/reroute/producer/reroute_producer.h>\r
\r
#include <algorithm>\r
\r
#include "server.h"\r
\r
+#include <accelerator/ogl/context.h>\r
+#include <accelerator/image/image_mixer.h>\r
+\r
#include <common/env.h>\r
#include <common/except.h>\r
#include <common/utf.h>\r
\r
-#include <core/mixer/gpu/accelerator.h>\r
#include <core/video_channel.h>\r
#include <core/video_format.h>\r
#include <core/producer/stage.h>\r
#include <modules/ffmpeg/ffmpeg.h>\r
#include <modules/flash/flash.h>\r
#include <modules/oal/oal.h>\r
-#include <modules/ogl/ogl.h>\r
+#include <modules/screen/screen.h>\r
#include <modules/image/image.h>\r
\r
#include <modules/oal/consumer/oal_consumer.h>\r
#include <modules/bluefish/consumer/bluefish_consumer.h>\r
#include <modules/decklink/consumer/decklink_consumer.h>\r
-#include <modules/ogl/consumer/ogl_consumer.h>\r
+#include <modules/screen/consumer/screen_consumer.h>\r
#include <modules/ffmpeg/consumer/ffmpeg_consumer.h>\r
\r
#include <protocol/amcp/AMCPProtocolStrategy.h>\r
\r
struct server::impl : boost::noncopyable\r
{\r
- spl::shared_ptr<gpu::accelerator> ogl_;\r
- std::vector<spl::shared_ptr<IO::AsyncEventServer>> async_servers_; \r
- std::vector<spl::shared_ptr<video_channel>> channels_;\r
+ spl::shared_ptr<accelerator::ogl::context> ogl_;\r
+ std::vector<spl::shared_ptr<IO::AsyncEventServer>> async_servers_; \r
+ std::vector<spl::shared_ptr<video_channel>> channels_;\r
\r
impl() \r
- : ogl_(gpu::accelerator::create())\r
+ : ogl_(accelerator::ogl::context::create())\r
{ \r
ffmpeg::init();\r
CASPAR_LOG(info) << L"Initialized ffmpeg module.";\r
oal::init(); \r
CASPAR_LOG(info) << L"Initialized oal module.";\r
\r
- ogl::init(); \r
+ screen::init(); \r
CASPAR_LOG(info) << L"Initialized ogl module.";\r
\r
image::init(); \r
if(format_desc.format == video_format::invalid)\r
BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Invalid video-mode."));\r
\r
- channels_.push_back(spl::make_shared<video_channel>(static_cast<int>(channels_.size()+1), format_desc, ogl_));\r
+ channels_.push_back(spl::make_shared<video_channel>(static_cast<int>(channels_.size()+1), format_desc, spl::make_shared<accelerator::ogl::image_mixer>(ogl_)));\r
\r
BOOST_FOREACH(auto& xml_consumer, xml_channel.second.get_child(L"consumers"))\r
{\r
{\r
auto name = xml_consumer.first;\r
if(name == L"screen")\r
- channels_.back()->output()->add(ogl::create_consumer(xml_consumer.second)); \r
+ channels_.back()->output()->add(caspar::screen::create_consumer(xml_consumer.second)); \r
if(name == L"bluefish") \r
channels_.back()->output()->add(bluefish::create_consumer(xml_consumer.second)); \r
else if(name == L"decklink") \r
\r
// Dummy diagnostics channel\r
if(env::properties().get(L"configuration.channel-grid", false))\r
- channels_.push_back(spl::make_shared<video_channel>(static_cast<int>(channels_.size()+1), core::video_format_desc(core::video_format::x576p2500), ogl_));\r
+ channels_.push_back(spl::make_shared<video_channel>(static_cast<int>(channels_.size()+1), core::video_format_desc(core::video_format::x576p2500), spl::make_shared<accelerator::ogl::image_mixer>(ogl_)));\r
}\r
\r
void setup_controllers(const boost::property_tree::wptree& pt)\r
</ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
+ <ProjectReference Include="..\accelerator\accelerator.vcxproj">\r
+ <Project>{8493d01a-f642-454c-8c44-88b38e2a3ef8}</Project>\r
+ </ProjectReference>\r
<ProjectReference Include="..\common\common.vcxproj">\r
<Project>{02308602-7fe0-4253-b96e-22134919f56a}</Project>\r
</ProjectReference>\r
<ProjectReference Include="..\modules\oal\oal.vcxproj">\r
<Project>{82ed7ed6-8a15-40ec-a8af-f5e712e0da68}</Project>\r
</ProjectReference>\r
- <ProjectReference Include="..\modules\ogl\ogl.vcxproj">\r
- <Project>{88f974f0-d09f-4788-8cf8-f563209e60c1}</Project>\r
- </ProjectReference>\r
<ProjectReference Include="..\modules\reroute\reroute.vcxproj">\r
<Project>{7d58bd57-fdd5-46e6-a23b-ed14b5314a0e}</Project>\r
</ProjectReference>\r
+ <ProjectReference Include="..\modules\screen\screen.vcxproj">\r
+ <Project>{88f974f0-d09f-4788-8cf8-f563209e60c1}</Project>\r
+ </ProjectReference>\r
<ProjectReference Include="..\protocol\protocol.vcxproj">\r
<Project>{2040b361-1fb6-488e-84a5-38a580da90de}</Project>\r
</ProjectReference>\r