\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
-namespace caspar { namespace core {\r
+namespace caspar { \r
+ \r
+class executor;\r
+ \r
+namespace core {\r
\r
class basic_frame;\r
struct frame_factory;\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
\r
- virtual int64_t nb_frames() const {return 0;}\r
+ virtual int64_t nb_frames() const {return std::numeric_limits<int>::max();}\r
\r
virtual safe_ptr<basic_frame> receive(int hints) = 0;\r
virtual safe_ptr<core::basic_frame> last_frame() const = 0;\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
\r
+safe_ptr<core::frame_producer> create_destroy_producer_proxy(executor& destroy_context, const safe_ptr<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
+ return value;\r
+}\r
\r
}}\r