/*\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
#pragma once\r
\r
-#include "../format/video_format.h"\r
-#include "../processor/read_frame.h"\r
+#include <common/memory/safe_ptr.h>\r
\r
#include <boost/noncopyable.hpp>\r
+#include <boost/property_tree/ptree_fwd.hpp>\r
\r
-#include <boost/thread/future.hpp>\r
-\r
-#include <memory>\r
+#include <functional>\r
+#include <string>\r
+#include <vector>\r
\r
namespace caspar { namespace core {\r
\r
+class read_frame;\r
+struct video_format_desc;\r
+\r
struct frame_consumer : boost::noncopyable\r
{\r
virtual ~frame_consumer() {}\r
-\r
- virtual boost::unique_future<void> prepare(const consumer_frame&)\r
- {\r
- boost::promise<void> promise;\r
- promise.set_value();\r
- return promise.get_future();\r
- }\r
-\r
- virtual boost::unique_future<void> display(const consumer_frame&)\r
- {\r
- boost::promise<void> promise;\r
- promise.set_value();\r
- return promise.get_future();\r
- }\r
- virtual bool has_sync_clock() const {return false;}\r
+ \r
+ virtual bool send(const safe_ptr<read_frame>& frame) = 0;\r
+ virtual void initialize(const video_format_desc& format_desc, int channel_index) = 0;\r
+ virtual std::wstring print() const = 0;\r
+ virtual boost::property_tree::wptree info() const = 0;\r
+ virtual bool has_synchronization_clock() const {return true;}\r
+ virtual size_t buffer_depth() const = 0;\r
+ virtual int index() const = 0;\r
+\r
+ static const safe_ptr<frame_consumer>& empty();\r
};\r
-typedef std::shared_ptr<frame_consumer> frame_consumer_ptr;\r
-typedef std::shared_ptr<const frame_consumer> frame_consumer_const_ptr;\r
\r
-typedef std::unique_ptr<frame_consumer> frame_consumer_uptr;\r
-typedef std::unique_ptr<const frame_consumer> frame_consumer_const_uptr;\r
+safe_ptr<frame_consumer> create_consumer_cadence_guard(const safe_ptr<frame_consumer>& consumer);\r
+\r
+typedef std::function<safe_ptr<core::frame_consumer>(const std::vector<std::wstring>&)> consumer_factory_t;\r
+\r
+void register_consumer_factory(const consumer_factory_t& factory);\r
+safe_ptr<core::frame_consumer> create_consumer(const std::vector<std::wstring>& params);\r
\r
}}
\ No newline at end of file