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:
jp9000
2014-02-22 20:14:19 -07:00
parent 7fcec77351
commit 0ff0d32731
11 changed files with 105 additions and 43 deletions

View File

@@ -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;