X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=core%2Fproducer%2Fstage.h;h=69925892ec05babee4b27d6112e6b623b832ed00;hb=c64b8283bfe0bcc28b0d196f997d6deec6b41a3f;hp=2fddec0c23f7f1dd83af68d0fbe9b6775ffd19f2;hpb=8ce604dedb112e843db6480c1d8901def4e0d870;p=casparcg diff --git a/core/producer/stage.h b/core/producer/stage.h index 2fddec0c2..69925892e 100644 --- a/core/producer/stage.h +++ b/core/producer/stage.h @@ -1,86 +1,111 @@ -/* -* Copyright (c) 2011 Sveriges Television AB -* -* 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 . -* -* Author: Robert Nagy, ronag89@gmail.com -*/ - -#pragma once - -#include "frame_producer.h" - -#include "../monitor/monitor.h" - -#include -#include -#include - -#include -#include - -#include -#include -#include - -FORWARD2(caspar, diagnostics, class graph); -FORWARD1(boost, template class unique_future); - -namespace caspar { namespace core { - -class stage sealed : public monitor::observable -{ - stage(const stage&); - stage& operator=(const stage&); -public: - typedef std::function transform_func_t; - typedef std::tuple transform_tuple_t; - - stage(spl::shared_ptr graph); - - std::map> operator()(const struct video_format_desc& format_desc); - - void apply_transforms(const std::vector& transforms); - void apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration = 0, const tweener& tween = L"linear"); - void clear_transforms(int index); - void clear_transforms(); - - void load(int index, const spl::shared_ptr& producer, const boost::optional& auto_play_delta = nullptr); - void pause(int index); - void play(int index); - void stop(int index); - void clear(int index); - void clear(); - void swap_layers(stage& other); - void swap_layer(int index, int other_index); - void swap_layer(int index, int other_index, stage& other); - - boost::unique_future> foreground(int index); - boost::unique_future> background(int index); - - boost::unique_future info() const; - boost::unique_future info(int index) const; - - // monitor::observable - - virtual void subscribe(const monitor::observable::observer_ptr& o) override; - virtual void unsubscribe(const monitor::observable::observer_ptr& o) override; -private: - struct impl; - spl::shared_ptr impl_; -}; - +/* +* Copyright (c) 2011 Sveriges Television AB +* +* 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 . +* +* Author: Robert Nagy, ronag89@gmail.com +*/ + +#pragma once + +#include "../fwd.h" +#include "../monitor/monitor.h" +#include "../interaction/interaction_sink.h" + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +FORWARD2(caspar, diagnostics, class graph); + +namespace caspar { namespace core { + +//typedef reactive::observable> frame_observable; + +class stage final : public interaction_sink +{ + stage(const stage&); + stage& operator=(const stage&); +public: + + // Static Members + + typedef std::function transform_func_t; + typedef std::tuple transform_tuple_t; + + // Constructors + + explicit stage(int channel_index, spl::shared_ptr graph); + + // Methods + + std::map operator()(const video_format_desc& format_desc); + + std::future apply_transforms(const std::vector& transforms); + std::future apply_transform(int index, const transform_func_t& transform, unsigned int mix_duration, const tweener& tween); + std::future clear_transforms(int index); + std::future clear_transforms(); + std::future get_current_transform(int index); + std::future load(int index, const spl::shared_ptr& producer, bool preview = false, const boost::optional& auto_play_delta = boost::optional()); + std::future pause(int index); + std::future resume(int index); + std::future play(int index); + std::future stop(int index); + std::future call(int index, const std::vector& params); + std::future clear(int index); + std::future clear(); + std::future swap_layers(stage& other, bool swap_transforms); + std::future swap_layer(int index, int other_index, bool swap_transforms); + std::future swap_layer(int index, int other_index, stage& other, bool swap_transforms); + + void add_layer_consumer(void* token, int layer, const spl::shared_ptr& layer_consumer); + void remove_layer_consumer(void* token, int layer); + + monitor::subject& monitor_output(); + + // frame_observable + //void subscribe(const frame_observable::observer_ptr& o) override; + //void unsubscribe(const frame_observable::observer_ptr& o) override; + + // interaction_sink + + void on_interaction(const interaction_event::ptr& event) override; + + // Properties + + std::future> foreground(int index); + std::future> background(int index); + + std::future info() const; + std::future info(int index) const; + + std::future delay_info() const; + std::future delay_info(int layer) const; +private: + struct impl; + spl::shared_ptr impl_; +}; + }} \ No newline at end of file