|
|
@ -9,7 +9,7 @@ const int window_width = 1280; |
|
|
|
const int window_height = 720; |
|
|
|
obs_display_t *display; |
|
|
|
|
|
|
|
const char * go_get_version() |
|
|
|
const char* go_get_version() |
|
|
|
{ |
|
|
|
sprintf(version, "Version: 0.0.1; OBS version: %s\n", obs_get_version_string()); |
|
|
|
return version; |
|
|
@ -74,17 +74,18 @@ static void render_sources_window(GtkApplication *app, GtkWidget *parent_window) |
|
|
|
static void activate(GtkApplication *app, gpointer user_data) |
|
|
|
{ |
|
|
|
GtkWidget *window = gtk_application_window_new(app); |
|
|
|
gtk_window_set_title(GTK_WINDOW(window), "OBS"); |
|
|
|
gtk_window_set_title(GTK_WINDOW(window), "OBS - Progrium"); |
|
|
|
gtk_window_set_default_size(GTK_WINDOW(window), window_width, window_height); |
|
|
|
gtk_window_present(GTK_WINDOW(window)); |
|
|
|
|
|
|
|
struct gs_init_data info; |
|
|
|
info.cx = window_width; |
|
|
|
info.cy = window_height; |
|
|
|
info.window.id = gdk_x11_window_get_xid(gtk_widget_get_window(window)); |
|
|
|
info.window.display = gdk_window_get_display(gtk_widget_get_window(window)); |
|
|
|
info.format = GS_BGRA; |
|
|
|
info.zsformat = GS_ZS_NONE; |
|
|
|
struct gs_init_data info = { |
|
|
|
.cx = window_width, |
|
|
|
.cy = window_height, |
|
|
|
.window.id = gdk_x11_window_get_xid(gtk_widget_get_window(window)), |
|
|
|
.window.display = gdk_window_get_display(gtk_widget_get_window(window)), |
|
|
|
.format = GS_BGRA, |
|
|
|
.zsformat = GS_ZS_NONE, |
|
|
|
}; |
|
|
|
|
|
|
|
display = obs_display_create(&info, 0); |
|
|
|
if (display == NULL) |
|
|
@ -94,21 +95,22 @@ static void activate(GtkApplication *app, gpointer user_data) |
|
|
|
|
|
|
|
obs_display_add_draw_callback(display, obs_render, NULL); |
|
|
|
|
|
|
|
//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); |
|
|
|
//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, "device_id", "/dev/video2"); |
|
|
|
//obs_data_set_string(settings, "format", "NV12"); |
|
|
|
|
|
|
|
obs_source_t *source = obs_source_create("v4l2_input", "Source", settings, NULL); |
|
|
|
if (source == NULL) |
|
|
|
printf("couldn't create source"); |
|
|
|
|
|
|
@ -125,7 +127,8 @@ static void activate(GtkApplication *app, gpointer user_data) |
|
|
|
int main(int argc, char **argv) |
|
|
|
{ |
|
|
|
GtkApplication* app; |
|
|
|
int status; |
|
|
|
obs_module_t *module; |
|
|
|
int status, res; |
|
|
|
|
|
|
|
app = gtk_application_new("xyz.dwayne.obs", G_APPLICATION_FLAGS_NONE); |
|
|
|
g_signal_connect(app, "activate", G_CALLBACK(activate), NULL); |
|
|
@ -139,31 +142,48 @@ int main(int argc, char **argv) |
|
|
|
printf("Failed to start OBS...\n"); |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
obs_load_all_modules(); |
|
|
|
|
|
|
|
// This next line crashes the app on load |
|
|
|
//obs_load_all_modules(); |
|
|
|
|
|
|
|
// This just initializes OpenGL |
|
|
|
// This just initializes OpenGL. |
|
|
|
// The program won't run if OpenGL hasn't been initialized. |
|
|
|
glutInit(&argc, argv); |
|
|
|
|
|
|
|
struct obs_video_info v; |
|
|
|
struct obs_audio_info a; |
|
|
|
|
|
|
|
v.graphics_module = "libobs-opengl.so.0"; |
|
|
|
v.fps_num = 30000; |
|
|
|
v.fps_den = 1001; |
|
|
|
v.base_width = window_width; |
|
|
|
v.base_height = window_height; |
|
|
|
v.output_width = window_width; |
|
|
|
v.output_height = window_height; |
|
|
|
v.output_format = VIDEO_FORMAT_NV12; |
|
|
|
v.adapter = 0; |
|
|
|
v.gpu_conversion = true; |
|
|
|
v.colorspace = VIDEO_CS_601; |
|
|
|
v.range = VIDEO_RANGE_PARTIAL; |
|
|
|
v.scale_type = OBS_SCALE_BICUBIC; |
|
|
|
|
|
|
|
a.samples_per_sec = 44100; |
|
|
|
a.speakers = SPEAKERS_STEREO; |
|
|
|
|
|
|
|
res = obs_open_module(&module, "/usr/lib/x86_64-linux-gnu/obs-plugins/obs-ffmpeg.so", NULL); |
|
|
|
if (res != MODULE_SUCCESS) |
|
|
|
printf("error opening plugin\n"); |
|
|
|
|
|
|
|
obs_init_module(module); |
|
|
|
|
|
|
|
res = obs_open_module(&module, "/usr/lib/x86_64-linux-gnu/obs-plugins/linux-v4l2.so", NULL); |
|
|
|
if (res != MODULE_SUCCESS) |
|
|
|
printf("error opening v4l2 plugin\n"); |
|
|
|
|
|
|
|
obs_init_module(module); |
|
|
|
|
|
|
|
obs_post_load_modules(); |
|
|
|
|
|
|
|
struct obs_video_info v = { |
|
|
|
.graphics_module = "libobs-opengl.so.0", |
|
|
|
.fps_num = 30000, |
|
|
|
.fps_den = 1001, |
|
|
|
.base_width = window_width, |
|
|
|
.base_height = window_height, |
|
|
|
.output_width = window_width, |
|
|
|
.output_height = window_height, |
|
|
|
.output_format = VIDEO_FORMAT_NV12, |
|
|
|
.adapter = 0, |
|
|
|
.gpu_conversion = true, |
|
|
|
.colorspace = VIDEO_CS_601, |
|
|
|
.range = VIDEO_RANGE_PARTIAL, |
|
|
|
.scale_type = OBS_SCALE_BICUBIC, |
|
|
|
}; |
|
|
|
|
|
|
|
struct obs_audio_info a = { |
|
|
|
.samples_per_sec = 44100, |
|
|
|
.speakers = SPEAKERS_STEREO, |
|
|
|
}; |
|
|
|
|
|
|
|
obs_reset_video(&v); |
|
|
|
obs_reset_audio(&a); |
|
|
|