]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 4 Feb 2011 14:22:45 +0000 (14:22 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 4 Feb 2011 14:22:45 +0000 (14:22 +0000)
common/common.vcxproj
common/common.vcxproj.filters
common/diagnostics/graph.cpp
common/log/log.cpp
core/consumer/bluefish/bluefish_consumer.cpp
core/producer/transition/transition_producer.cpp
protocol/amcp/AMCPCommandsImpl.cpp
shell/caspar.config

index 90d6ab280fd73a3884287dc1f05fb406666f7b1f..e3dfb72d24cc8d253a16317c7a829843d38ac65a 100644 (file)
   <ItemGroup>\r
     <ClInclude Include="compiler\vs\disable_silly_warnings.h" />\r
     <ClInclude Include="concurrency\executor.h" />\r
-    <ClInclude Include="diagnostics\context.h" />\r
     <ClInclude Include="diagnostics\graph.h" />\r
-    <ClInclude Include="diagnostics\sink_backend.h" />\r
     <ClInclude Include="exception\exceptions.h" />\r
     <ClInclude Include="exception\win32_exception.h" />\r
     <ClInclude Include="gl\gl_check.h" />\r
     <ClInclude Include="utility\timer.h" />\r
   </ItemGroup>\r
   <ItemGroup>\r
-    <ClCompile Include="diagnostics\context.cpp">\r
-      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
-      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
-      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
-    </ClCompile>\r
     <ClCompile Include="diagnostics\graph.cpp">\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
     </ClCompile>\r
-    <ClCompile Include="diagnostics\sink_backend.cpp">\r
-      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
-      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
-      <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
-    </ClCompile>\r
     <ClCompile Include="exception\win32_exception.cpp">\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
index 9c9cca0a24366b53cfb0bb8fc8e74b4815e43c57..658daa79cbb19c96824559812eff5c130274fa46 100644 (file)
     <ClCompile Include="diagnostics\graph.cpp">\r
       <Filter>Source\diagnostics</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="diagnostics\context.cpp">\r
-      <Filter>Source\diagnostics</Filter>\r
-    </ClCompile>\r
-    <ClCompile Include="diagnostics\sink_backend.cpp">\r
-      <Filter>Source\log</Filter>\r
-    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="exception\exceptions.h">\r
     <ClInclude Include="diagnostics\graph.h">\r
       <Filter>Source\diagnostics</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="diagnostics\context.h">\r
-      <Filter>Source\diagnostics</Filter>\r
-    </ClInclude>\r
-    <ClInclude Include="diagnostics\sink_backend.h">\r
-      <Filter>Source\log</Filter>\r
-    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
index e5529a91d46420c8384b15e61ebd7e01128f6c9b..2f163840eb847828a2182cf470605254620ef17e 100644 (file)
@@ -1,7 +1,6 @@
 #include "../stdafx.h"\r
 \r
 #include "graph.h"\r
-#include "context.h"\r
 \r
 #pragma warning (disable : 4244)\r
 \r
 #include <array>\r
 \r
 namespace caspar { namespace diagnostics {\r
+               \r
+struct drawable : public sf::Drawable\r
+{\r
+       virtual ~drawable(){}\r
+       virtual void render(sf::RenderTarget& target) = 0;\r
+       virtual void Render(sf::RenderTarget& target) const { const_cast<drawable*>(this)->render(target);}\r
+};\r
+\r
+class context : public drawable\r
+{      \r
+       timer timer_;\r
+       sf::RenderWindow window_;\r
+       \r
+       std::list<std::shared_ptr<drawable>> drawables_;\r
+               \r
+       executor executor_;\r
+public:                                        \r
+\r
+       template<typename Func>\r
+       static auto begin_invoke(Func&& func) -> boost::unique_future<decltype(func())> // noexcept\r
+       {       \r
+               return get_instance().executor_.begin_invoke(std::forward<Func>(func)); \r
+       }\r
+\r
+       static void register_drawable(const std::shared_ptr<drawable>& drawable)\r
+       {\r
+               begin_invoke([=]\r
+               {\r
+                       get_instance().do_register_drawable(drawable);\r
+               });\r
+       }\r
+                       \r
+private:\r
+       context()\r
+       {\r
+               executor_.start();\r
+               executor_.begin_invoke([this]\r
+               {\r
+                       window_.Create(sf::VideoMode(600, 1000), "CasparCG Diagnostics");\r
+                       window_.SetPosition(0, 0);\r
+                       window_.SetActive();\r
+                       glEnable(GL_BLEND);\r
+                       glEnable(GL_LINE_SMOOTH);\r
+                       glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);\r
+                       glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);\r
+                       tick();\r
+               });\r
+       }\r
+\r
+       void tick()\r
+       {\r
+               sf::Event e;\r
+               while(window_.GetEvent(e)){}            \r
+               glClear(GL_COLOR_BUFFER_BIT);\r
+               window_.Draw(*this);\r
+               window_.Display();\r
+               timer_.tick(1.0/50.0);\r
+               executor_.begin_invoke([this]{tick();});\r
+       }\r
+\r
+       void render(sf::RenderTarget& target)\r
+       {\r
+               auto count = std::max<size_t>(10, drawables_.size());\r
+               float target_dy = 1.0f/static_cast<float>(count);\r
+\r
+               float last_y = 0.0f;\r
+               int n = 0;\r
+               for(auto it = drawables_.begin(); it != drawables_.end(); ++n)\r
+               {\r
+                       auto& drawable = *it;\r
+                       if(!drawable.unique())\r
+                       {\r
+                               drawable->SetScale(static_cast<float>(window_.GetWidth()), static_cast<float>(target_dy*window_.GetHeight()));\r
+                               float target_y = std::max(last_y, static_cast<float>(n * window_.GetHeight())*target_dy);\r
+                               drawable->SetPosition(0.0f, target_y);                  \r
+                               target.Draw(*drawable);                         \r
+                               ++it;           \r
+                       }\r
+                       else    \r
+                               it = drawables_.erase(it);                      \r
+               }               \r
+       }       \r
+       \r
+       void do_register_drawable(const std::shared_ptr<drawable>& drawable)\r
+       {\r
+               drawables_.push_back(drawable);\r
+       }\r
+       \r
+       static context& get_instance()\r
+       {\r
+               static context impl;\r
+               return impl;\r
+       }\r
+};\r
 \r
 class guide : public drawable\r
 {\r
@@ -139,11 +232,9 @@ struct graph::implementation : public drawable
 {\r
        std::map<std::string, diagnostics::line> lines_;\r
        std::string name_;\r
-       float height_scale_;\r
 \r
        implementation(const std::string& name) \r
-               : name_(name)\r
-               , height_scale_(0){}\r
+               : name_(name){}\r
 \r
        void update(const std::string& name, float value)\r
        {\r
@@ -180,55 +271,49 @@ struct graph::implementation : public drawable
 private:\r
        void render(sf::RenderTarget& target)\r
        {\r
+               const size_t text_size = 15;\r
+               const size_t text_margin = 2;\r
+               const size_t text_offset = text_size+text_margin*2;\r
+\r
+               sf::String text(name_.c_str(), sf::Font::GetDefaultFont(), text_size);\r
+               text.SetStyle(sf::String::Italic);\r
+               text.Move(text_margin, text_margin);\r
+               \r
                glPushMatrix();\r
-                       glScaled(1.0f, height_scale_, 1.0f);\r
-                       height_scale_ = std::min(1.0f, height_scale_+0.1f);\r
+                       glScaled(1.0f/GetScale().x, 1.0f/GetScale().y, 1.0f);\r
+                       target.Draw(text);\r
+                       float x_offset = text.GetPosition().x + text.GetRect().Right + text_margin*4;\r
+                       for(auto it = lines_.begin(); it != lines_.end(); ++it)\r
+                       {                                               \r
+                               sf::String line_text(it->first, sf::Font::GetDefaultFont(), text_size);\r
+                               line_text.SetPosition(x_offset, text_margin);\r
+                               auto c = it->second.get_color();\r
+                               line_text.SetColor(sf::Color(c.red*255.0f, c.green*255.0f, c.blue*255.0f, c.alpha*255.0f));\r
+                               target.Draw(line_text);\r
+                               x_offset = line_text.GetRect().Right + text_margin*2;\r
+                       }\r
 \r
-                       const size_t text_size = 15;\r
-                       const size_t text_margin = 2;\r
-                       const size_t text_offset = text_size+text_margin*2;\r
+                       glDisable(GL_TEXTURE_2D);\r
+               glPopMatrix();\r
 \r
-                       sf::String text(name_.c_str(), sf::Font::GetDefaultFont(), text_size);\r
-                       text.SetStyle(sf::String::Italic);\r
-                       text.Move(text_margin, text_margin);\r
-               \r
-                       glPushMatrix();\r
-                               glScaled(1.0f/GetScale().x, 1.0f/GetScale().y, 1.0f);\r
-                               target.Draw(text);\r
-                               float x_offset = text.GetPosition().x + text.GetRect().Right + text_margin*4;\r
-                               for(auto it = lines_.begin(); it != lines_.end(); ++it)\r
-                               {                                               \r
-                                       sf::String line_text(it->first, sf::Font::GetDefaultFont(), text_size);\r
-                                       line_text.SetPosition(x_offset, text_margin);\r
-                                       auto c = it->second.get_color();\r
-                                       line_text.SetColor(sf::Color(c.red*255.0f, c.green*255.0f, c.blue*255.0f, c.alpha*255.0f));\r
-                                       target.Draw(line_text);\r
-                                       x_offset = line_text.GetRect().Right + text_margin*2;\r
-                               }\r
-\r
-                               glDisable(GL_TEXTURE_2D);\r
-                       glPopMatrix();\r
-\r
-                       glBegin(GL_QUADS);\r
-                               glColor4f(1.0f, 1.0f, 1.0f, 0.2f);      \r
-                               glVertex2f(1.0f, 0.99f);\r
-                               glVertex2f(0.0f, 0.99f);\r
-                               glVertex2f(0.0f, 0.01f);        \r
-                               glVertex2f(1.0f, 0.01f);        \r
-                       glEnd();\r
-\r
-                       glPushMatrix();\r
-                               glTranslated(0.0f, text_offset/GetScale().y, 1.0f);\r
-                               glScaled(1.0f, 1.0-text_offset/GetScale().y, 1.0f);\r
-               \r
-                               target.Draw(diagnostics::guide(1.0f, color(1.0f, 1.0f, 1.0f, 0.6f)));\r
-                               target.Draw(diagnostics::guide(0.0f, color(1.0f, 1.0f, 1.0f, 0.6f)));\r
+               glBegin(GL_QUADS);\r
+                       glColor4f(1.0f, 1.0f, 1.0f, 0.2f);      \r
+                       glVertex2f(1.0f, 0.99f);\r
+                       glVertex2f(0.0f, 0.99f);\r
+                       glVertex2f(0.0f, 0.01f);        \r
+                       glVertex2f(1.0f, 0.01f);        \r
+               glEnd();\r
 \r
-                               for(auto it = lines_.begin(); it != lines_.end(); ++it)         \r
-                                       target.Draw(it->second);\r
+               glPushMatrix();\r
+                       glTranslated(0.0f, text_offset/GetScale().y, 1.0f);\r
+                       glScaled(1.0f, 1.0-text_offset/GetScale().y, 1.0f);\r
                \r
-                       glPopMatrix();\r
+                       target.Draw(diagnostics::guide(1.0f, color(1.0f, 1.0f, 1.0f, 0.6f)));\r
+                       target.Draw(diagnostics::guide(0.0f, color(1.0f, 1.0f, 1.0f, 0.6f)));\r
 \r
+                       for(auto it = lines_.begin(); it != lines_.end(); ++it)         \r
+                               target.Draw(it->second);\r
+               \r
                glPopMatrix();\r
        }\r
 \r
index 5ee9065f3870e87799090d8c911381c3f547954b..0ac0278c16a1a53cc83311d2f8bda7024259a7cb 100644 (file)
@@ -8,7 +8,6 @@
 #include "log.h"\r
 \r
 #include "../exception/exceptions.h"\r
-#include "../diagnostics/sink_backend.h"\r
 \r
 #include <ios>\r
 #include <string>\r
@@ -54,9 +53,12 @@ void init()
 \r
        typedef boost::log::sinks::synchronous_sink<boost::log::sinks::wtext_file_backend> file_sink_type;\r
 \r
-       typedef boost::log::sinks::asynchronous_sink<diagnostics::sink_backend> stream_sink_type;\r
+       typedef boost::log::sinks::asynchronous_sink<boost::log::sinks::wtext_ostream_backend> stream_sink_type;\r
+\r
+       auto stream_backend = boost::make_shared<boost::log::sinks::wtext_ostream_backend>();\r
+       stream_backend->add_stream(boost::shared_ptr<std::wostream>(&std::wcout, boost::log::empty_deleter()));\r
+       stream_backend->auto_flush(true);\r
 \r
-       auto stream_backend = boost::make_shared<diagnostics::sink_backend>();\r
        auto stream_sink = boost::make_shared<stream_sink_type>(stream_backend);\r
 \r
        stream_sink->locked_backend()->set_formatter(\r
@@ -84,7 +86,7 @@ void add_file_sink(const std::wstring& folder)
                        BOOST_THROW_EXCEPTION(directory_not_found());\r
 \r
                auto file_sink = boost::make_shared<file_sink_type>(\r
-                       boost::log::keywords::file_name = (folder + L"%Y-%m-%d_%H-%M-%S.%N.log"),\r
+                       boost::log::keywords::file_name = (folder + L"caspar_%Y-%m-%d_%H-%M-%S.%N.log"),\r
                        boost::log::keywords::time_based_rotation = boost::log::sinks::file::rotation_at_time_point(0, 0, 0),\r
                        boost::log::keywords::auto_flush = true\r
                );\r
index 705e81fa82711b70e07d2b357f116c054d57de43..07e9bc143dd074c5f72a4ccfc24c672a2ede294a 100644 (file)
@@ -128,7 +128,7 @@ public:
 \r
                                if(blue_)\r
                                        blue_->device_detach();         \r
-               });\r
+                       });\r
                }\r
 \r
                CASPAR_LOG(info) << "BLUECARD INFO: Successfully released device " << device_index_;\r
