|
|
@ -9,55 +9,69 @@ const int window_width = 1280; |
|
|
|
const int window_height = 720; |
|
|
|
obs_display_t *display; |
|
|
|
|
|
|
|
const char * |
|
|
|
get_version() |
|
|
|
const char * go_get_version() |
|
|
|
{ |
|
|
|
sprintf(version, "Version: 0.0.1; OBS version: %s\n", obs_get_version_string()); |
|
|
|
return version; |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
print_version_string() |
|
|
|
void print_version_string() |
|
|
|
{ |
|
|
|
printf ("%s\n", get_version ()); |
|
|
|
printf("%s\n", go_get_version()); |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
obs_render (void *param, |
|
|
|
uint32_t cx, |
|
|
|
uint32_t cy) |
|
|
|
static void obs_render(void *param, uint32_t cx, uint32_t cy) |
|
|
|
{ |
|
|
|
obs_render_main_texture(); |
|
|
|
} |
|
|
|
|
|
|
|
void |
|
|
|
render_input_types_window(GtkApplication *app, |
|
|
|
GtkWidget *parent_window) |
|
|
|
static bool enum_sources(void *param, obs_source_t *source) |
|
|
|
{ |
|
|
|
GtkWidget *box = param; |
|
|
|
const char *source_name = obs_source_get_name(source); |
|
|
|
uint32_t flags = obs_source_get_output_flags(source); |
|
|
|
|
|
|
|
if ((flags & OBS_SOURCE_VIDEO) != 0) |
|
|
|
printf("video source!\n"); |
|
|
|
|
|
|
|
printf("source: %s\n", source_name); |
|
|
|
gtk_container_add(GTK_CONTAINER(box), gtk_label_new(source_name)); |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
static void render_sources_window(GtkApplication *app, GtkWidget *parent_window) |
|
|
|
{ |
|
|
|
GtkWidget *window, *box; |
|
|
|
const char *input_type; |
|
|
|
const char *t; |
|
|
|
|
|
|
|
printf("rendering input types\n"); |
|
|
|
printf("rendering sources\n"); |
|
|
|
|
|
|
|
window = gtk_application_window_new(app); |
|
|
|
gtk_window_set_title(GTK_WINDOW(window), "OBS - Sources"); |
|
|
|
gtk_window_set_default_size(GTK_WINDOW(window), 500, 500); |
|
|
|
|
|
|
|
box = gtk_list_box_new(); |
|
|
|
for (int i = 0; obs_enum_input_types (i, &input_type); ++i) |
|
|
|
|
|
|
|
for (int i = 0; obs_enum_source_types(i, &t); ++i) |
|
|
|
{ |
|
|
|
printf("input type: %s\n", input_type); |
|
|
|
gtk_container_add (GTK_CONTAINER (box), gtk_label_new (input_type)); |
|
|
|
printf("source type: %s\n", t); |
|
|
|
//gtk_container_add(GTK_CONTAINER(box), gtk_label_new(t)); |
|
|
|
} |
|
|
|
|
|
|
|
for (int i = 0; obs_enum_input_types(i, &t); ++i) |
|
|
|
{ |
|
|
|
printf("input type: %s\n", t); |
|
|
|
//gtk_container_add(GTK_CONTAINER(box), gtk_label_new(t)); |
|
|
|
} |
|
|
|
|
|
|
|
obs_enum_sources(enum_sources, box); |
|
|
|
|
|
|
|
gtk_container_add(GTK_CONTAINER(window), box); |
|
|
|
gtk_widget_show_all(box); |
|
|
|
gtk_window_present(GTK_WINDOW(window)); |
|
|
|
} |
|
|
|
|
|
|
|
static void |
|
|
|
activate (GtkApplication *app, |
|
|
|
gpointer user_data) |
|
|
|
static void activate(GtkApplication *app, gpointer user_data) |
|
|
|
{ |
|
|
|
GtkWidget *window = gtk_application_window_new(app); |
|
|
|
gtk_window_set_title(GTK_WINDOW(window), "OBS"); |
|
|
@ -79,12 +93,36 @@ activate (GtkApplication *app, |
|
|
|
} |
|
|
|
|
|
|
|
obs_display_add_draw_callback(display, obs_render, NULL); |
|
|
|
render_input_types_window (app, window); |
|
|
|
|
|
|
|
//const char *v_id = obs_get_latest_input_type_id(); |
|
|
|
obs_data_t *settings = obs_data_create(); |
|
|
|
obs_data_set_default_int(settings, "input", -1); |
|
|
|
obs_data_set_default_int(settings, "pixelformat", -1); |
|
|
|
obs_data_set_default_int(settings, "standard", -1); |
|
|
|
obs_data_set_default_int(settings, "dv_timing", -1); |
|
|
|
obs_data_set_default_int(settings, "resolution", -1); |
|
|
|
obs_data_set_default_int(settings, "framerate", -1); |
|
|
|
obs_data_set_default_int(settings, "color_range", VIDEO_RANGE_DEFAULT); |
|
|
|
obs_data_set_default_bool(settings, "buffering", true); |
|
|
|
obs_data_set_default_bool(settings, "auto_reset", false); |
|
|
|
obs_data_set_default_int(settings, "timeout_frames", 5); |
|
|
|
|
|
|
|
//obs_data_set_string(settings, "local_file", ""); |
|
|
|
obs_source_t *source = obs_source_create("souce1", "Source", NULL, NULL); |
|
|
|
if (source == NULL) |
|
|
|
printf("couldn't create source"); |
|
|
|
|
|
|
|
obs_scene_t *scene = obs_scene_create("scene1"); |
|
|
|
if (scene == NULL) |
|
|
|
printf("couldn't create scene"); |
|
|
|
|
|
|
|
obs_scene_add(scene, source); |
|
|
|
obs_set_output_source(0, obs_scene_get_source(scene)); |
|
|
|
|
|
|
|
render_sources_window(app, window); |
|
|
|
} |
|
|
|
|
|
|
|
int |
|
|
|
main(int argc, |
|
|
|
char **argv) |
|
|
|
int main(int argc, char **argv) |
|
|
|
{ |
|
|
|
GtkApplication* app; |
|
|
|
int status; |
|
|
@ -102,6 +140,8 @@ main(int argc, |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
obs_load_all_modules(); |
|
|
|
|
|
|
|
// This just initializes OpenGL |
|
|
|
glutInit(&argc, argv); |
|
|
|
|
|
|
|