2014-04-28 17:59:53 -07:00
|
|
|
#include <obs-module.h>
|
|
|
|
|
2014-08-29 17:05:32 -07:00
|
|
|
#include "xcompcap-main.hpp"
|
2014-04-28 17:59:53 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
static void* xcompcap_create(obs_data_t *settings, obs_source_t *source)
|
2014-04-28 17:59:53 -07:00
|
|
|
{
|
|
|
|
return new XCompcapMain(settings, source);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xcompcap_destroy(void *data)
|
|
|
|
{
|
|
|
|
XCompcapMain* cc = (XCompcapMain*)data;
|
|
|
|
delete cc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xcompcap_video_tick(void* data, float seconds)
|
|
|
|
{
|
|
|
|
XCompcapMain* cc = (XCompcapMain*)data;
|
|
|
|
cc->tick(seconds);
|
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
static void xcompcap_video_render(void* data, gs_effect_t *effect)
|
2014-04-28 17:59:53 -07:00
|
|
|
{
|
|
|
|
XCompcapMain* cc = (XCompcapMain*)data;
|
|
|
|
cc->render(effect);
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t xcompcap_getwidth(void* data)
|
|
|
|
{
|
|
|
|
XCompcapMain* cc = (XCompcapMain*)data;
|
|
|
|
return cc->width();
|
|
|
|
}
|
|
|
|
|
|
|
|
static uint32_t xcompcap_getheight(void* data)
|
|
|
|
{
|
|
|
|
XCompcapMain* cc = (XCompcapMain*)data;
|
|
|
|
return cc->height();
|
|
|
|
}
|
|
|
|
|
2014-09-29 08:36:13 -07:00
|
|
|
static obs_properties_t *xcompcap_props(void *unused)
|
2014-04-28 17:59:53 -07:00
|
|
|
{
|
2014-09-29 08:36:13 -07:00
|
|
|
UNUSED_PARAMETER(unused);
|
|
|
|
|
2014-06-25 00:13:00 -07:00
|
|
|
return XCompcapMain::properties();
|
2014-04-28 17:59:53 -07:00
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void xcompcap_defaults(obs_data_t *settings)
|
2014-04-28 17:59:53 -07:00
|
|
|
{
|
|
|
|
XCompcapMain::defaults(settings);
|
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void xcompcap_update(void *data, obs_data_t *settings)
|
2014-04-28 17:59:53 -07:00
|
|
|
{
|
|
|
|
XCompcapMain* cc = (XCompcapMain*)data;
|
|
|
|
cc->updateSettings(settings);
|
|
|
|
}
|
|
|
|
|
2014-06-25 00:13:00 -07:00
|
|
|
static const char* xcompcap_getname(void)
|
2014-04-28 17:59:53 -07:00
|
|
|
{
|
2014-07-09 22:12:57 -07:00
|
|
|
return obs_module_text("XCCapture");
|
2014-04-28 17:59:53 -07:00
|
|
|
}
|
|
|
|
|
2014-08-29 17:05:32 -07:00
|
|
|
extern "C" void xcomposite_load(void)
|
2014-04-28 17:59:53 -07:00
|
|
|
{
|
2014-05-15 02:12:22 -07:00
|
|
|
if (!XCompcapMain::init())
|
2014-08-29 17:05:32 -07:00
|
|
|
return;
|
2014-04-28 17:59:53 -07:00
|
|
|
|
|
|
|
obs_source_info sinfo;
|
|
|
|
memset(&sinfo, 0, sizeof(obs_source_info));
|
|
|
|
|
|
|
|
sinfo.id = "xcomposite_input";
|
|
|
|
sinfo.output_flags = OBS_SOURCE_VIDEO;
|
|
|
|
|
2014-08-04 21:27:52 -07:00
|
|
|
sinfo.get_name = xcompcap_getname;
|
|
|
|
sinfo.create = xcompcap_create;
|
|
|
|
sinfo.destroy = xcompcap_destroy;
|
|
|
|
sinfo.get_properties = xcompcap_props;
|
|
|
|
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;
|
2014-04-28 17:59:53 -07:00
|
|
|
|
|
|
|
obs_register_source(&sinfo);
|
|
|
|
}
|
|
|
|
|
2014-08-29 17:05:32 -07:00
|
|
|
extern "C" void xcomposite_unload(void)
|
2014-04-28 17:59:53 -07:00
|
|
|
{
|
|
|
|
XCompcapMain::deinit();
|
|
|
|
}
|