MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ start()

void MayaFlux::Yantra::Vision::VisionWorkflow::start ( const std::shared_ptr< Kakshya::VideoStreamContainer > &  source,
const std::shared_ptr< Buffers::TextureBuffer > &  frames,
const LiveConfig &  live,
const std::shared_ptr< VisionMatrix > &  matrix,
const std::string &  name,
std::function< void(const VisionIO &)>  consumer,
std::function< bool()>  stop_when = {} 
)
private

Subscribe consumer and start the producer named name, which stops the run at source's end, or once stop_when reports true when it is given.

Definition at line 544 of file VisionWorkflow.cpp.

552{
553 auto results = std::make_shared<Vruta::BroadcastSource<VisionIO>>();
554 auto event = Kriya::subscribe(*m_event_manager.lock(), results, std::move(consumer));
555 keep(name, event);
556
557 auto ended = stop_at_end(source, m_scheduler, m_event_manager, event, name);
558 if (stop_when) {
559 ended = [at_end = std::move(ended), stop_when = std::move(stop_when),
560 scheduler = m_scheduler, events = m_event_manager, weak_consumer = std::weak_ptr(event), name]() {
561 if (at_end())
562 return true;
563 if (!stop_when())
564 return false;
565 stop_run(scheduler, events, weak_consumer, name);
566 return true;
567 };
568 }
569
570 start_producer(*m_scheduler.lock(), results, source, frames, live.apply_to, matrix, live.interval_seconds,
571 ended, name);
572}
std::string name
Definition VKDevice.cpp:123
std::weak_ptr< Vruta::EventManager > m_event_manager
void keep(const std::string &name, const std::shared_ptr< Vruta::Event > &consumer)
std::weak_ptr< Vruta::TaskScheduler > m_scheduler
std::shared_ptr< Vruta::Event > subscribe(Vruta::EventManager &events, std::shared_ptr< Vruta::BroadcastSource< T > > source, Callback callback, const std::string &name="")
Call callback with every value source signals, registered on events.

References MayaFlux::Yantra::Vision::LiveConfig::apply_to, MayaFlux::Yantra::Vision::LiveConfig::interval_seconds, name, and MayaFlux::Kriya::subscribe().

Referenced by process_to_buffer(), process_to_live_container(), and process_to_stream().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: