]> git.sesse.net Git - casparcg/commitdiff
2.0.0.2: graph updates.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 31 Jan 2011 23:31:49 +0000 (23:31 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 31 Jan 2011 23:31:49 +0000 (23:31 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@438 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

12 files changed:
common/common.vcxproj
common/diagnostics/graph.cpp
common/diagnostics/graph.h
core/consumer/bluefish/bluefish_consumer.cpp
core/consumer/frame_consumer_device.cpp
core/consumer/oal/oal_consumer.cpp
core/consumer/ogl/ogl_consumer.cpp
core/producer/ffmpeg/ffmpeg_producer.cpp
core/producer/ffmpeg/input.cpp
core/producer/flash/flash_producer.cpp
mixer/frame_mixer_device.cpp
shell/shell.vcxproj

index 0c60eec06d26fcef822a51421b25b33ee34dfdcb..17f0031b825021d0618ed2554081493088c1fc82 100644 (file)
       <FunctionLevelLinking>\r
       </FunctionLevelLinking>\r
       <IntrinsicFunctions>true</IntrinsicFunctions>\r
-      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <PreprocessorDefinitions>SFML_DYNAMIC;WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <ExceptionHandling>Async</ExceptionHandling>\r
       <EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>\r
       <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
index 5449e7b59cef09e43d39ab5982abfe256d6c6380..184a69fcb2f39f68e8907c741eee1460237d8e84 100644 (file)
@@ -7,9 +7,10 @@
 #include "../concurrency/executor.h"\r
 #include "../utility/timer.h"\r
 \r
-#include <SFML/Window.hpp>\r
+#include <SFML/Graphics.hpp>\r
 \r
 #include <boost/foreach.hpp>\r
+#include <boost/optional.hpp>\r
 #include <boost/circular_buffer.hpp>\r
 #include <boost/range/algorithm_ext/erase.hpp>\r
 \r
 \r
 namespace caspar { namespace diagnostics {\r
 \r
-struct drawable\r
+struct drawable : public sf::Drawable\r
 {\r
        virtual ~drawable(){}\r
-       virtual void draw() = 0;\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\r
+class context : public drawable\r
 {      \r
        timer timer_;\r
-       sf::Window window_;\r
+       sf::RenderWindow window_;\r
        \r
        std::list<std::weak_ptr<drawable>> drawables_;\r
+       std::map<size_t, sf::Font> fonts_;\r
                \r
        executor executor_;\r
 public:                                        \r
@@ -48,7 +51,7 @@ public:
                        get_instance().drawables_.push_back(drawable);\r
                });\r
        }\r
-       \r
+                       \r
 private:\r
 \r
        void tick()\r
@@ -56,38 +59,32 @@ private:
                sf::Event e;\r
                while(window_.GetEvent(e)){}            \r
                glClear(GL_COLOR_BUFFER_BIT);\r
-               render();\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()\r
+       void render(sf::RenderTarget& target)\r
        {\r
-               glLoadIdentity();\r
-               glTranslated(-1.0f, -1.0f, 0.0f);\r
-               glScaled(2.0f, 2.0f, 1.0f);\r
+               auto count = std::max<size_t>(5, drawables_.size());\r
 \r
-               float dy = 1.0/static_cast<float>(std::max<int>(5, drawables_.size()));\r
-\r
-               glTranslated(0.0f, (1.0-dy), 0.0f);\r
-               for(auto it = drawables_.begin(); it != drawables_.end();)\r
+               int n = 0;\r
+               for(auto it = drawables_.begin(); it != drawables_.end(); ++n)\r
                {\r
                        auto drawable = it->lock();\r
                        if(drawable)\r
                        {\r
-                               glPushMatrix();\r
-                                       glScaled(1.0f, dy, 1.0f);\r
-                                       drawable->draw();\r
-                               glPopMatrix();\r
-                               glTranslated(0.0f, -dy, 0.0f);\r
+                               drawable->SetScale(window_.GetWidth(), window_.GetHeight()/count);\r
+                               drawable->SetPosition(0.0f, n* window_.GetHeight()/count);\r
+                               target.Draw(*drawable);\r
                                ++it;\r
                        }\r
                        else                    \r
                                it = drawables_.erase(it);                      \r
                }               \r
        }       \r
-\r
+       \r
        static context& get_instance()\r
        {\r
                static context impl;\r
@@ -110,9 +107,38 @@ private:
                });\r
        }\r
 };\r
