]> git.sesse.net Git - casparcg/blobdiff - core/consumer/output.h
Created a consumer that provides sync to a channel based on the pace of another chann...
[casparcg] / core / consumer / output.h
index 9c8c6309602a56a908ab34d37adef9dc6ef8ec74..bd75385c715a7119e2be6315e76f785b2f3c8351 100644 (file)
@@ -1,57 +1,74 @@
-/*\r
-* Copyright (c) 2011 Sveriges Television AB <info@casparcg.com>\r
-*\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
-*\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
-#pragma once\r
-\r
-#include <common/forward.h>\r
-#include <common/memory/safe_ptr.h>\r
-#include <common/reactive.h>\r
-\r
-#include <boost/noncopyable.hpp>\r
-#include <boost/property_tree/ptree_fwd.hpp>\r
-\r
-FORWARD1(boost, template<typename> class unique_future)\r
-FORWARD2(caspar, diagnostics, class graph);\r
-\r
-namespace caspar { namespace core {\r
-       \r
-class output sealed : boost::noncopyable\r
-{\r
-public:\r
-       explicit output(const struct video_format_desc& format_desc, int channel_index);\r
-       \r
-       // output\r
-\r
-       void operator()(safe_ptr<const struct frame> frame, const struct video_format_desc& format_desc);\r
-       \r
-       void add(const safe_ptr<struct frame_consumer>& consumer);\r
-       void add(int index, const safe_ptr<struct frame_consumer>& consumer);\r
-       void remove(const safe_ptr<struct frame_consumer>& consumer);\r
-       void remove(int index);\r
-       \r
-       boost::unique_future<boost::property_tree::wptree> info() const;\r
-\r
-private:\r
-       struct impl;\r
-       safe_ptr<impl> impl_;\r
-};\r
-\r
-}}
\ No newline at end of file
+/*
+* 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: Robert Nagy, ronag89@gmail.com
+*/
+
+#pragma once
+
+#include "../monitor/monitor.h"
+#include "../fwd.h"
+
+#include <common/forward.h>
+#include <common/future_fwd.h>
+#include <common/memory.h>
+
+#include <boost/property_tree/ptree_fwd.hpp>
+
+#include <future>
+
+FORWARD2(caspar, diagnostics, class graph);
+
+namespace caspar { namespace core {
+
+class output final
+{
+       output(const output&);
+       output& operator=(const output&);
+public:
+
+       // Static Members
+
+       // Constructors
+
+       explicit output(spl::shared_ptr<caspar::diagnostics::graph> graph, const video_format_desc& format_desc, const core::audio_channel_layout& channel_layout, int channel_index);
+
+       // Methods
+
+       // Returns when submitted to consumers, but the future indicates when the consumers are ready for a new frame.
+       std::future<void> operator()(const_frame frame, const video_format_desc& format_desc, const core::audio_channel_layout& channel_layout);
+
+       void add(const spl::shared_ptr<frame_consumer>& consumer);
+       void add(int index, const spl::shared_ptr<frame_consumer>& consumer);
+       void remove(const spl::shared_ptr<frame_consumer>& consumer);
+       void remove(int index);
+
+       monitor::subject& monitor_output();
+
+       // Properties
+
+       std::future<boost::property_tree::wptree> info() const;
+       std::future<boost::property_tree::wptree> delay_info() const;
+       std::vector<spl::shared_ptr<const frame_consumer>> get_consumers() const;
+
+private:
+       struct impl;
+       spl::shared_ptr<impl> impl_;
+};
+
+}}