| 10 | using namespace xstudio::plugin; |
| 11 | |
| 12 | StandardPlugin::StandardPlugin( |
| 13 | caf::actor_config &cfg, std::string name, const utility::JsonStore &init_settings) |
| 14 | : caf::event_based_actor(cfg), module::Module(name) { |
| 15 | |
| 16 | utility::print_on_exit(this, name); |
| 17 | |
| 18 | join_studio_events(); |
| 19 | |
| 20 | plugin_events_ = spawn<broadcast::BroadcastActor>(this); |
| 21 | link_to(plugin_events_); |
| 22 | |
| 23 | #pragma GCC diagnostic push |
| 24 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 25 | |
| 26 | set_default_handler( |
| 27 | [this](caf::scheduled_actor *, caf::message &msg) -> caf::skippable_result { |
| 28 | spdlog::warn( |
| 29 | "{} got unexpected message from {} {}", |
| 30 | Module::name(), |
| 31 | to_string(current_sender()), |
| 32 | to_string(msg)); |
| 33 | |
| 34 | if (current_sender()) { |
| 35 | mail(utility::name_atom_v) |
| 36 | .request(caf::actor_cast<caf::actor>(current_sender()), infinite) |
| 37 | .then( |
| 38 | [=](std::string __name) { |
| 39 | std::cerr << "Message came from " << __name << "\n"; |
| 40 | }, |
| 41 | [=](caf::error &err) { std::cerr << "Can't get name of sender.\n"; }); |
| 42 | } |
| 43 | return message{}; |
| 44 | }); |
| 45 | |
| 46 | #pragma GCC diagnostic pop |
| 47 | |
| 48 | message_handler_ = { |
| 49 | |
| 50 | [=](plugin::plugin_events_group_atom) -> caf::actor { return plugin_events_; }, |
| 51 | |
| 52 | [=](utility::event_atom, session::session_atom, caf::actor session) { |
| 53 | session_changed(session); |
| 54 | }, |
| 55 | |
| 56 | [=](utility::event_atom, |
| 57 | session::session_request_atom, |
| 58 | const std::string &path, |
| 59 | const utility::JsonStore &js) {}, |
| 60 | |
| 61 | [=](broadcast::broadcast_down_atom, const caf::actor_addr &addr) { |
| 62 | if (addr == playhead_media_events_group_) { |
| 63 | playhead_media_events_group_ = caf::actor_addr(); |
| 64 | } |
| 65 | }, |
| 66 | |
| 67 | [=](ui::viewport::prepare_overlay_render_data_atom, |
| 68 | const media_reader::ImageBufDisplaySetPtr &image_set, |
| 69 | const std::string &viewport_name, |
nothing calls this directly
no test coverage detected