]> git.sesse.net Git - casparcg/commitdiff
2.0.0: Fixed potential pure virtual function call.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sat, 22 Oct 2011 20:39:51 +0000 (20:39 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sat, 22 Oct 2011 20:39:51 +0000 (20:39 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1382 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

common/diagnostics/graph.cpp
common/diagnostics/graph.h
common/memory/safe_ptr.h
modules/decklink/interop/DeckLinkAPI_h.h
modules/decklink/interop/DeckLinkAPI_i.c
modules/decklink/producer/decklink_producer.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/flash/producer/flash_producer.cpp
shell/casparcg.config

index 5378f515642683b7f30d24d2ef7dcb515cbc18f7..db6eff7904baeb56045888a90ab7004dcb4cbde9 100644 (file)
@@ -258,25 +258,26 @@ public:
 struct graph::implementation : public drawable\r
 {\r
        std::map<std::string, diagnostics::line> lines_;\r
-       const printer parent_printer_;\r
        std::string name_;\r
+       std::string text_;\r
 \r
        int counter_;\r
 \r
        implementation(const std::string& name) \r
                : name_(name)\r
+               , text_(name)\r
                , counter_(0){}\r
-\r
-       implementation(const printer& parent_printer) \r
-               : parent_printer_(parent_printer)\r
-               , name_(parent_printer_ ? narrow(parent_printer_()) : "")\r
-               , counter_(0){}\r
-\r
+       \r
        void update(const std::string& name, double value)\r
        {\r
                lines_[name].update(value);\r
        }\r
 \r
+       void update_text(const std::string& value)\r
+       {\r
+               text_ = value;\r
+       }\r
+\r
        void set(const std::string& name, double value)\r
        {\r
                lines_[name].set(value);\r
@@ -300,17 +301,11 @@ struct graph::implementation : public drawable
 private:\r
        void render(sf::RenderTarget& target)\r
        {\r
-               if(counter_++ > 25) // Don't update name too often since print can be implemented with locks.\r
-               {\r
-                       counter_ = 0;\r
-                       if(parent_printer_)\r
-                               name_ = narrow(parent_printer_());\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)*2;\r
 \r
-               sf::String text(name_.c_str(), sf::Font::GetDefaultFont(), text_size);\r
+               sf::String text(text_.c_str(), sf::Font::GetDefaultFont(), text_size);\r
                text.SetStyle(sf::String::Italic);\r
                text.Move(text_margin, text_margin);\r
                \r
@@ -362,23 +357,30 @@ graph::graph(const std::string& name) : impl_(env::properties().get("configurati
                context::register_drawable(impl_);\r
 }\r
 \r
-graph::graph(const printer& parent_printer) : impl_(env::properties().get("configuration.diagnostics.graphs", true) ? new implementation(parent_printer) : nullptr)\r
+void graph::update_value(const std::string& name, double value)\r
 {\r
        if(impl_)\r
-               context::register_drawable(impl_);\r
+       {       \r
+               auto p = impl_;\r
+               context::begin_invoke([=]\r
+               {       \r
+                       p->update(name, value);\r
+               });\r
+       }\r
 }\r
 \r
-void graph::update_value(const std::string& name, double value)\r
+void graph::update_text(const std::string& value)\r
 {\r
        if(impl_)\r
-       {       \r
+       {               \r
                auto p = impl_;\r
                context::begin_invoke([=]\r
                {       \r
-                       p->update(name, value);\r
+                       p->update_text(value);\r
                });\r
        }\r
 }\r
+\r
 void graph::set_value(const std::string& name, double value)\r
 {\r
        if(impl_)\r
@@ -428,11 +430,6 @@ safe_ptr<graph> create_graph(const std::string& name)
 {\r
        return safe_ptr<graph>(new graph(name));\r
 }\r
-safe_ptr<graph> create_graph(const printer& parent_printer)\r
-{\r
-       return safe_ptr<graph>(new graph(parent_printer));\r
-}\r
-\r
 \r
 //namespace v2\r
 //{    \r
index 3f54c0a7c1b6f3ad9c18b9d84bade6b93192d4e1..0d9ef3d6226c954a11b522a8caeec23a2da5e816 100644 (file)
@@ -52,11 +52,10 @@ struct color
 class graph\r
 {\r
        friend safe_ptr<graph> create_graph(const std::string& name);\r
-       friend safe_ptr<graph> create_graph(const printer& parent_printer);\r
        graph(const std::string& name);\r
-       graph(const printer& parent_printer);\r
 public:\r
        void update_value(const std::string& name, double value);\r
+       void update_text(const std::string& value);\r
        void set_value(const std::string& name, double value);\r
        void set_color(const std::string& name, color c);\r
        void add_tag(const std::string& name);\r
@@ -67,7 +66,6 @@ private:
 };\r
 \r
 safe_ptr<graph> create_graph(const std::string& name);\r
-safe_ptr<graph> create_graph(const printer& parent_printer);\r
        \r
 //namespace v2\r
 //{\r
index e4269e69bd2166f96f984fb8287e930b77aafa7a..88c184af3f6f796c2678fa48851a6b7eb9e3282a 100644 (file)
@@ -35,8 +35,8 @@ public:
        \r
        safe_ptr() : impl_(std::make_shared<T>()){}     \r
        \r
-       safe_ptr(const safe_ptr<T>& other) : impl_(other.impl_){}  // noexcept\r
-       safe_ptr(safe_ptr<T>&& other) : impl_(std::move(other.impl_)){}\r
+       safe_ptr(const safe_ptr& other) : impl_(other.impl_){}  // noexcept\r
+       safe_ptr(safe_ptr&& other) : impl_(std::move(other.impl_)){}\r
 \r
        template<typename U>\r
        safe_ptr(const safe_ptr<U>& other, typename std::enable_if<std::is_convertible<U*, T*>::value, void*>::type = 0) : impl_(other.impl_){}  // noexcept\r
@@ -86,19 +86,26 @@ public:
        }\r
 \r
        template<typename U>\r
-       typename std::enable_if<std::is_convertible<U*, T*>::value, safe_ptr<T>&>::type\r
+       typename std::enable_if<std::is_convertible<typename std::add_pointer<U>::type, T*>::value, safe_ptr&>::type\r
        operator=(const safe_ptr<U>& other)\r
        {\r
-               safe_ptr<T> temp(other);\r
-               temp.swap(*this);\r
+               safe_ptr(other).swap(*this);\r
+               return *this;\r
+       }\r
+\r
+       template<typename U>\r
+       typename std::enable_if<std::is_convertible<typename std::add_pointer<U>::type, T*>::value, safe_ptr&>::type\r
+       operator=(safe_ptr<U>&& other)\r
+       {\r
+               safe_ptr(std::move(other)).swap(*this);\r
                return *this;\r
        }\r
 \r
        template <typename U>\r
-       typename std::enable_if<std::is_convertible<typename std::add_pointer<U>::type, T*>::value, safe_ptr<T>&>::type\r
+       typename std::enable_if<std::is_convertible<typename std::add_pointer<U>::type, T*>::value, safe_ptr&>::type\r
        operator=(U&& impl)\r
        {\r
-               safe_ptr<T> temp(std::forward<T>(impl));\r
+               safe_ptr temp(std::forward<T>(impl));\r
                temp.swap(*this);\r
                return *this;\r
        }\r
@@ -127,7 +134,7 @@ public:
        operator const std::shared_ptr<T>&() const { return impl_;}  // noexcept\r
 \r
        template<class U>\r
-       bool owner_before(const safe_ptr<T>& ptr){ return impl_.owner_before(ptr.impl_); }  // noexcept\r
+       bool owner_before(const safe_ptr& ptr){ return impl_.owner_before(ptr.impl_); }  // noexcept\r
 \r
        template<class U>\r
        bool owner_before(const std::shared_ptr<U>& ptr){ return impl_.owner_before(ptr); }  // noexcept\r
index 4a466545a801cf263d739eaa12fe7983ee267fb7..df6064712e08e7ac64700698689610146c9e68b4 100644 (file)
@@ -4,7 +4,7 @@
 \r
 \r
  /* File created by MIDL compiler version 7.00.0555 */\r
-/* at Wed Sep 21 22:02:53 2011\r
+/* at Wed Sep 21 23:31:49 2011\r
  */\r
 /* Compiler settings for interop\DeckLinkAPI.idl:\r
     Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r
index a31a6cd25bed4537f68ba0e6b70501701e335642..86e24837f50616ac7a8ab03eb3b957add041630a 100644 (file)
@@ -6,7 +6,7 @@
 \r
 \r
  /* File created by MIDL compiler version 7.00.0555 */\r
-/* at Wed Sep 21 22:02:53 2011\r
+/* at Wed Sep 21 23:31:49 2011\r
  */\r
 /* Compiler settings for interop\DeckLinkAPI.idl:\r
     Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555 \r
index 902d78e210e30e1f1dd9681045747a47b7f14a0b..178b0042c1dd6a3bce18989fca03fef82d34e3b4 100644 (file)
@@ -108,7 +108,7 @@ public:
        {\r
                frame_buffer_.set_capacity(2);\r
                \r
-               graph_ = diagnostics::create_graph(boost::bind(&decklink_producer::print, this));\r
+               graph_ = diagnostics::create_graph(narrow(print()));\r
                graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
                graph_->set_color("late-frame", diagnostics::color(0.6f, 0.3f, 0.3f));\r
index 480e95b8d0d3739eb4db855e35613adc428ca9fc..5641222a1f423d958c17b3dc15b21d6bdd59d7b8 100644 (file)
@@ -79,7 +79,7 @@ struct ffmpeg_producer : public core::frame_producer
 public:\r
        explicit ffmpeg_producer(const safe_ptr<core::frame_factory>& frame_factory, const std::wstring& filename, const std::wstring& filter, bool loop, int start, size_t length) \r
                : filename_(filename)\r
-               , graph_(diagnostics::create_graph([this]{return print();}))\r
+               , graph_(diagnostics::create_graph(""))\r
                , frame_factory_(frame_factory)         \r
                , format_desc_(frame_factory->get_video_format_desc())\r
                , input_(graph_, filename_, loop, start, length)\r
@@ -137,6 +137,8 @@ public:
                        else                    \r
                                graph_->add_tag("underflow");   \r
                }\r
+\r
+               graph_->update_text(narrow(print()));\r
                \r
                return frame;\r
        }\r
index 13a0fa3425259423d3783322202b9ffcd482f820..8f3f957590bd165afb46a2ec07c0494379ae3324 100644 (file)
@@ -281,7 +281,7 @@ public:
 \r
                fps_ = 0;\r
 \r
-               graph_ = diagnostics::create_graph([this]{return print();});\r
+               graph_ = diagnostics::create_graph(narrow(print()));\r
                graph_->set_color("output-buffer-count", diagnostics::color(1.0f, 1.0f, 0.0f));          \r
                graph_->set_color("underflow", diagnostics::color(0.6f, 0.3f, 0.9f));   \r
                \r
@@ -390,7 +390,8 @@ public:
                                }\r
 \r
                                graph_->set_value("output-buffer-count", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity()));        \r
-                               fps_.fetch_and_store(static_cast<int>(context_->fps()*100.0));\r
+                               fps_.fetch_and_store(static_cast<int>(context_->fps()*100.0));                          \r
+                               graph_->update_text(narrow(print()));\r
 \r
                                render(renderer);\r
                        }\r
index 236741a0c35e54be25021ddd7fada8605def6758..fd68da33d44d25098273c54831a476005604778f 100644 (file)
@@ -39,7 +39,6 @@
             <device>1</device>\r
             <embedded-audio>true</embedded-audio>\r
           </decklink>\r
-          <screen></screen>\r
         </consumers>\r
       </channel>\r
     </channels>\r