Browse Source

First commit

main
Dwayne Harris 3 years ago
commit
03169acc21
  1. 10
      Makefile
  2. 59
      main.c

10
Makefile

@ -0,0 +1,10 @@
all: build
build:
gcc -Wall main.c -lobs -lglut -lGL -o main
run: build
./main
clean:
rm main

59
main.c

@ -0,0 +1,59 @@
#include <stdio.h>
#include <GL/freeglut.h>
#include <obs/obs.h>
void render() {
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glFlush();
}
int main(int argc, char** argv) {
const char* version;
version = obs_get_version_string();
printf("OBS version: %s\n", version);
if (!obs_initialized()) {
if (!obs_startup("en-US", NULL, NULL)) {
printf("Failed to start OBS...\n");
return 1;
}
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 = 1280;
v.base_height = 720;
v.output_width = 1280;
v.output_height = 720;
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;
obs_reset_video(&v);
obs_reset_audio(&a);
}
glutInitDisplayMode(GLUT_SINGLE);
glutInitWindowSize(500, 500);
glutInitWindowPosition(100, 100);
glutCreateWindow("OBS Window");
glutDisplayFunc(render);
glutMainLoop();
obs_shutdown();
return 0;
}
Loading…
Cancel
Save