+       \r
+class guide : public drawable\r
+{\r
+       float value_;\r
+       color c_;\r
+public:\r
+       guide(color c = color(1.0f, 1.0f, 1.0f, 0.6f)) \r
+               : value_(0.0f)\r
+               , c_(c){}\r
+\r
+       guide(float value, color c = color(1.0f, 1.0f, 1.0f, 0.6f)) \r
+               : value_(value)\r
+               , c_(c){}\r
+                       \r
+       void set_color(color c) {c_ = c;}\r
+\r
+       void render(sf::RenderTarget&)\r
+       {               \r
+               glEnable(GL_LINE_STIPPLE);\r
+               glLineStipple(3, 0xAAAA);\r
+               glBegin(GL_LINE_STRIP); \r
+                       glColor4f(c_.red, c_.green, c_.blue+0.2f, c_.alpha);            \r
+                       glVertex3f(0.0f, (1.0f-value_) * 0.8f + 0.1f, 0.0f);            \r
+                       glVertex3f(1.0f, (1.0f-value_) * 0.8f + 0.1f, 0.0f);    \r
+               glEnd();\r
+               glDisable(GL_LINE_STIPPLE);\r
+       }\r
+};\r
 \r
-class line\r
+class line : public drawable\r
 {\r
+       boost::optional<diagnostics::guide> guide_;\r
        boost::circular_buffer<float> line_data_;\r
        std::vector<float> tick_data_;\r
        color c_;\r
@@ -125,10 +151,22 @@ public:
        {\r
                tick_data_.push_back(value);\r
        }\r
+\r
+       void guide(const guide& guide)\r
+       {\r
+               guide_ = guide;\r
+               guide_->set_color(c_);\r
+       }\r
        \r
-       void set_color(color c){c_ = c;}\r
+       void set_color(color c)\r
+       {\r
+               c_ = c;\r
+               guide_->set_color(c_);\r
+       }\r
+\r
+       color get_color() const { return c_; }\r
        \r
-       void draw()\r
+       void render(sf::RenderTarget& target)\r
        {\r
                float dx = 1.0f/static_cast<float>(line_data_.capacity());\r
                float x = static_cast<float>(line_data_.capacity()-line_data_.size())*dx;\r
@@ -143,49 +181,24 @@ public:
                {\r
                        line_data_.push_back(line_data_.back());\r
                }\r
+\r
+               if(guide_)\r
+                       target.Draw(*guide_);\r
                \r
                glBegin(GL_LINE_STRIP);\r
-               glColor4f(c_.red, c_.green, c_.blue, 1.0f);                     \r
+               glColor4f(c_.red, c_.green, c_.blue, 1.0f);             \r
                for(size_t n = 0; n < line_data_.size(); ++n)                           \r
-                       glVertex3f(x+n*dx, std::max(0.05f, std::min(0.95f, line_data_[n]*0.8f + 0.1f)), 0.0f);          \r
+                       glVertex3f(x+n*dx, std::max(0.05f, std::min(0.95f, (1.0f-line_data_[n])*0.8f + 0.1f)), 0.0f);           \r
                glEnd();\r
        }\r
 };\r
