]> git.sesse.net Git - casparcg/commitdiff
2.0.0.2: Fixed invalid layer index print.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 28 Feb 2011 20:36:56 +0000 (20:36 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 28 Feb 2011 20:36:56 +0000 (20:36 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@501 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

core/producer/frame_producer_device.cpp
core/producer/layer.h
protocol/util/ClientInfo.h

index 763f031b4573958dd67bdb5a2e556f70ccbf584f..e15847b57943a15dadb597998240360861d65d91 100644 (file)
@@ -53,6 +53,14 @@ public:
                output_(draw());\r
                executor_.begin_invoke([=]{tick();});\r
        }\r
+               \r
+       layer& get_layer(int index)\r
+       {\r
+               auto it = layers_.find(index);\r
+               if(it == layers_.end())\r
+                       it = layers_.insert(std::make_pair(index, layer(index, std::bind(&implementation::print, this)))).first;\r
+               return it->second;\r
+       }\r
        \r
        std::vector<safe_ptr<draw_frame>> draw()\r
        {       \r
@@ -73,29 +81,29 @@ public:
 \r
        void load(int index, const safe_ptr<frame_producer>& producer, bool play_on_load, bool preview)\r
        {\r
-               producer->set_parent_printer(std::bind(&layer::print, &layers_[index]));\r
+               producer->set_parent_printer(std::bind(&layer::print, &get_layer(index)));\r
                producer->initialize(factory_);\r
-               executor_.invoke([&]{layers_[index].load(producer, play_on_load, preview);});\r
+               executor_.invoke([&]{get_layer(index).load(producer, play_on_load, preview);});\r
        }\r
 \r
        void pause(int index)\r
        {               \r
-               executor_.invoke([&]{layers_[index].pause();});\r
+               executor_.invoke([&]{get_layer(index).pause();});\r
        }\r
 \r
        void play(int index)\r
        {               \r
-               executor_.invoke([&]{layers_[index].play();});\r
+               executor_.invoke([&]{get_layer(index).play();});\r
        }\r
 \r
        void stop(int index)\r
        {               \r
-               executor_.invoke([&]{layers_[index].stop();});\r
+               executor_.invoke([&]{get_layer(index).stop();});\r
        }\r
 \r
        void clear(int index)\r
        {\r
-               executor_.invoke([&]{layers_[index].clear();});\r
+               executor_.invoke([&]{get_layer(index).clear();});\r
        }\r
                \r
        void clear()\r
@@ -111,7 +119,7 @@ public:
        {\r
                executor_.invoke([&]\r
                {\r
-                       layers_[index].swap(layers_[other_index]);\r
+                       get_layer(index).swap(layers_[other_index]);\r
                });\r
        }\r
 \r
@@ -123,7 +131,7 @@ public:
                {\r
                        auto func = [&]\r
                        {\r
-                               layers_[index].swap(other.impl_->layers_.at(other_index));              \r
+                               get_layer(index).swap(other.impl_->layers_.at(other_index));            \r
 \r
                                CASPAR_LOG(info) << print() << L" Swapped layer " << index << L" with " << other.impl_->print() << L" layer " << other_index << L".";   \r
                        };\r
@@ -151,7 +159,7 @@ public:
                        std::set_union(my_indices.begin(), my_indices.end(), other_indicies.begin(), other_indicies.end(), std::back_inserter(indices));\r
                        \r
                        BOOST_FOREACH(auto index, indices)\r
-                               layers_[index].swap(other.impl_->layers_[index]);\r
+                               get_layer(index).swap(other.impl_->get_layer(index));\r
 \r
                        CASPAR_LOG(info) << print() << L" Swapped layers with " << other.impl_->print() << L".";\r
                };\r
index 9e70ae583e79f451f7f9ccd9c0b39c4d3ffbd3c5..dae8b399d3942d335f9bb94c74e714de81cb07ac 100644 (file)
@@ -17,7 +17,7 @@ class draw_frame;
 class layer : boost::noncopyable\r
 {\r
 public:\r
-       layer(int index = -101, const printer& parent_printer = nullptr); // nothrow\r
+       layer(int index = std::numeric_limits<int>::min(), const printer& parent_printer = nullptr); // nothrow\r
        layer(layer&& other); // nothrow\r
        layer& operator=(layer&& other); // nothrow\r
 \r
index b6da5d3d03a08c7894cbfca7d77dca02d9fa0afa..f06a25e7d9c9e2313cac27d5b395a0b32295998e 100644 (file)
@@ -44,7 +44,7 @@ struct ConsoleClientInfo : public caspar::IO::ClientInfo
 {\r
        void Send(const std::wstring& data)\r
        {\r
-               std::wcout << data << std::endl;\r
+               std::wcout << L"# " << data << L" #" << std::endl;\r
        }\r
        void Disconnect(){}\r
 };\r