yolobs-studio/plugins/linux-capture/xcomposite-main.cpp

94 lines
2 KiB
C++
Raw Permalink Normal View History

2016-02-23 23:16:51 +00:00
#include <obs-module.h>
#include "xcompcap-main.hpp"
2019-09-22 21:19:10 +00:00
static void *xcompcap_create(obs_data_t *settings, obs_source_t *source)
2016-02-23 23:16:51 +00:00
{
return new XCompcapMain(settings, source);
}
static void xcompcap_destroy(void *data)
{
2019-09-22 21:19:10 +00:00
XCompcapMain *cc = (XCompcapMain *)data;
2016-02-23 23:16:51 +00:00
delete cc;
}
2019-09-22 21:19:10 +00:00
static void xcompcap_video_tick(void *data, float seconds)
2016-02-23 23:16:51 +00:00
{
2019-09-22 21:19:10 +00:00
XCompcapMain *cc = (XCompcapMain *)data;
2016-02-23 23:16:51 +00:00
cc->tick(seconds);
}
2019-09-22 21:19:10 +00:00
static void xcompcap_video_render(void *data, gs_effect_t *effect)
2016-02-23 23:16:51 +00:00
{
2019-09-22 21:19:10 +00:00
XCompcapMain *cc = (XCompcapMain *)data;
2016-02-23 23:16:51 +00:00
cc->render(effect);
}
2019-09-22 21:19:10 +00:00
static uint32_t xcompcap_getwidth(void *data)
2016-02-23 23:16:51 +00:00
{
2019-09-22 21:19:10 +00:00
XCompcapMain *cc = (XCompcapMain *)data;
2016-02-23 23:16:51 +00:00
return cc->width();
}
2019-09-22 21:19:10 +00:00
static uint32_t xcompcap_getheight(void *data)
2016-02-23 23:16:51 +00:00
{
2019-09-22 21:19:10 +00:00
XCompcapMain *cc = (XCompcapMain *)data;
2016-02-23 23:16:51 +00:00
return cc->height();
}
static obs_properties_t *xcompcap_props(void *unused)
{
UNUSED_PARAMETER(unused);
return XCompcapMain::properties();
}
void xcompcap_defaults(obs_data_t *settings)
{
XCompcapMain::defaults(settings);
}
void xcompcap_update(void *data, obs_data_t *settings)
{
2019-09-22 21:19:10 +00:00
XCompcapMain *cc = (XCompcapMain *)data;
2016-02-23 23:16:51 +00:00
cc->updateSettings(settings);
}
2019-09-22 21:19:10 +00:00
static const char *xcompcap_getname(void *)
2016-02-23 23:16:51 +00:00
{
return obs_module_text("XCCapture");
}
extern "C" void xcomposite_load(void)
{
if (!XCompcapMain::init())
return;
obs_source_info sinfo;
memset(&sinfo, 0, sizeof(obs_source_info));
sinfo.id = "xcomposite_input";
2019-09-22 21:19:10 +00:00
sinfo.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW |
OBS_SOURCE_DO_NOT_DUPLICATE;
2016-02-23 23:16:51 +00:00
2019-09-22 21:19:10 +00:00
sinfo.get_name = xcompcap_getname;
sinfo.create = xcompcap_create;
sinfo.destroy = xcompcap_destroy;
2016-02-23 23:16:51 +00:00
sinfo.get_properties = xcompcap_props;
2019-09-22 21:19:10 +00:00
sinfo.get_defaults = xcompcap_defaults;
sinfo.update = xcompcap_update;
sinfo.video_tick = xcompcap_video_tick;
sinfo.video_render = xcompcap_video_render;
sinfo.get_width = xcompcap_getwidth;
sinfo.get_height = xcompcap_getheight;
2020-03-25 08:07:22 +00:00
sinfo.icon_type = OBS_ICON_TYPE_WINDOW_CAPTURE,
2016-02-23 23:16:51 +00:00
obs_register_source(&sinfo);
}
extern "C" void xcomposite_unload(void)
{
XCompcapMain::deinit();
}