-       \r
-class guide\r
-{\r
-       color c_;\r
-       float value_;\r
-public:\r
-       guide() : value_(0.0f){}\r
-\r
-       guide(float value, color c) \r
-               : value_(value)\r
-               , c_(c){}\r
-                       \r
-       void draw()\r
-       {               \r
-               glEnable(GL_LINE_STIPPLE);\r
-               glLineStipple(3, 0xAAAA);\r
-               glBegin(GL_LINE_STRIP);\r
-               glColor4f(c_.red, c_.green, c_.blue, 1.0f);                             \r
-                       glVertex3f(0.0f, value_ * 0.8f + 0.1f, 0.0f);           \r
-                       glVertex3f(1.0f, value_ * 0.8f + 0.1f, 0.0f);   \r
-               glEnd();\r
-               glDisable(GL_LINE_STIPPLE);\r
-       }\r
-};\r
 \r
 struct graph::implementation : public drawable\r
 {\r
        std::map<std::string, diagnostics::line> lines_;\r
-       std::map<std::string, diagnostics::guide> guides_;\r
+       std::string name_;\r
 \r
-       implementation(const std::string&)\r
-       {\r
-               guides_["max"] = diagnostics::guide(1.0f, color(0.4f, 0.4f, 0.4f));\r
-               guides_["min"] = diagnostics::guide(0.0f, color(0.4f, 0.4f, 0.4f));\r
-       }\r
+       implementation(const std::string& name) : name_(name){}\r
 \r
        void update(const std::string& name, float value)\r
        {\r
@@ -203,17 +216,42 @@ struct graph::implementation : public drawable
                });\r
        }\r
        \r
-       void add_guide(const std::string& name, float value, color c)\r
+       void guide(const std::string& name, float value)\r
        {\r
                context::begin_invoke([=]\r
                {\r
-                       guides_[name] = diagnostics::guide(value, c);\r
+                       lines_[name].guide(diagnostics::guide(value));\r
                });\r
        }\r
 \r
 private:\r
-       void draw()\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/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
@@ -221,12 +259,19 @@ private:
                        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
-               for(auto it = guides_.begin(); it != guides_.end(); ++it)\r
-                       it->second.draw();\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
-               for(auto it = lines_.begin(); it != lines_.end(); ++it)\r
-                       it->second.draw();\r
        }\r
 \r
        implementation(implementation&);\r
@@ -238,8 +283,8 @@ graph::graph(const std::string& name) : impl_(new implementation(name))
        context::register_drawable(impl_);\r
 }\r
 void graph::update(const std::string& name, float value){impl_->update(name, value);}\r
+void graph::guide(const std::string& name, float value){impl_->guide(name, value);}\r
 void graph::set_color(const std::string& name, color c){impl_->set_color(name, c);}\r
-void graph::add_guide(const std::string& name, float value, color c){impl_->add_guide(name, value, c);}\r
 \r
 safe_ptr<graph> create_graph(const std::string& name)\r
 {\r
index 52bfe76074552d56c0f79b6526ec62dd1fa56580..f9e5f31d983c05e2ee72964600d82b0b787ad33f 100644 (file)
@@ -26,7 +26,7 @@ class graph
        graph(const std::string& name);\r
 public:\r
        void update(const std::string& name, float value);\r
-       void add_guide(const std::string& name, float value, color c);\r
+       void guide(const std::string& name, float value);\r
        void set_color(const std::string& name, color c);\r
 private:\r
        struct implementation;\r
index 09dc47671ff7705943e334e1fe642ccfa784d16c..8b46919d75805d86628e066d80f5f4b799c4527a 100644 (file)
@@ -105,7 +105,7 @@ struct bluefish_consumer::implementation : boost::noncopyable
        executor executor_;\r
 public:\r
        implementation::implementation(unsigned int device_index, bool embed_audio) \r
-               : graph_(diagnostics::create_graph("bluefish"))\r
+               : graph_(diagnostics::create_graph("bluefish[" + boost::lexical_cast<std::string>(device_index) + "]"))\r
                , device_index_(device_index)           \r
                , mem_fmt_(MEM_FMT_ARGB_PC)\r
                , upd_fmt_(UPD_FMT_FRAME)\r
@@ -114,8 +114,8 @@ public:
                , engine_mode_(VIDEO_ENGINE_FRAMESTORE)         \r
                , embed_audio_(embed_audio)\r
        {\r
-               graph_->add_guide("frame_time_target", 0.5, diagnostics::color(1.0f, 0.0f, 0.0f));\r
-               graph_->set_color("frame_time", diagnostics::color(1.0f, 0.0f, 0.0f));  \r
+               graph_->guide("frame-time", 0.5);\r
+               graph_->set_color("frame-time", diagnostics::color(1.0f, 0.0f, 0.0f));  \r
        }\r
 \r
        ~implementation()\r
@@ -306,7 +306,7 @@ public:
                                }\r
 \r
                                std::rotate(reserved_frames_.begin(), reserved_frames_.begin() + 1, reserved_frames_.end());\r
