New upstream version 19.0.3+dfsg1

This commit is contained in:
Sebastian Ramacher 2017-06-29 21:01:10 +02:00
parent 3708b8e092
commit 1f1bbb3518
534 changed files with 13862 additions and 2459 deletions

View file

@ -61,7 +61,7 @@ static log_handler_t def_log_handler;
static string currentLogFile;
static string lastLogFile;
static bool portable_mode = false;
bool portable_mode = false;
static bool log_verbose = false;
static bool unfiltered_log = false;
bool opt_start_streaming = false;
@ -69,6 +69,8 @@ bool opt_start_recording = false;
bool opt_studio_mode = false;
bool opt_start_replaybuffer = false;
bool opt_minimize_tray = false;
bool opt_allow_opengl = false;
bool opt_always_on_top = false;
string opt_starting_collection;
string opt_starting_profile;
string opt_starting_scene;
@ -162,6 +164,7 @@ QObject *CreateShortcutFilter()
case Qt::Key_Return:
if (dialog && pressed)
return false;
/* Falls through. */
default:
hotkey.key = obs_key_from_virtual_key(
event->nativeVirtualKey());
@ -342,11 +345,11 @@ static void do_log(int log_level, const char *msg, va_list args, void *param)
def_log_handler(log_level, msg, args2, nullptr);
#endif
if (too_many_repeated_entries(logFile, msg, str))
return;
if (log_level <= LOG_INFO || log_verbose)
if (log_level <= LOG_INFO || log_verbose) {
if (too_many_repeated_entries(logFile, msg, str))
return;
LogStringChunk(logFile, str);
}
#if defined(_WIN32) && defined(OBS_DEBUGBREAK_ON_ERROR)
if (log_level <= LOG_ERROR && IsDebuggerPresent())
@ -408,6 +411,11 @@ bool OBSApp::InitGlobalConfigDefaults()
config_set_default_bool(globalConfig, "BasicWindow",
"ShowStatusBar", true);
#ifdef _WIN32
config_set_default_bool(globalConfig, "Audio", "DisableAudioDucking",
true);
#endif
#ifdef __APPLE__
config_set_default_bool(globalConfig, "Video", "DisableOSXVSync", true);
config_set_default_bool(globalConfig, "Video", "ResetOSXVSyncOnExit",
@ -576,6 +584,7 @@ static string GetSceneCollectionFileFromName(const char *name)
bool OBSApp::InitGlobalConfig()
{
char path[512];
bool changed = false;
int len = GetConfigPath(path, sizeof(path),
"obs-studio/global.ini");
@ -599,6 +608,7 @@ bool OBSApp::InitGlobalConfig()
config_set_string(globalConfig,
"Basic", "SceneCollectionFile",
path.c_str());
changed = true;
}
}
@ -610,9 +620,24 @@ bool OBSApp::InitGlobalConfig()
opt_starting_profile.c_str());
config_set_string(globalConfig, "Basic", "ProfileDir",
path.c_str());
changed = true;
}
}
if (!config_has_user_value(globalConfig, "General", "Pre19Defaults")) {
uint32_t lastVersion = config_get_int(globalConfig, "General",
"LastVersion");
bool useOldDefaults = lastVersion &&
lastVersion < MAKE_SEMANTIC_VERSION(19, 0, 0);
config_set_bool(globalConfig, "General", "Pre19Defaults",
useOldDefaults);
changed = true;
}
if (changed)
config_save_safe(globalConfig, "tmp", nullptr);
return InitGlobalConfigDefaults();
}
@ -731,6 +756,13 @@ OBSApp::OBSApp(int &argc, char **argv, profiler_name_store_t *store)
OBSApp::~OBSApp()
{
#ifdef _WIN32
bool disableAudioDucking = config_get_bool(globalConfig, "Audio",
"DisableAudioDucking");
if (disableAudioDucking)
DisableAudioDucking(false);
#endif
#ifdef __APPLE__
bool vsyncDiabled = config_get_bool(globalConfig, "Video",
"DisableOSXVSync");
@ -849,6 +881,13 @@ void OBSApp::AppInit()
config_set_default_string(globalConfig, "Basic", "SceneCollectionFile",
Str("Untitled"));
#ifdef _WIN32
bool disableAudioDucking = config_get_bool(globalConfig, "Audio",
"DisableAudioDucking");
if (disableAudioDucking)
DisableAudioDucking(true);
#endif
#ifdef __APPLE__
if (config_get_bool(globalConfig, "Video", "DisableOSXVSync"))
EnableOSXVSync(false);
@ -901,6 +940,8 @@ bool OBSApp::OBSInit()
blog(LOG_INFO, "Portable mode: %s",
portable_mode ? "true" : "false");
setQuitOnLastWindowClosed(false);
mainWindow = new OBSBasic();
mainWindow->setAttribute(Qt::WA_DeleteOnClose, true);
@ -1183,8 +1224,16 @@ static void create_log_file(fstream &logFile)
dst << "obs-studio/logs/" << currentLogFile.c_str();
BPtr<char> path(GetConfigPathPtr(dst.str().c_str()));
#ifdef _WIN32
BPtr<wchar_t> wpath;
os_utf8_to_wcs_ptr(path, 0, &wpath);
logFile.open(wpath,
ios_base::in | ios_base::out | ios_base::trunc);
#else
logFile.open(path,
ios_base::in | ios_base::out | ios_base::trunc);
#endif
if (logFile.is_open()) {
delete_oldest_file("obs-studio/logs");
@ -1287,6 +1336,46 @@ static int run_program(fstream &logFile, int argc, char *argv[])
program.installTranslator(&translator);
#ifdef _WIN32
/* --------------------------------------- */
/* check and warn if already running */
bool already_running = false;
RunOnceMutex rom = GetRunOnceMutex(already_running);
if (already_running) {
blog(LOG_WARNING, "\n================================");
blog(LOG_WARNING, "Warning: OBS is already running!");
blog(LOG_WARNING, "================================\n");
QMessageBox::StandardButtons buttons(
QMessageBox::Yes | QMessageBox::Cancel);
QMessageBox mb(QMessageBox::Question,
QTStr("AlreadyRunning.Title"),
QTStr("AlreadyRunning.Text"),
buttons,
nullptr);
mb.setButtonText(QMessageBox::Yes,
QTStr("AlreadyRunning.LaunchAnyway"));
mb.setButtonText(QMessageBox::Cancel, QTStr("Cancel"));
mb.setDefaultButton(QMessageBox::Cancel);
QMessageBox::StandardButton button;
button = (QMessageBox::StandardButton)mb.exec();
if (button == QMessageBox::Cancel) {
blog(LOG_INFO, "User shut down the program "
"because OBS was already "
"running");
return 0;
}
blog(LOG_WARNING, "User is now running a secondary "
"instance of OBS!");
}
/* --------------------------------------- */
#endif
if (!program.OBSInit())
return 0;
@ -1302,7 +1391,7 @@ static int run_program(fstream &logFile, int argc, char *argv[])
return ret;
}
#define MAX_CRASH_REPORT_SIZE (50 * 1024)
#define MAX_CRASH_REPORT_SIZE (150 * 1024)
#ifdef _WIN32
@ -1326,8 +1415,16 @@ static void main_crash_handler(const char *format, va_list args, void *param)
BPtr<char> path(GetConfigPathPtr(name.c_str()));
fstream file;
file.open(path, ios_base::in | ios_base::out | ios_base::trunc |
#ifdef _WIN32
BPtr<wchar_t> wpath;
os_utf8_to_wcs_ptr(path, 0, &wpath);
file.open(wpath, ios_base::in | ios_base::out | ios_base::trunc |
ios_base::binary);
#else
file.open(path, ios_base::in | ios_base::out | ios_base::trunc |
ios_base::binary);
#endif
file << text;
file.close();
@ -1739,6 +1836,7 @@ int main(int argc, char *argv[])
#endif
#ifdef _WIN32
SetErrorMode(SEM_FAILCRITICALERRORS);
load_debug_privilege();
base_set_crash_handler(main_crash_handler, nullptr);
#endif
@ -1756,6 +1854,9 @@ int main(int argc, char *argv[])
} else if (arg_is(argv[i], "--verbose", nullptr)) {
log_verbose = true;
} else if (arg_is(argv[i], "--always-on-top", nullptr)) {
opt_always_on_top = true;
} else if (arg_is(argv[i], "--unfiltered_log", nullptr)) {
unfiltered_log = true;
@ -1783,6 +1884,9 @@ int main(int argc, char *argv[])
} else if (arg_is(argv[i], "--studio-mode", nullptr)) {
opt_studio_mode = true;
} else if (arg_is(argv[i], "--allow-opengl", nullptr)) {
opt_allow_opengl = true;
} else if (arg_is(argv[i], "--help", "-h")) {
std::cout <<
"--help, -h: Get list of available commands.\n\n" <<
@ -1797,7 +1901,9 @@ int main(int argc, char *argv[])
"--minimize-to-tray: Minimize to system tray.\n" <<
"--portable, -p: Use portable mode.\n\n" <<
"--verbose: Make log more verbose.\n" <<
"--always-on-top: Start in 'always on top' mode.\n\n" <<
"--unfiltered_log: Make log unfiltered.\n\n" <<
"--allow-opengl: Allow OpenGL on Windows.\n\n" <<
"--version, -V: Get current version.\n";
exit(0);