]> 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 73102093fba613aa3d2138f5c3ac71ce16962dd9..bd75385c715a7119e2be6315e76f785b2f3c8351 100644 (file)
@@ -1,50 +1,74 @@
-/*\r
-* copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
-*\r
-*  This file is part of CasparCG.\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
-*/\r
-#pragma once\r
-\r
-#include "../consumer/frame_consumer.h"\r
-\r
-#include <common/concurrency/governor.h>\r
-#include <common/memory/safe_ptr.h>\r
-\r
-#include <boost/noncopyable.hpp>\r
-\r
-#include <agents.h>\r
-\r
-namespace caspar { namespace core {\r
-       \r
-class video_channel_context;\r
-\r
-class output : boost::noncopyable\r
-{\r
-public:\r
-       typedef std::pair<safe_ptr<core::read_frame>, ticket_t> source_element_t;\r
-       typedef Concurrency::ISource<source_element_t>                  source_t;\r
-\r
-       explicit output(source_t& source, const video_format_desc& format_desc);\r
-\r
-       void add(int index, safe_ptr<frame_consumer>&& consumer);\r
-       void remove(int index);\r
-private:\r
-       struct implementation;\r
-       safe_ptr<implementation> 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_;
+};
+
+}}