|
|
@@ -99,22 +99,49 @@ static uint32_t color_source_getheight(void *data)
|
|
|
return context->height;
|
|
|
}
|
|
|
|
|
|
-static void color_source_defaults(obs_data_t *settings)
|
|
|
+static void color_source_defaults_v1(obs_data_t *settings)
|
|
|
{
|
|
|
obs_data_set_default_int(settings, "color", 0xFFFFFFFF);
|
|
|
obs_data_set_default_int(settings, "width", 400);
|
|
|
obs_data_set_default_int(settings, "height", 400);
|
|
|
}
|
|
|
|
|
|
-struct obs_source_info color_source_info = {
|
|
|
+static void color_source_defaults_v2(obs_data_t *settings)
|
|
|
+{
|
|
|
+ struct obs_video_info ovi;
|
|
|
+ obs_get_video_info(&ovi);
|
|
|
+
|
|
|
+ obs_data_set_default_int(settings, "color", 0xFFFFFFFF);
|
|
|
+ obs_data_set_default_int(settings, "width", ovi.base_width);
|
|
|
+ obs_data_set_default_int(settings, "height", ovi.base_width);
|
|
|
+}
|
|
|
+
|
|
|
+struct obs_source_info color_source_info_v1 = {
|
|
|
.id = "color_source",
|
|
|
.type = OBS_SOURCE_TYPE_INPUT,
|
|
|
+ .output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW |
|
|
|
+ OBS_SOURCE_CAP_OBSOLETE,
|
|
|
+ .create = color_source_create,
|
|
|
+ .destroy = color_source_destroy,
|
|
|
+ .update = color_source_update,
|
|
|
+ .get_name = color_source_get_name,
|
|
|
+ .get_defaults = color_source_defaults_v1,
|
|
|
+ .get_width = color_source_getwidth,
|
|
|
+ .get_height = color_source_getheight,
|
|
|
+ .video_render = color_source_render,
|
|
|
+ .get_properties = color_source_properties,
|
|
|
+ .icon_type = OBS_ICON_TYPE_COLOR,
|
|
|
+};
|
|
|
+
|
|
|
+struct obs_source_info color_source_info_v2 = {
|
|
|
+ .id = "color_source_v2",
|
|
|
+ .type = OBS_SOURCE_TYPE_INPUT,
|
|
|
.output_flags = OBS_SOURCE_VIDEO | OBS_SOURCE_CUSTOM_DRAW,
|
|
|
.create = color_source_create,
|
|
|
.destroy = color_source_destroy,
|
|
|
.update = color_source_update,
|
|
|
.get_name = color_source_get_name,
|
|
|
- .get_defaults = color_source_defaults,
|
|
|
+ .get_defaults = color_source_defaults_v2,
|
|
|
.get_width = color_source_getwidth,
|
|
|
.get_height = color_source_getheight,
|
|
|
.video_render = color_source_render,
|