]> git.sesse.net Git - casparcg/commitdiff
Added missing files
authorHelge Norberg <helge.norberg@svt.se>
Mon, 12 Aug 2013 16:14:21 +0000 (18:14 +0200)
committerHelge Norberg <helge.norberg@svt.se>
Mon, 12 Aug 2013 16:14:21 +0000 (18:14 +0200)
.gitignore
core/producer/scene/hotswap_producer.cpp [new file with mode: 0644]
core/producer/scene/hotswap_producer.h [new file with mode: 0644]

index 3f6cfa02ffa420f820436d5405627099870e72b4..d21b4931daddd3451c0ad21aedd2e9ee4063646d 100644 (file)
 /test/psd-test/Debug
 
 /test/psd-test/psd-test.vcxproj.user
+freetype
diff --git a/core/producer/scene/hotswap_producer.cpp b/core/producer/scene/hotswap_producer.cpp
new file mode 100644 (file)
index 0000000..f120cc8
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
+*
+* This file is part of CasparCG (www.casparcg.com).
+*
+* CasparCG is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* CasparCG is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
+*
+* Author: Helge Norberg, helge.norberg@svt.se
+*/
+
+#include "../../stdafx.h"
+
+#include "hotswap_producer.h"
+
+#include "../frame_producer.h"
+#include "../../frame/draw_frame.h"
+
+namespace caspar { namespace core {
+
+struct hotswap_producer::impl
+{
+       binding<std::shared_ptr<frame_producer>> producer;
+       constraints size;
+
+       impl(int width, int height)
+               : size(width, height)
+       {
+       }
+};
+
+hotswap_producer::hotswap_producer(int width, int height)
+       : impl_(new impl(width, height))
+{
+}
+
+hotswap_producer::~hotswap_producer()
+{
+}
+
+draw_frame hotswap_producer::receive_impl()
+{
+       auto producer = impl_->producer.get();
+
+       if (producer)
+               return producer->receive();
+       else
+               return draw_frame::empty();
+}
+
+constraints& hotswap_producer::pixel_constraints()
+{
+       return impl_->size;
+}
+       
+std::wstring hotswap_producer::print() const
+{
+       auto producer = impl_->producer.get();
+       return L"hotswap[" + (producer ? producer->print() : L"") + L"]";
+}
+
+std::wstring hotswap_producer::name() const
+{
+       return L"hotswap";
+}
+       
+boost::property_tree::wptree hotswap_producer::info() const
+{
+       boost::property_tree::wptree info;
+       info.add(L"type", L"hotswap");
+
+       auto producer = impl_->producer.get();
+
+       if (producer)
+               info.add(L"producer", producer->print());
+
+       return info;
+}
+
+void hotswap_producer::subscribe(const monitor::observable::observer_ptr& o)
+{
+}
+
+void hotswap_producer::unsubscribe(const monitor::observable::observer_ptr& o)
+{
+}
+
+binding<std::shared_ptr<frame_producer>>& hotswap_producer::producer()
+{
+       return impl_->producer;
+}
+
+}}
diff --git a/core/producer/scene/hotswap_producer.h b/core/producer/scene/hotswap_producer.h
new file mode 100644 (file)
index 0000000..5e95caa
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>
+*
+* This file is part of CasparCG (www.casparcg.com).
+*
+* CasparCG is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* CasparCG is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
+*
+* Author: Helge Norberg, helge.norberg@svt.se
+*/
+
+#pragma once
+
+#include <common/memory.h>
+
+#include <string>
+#include <vector>
+
+#include "../frame_producer.h"
+
+namespace caspar { namespace core {
+
+class hotswap_producer : public frame_producer_base
+{
+public:
+       hotswap_producer(int width, int height);
+       ~hotswap_producer();
+
+       draw_frame receive_impl() override;
+       constraints& pixel_constraints() override;
+       std::wstring print() const override;
+       std::wstring name() const override;
+       boost::property_tree::wptree info() const override;
+       void subscribe(const monitor::observable::observer_ptr& o) override;
+       void unsubscribe(const monitor::observable::observer_ptr& o) override;
+
+       binding<std::shared_ptr<frame_producer>>& producer();
+private:
+       struct impl;
+       std::unique_ptr<impl> impl_;
+};
+
+}}