mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-03-06 07:36:12 -05:00
Fix video reset and apply new video settings
This allows the changing of bideo settings without having to completely reset all graphics data. Will recreate internal output/conversion buffers and such and reset the main preview.
This commit is contained in:
@@ -51,13 +51,11 @@ void OBSBasic::OBSInit()
|
||||
|
||||
if (!obs_startup())
|
||||
throw "Failed to initialize libobs";
|
||||
if (!InitGraphics())
|
||||
throw "Failed to initialize graphics";
|
||||
if (!InitAudio())
|
||||
if (!ResetVideo())
|
||||
throw "Failed to initialize video";
|
||||
if (!ResetAudio())
|
||||
throw "Failed to initialize audio";
|
||||
|
||||
obs_add_draw_callback(OBSBasic::RenderMain, this);
|
||||
|
||||
signal_handler_connect(obs_signalhandler(), "source-add",
|
||||
OBSBasic::SourceAdded, this);
|
||||
signal_handler_connect(obs_signalhandler(), "source-remove",
|
||||
@@ -278,7 +276,7 @@ void OBSBasic::RenderMain(void *data, uint32_t cx, uint32_t cy)
|
||||
|
||||
/* Main class functions */
|
||||
|
||||
bool OBSBasic::InitGraphics()
|
||||
bool OBSBasic::ResetVideo()
|
||||
{
|
||||
struct obs_video_info ovi;
|
||||
|
||||
@@ -306,10 +304,14 @@ bool OBSBasic::InitGraphics()
|
||||
ovi.window_width = size.width();
|
||||
ovi.window_height = size.height();
|
||||
|
||||
return obs_reset_video(&ovi);
|
||||
if (!obs_reset_video(&ovi))
|
||||
return false;
|
||||
|
||||
obs_add_draw_callback(OBSBasic::RenderMain, this);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OBSBasic::InitAudio()
|
||||
bool OBSBasic::ResetAudio()
|
||||
{
|
||||
/* TODO: load audio settings from config */
|
||||
struct audio_output_info ai;
|
||||
|
||||
Reference in New Issue
Block a user