]> git.sesse.net Git - casparcg/commitdiff
2.0.0.2:
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 1 Nov 2010 17:57:54 +0000 (17:57 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 1 Nov 2010 17:57:54 +0000 (17:57 +0000)
- Used SFML graphics for ogl consumer
- Used SFML for gl_check

git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@191 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

15 files changed:
casparcg.sln
common/common.vcxproj
common/common.vcxproj.filters
common/gl/gl_check.h [new file with mode: 0644]
common/gl/utility.h [deleted file]
core/consumer/ogl/ogl_consumer.cpp
core/core.vcxproj
core/core.vcxproj.filters
core/frame/gpu_composite_frame.cpp
core/frame/gpu_frame.cpp
core/frame/gpu_frame_processor.cpp
core/producer/ffmpeg/ffmpeg_producer.cpp
core/producer/ffmpeg/video/video_transformer.cpp
core/producer/flash/flash_producer.cpp
core/producer/image/image_loader.cpp

index b22b6f99646c685e32205a7ba6b8c0fc8ac37e66..554d62a1128ffb8e37df575b8e5a4aa506fc97e8 100644 (file)
@@ -5,8 +5,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "common\common.vcx
 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
@@ -25,10 +23,6 @@ Global
                {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
index 04dea56171715804eb76ddcc8d28bc49abcd3c8f..8d1421d3a692dfd725ca061f90b534ac5185ef87 100644 (file)
@@ -97,7 +97,7 @@
     <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
index e4ab23a71320d5932dd193ed851002d66b6d0d0c..4c4210e22e92d82b046d25d8236dd5a80e7c925c 100644 (file)
     <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
diff --git a/common/gl/gl_check.h b/common/gl/gl_check.h
new file mode 100644 (file)
index 0000000..c8c10a9
--- /dev/null
@@ -0,0 +1,122 @@
+////////////////////////////////////////////////////////////\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
diff --git a/common/gl/utility.h b/common/gl/utility.h
deleted file mode 100644 (file)
index df5a170..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#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
index c21ceb2b6726d5fe8b782e2efbf1139612920213..ae9be4b79745a32d200a111e1e6a1c02348fe8ec 100644 (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
@@ -99,28 +95,18 @@ struct consumer::implementation : boost::noncopyable
                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
@@ -131,40 +117,15 @@ struct consumer::implementation : boost::noncopyable
 \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
@@ -206,28 +167,25 @@ struct consumer::implementation : boost::noncopyable
        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
@@ -258,10 +216,10 @@ struct consumer::implementation : boost::noncopyable
                                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
@@ -274,7 +232,6 @@ struct consumer::implementation : boost::noncopyable
                \r
 \r
        GLuint dlist_;\r
-       GLuint texture_;\r
 \r
        bool windowed_;\r
        unsigned int screen_width_;\r
@@ -285,13 +242,16 @@ struct consumer::implementation : boost::noncopyable
        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
index 7224fbc440742fe482fcc0c2b4168f1f11723d2f..0919e1c77d68179369004a81b17f940bf7eb8e92 100644 (file)
@@ -77,7 +77,7 @@
       <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
index 7808a90b92a75300607cb34e63da153f18b3a321..8b9c590e867a3c63f1a662b705e0dab3fe793e6e 100644 (file)
     <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
index ebed4da062f963818e2efd66518faee5d4e0e17f..cb08e71a2b59ff72ffda1ffb261e68cebea3769c 100644 (file)
@@ -1,7 +1,7 @@
 #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
index b11875a17c9a677f9ffe4623b424d5849500de4b..a7f788fbe65d711b770233d8203b2d2fbfd57f77 100644 (file)
@@ -2,7 +2,7 @@
 \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
index bdc3c04536534758d8fe3882bc964caaa161ab39..5c260de85909986045212a53607abf7affce9741 100644 (file)
@@ -9,7 +9,7 @@
 #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
@@ -40,10 +40,10 @@ public:
 \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
@@ -78,15 +78,15 @@ struct gpu_frame_processor::implementation : boost::noncopyable
                {\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
@@ -131,7 +131,7 @@ struct gpu_frame_processor::implementation : boost::noncopyable
                                                                \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
@@ -186,28 +186,26 @@ struct gpu_frame_processor::implementation : boost::noncopyable
        \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
index 8dc858c495bc65e2950b61a3ea898a9038694ab7..f5d77506808cae2fbe2834b186ba702544887f48 100644 (file)
@@ -25,14 +25,13 @@ extern "C"
 \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
index 1c9d9fea379d888708a0da830374d43e2b030caf..78bb54961c9f2bc8054f19c416c062b47b069726 100644 (file)
@@ -45,14 +45,19 @@ struct video_transformer::implementation : boost::noncopyable
                        sws_context_.reset(sws_getContext(width, height, pix_fmt, width, height, \r
                                                                                                PIX_FMT_BGRA, SWS_BILINEAR, nullptr, nullptr, &param), 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
index d1fd2a170575fba46a9798af2cc3a307c5b446bd..9e3502ed0ea4c43e23f6358fb0e12f24c04cb9c7 100644 (file)
@@ -53,7 +53,7 @@ namespace caspar { namespace core { namespace flash {
 \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
@@ -67,8 +67,6 @@ struct flash_producer::implementation
                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
@@ -76,8 +74,11 @@ struct flash_producer::implementation
                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
@@ -283,6 +284,7 @@ struct flash_producer::implementation
        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
index 7fc7444626c5d361c8d3a56aa3bc7b498811e7b4..cb2c6ef31dabbe720ebc3b55bd817a81c7444fff 100644 (file)
 \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