index 0f92332ff5add1e47142e88d94989c4813d8b2f9..580920682322b20b2031a860033e37f63b913835 100644 (file)
 \r
 #include "transition_producer.h"\r
 \r
-#include <common/diagnostics/graph.h>\r
-#include <common/utility/timer.h>\r
 #include <core/video_format.h>\r
 \r
 #include <mixer/frame/draw_frame.h>\r
-#include <mixer/frame_mixer_device.h>\r
 #include <mixer/image/image_transform.h>\r
 #include <mixer/audio/audio_mixer.h>\r
 #include <mixer/audio/audio_transform.h>\r
 \r
-#include <boost/range/algorithm/copy.hpp>\r
-\r
 namespace caspar { namespace core {    \r
 \r
 struct transition_producer::implementation : boost::noncopyable\r
@@ -45,20 +40,13 @@ struct transition_producer::implementation : boost::noncopyable
        safe_ptr<frame_producer>        source_producer_;\r
 \r
        std::shared_ptr<frame_factory>  frame_factory_;\r
-\r
-       safe_ptr<diagnostics::graph> graph_;\r
-       timer                                        perf_timer_;\r
-\r
+       \r
        implementation(const safe_ptr<frame_producer>& dest, const transition_info& info) \r
                : current_frame_(0)\r
                , info_(info)\r
                , dest_producer_(dest)\r
                , source_producer_(frame_producer::empty())\r
-               , graph_(diagnostics::create_graph(narrow(print())))\r
        {\r
-               graph_->guide("frame-time", 0.5);\r
-               graph_->set_color("frame-time",  diagnostics::color(1.0f, 0.0f, 0.0f));\r
-               graph_->set_color("frames-left",  diagnostics::color(0.0f, 1.0f, 0.0f));\r
        }\r
                                \r
        void initialize(const safe_ptr<frame_factory>& frame_factory)\r
@@ -78,15 +66,6 @@ struct transition_producer::implementation : boost::noncopyable
        }\r
 \r
        safe_ptr<draw_frame> receive()\r
-       {\r
-               perf_timer_.reset();\r
-               auto frame = do_receive();\r
-               graph_->update("frame-time", static_cast<float>(perf_timer_.elapsed()/frame_factory_->get_video_format_desc().interval*0.5));\r
-               graph_->update("frames-left", static_cast<float>(info_.duration-current_frame_)/static_cast<float>(info_.duration));\r
-               return frame;\r
-       }\r
-               \r
-       safe_ptr<draw_frame> do_receive()\r
        {\r
                if(current_frame_++ >= info_.duration)\r
                        return draw_frame::eof();\r
index ae706655e8670c0ce5339ff8642e2824d625feda..6b61b40e49eb74e4e802a39efee04f78f6f59cfa 100644 (file)
@@ -1032,7 +1032,7 @@ bool SetCommand::DoExecute()
 \r
        if(name == TEXT("MODE"))\r
        {\r
-               //if(this->GetChannel()->producer().SetVideoFormat(value)) TODO\r
+               //if(this->GetChannel()->consumer().SetVideoFormat(value)) TODO\r
                //      this->SetReplyString(TEXT("202 SET MODE OK\r\n"));\r
                //else\r
                        this->SetReplyString(TEXT("501 SET MODE FAILED\r\n"));\r
index 59f492d0a39ec3e1201bc7267ae298c36b1ef5ac..c1c07baf481d6bf7dd60f8c7c70426c2a0029ba4 100644 (file)
@@ -9,7 +9,7 @@
   </paths>\r
   <channels>\r
     <channel>\r
-      <videomode>1080i5000</videomode>\r
+      <videomode>PAL</videomode>\r
       <consumers>\r
         <ogl>\r
           <device>1</device>\r