-                               graph_->update("frame_time", static_cast<float>((perf_timer_.elapsed()-format_desc_.interval)/format_desc_.interval*0.5));\r
+                               graph_->update("frame-time", static_cast<float>((perf_timer_.elapsed()-format_desc_.interval)/format_desc_.interval*0.5));\r
                        }\r
                        catch(...)\r
                        {\r
index 45d6f5591dd7500bb6d270d7e3b0ffa95e87a080..96eae812fc01d87e728b915e7f1ea17b7c008531 100644 (file)
@@ -9,6 +9,7 @@
 #include "../video_format.h"\r
 \r
 #include <common/concurrency/executor.h>\r
+#include <common/diagnostics/graph.h>\r
 #include <common/utility/timer.h>\r
 #include <common/utility/assert.h>\r
 \r
@@ -21,6 +22,9 @@ namespace caspar { namespace core {
 struct frame_consumer_device::implementation\r
 {\r
        static int const MAX_DEPTH = 3;\r
+\r
+       safe_ptr<diagnostics::graph> graph_;\r
+       timer perf_timer_;\r
        \r
        timer clock_;\r
 \r
@@ -33,8 +37,11 @@ struct frame_consumer_device::implementation
        executor executor_;     \r
 public:\r
        implementation(const video_format_desc& format_desc) \r
-               : format_desc_(format_desc)\r
+               : graph_(diagnostics::create_graph("output"))\r
+               , format_desc_(format_desc)\r
        {               \r
+               graph_->guide("frame-time", 0.5f);      \r
+               graph_->set_color("frame-time", diagnostics::color(1.0f, 0.0f, 0.0f));\r
                executor_.set_capacity(2);\r
                executor_.start();\r
        }\r
@@ -92,6 +99,9 @@ public:
                        }\r
 \r
                        clock_.tick(1.0/format_desc_.fps);\r
+                       \r
+                       graph_->update("frame-time", static_cast<float>(perf_timer_.elapsed()/format_desc_.interval*0.5));\r
+                       perf_timer_.reset();\r
                });\r
        }\r
 };\r
index 200f2af892bff75ea93a88e497acdb256d6538c7..32d3644ec593cdc55f10c8e0af52bdf1ac4f8470 100644 (file)
@@ -22,6 +22,8 @@
 \r
 #include "oal_consumer.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/read_frame.h>\r
