]> git.sesse.net Git - casparcg/blobdiff - core/producer/stage.h
### Mayor refactoring. Simplified frame handling and image_mixer. Separated video...
[casparcg] / core / producer / stage.h
index a435279f05229b64788a516ec9acc145cceaeb60..900d841c990b208691ffc73742c7893c2147c5f8 100644 (file)
 \r
 #include "frame_producer.h"\r
 \r
-#include <common/no_copy.h>\r
+#include "../monitor/monitor.h"\r
+\r
 #include <common/forward.h>\r
-#include <common/memory/safe_ptr.h>\r
-#include <common/concurrency/target.h>\r
+#include <common/spl/memory.h>\r
+#include <common/tweener.h>\r
 \r
+#include <boost/optional.hpp>\r
 #include <boost/property_tree/ptree_fwd.hpp>\r
 \r
 #include <functional>\r
@@ -39,47 +41,56 @@ FORWARD1(boost, template<typename> class unique_future);
 \r
 namespace caspar { namespace core {\r
        \r
-class stage sealed\r
+class stage sealed : public monitor::observable\r
 {\r
-       CASPAR_NO_COPY(stage);\r
+       stage(const stage&);\r
+       stage& operator=(const stage&);\r
 public:        \r
-       typedef std::function<struct frame_transform(struct frame_transform)>                                                   transform_func_t;\r
-       typedef std::tuple<int, transform_func_t, unsigned int, std::wstring>                                                   transform_tuple_t;\r
-       typedef target<std::pair<std::map<int, safe_ptr<class basic_frame>>, std::shared_ptr<void>>>    target_t;\r
 \r
-       stage(const safe_ptr<target_t>& target, const safe_ptr<diagnostics::graph>& graph, const struct video_format_desc& format_desc);\r
+       // Static Members\r
        \r
-       // stage\r
+       typedef std::function<struct frame_transform(struct frame_transform)> transform_func_t;\r
+       typedef std::tuple<int, transform_func_t, unsigned int, tweener> transform_tuple_t;\r
+\r
+       // Constructors\r
+\r
+       explicit stage(spl::shared_ptr<diagnostics::graph> graph);\r
        \r
+       // Methods\r
+\r
+       std::map<int, class draw_frame> operator()(const struct video_format_desc& format_desc);\r
+\r
        void apply_transforms(const std::vector<transform_tuple_t>& transforms);\r
-       void apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration = 0, const tweener& tween = L"linear");\r
        void clear_transforms(int index);\r
        void clear_transforms();\r
-\r
-       void spawn_token();\r
-                       \r
-       void load(int index, const safe_ptr<struct frame_producer>& producer, bool preview = false, int auto_play_delta = -1);\r
+                               \r
+       void load(int index, const spl::shared_ptr<class frame_producer>& producer, const boost::optional<int32_t>& auto_play_delta = nullptr);\r
        void pause(int index);\r
        void play(int index);\r
        void stop(int index);\r
        void clear(int index);\r
        void clear();   \r
-       void swap_layers(const safe_ptr<stage>& other);\r
+       void swap_layers(stage& other);\r
        void swap_layer(int index, int other_index);\r
-       void swap_layer(int index, int other_index, const safe_ptr<stage>& other);\r
+       void swap_layer(int index, int other_index, stage& other);\r
        \r
-       boost::unique_future<std::wstring>                                              call(int index, bool foreground, const std::wstring& param);\r
-       boost::unique_future<safe_ptr<struct frame_producer>>   foreground(int index);\r
-       boost::unique_future<safe_ptr<struct frame_producer>>   background(int index);\r
+       // monitor::observable\r
 \r
-       boost::unique_future<boost::property_tree::wptree> info() const;\r
-       boost::unique_future<boost::property_tree::wptree> info(int layer) const;\r
-       \r
-       void set_video_format_desc(const struct video_format_desc& format_desc);\r
+       virtual void subscribe(const monitor::observable::observer_ptr& o) override;\r
+       virtual void unsubscribe(const monitor::observable::observer_ptr& o) override;\r
+\r
+       // Properties\r
+\r
+       boost::unique_future<spl::shared_ptr<class frame_producer>>     foreground(int index);\r
+       boost::unique_future<spl::shared_ptr<class frame_producer>>     background(int index);\r
+\r
+       boost::unique_future<boost::property_tree::wptree>                      info() const;\r
+       boost::unique_future<boost::property_tree::wptree>                      info(int index) const;\r
 \r
 private:\r
        struct impl;\r
-       safe_ptr<impl> impl_;\r
+       spl::shared_ptr<impl> impl_;\r
 };\r
 \r
 }}
\ No newline at end of file