]> git.sesse.net Git - casparcg/blobdiff - core/producer/frame_producer.h
2.0.2: auto-deinterlace when using MIXER fill scaling and/or translation.
[casparcg] / core / producer / frame_producer.h
index 830461d5b9841ca7a31c73bc28e0285033b1c88a..b1f3aa5568d55b39f6adf36f8ab3b29d6a70bc0c 100644 (file)
@@ -1,34 +1,40 @@
 /*\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 <common/memory/safe_ptr.h>\r
 \r
 #include <boost/noncopyable.hpp>\r
 \r
+#include <algorithm>\r
 #include <functional>\r
 #include <string>\r
 #include <vector>\r
 #include <stdint.h>\r
 #include <numeric>\r
 \r
+#include <boost/thread/future.hpp>\r
+#include <boost/property_tree/ptree_fwd.hpp>\r
+\r
 namespace caspar { \r
        \r
 class executor;\r
@@ -44,14 +50,21 @@ public:
        enum hints\r
        {\r
                NO_HINT = 0,\r
-               ALPHA_HINT = 1\r
+               ALPHA_HINT = 1,\r
+               DEINTERLACE_HINT\r
        };\r
 \r
        virtual ~frame_producer(){}     \r
 \r
        virtual std::wstring print() const = 0; // nothrow\r
+       virtual boost::property_tree::wptree info() const = 0;\r
 \r
-       virtual void param(const std::wstring&){}\r
+       virtual boost::unique_future<std::wstring> call(const std::wstring&) \r
+       {\r
+               boost::promise<std::wstring> promise;\r
+               promise.set_value(L"");\r
+               return promise.get_future();\r
+       }\r
 \r
        virtual safe_ptr<frame_producer> get_following_producer() const {return frame_producer::empty();}  // nothrow\r
        virtual void set_leading_producer(const safe_ptr<frame_producer>&) {}  // nothrow\r
@@ -69,7 +82,24 @@ safe_ptr<basic_frame> receive_and_follow(safe_ptr<frame_producer>& producer, int
 typedef std::function<safe_ptr<core::frame_producer>(const safe_ptr<frame_factory>&, const std::vector<std::wstring>&)> producer_factory_t;\r
 void register_producer_factory(const producer_factory_t& factory); // Not thread-safe.\r
 safe_ptr<core::frame_producer> create_producer(const safe_ptr<frame_factory>&, const std::vector<std::wstring>& params);\r
+safe_ptr<core::frame_producer> create_producer(const safe_ptr<frame_factory>&, const std::wstring& params);\r
+safe_ptr<core::frame_producer> create_producer_destroy_proxy(safe_ptr<core::frame_producer>&& producer);\r
+\r
+template<typename T>\r
+typename std::decay<T>::type get_param(const std::wstring& name, const std::vector<std::wstring>& params, T fail_value)\r
+{      \r
+       auto it = std::find(params.begin(), params.end(), name);\r
+       if(it == params.end() || ++it == params.end())  \r
+               return fail_value;\r
+       \r
+       T value = fail_value;\r
+       try\r
+       {\r
+               value = boost::lexical_cast<std::decay<T>::type>(*it);\r
+       }\r
+       catch(boost::bad_lexical_cast&){}\r
 \r
-safe_ptr<core::frame_producer> create_destroy_producer_proxy(executor& destroy_context, const safe_ptr<frame_producer>& producer);\r
+       return value;\r
+}\r
 \r
 }}\r