| 49 | } |
| 50 | |
| 51 | static void registerWebsocketVendor() |
| 52 | { |
| 53 | vendor = obs_websocket_register_vendor(VendorName); |
| 54 | if (!vendor) { |
| 55 | blog(LOG_ERROR, |
| 56 | "Vendor registration failed! (obs-websocket should have logged something if installed properly.)"); |
| 57 | return; |
| 58 | } |
| 59 | |
| 60 | auto api_version = obs_websocket_get_api_version(); |
| 61 | if (api_version == 0) { |
| 62 | blog(LOG_ERROR, |
| 63 | "Unable to fetch obs-websocket plugin API version."); |
| 64 | return; |
| 65 | } else if (api_version == 1) { |
| 66 | blog(LOG_WARNING, |
| 67 | "Unsupported obs-websocket plugin API version for calling requests."); |
| 68 | return; |
| 69 | } |
| 70 | |
| 71 | registerWebsocketVendorRequest(VendorRequestStart, |
| 72 | [](obs_data_t *, obs_data_t *, void *) { |
| 73 | StartPlugin(); |
| 74 | }); |
| 75 | registerWebsocketVendorRequest(VendorRequestStop, |
| 76 | [](obs_data_t *, obs_data_t *, void *) { |
| 77 | StopPlugin(); |
| 78 | }); |
| 79 | registerWebsocketVendorRequest( |
| 80 | VendorRequestStatus, |
| 81 | [](obs_data_t *, obs_data_t *response, void *) { |
| 82 | obs_data_set_bool(response, "isRunning", |
| 83 | PluginIsRunning()); |
| 84 | }); |
| 85 | } |
| 86 | |
| 87 | const char *GetWebsocketVendorName() |
| 88 | { |
nothing calls this directly
no test coverage detected