@@ -34,13 +36,21 @@ namespace caspar { namespace core {
 \r
 struct oal_consumer::implementation : public sf::SoundStream, boost::noncopyable\r
 {\r
+       safe_ptr<diagnostics::graph> graph_;\r
+       timer perf_timer_;\r
+\r
        tbb::concurrent_bounded_queue<std::vector<short>> input_;\r
        boost::circular_buffer<std::vector<short>> container_;\r
        tbb::atomic<bool> is_running_;\r
+\r
+       video_format_desc format_desc_;\r
 public:\r
        implementation() \r
-               : container_(5)\r
+               : graph_(diagnostics::create_graph("audio"))\r
+               , container_(5)\r
        {\r
+               graph_->guide("frame-time", 0.5);\r
+               graph_->set_color("frame-time", diagnostics::color(1.0f, 0.0f, 0.0f));  \r
                is_running_ = true;\r
        }\r
 \r
@@ -53,8 +63,9 @@ public:
                CASPAR_LOG(info) << "Sucessfully ended oal_consumer";\r
        }\r
 \r
-       void initialize(const video_format_desc&)\r
+       void initialize(const video_format_desc& format_desc)\r
        {\r
+               format_desc_ = format_desc;\r
                sf::SoundStream::Initialize(2, 48000);\r
                Play();         \r
                CASPAR_LOG(info) << "Sucessfully started oal_consumer";\r
@@ -72,12 +83,16 @@ public:
 \r
        virtual bool OnGetData(sf::SoundStream::Chunk& data)\r
        {               \r
+               graph_->update("frame-time", static_cast<float>(perf_timer_.elapsed()/format_desc_.interval*0.5));\r
+\r
                std::vector<short> audio_data;          \r
                input_.pop(audio_data);\r
                                \r
                container_.push_back(std::move(audio_data));\r
                data.Samples = container_.back().data();\r
-               data.NbSamples = container_.back().size();              \r
+               data.NbSamples = container_.back().size();      \r
+               \r
+               perf_timer_.reset();\r
 \r
                return is_running_;\r
        }\r
index f53fc3a62dbda31ae8f6aad4feb2fdd68afefddf..726b75cf628bed7cc19fe6f98abbb720046487ed 100644 (file)
@@ -44,9 +44,6 @@ namespace caspar { namespace core {
 \r
 struct ogl_consumer::implementation : boost::noncopyable\r
 {                      \r
-       safe_ptr<diagnostics::graph> graph_;\r
-       timer perf_timer_;\r
-\r
        boost::unique_future<void> active_;\r
 \r
        float wratio_;\r
@@ -70,6 +67,9 @@ struct ogl_consumer::implementation : boost::noncopyable
        \r
        sf::Window window_;\r
        \r
+       safe_ptr<diagnostics::graph> graph_;\r
+       timer perf_timer_;\r
+\r
        executor executor_;\r
 public:\r
        implementation(unsigned int screen_index, stretch stretch, bool windowed) \r
@@ -79,10 +79,10 @@ public:
                , screen_x_(0)\r
                , screen_y_(0)\r
                , screen_index_(screen_index)\r
-               , graph_(diagnostics::create_graph("ogl_consumer"))\r
+               , graph_(diagnostics::create_graph("screen[" + boost::lexical_cast<std::string>(screen_index) + "]"))\r
        {               \r
-               graph_->add_guide("frame_time_target", 0.5, diagnostics::color(1.0f, 0.0f, 0.0f));\r
-               graph_->set_color("frame_time", diagnostics::color(1.0f, 0.0f, 0.0f));\r
+               graph_->guide("frame-time", 0.5);\r
+               graph_->set_color("frame-time", diagnostics::color(1.0f, 0.0f, 0.0f));\r
 \r
                CASPAR_LOG(info) << "Sucessfully started ogl_consumer";\r
        }\r
@@ -257,7 +257,7 @@ public:
                        while(window_.GetEvent(e)){}\r
                        render(frame);\r
                        window_.Display();\r
-                       graph_->update("frame_time", static_cast<float>(perf_timer_.elapsed()/format_desc_.interval*0.5));\r
+                       graph_->update("frame-time", static_cast<float>(perf_timer_.elapsed()/format_desc_.interval*0.5));\r
                });\r
        }\r
 \r
index 799517fe212fb84d791dad2de5411b7c07b803d0..d5bbd7836a295eee7c402d0990500fc9cee0a54d 100644 (file)
@@ -22,6 +22,8 @@ namespace caspar { namespace core { namespace ffmpeg{
        \r
 struct ffmpeg_producer : public frame_producer\r
 {\r
+       const std::wstring                                      filename_;\r
+       \r
        safe_ptr<diagnostics::graph>            graph_;\r
        timer                                                           perf_timer_;\r
 \r
@@ -33,21 +35,19 @@ struct ffmpeg_producer : public frame_producer
        std::deque<std::vector<short>>          audio_chunk_channel_;\r
 \r
        std::queue<safe_ptr<draw_frame>>        ouput_channel_;\r
-       \r
-       const std::wstring                                      filename_;\r
-       \r
+               \r
        safe_ptr<draw_frame>                            last_frame_;\r
        std::shared_ptr<frame_factory>          frame_factory_;\r
-\r
 public:\r
        explicit ffmpeg_producer(const std::wstring& filename, bool loop) \r
-               : graph_(diagnostics::create_graph("ffmpeg"))\r
-               , filename_(filename)\r
+               : filename_(filename)\r
+               , graph_(diagnostics::create_graph(narrow(print())))            \r
                , last_frame_(draw_frame(draw_frame::empty()))\r
                , input_(graph_, filename, loop)\r
+               \r
        {\r
-               graph_->add_guide("frame_time_target", 0.5, diagnostics::color(1.0f, 0.0f, 0.0f));\r
-               graph_->set_color("frame_time",  diagnostics::color(1.0f, 0.0f, 0.0f));\r
+               graph_->guide("frame-time", 0.5);\r
+               graph_->set_color("frame-time",  diagnostics::color(1.0f, 0.0f, 0.0f));\r
        }\r
 \r
        ~ffmpeg_producer()\r
@@ -141,7 +141,7 @@ public:
                                return last_frame_;                     \r
                }\r
                \r
-               graph_->update("frame_time", static_cast<float>(perf_timer_.elapsed()/frame_factory_->get_video_format_desc().interval*0.5));\r
+               graph_->update("frame-time", static_cast<float>(perf_timer_.elapsed()/frame_factory_->get_video_format_desc().interval*0.5));\r
 \r
                auto result = last_frame_;\r
                if(!ouput_channel_.empty())\r
index bc4c240ceae3ebd9a89735267b014ad00b1bfdf8..83bbaac09fa5e53d7ad98b8041a498c5876bf8ee 100644 (file)
@@ -60,7 +60,7 @@ public:
                , audio_s_index_(-1)\r
                , filename_(filename)\r
        {                       \r
-               graph_->set_color("input_buffer_size", diagnostics::color(0.0f, 1.0f, 1.0f));           \r
+               graph_->set_color("input-buffer", diagnostics::color(1.0f, 1.0f, 0.0f));        \r
 \r
                int errn;\r
                AVFormatContext* weak_format_context_;\r
@@ -147,7 +147,7 @@ public:
                        }\r
                        else if(!loop_ || !seek_frame(0, AVSEEK_FLAG_BACKWARD)) // TODO: av_seek_frame does not work for all formats\r
                                executor_.stop();\r
-                       graph_->update("input_buffer_size", static_cast<float>(buffer_size_)/static_cast<float>(BUFFER_SIZE));\r
+                       graph_->update("input-buffer", static_cast<float>(buffer_size_)/static_cast<float>(BUFFER_SIZE));\r
                }\r
        }\r
        \r
index 076ecbeb9e7427e823a42857d89ed22aa02e39c1..e163e374a0d28dff515776521575b5d0e1e047fe 100644 (file)
@@ -43,9 +43,6 @@ namespace caspar { namespace core { namespace flash {
        \r
 class flash_renderer\r
 {\r
-       safe_ptr<diagnostics::graph> graph_;\r
-       timer diag_timer_;\r
-\r
        struct co_init\r
        {\r
                co_init(){CoInitialize(nullptr);}\r
@@ -65,6 +62,9 @@ class flash_renderer
        safe_ptr<draw_frame> head_;\r
        \r
        timer timer_;\r
+\r
+       safe_ptr<diagnostics::graph> graph_;\r
+       timer diag_timer_;\r
 public:\r
        flash_renderer(const safe_ptr<diagnostics::graph>& graph, const std::shared_ptr<frame_factory>& frame_factory, const std::wstring& filename) \r
                : graph_(graph)\r
@@ -76,8 +76,8 @@ public:
                , ax_(nullptr)\r
                , head_(draw_frame::empty())\r
        {\r
-               graph_->add_guide("frame_time_target", 0.5f, diagnostics::color(1.0f, 0.0f, 0.0f));\r
-               graph_->set_color("frame_time", diagnostics::color(1.0f, 0.0f, 0.0f));          \r
+               graph_->guide("frame-time", 0.5f);\r
+               graph_->set_color("frame-time", diagnostics::color(1.0f, 0.0f, 0.0f));          \r
                CASPAR_LOG(info) << print() << L" Started";\r
                \r
                if(FAILED(CComObject<caspar::flash::FlashAxContainer>::CreateInstance(&ax_)))\r
@@ -163,13 +163,15 @@ private:
                        head_ = frame;\r
                }               \r
                \r
-               graph_->update("frame_time", static_cast<float>(diag_timer_.elapsed()/(1.0/ax_->GetFPS())));\r
+               graph_->update("frame-time", static_cast<float>(diag_timer_.elapsed()/(1.0/ax_->GetFPS())));\r
                return head_;\r
        }\r
 };\r
 \r
 struct flash_producer::implementation\r
 {      \r
+       const std::wstring filename_;   \r
+\r
        safe_ptr<diagnostics::graph> graph_;\r
 \r
        safe_ptr<draw_frame> tail_;\r
@@ -179,19 +181,18 @@ struct flash_producer::implementation
        std::shared_ptr<frame_factory> frame_factory_;\r
        \r
        std::wstring print() const{ return L"flash[" + boost::filesystem::wpath(filename_).filename() + L"]"; } \r
-       std::wstring filename_;\r
 \r
        executor executor_;\r
 public:\r
        implementation(const std::wstring& filename) \r
-               : graph_(diagnostics::create_graph("flash"))\r
-               , filename_(filename)\r
-               , tail_(draw_frame::empty())\r
+               : filename_(filename)\r
+               , graph_(diagnostics::create_graph(narrow(print())))\r
+               , tail_(draw_frame::empty())            \r
        {       \r
                if(!boost::filesystem::exists(filename))\r
                        BOOST_THROW_EXCEPTION(file_not_found() << boost::errinfo_file_name(narrow(filename)));  \r
 \r
-               graph_->set_color("buffer_size", diagnostics::color(0.0f, 1.0f, 0.0f)); \r
+               graph_->set_color("output-buffer", diagnostics::color(0.0f, 1.0f, 0.0f));       \r
        }\r
 \r
        ~implementation()\r
@@ -212,7 +213,7 @@ public:
 \r
        virtual safe_ptr<draw_frame> receive()\r
        {               \r
-               graph_->update("buffer_size", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity()));\r
+               graph_->update("output-buffer", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity()));\r
                if(!frame_buffer_.try_pop(tail_))\r
                        CASPAR_LOG(trace) << print() << " underflow";\r
                else\r
index 92cf45668d15308b70f3b5f38b5306c5b18c3236..b2bd8abce4fa47b3b8fb21005396cacbdec3b021 100644 (file)
@@ -49,9 +49,9 @@ public:
                , image_mixer_(format_desc)\r
                , output_(output)\r
        {\r
-               graph_->add_guide("frame_time_target", 0.5f, diagnostics::color(1.0f, 0.0f, 0.0f));     \r
-               graph_->set_color("frame_time", diagnostics::color(1.0f, 0.0f, 0.0f));\r
-               graph_->set_color("buffer_size", diagnostics::color( 0.0f, 1.0f, 0.0f));                \r
+               graph_->guide("frame-time", 0.5f);      \r
+               graph_->set_color("frame-time", diagnostics::color(1.0f, 0.0f, 0.0f));\r
+               graph_->set_color("output-buffer", diagnostics::color( 0.0f, 1.0f, 0.0f));              \r
                executor_.start();\r
                executor_.set_capacity(2);\r
        }\r
@@ -83,11 +83,11 @@ public:
                                audio_mixer_.end();\r
                        }\r
                        audio_mixer_.end_pass();\r
-                       graph_->update("frame_time", static_cast<float>(perf_timer_.elapsed()/format_desc_.interval*0.5));\r
+                       graph_->update("frame-time", static_cast<float>(perf_timer_.elapsed()/format_desc_.interval*0.5));\r
 \r
                        output_(make_safe<const read_frame>(std::move(image.get()), std::move(audio)));\r
                });\r
-               graph_->update("buffer_size", static_cast<float>(executor_.size())/static_cast<float>(executor_.capacity()));\r
+               graph_->update("output-buffer", static_cast<float>(executor_.size())/static_cast<float>(executor_.capacity()));\r
        }\r
                \r
        safe_ptr<write_frame> create_frame(const pixel_format_desc& desc)\r
index ba30f9e5bd596fa890e6c4cc26d4f89c13a7bdc8..5d501ae9dd84cc2c785b620bae8b084d090975b1 100644 (file)
       </Command>\r
     </PreLinkEvent>\r
     <Link>\r
-      <AdditionalDependencies>sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;sfml-system.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat-52.lib;avcodec-52.lib;avutil-50.lib;SWSCALE-0.lib;tbb.lib;Glee.lib;%(AdditionalDependencies)</AdditionalDependencies>\r
+      <AdditionalDependencies>sfml-system.lib;sfml-audio.lib;sfml-window.lib;sfml-graphics.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.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