]> git.sesse.net Git - casparcg/blobdiff - modules/bluefish/consumer/bluefish_consumer.cpp
Fixed graph memory-leak.
[casparcg] / modules / bluefish / consumer / bluefish_consumer.cpp
index 14661432564447702e2e5e0382fea87aa8595c8e..162a3d4128f49989fa79791f71c418dec5d41f9d 100644 (file)
@@ -1,21 +1,22 @@
 /*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
 *\r
-*  This file is part of CasparCG.\r
+* This file is part of CasparCG (www.casparcg.com).\r
 *\r
-*    CasparCG is free software: you can redistribute it and/or modify\r
-*    it under the terms of the GNU General Public License as published by\r
-*    the Free Software Foundation, either version 3 of the License, or\r
-*    (at your option) any later version.\r
+* CasparCG is free software: you can redistribute it and/or modify\r
+* it under the terms of the GNU General Public License as published by\r
+* the Free Software Foundation, either version 3 of the License, or\r
+* (at your option) any later version.\r
 *\r
-*    CasparCG is distributed in the hope that it will be useful,\r
-*    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-*    GNU General Public License for more details.\r
-\r
-*    You should have received a copy of the GNU General Public License\r
-*    along with CasparCG.  If not, see <http://www.gnu.org/licenses/>.\r
+* CasparCG is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.\r
 *\r
+* Author: Robert Nagy, ronag89@gmail.com\r
 */\r
  \r
 #include "../StdAfx.h"\r
@@ -85,9 +86,7 @@ public:
        {\r
                executor_.set_capacity(1);\r
 \r
-               graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
-               graph_->add_guide("frame-time", 0.5f);  \r
                graph_->set_color("sync-time", diagnostics::color(1.0f, 0.0f, 0.0f));\r
                graph_->set_color("frame-time", diagnostics::color(0.5f, 1.0f, 0.2f));\r
                graph_->set_text(print());\r
@@ -192,7 +191,7 @@ public:
                        try\r
                        {       \r
                                display_frame(frame);                           \r
-                               graph_->update_value("tick-time", static_cast<float>(tick_timer_.elapsed()*format_desc_.fps*0.5));\r
+                               graph_->set_value("tick-time", static_cast<float>(tick_timer_.elapsed()*format_desc_.fps*0.5));\r
                                tick_timer_.restart();\r
                        }\r
                        catch(...)\r
@@ -209,7 +208,7 @@ public:
                sync_timer_.restart();\r
                unsigned long n_field = 0;\r
                blue_->wait_output_video_synch(UPD_FMT_FRAME, n_field);\r
-               graph_->update_value("sync-time", sync_timer_.elapsed()*format_desc_.fps*0.5);\r
+               graph_->set_value("sync-time", sync_timer_.elapsed()*format_desc_.fps*0.5);\r
                \r
                frame_timer_.restart();         \r
 \r
@@ -259,7 +258,7 @@ public:
 \r
                boost::range::rotate(reserved_frames_, std::begin(reserved_frames_)+1);\r
                \r
-               graph_->update_value("frame-time", static_cast<float>(frame_timer_.elapsed()*format_desc_.fps*0.5));\r
+               graph_->set_value("frame-time", static_cast<float>(frame_timer_.elapsed()*format_desc_.fps*0.5));\r
        }\r
 \r
        void encode_hanc(BLUE_UINT32* hanc_data, void* audio_data, size_t audio_samples, size_t audio_nchannels)\r
@@ -285,7 +284,7 @@ public:
        \r
        std::wstring print() const\r
        {\r
-               return model_name_ + L" [" + boost::lexical_cast<std::wstring>(channel_index_) + L"|device " + \r
+               return model_name_ + L" [" + boost::lexical_cast<std::wstring>(channel_index_) + L"-" + \r
                        boost::lexical_cast<std::wstring>(device_index_) + L"|" +  format_desc_.name + L"]";\r
        }\r
 };\r
@@ -373,11 +372,11 @@ safe_ptr<core::frame_consumer> create_consumer(const std::vector<std::wstring>&
        return make_safe<bluefish_consumer_proxy>(device_index, embedded_audio, key_only);\r
 }\r
 \r
-safe_ptr<core::frame_consumer> create_consumer(const boost::property_tree::ptree& ptree) \r
+safe_ptr<core::frame_consumer> create_consumer(const boost::property_tree::wptree& ptree) \r
 {      \r
-       const auto device_index         = ptree.get("device",             1);\r
-       const auto embedded_audio       = ptree.get("embedded-audio", false);\r
-       const auto key_only                     = ptree.get("key-only",           false);\r
+       const auto device_index         = ptree.get(L"device",                  1);\r
+       const auto embedded_audio       = ptree.get(L"embedded-audio",  false);\r
+       const auto key_only                     = ptree.get(L"key-only",                false);\r
 \r
        return make_safe<bluefish_consumer_proxy>(device_index, embedded_audio, key_only);\r
 }\r