Created
January 29, 2019 16:12
-
-
Save eyalcohen4/9368f7bcf8b428ae498c2782febba002 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.10) | |
project(obs_headless_poc) | |
set(obs_include_dir ${CMAKE_CURRENT_SOURCE_DIR}/obs-studio/libobs/) | |
set(obs_lib_dir ${CMAKE_CURRENT_SOURCE_DIR}/obs-studio/build/libobs/) | |
include_directories(/home/myplay/dev/obs-headless-poc/obs-studio/libobs) | |
link_directories(/home/myplay/dev/obs-headless-poc/obs-studio/build/libobs) | |
include_directories(/home/myplay/dev/obs-headless-poc/obs-studio/libobs-opengl) | |
link_directories(/home/myplay/dev/obs-headless-poc/obs-studio/build/libobs-opengl) | |
file(GLOB SOURCES | |
"./src/*.h" | |
"./src/*.cpp") | |
add_executable(app ${SOURCES}) | |
target_link_libraries(app /home/myplay/dev/obs-headless-poc/obs-studio/build/libobs/libobs.so /home/myplay/dev/obs-headless-poc/obs-studio/build/libobs-opengl/libobs-opengl.so) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "main.h" | |
#include <iostream> | |
using namespace std; | |
obs_video_info create_ovi() { | |
struct obs_video_info ovi; | |
ovi.adapter = 0; | |
ovi.graphics_module = "libobs-opengl"; | |
ovi.output_format = VIDEO_FORMAT_I420; | |
ovi.fps_num = 30000; | |
ovi.fps_den = 1000; | |
ovi.base_width = 640; | |
ovi.base_height = 360; | |
ovi.output_width = 640; | |
ovi.output_height = 360; | |
return ovi; | |
} | |
obs_audio_info create_oai() { | |
struct obs_audio_info oai; | |
oai.samples_per_sec = 44100; | |
oai.speakers = SPEAKERS_STEREO; | |
return oai; | |
} | |
void initialize_obs() { | |
try { | |
struct obs_audio_info oai = create_oai(); | |
struct obs_video_info ovi = create_ovi(); | |
obs_startup("en-US", nullptr, nullptr); | |
obs_initialized(); | |
obs_reset_video(&ovi); | |
obs_reset_audio(&oai); | |
cout << "OBS Initialized Successfully \n"; | |
} catch (const std::exception& err) { | |
cout << "[initialize_obs] error"; | |
cerr << err.what(); | |
} | |
} | |
int main() { | |
cout << "This is an executable running right now! \n"; | |
try { | |
initialize_obs(); | |
} catch (const std::exception& e) { | |
cerr << e.what(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment