EndProject\r
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "core\core.vcxproj", "{79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}"\r
EndProject\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "test\test.vcxproj", "{CE1CD805-3904-4E58-824E-09C027585991}"\r
-EndProject\r
Global\r
GlobalSection(SubversionScc) = preSolution\r
Svn-Managed = True\r
{79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}.Debug|Win32.Build.0 = Debug|Win32\r
{79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}.Release|Win32.ActiveCfg = Release|Win32\r
{79388C20-6499-4BF6-B8B9-D8C33D7D4DDD}.Release|Win32.Build.0 = Release|Win32\r
- {CE1CD805-3904-4E58-824E-09C027585991}.Debug|Win32.ActiveCfg = Debug|Win32\r
- {CE1CD805-3904-4E58-824E-09C027585991}.Debug|Win32.Build.0 = Debug|Win32\r
- {CE1CD805-3904-4E58-824E-09C027585991}.Release|Win32.ActiveCfg = Release|Win32\r
- {CE1CD805-3904-4E58-824E-09C027585991}.Release|Win32.Build.0 = Release|Win32\r
EndGlobalSection\r
GlobalSection(SolutionProperties) = preSolution\r
HideSolutionNode = FALSE\r
<ClInclude Include="config.h" />\r
<ClInclude Include="exception\exceptions.h" />\r
<ClInclude Include="exception\win32_exception.h" />\r
- <ClInclude Include="gl\utility.h" />\r
+ <ClInclude Include="gl\gl_check.h" />\r
<ClInclude Include="io\AsyncEventServer.h" />\r
<ClInclude Include="io\ClientInfo.h" />\r
<ClInclude Include="io\ProtocolStrategy.h" />\r
<ClInclude Include="utility\find_file.h">\r
<Filter>Source\utility</Filter>\r
</ClInclude>\r
- <ClInclude Include="gl\utility.h">\r
- <Filter>Source\gl</Filter>\r
- </ClInclude>\r
<ClInclude Include="utility\memory.h">\r
<Filter>Source\utility</Filter>\r
</ClInclude>\r
+ <ClInclude Include="gl\gl_check.h">\r
+ <Filter>Source\gl</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
</Project>
\ No newline at end of file
--- /dev/null
+////////////////////////////////////////////////////////////\r
+//\r
+// SFML - Simple and Fast Multimedia Library\r
+// Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)\r
+//\r
+// This software is provided 'as-is', without any express or implied warranty.\r
+// In no event will the authors be held liable for any damages arising from the use of this software.\r
+//\r
+// Permission is granted to anyone to use this software for any purpose,\r
+// including commercial applications, and to alter it and redistribute it freely,\r
+// subject to the following restrictions:\r
+//\r
+// 1. The origin of this software must not be misrepresented;\r
+// you must not claim that you wrote the original software.\r
+// If you use this software in a product, an acknowledgment\r
+// in the product documentation would be appreciated but is not required.\r
+//\r
+// 2. Altered source versions must be plainly marked as such,\r
+// and must not be misrepresented as being the original software.\r
+//\r
+// 3. This notice may not be removed or altered from any source distribution.\r
+//\r
+////////////////////////////////////////////////////////////\r
+\r
+#pragma once\r
+\r
+#include <Glee.h>\r
+\r
+#include "../exception/exceptions.h"\r
+#include "../log/log.h"\r
+\r
+#include <boost/lexical_cast.hpp>\r
+\r
+namespace caspar { namespace common { namespace gl {\r
+ \r
+inline void SMFL_GLCheckError(const std::string& expr, const std::string& File, unsigned int Line)\r
+{\r
+ // Get the last error\r
+ GLenum ErrorCode = glGetError();\r
+\r
+ if (ErrorCode != GL_NO_ERROR)\r
+ {\r
+ std::string Error = "unknown error";\r
+ std::string Desc = "no description";\r
+\r
+ // Decode the error code\r
+ switch (ErrorCode)\r
+ {\r
+ case GL_INVALID_ENUM :\r
+ {\r
+ Error = "GL_INVALID_ENUM";\r
+ Desc = "an unacceptable value has been specified for an enumerated argument";\r
+ break;\r
+ }\r
+\r
+ case GL_INVALID_VALUE :\r
+ {\r
+ Error = "GL_INVALID_VALUE";\r
+ Desc = "a numeric argument is out of range";\r
+ break;\r
+ }\r
+\r
+ case GL_INVALID_OPERATION :\r
+ {\r
+ Error = "GL_INVALID_OPERATION";\r
+ Desc = "the specified operation is not allowed in the current state";\r
+ break;\r
+ }\r
+\r
+ case GL_STACK_OVERFLOW :\r
+ {\r
+ Error = "GL_STACK_OVERFLOW";\r
+ Desc = "this command would cause a stack overflow";\r
+ break;\r
+ }\r
+\r
+ case GL_STACK_UNDERFLOW :\r
+ {\r
+ Error = "GL_STACK_UNDERFLOW";\r
+ Desc = "this command would cause a stack underflow";\r
+ break;\r
+ }\r
+\r
+ case GL_OUT_OF_MEMORY :\r
+ {\r
+ Error = "GL_OUT_OF_MEMORY";\r
+ Desc = "there is not enough memory left to execute the command";\r
+ break;\r
+ }\r
+\r
+ case GL_INVALID_FRAMEBUFFER_OPERATION_EXT :\r
+ {\r
+ Error = "GL_INVALID_FRAMEBUFFER_OPERATION_EXT";\r
+ Desc = "the object bound to FRAMEBUFFER_BINDING_EXT is not \"framebuffer complete\"";\r
+ break;\r
+ }\r
+ }\r
+\r
+ // Log the error\r
+ CASPAR_LOG(error) << "An internal OpenGL call failed in "\r
+ << File.substr(File.find_last_of("\\/") + 1).c_str() << " (" << Line << ") : "\r
+ << Error.c_str() << ", " << Desc.c_str()\r
+ << ", " << expr.c_str()\r
+ << std::endl;\r
+ }\r
+}\r
+\r
+#ifdef _DEBUG\r
+ \r
+#define CASPAR_GL_EXPR_STR(expr) #expr\r
+\r
+#define CASPAR_GL_CHECK(expr) \\r
+ do \\r
+ { \\r
+ (expr); \\r
+ caspar::common::gl::SMFL_GLCheckError(CASPAR_GL_EXPR_STR(expr), __FILE__, __LINE__);\\r
+ }while(0);\r
+#else\r
+#define CASPAR_GL_CHECK(expr) expr\r
+#endif\r
+\r
+}}}
\ No newline at end of file
+++ /dev/null
-#pragma once\r
-\r
-#include <Glee.h>\r
-\r
-#include "../exception/exceptions.h"\r
-\r
-#include <boost/lexical_cast.hpp>\r
-\r
-namespace caspar { namespace common { namespace gpu {\r
-\r
-#ifdef _DEBUG\r
- \r
-#define CASPAR_GL_CHECK(expr) \\r
- do \\r
- { \\r
- expr; \\r
- auto error = glGetError(); \\r
- if(error != GL_NO_ERROR) \\r
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(boost::lexical_cast<std::string>(glGetError()))); \\r
- }while(0);\r
-#else\r
-#define CASPAR_GL_CHECK(expr) expr\r
-#endif\r
-\r
-}}}
\ No newline at end of file
#include "../../frame/frame_format.h"\r
#include "../../frame/gpu_frame.h"\r
#include "../../../common/utility/memory.h"\r
+#include "../../../common/gl/gl_check.h"\r
\r
#include <boost/thread.hpp>\r
\r
#include <Glee.h>\r
#include <SFML/Window.hpp>\r
+#include <SFML/Graphics.hpp>\r
\r
#include <windows.h>\r
\r
namespace caspar { namespace core { namespace ogl{ \r
\r
-void GL_CHECK()\r
-{\r
- if(glGetError() != GL_NO_ERROR)\r
- BOOST_THROW_EXCEPTION(ogl_error() << msg_info(boost::lexical_cast<std::string>(glGetError())));\r
-}\r
-\r
struct consumer::implementation : boost::noncopyable\r
{ \r
implementation(const frame_format_desc& format_desc, unsigned int screen_index, stretch stretch, bool windowed) \r
- : format_desc_(format_desc), stretch_(stretch), texture_(0), pbo_index_(0), screen_width_(0), screen_height_(0), windowed_(windowed)\r
+ : format_desc_(format_desc), stretch_(stretch), pbo_index_(0), screen_width_(0), screen_height_(0), windowed_(windowed)\r
{\r
pbos_[0] = pbos_[1] = 0;\r
\r
frame_buffer_.push(nullptr),\r
thread_.join();\r
\r
- if(texture_)\r
- glDeleteTextures(1, &texture_);\r
if(pbos_[0] && pbos_[1])\r
glDeleteBuffers(2, pbos_);\r
}\r
\r
void init() \r
{\r
- window_.reset(new sf::Window());\r
- window_->Create(sf::VideoMode(format_desc_.width, format_desc_.height, 32), "CasparCG", windowed_ ? sf::Style::Titlebar : sf::Style::Fullscreen);\r
- window_->ShowMouseCursor(false);\r
- window_->SetPosition(screenX_, screenY_);\r
- window_->SetSize(screen_width_, screen_height_);\r
- window_->SetActive();\r
-\r
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);\r
- glEnable(GL_TEXTURE_2D);\r
- \r
- glViewport(0, 0, screen_width_, screen_height_);\r
- \r
- GL_CHECK();\r
- \r
+ window_.Create(sf::VideoMode(format_desc_.width, format_desc_.height, 32), "CasparCG", windowed_ ? sf::Style::Titlebar : sf::Style::Fullscreen);\r
+ window_.ShowMouseCursor(false);\r
+ window_.SetPosition(screenX_, screenY_);\r
+ window_.SetSize(screen_width_, screen_height_);\r
+ window_.SetActive();\r
+ \r
std::pair<float, float> target_ratio = None();\r
if(stretch_ == ogl::fill)\r
target_ratio = Fill();\r
\r
float wSize = target_ratio.first;\r
float hSize = target_ratio.second;\r
-\r
- dlist_ = glGenLists(1);\r
- GL_CHECK();\r
-\r
- glNewList(dlist_, GL_COMPILE);\r
- glBegin(GL_QUADS);\r
- glTexCoord2f(0.0f, 1.0f); glVertex2f(-wSize, -hSize);\r
- glTexCoord2f(1.0f, 1.0f); glVertex2f( wSize, -hSize);\r
- glTexCoord2f(1.0f, 0.0f); glVertex2f( wSize, hSize);\r
- glTexCoord2f(0.0f, 0.0f); glVertex2f(-wSize, hSize);\r
- glEnd(); \r
- glEndList();\r
- GL_CHECK();\r
- \r
- glGenTextures(1, &texture_); \r
- GL_CHECK();\r
-\r
- glBindTexture( GL_TEXTURE_2D, texture_);\r
- GL_CHECK();\r
-\r
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );\r
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );\r
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP );\r
- glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP );\r
-\r
- glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, format_desc_.width, format_desc_.height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);\r
- GL_CHECK();\r
-\r
- glGenBuffersARB(2, pbos_);\r
- GL_CHECK();\r
- glBindBuffer(GL_PIXEL_PACK_BUFFER, pbos_[0]);\r
- glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, format_desc_.size, 0, GL_STREAM_DRAW);\r
- glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pbos_[1]);\r
- glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, format_desc_.size, 0, GL_STREAM_DRAW); \r
+ \r
+ image_.Create(format_desc_.width, format_desc_.height);\r
+ sprite_.SetImage(image_);\r
+ \r
+ CASPAR_GL_CHECK(glGenBuffersARB(2, pbos_));\r
+ CASPAR_GL_CHECK(glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pbos_[0]));\r
+ CASPAR_GL_CHECK(glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, format_desc_.size, 0, GL_STREAM_DRAW));\r
+ CASPAR_GL_CHECK(glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, pbos_[1]));\r
+ CASPAR_GL_CHECK(glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, format_desc_.size, 0, GL_STREAM_DRAW)); \r
\r
pbo_index_ = 0;\r
}\r
void render(const gpu_frame_ptr& frame)\r
{ \r
// Render\r
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);\r
- glClearColor(0.0f, 0.0f, 0.0f, 0.0f);\r
- glLoadIdentity();\r
- \r
- glBindTexture(GL_TEXTURE_2D, texture_);\r
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbos_[pbo_index_]);\r
+ window_.Clear();\r
\r
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, format_desc_.width, format_desc_.height, GL_BGRA, GL_UNSIGNED_BYTE, 0);\r
+ image_.Bind();\r
+ CASPAR_GL_CHECK(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbos_[pbo_index_])); \r
+ CASPAR_GL_CHECK(glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, format_desc_.width, format_desc_.height, GL_BGRA, GL_UNSIGNED_BYTE, 0));\r
\r
- glCallList(dlist_); \r
+ window_.Draw(sprite_);\r
\r
// Update\r
int nextPboIndex = pbo_index_ ^ 1;\r
\r
- glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbos_[nextPboIndex]);\r
- glBufferData(GL_PIXEL_UNPACK_BUFFER, format_desc_.size, NULL, GL_STREAM_DRAW);\r
+ CASPAR_GL_CHECK(glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pbos_[nextPboIndex]));\r
+ CASPAR_GL_CHECK(glBufferData(GL_PIXEL_UNPACK_BUFFER, format_desc_.size, NULL, GL_STREAM_DRAW));\r
GLubyte* ptr = static_cast<GLubyte*>(glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_WRITE_ONLY));\r
\r
if(ptr != NULL) \r
{\r
common::copy(ptr, frame->data(), frame->size());\r
- glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);\r
+ CASPAR_GL_CHECK(glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER));\r
}\r
\r
// Swap\r
if(frame != nullptr)\r
{\r
sf::Event e;\r
- while(window_->GetEvent(e)){}\r
- window_->SetActive();\r
+ while(window_.GetEvent(e)){}\r
+ window_.SetActive();\r
render(frame);\r
- window_->Display();\r
+ window_.Display();\r
}\r
}\r
catch(...)\r
\r
\r
GLuint dlist_;\r
- GLuint texture_;\r
\r
bool windowed_;\r
unsigned int screen_width_;\r
GLuint pbos_[2];\r
int pbo_index_;\r
\r
- std::unique_ptr<sf::Window> window_;\r
stretch stretch_;\r
frame_format_desc format_desc_;\r
\r
std::exception_ptr exception_;\r
boost::thread thread_;\r
tbb::concurrent_bounded_queue<gpu_frame_ptr> frame_buffer_;\r
+\r
+ sf::Image image_;\r
+ sf::Sprite sprite_;\r
+ sf::RenderWindow window_;\r
};\r
\r
consumer::consumer(const frame_format_desc& format_desc, unsigned int screen_index, stretch stretch, bool windowed)\r
<MultiProcessorCompilation>true</MultiProcessorCompilation>\r
</ClCompile>\r
<Link>\r
- <AdditionalDependencies>BlueHancUtils_d.lib;sfml-audio-d.lib;sfml-window-d.lib;OpenGL32.lib;FreeImage.lib;GLee.lib;Winmm.lib;Ws2_32.lib;BlueVelvet3_d.lib;avformat-52.lib;avcodec-52.lib;avutil-50.lib;swscale-0.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ <AdditionalDependencies>BlueHancUtils_d.lib;sfml-audio-d.lib;sfml-window-d.lib;sfml-graphics-d.lib;OpenGL32.lib;FreeImage.lib;GLee.lib;Winmm.lib;Ws2_32.lib;BlueVelvet3_d.lib;avformat-52.lib;avcodec-52.lib;avutil-50.lib;swscale-0.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
<Version>\r
</Version>\r
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
</Command>\r
</PreLinkEvent>\r
<Link>\r
- <AdditionalDependencies>BlueHancUtils.lib;sfml-audio.lib;sfml-window.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;Bluevelvet3.lib;avformat-52.lib;avcodec-52.lib;avutil-50.lib;SWSCALE-0.lib;tbb.lib;Glee.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+ <AdditionalDependencies>BlueHancUtils.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;Bluevelvet3.lib;avformat-52.lib;avcodec-52.lib;avutil-50.lib;SWSCALE-0.lib;tbb.lib;Glee.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
<Version>\r
</Version>\r
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
<ClInclude Include="producer\ffmpeg\input.h" />\r
<ClInclude Include="producer\ffmpeg\packet.h" />\r
<ClInclude Include="producer\ffmpeg\video\video_decoder.h" />\r
- <ClInclude Include="producer\ffmpeg\video\video_deinterlacer.h" />\r
<ClInclude Include="producer\ffmpeg\video\video_transformer.h" />\r
<ClInclude Include="producer\flash\axflash.h" />\r
<ClInclude Include="producer\flash\bitmap.h" />\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../stdafx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../stdafx.h</PrecompiledHeaderFile>\r
</ClCompile>\r
- <ClCompile Include="producer\ffmpeg\video\video_deinterlacer.cpp">\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../stdafx.h</PrecompiledHeaderFile>\r
- <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../stdafx.h</PrecompiledHeaderFile>\r
- </ClCompile>\r
<ClCompile Include="producer\ffmpeg\video\video_transformer.cpp">\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../../../stdafx.h</PrecompiledHeaderFile>\r
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../../stdafx.h</PrecompiledHeaderFile>\r
<ClInclude Include="producer\ffmpeg\video\video_decoder.h">\r
<Filter>Source\producer\ffmpeg\video</Filter>\r
</ClInclude>\r
- <ClInclude Include="producer\ffmpeg\video\video_deinterlacer.h">\r
- <Filter>Source\producer\ffmpeg\video</Filter>\r
- </ClInclude>\r
<ClInclude Include="producer\image\image_loader.h">\r
<Filter>Source\producer\image</Filter>\r
</ClInclude>\r
<ClCompile Include="producer\ffmpeg\audio\audio_decoder.cpp">\r
<Filter>Source\producer\ffmpeg\audio</Filter>\r
</ClCompile>\r
- <ClCompile Include="producer\ffmpeg\video\video_deinterlacer.cpp">\r
- <Filter>Source\producer\ffmpeg\video</Filter>\r
- </ClCompile>\r
<ClCompile Include="producer\ffmpeg\video\video_decoder.cpp">\r
<Filter>Source\producer\ffmpeg\video</Filter>\r
</ClCompile>\r
#include "../StdAfx.h"\r
\r
#include "gpu_composite_frame.h"\r
-#include "../../common/gl/utility.h"\r
+#include "../../common/gl/gl_check.h"\r
#include "../../common/utility/memory.h"\r
\r
#include <algorithm>\r
\r
#include "gpu_frame.h"\r
#include "../../common/utility/memory.h"\r
-#include "../../common/gl/utility.h"\r
+#include "../../common/gl/gl_check.h"\r
\r
namespace caspar { namespace core {\r
\r
#include "../../common/exception/exceptions.h"\r
#include "../../common/concurrency/executor.h"\r
#include "../../common/utility/memory.h"\r
-#include "../../common/gl/utility.h"\r
+#include "../../common/gl/gl_check.h"\r
\r
#include <Glee.h>\r
#include <SFML/Window.hpp>\r
\r
CASPAR_GL_CHECK(glBindTexture(GL_TEXTURE_2D, texture_));\r
\r
- CASPAR_GL_CHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));\r
+ CASPAR_GL_CHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));\r
CASPAR_GL_CHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));\r
- CASPAR_GL_CHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));\r
- CASPAR_GL_CHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));\r
+ //CASPAR_GL_CHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));\r
+ //CASPAR_GL_CHECK(glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));\r
\r
CASPAR_GL_CHECK(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL));\r
\r
{\r
ogl_context_.reset(new sf::Context());\r
ogl_context_->SetActive(true);\r
- glEnable(GL_POLYGON_STIPPLE);\r
- glEnable(GL_TEXTURE_2D);\r
- glEnable(GL_BLEND);\r
- glDisable(GL_DEPTH_TEST);\r
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); \r
- glClearColor(0.0, 0.0, 0.0, 0.0);\r
- glViewport(0, 0, format_desc_.width, format_desc_.height);\r
- glLoadIdentity();\r
-\r
+ CASPAR_GL_CHECK(glEnable(GL_POLYGON_STIPPLE));\r
+ CASPAR_GL_CHECK(glEnable(GL_TEXTURE_2D));\r
+ CASPAR_GL_CHECK(glEnable(GL_BLEND));\r
+ CASPAR_GL_CHECK(glDisable(GL_DEPTH_TEST));\r
+ CASPAR_GL_CHECK(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); \r
+ CASPAR_GL_CHECK(glClearColor(0.0, 0.0, 0.0, 0.0));\r
+ CASPAR_GL_CHECK(glViewport(0, 0, format_desc_.width, format_desc_.height));\r
+ glLoadIdentity(); \r
+ \r
reading_.resize(2, std::make_shared<gpu_composite_frame>(format_desc_.width, format_desc_.height));\r
writing_.resize(2, std::make_shared<gpu_composite_frame>(format_desc_.width, format_desc_.height));\r
fbo_ = std::make_shared<frame_buffer>(format_desc_.width, format_desc_.height);\r
\r
// 4. Output to external buffer\r
if(output_frame_->read_unlock())\r
- finished_frames_.push(output_frame_);\r
+ output_.push(output_frame_);\r
\r
// 3. Draw to framebuffer and start asynchronous DMA transfer to page-locked memory \r
// Clear framebuffer\r
\r
void pop(gpu_frame_ptr& frame)\r
{\r
- finished_frames_.pop(frame);\r
+ output_.pop(frame);\r
}\r
\r
tbb::concurrent_unordered_map<size_t, tbb::concurrent_bounded_queue<gpu_frame_ptr>> reading_frame_pools_;\r
\r
frame_buffer_ptr fbo_;\r
\r
- tbb::concurrent_bounded_queue<gpu_composite_frame_ptr> input_;\r
+ tbb::concurrent_bounded_queue<gpu_composite_frame_ptr> input_;\r
+ tbb::concurrent_bounded_queue<gpu_frame_ptr> output_; \r
\r
size_t index_;\r
- std::vector<gpu_composite_frame_ptr> reading_;\r
- std::vector<gpu_composite_frame_ptr> writing_;\r
+ std::vector<gpu_composite_frame_ptr> reading_;\r
+ std::vector<gpu_composite_frame_ptr> writing_;\r
\r
- gpu_frame_ptr output_frame_;\r
- \r
+ gpu_frame_ptr output_frame_; \r
frame_format_desc format_desc_;\r
\r
std::unique_ptr<sf::Context> ogl_context_;\r
\r
common::executor executor_;\r
-\r
- tbb::concurrent_bounded_queue<gpu_frame_ptr> finished_frames_; \r
};\r
\r
gpu_frame_processor::gpu_frame_processor(const frame_format_desc& format_desc) : impl_(new implementation(format_desc)){}\r
\r
#include "audio/audio_decoder.h"\r
#include "video/video_decoder.h"\r
-#include "video/video_deinterlacer.h"\r
#include "video/video_transformer.h"\r
\r
#include "../../frame/frame_format.h"\r
#include "../../../common/utility/find_file.h"\r
-#include "../../server.h"\r
#include "../../../common/utility/memory.h"\r
#include "../../../common/utility/scope_exit.h"\r
+#include "../../server.h"\r
\r
#include <tbb/mutex.h>\r
#include <tbb/parallel_invoke.h>\r
sws_context_.reset(sws_getContext(width, height, pix_fmt, width, height, \r
PIX_FMT_BGRA, SWS_BILINEAR, nullptr, nullptr, ¶m), sws_freeContext);\r
}\r
- \r
+\r
+ //size_t pic_size = avpicture_get_size(PIX_FMT_YUV411P, width, height);\r
+\r
+ //size_t pic_size_sqr = static_cast<size_t>(sqrt(static_cast<double>(pic_size)))/4;\r
+ //pic_size_sqr += pic_size_sqr % 2;\r
+\r
video_packet->frame = factory_->create_frame(width, height);\r
AVFrame av_frame; \r
avcodec_get_frame_defaults(&av_frame);\r
- avpicture_fill(reinterpret_cast<AVPicture*>(&av_frame), video_packet->frame->data(), PIX_FMT_BGRA, width, height);\r
- \r
+ size_t size = avpicture_fill(reinterpret_cast<AVPicture*>(&av_frame), video_packet->frame->data(), PIX_FMT_BGRA, width, height);\r
+ \r
sws_scale(sws_context_.get(), video_packet->decoded_frame->data, video_packet->decoded_frame->linesize, 0, height, av_frame.data, av_frame.linesize);\r
- \r
+ \r
if(video_packet->codec->id == CODEC_ID_DVVIDEO) // Move up one field\r
video_packet->frame->translate(0.0f, 1.0/static_cast<double>(video_packet->format_desc.height));\r
\r
\r
using namespace boost::assign;\r
\r
-// This is needed in order to make CComObject work since this is not a real ATL project\r
+// NOTE: This is needed in order to make CComObject work since this is not a real ATL project\r
CComModule _AtlModule;\r
extern __declspec(selectany) CAtlModule* _pAtlModule = &_AtlModule;\r
\r
BOOST_THROW_EXCEPTION(file_not_found() << boost::errinfo_file_name(common::narrow(filename)));\r
\r
frame_buffer_.set_capacity(flash_producer::DEFAULT_BUFFER_SIZE); \r
-\r
- start();\r
}\r
\r
~implementation() \r
stop();\r
}\r
\r
- void start()\r
+ void start(bool force = true)\r
{ \r
+ if(executor_.is_running() && !force)\r
+ return;\r
+\r
try\r
{\r
is_empty_ = true;\r
void initialize(const frame_factory_ptr& factory)\r
{\r
factory_ = factory;\r
+ start(false);\r
}\r
\r
typedef tbb::concurrent_bounded_queue<bitmap_ptr> bitmap_pool;\r
\r
namespace caspar { namespace core { namespace image{\r
\r
+#include <boost/thread/once.hpp>\r
+\r
struct FreeImage_initializer\r
{\r
FreeImage_initializer(){FreeImage_Initialise(true);}\r
~FreeImage_initializer(){FreeImage_DeInitialise();}\r
-};\r
-\r
-FreeImage_initializer init;\r
+} init;\r
\r
std::shared_ptr<FIBITMAP> load_image(const std::string& filename)\r
{\r