New upstream version 26.0.2+dfsg1

This commit is contained in:
Sebastian Ramacher 2020-10-12 22:28:36 +02:00
parent bc27b6c1ca
commit 040dcc3fc2
23 changed files with 226 additions and 184 deletions

View file

@ -219,6 +219,13 @@ Var dllFilesInUse
Function checkDLLs
OBSInstallerUtils::ResetInUseFileChecks
!ifdef INSTALL64
OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\bin\64bit\avutil-56.dll"
OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\bin\64bit\swscale-5.dll"
!else
OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\bin\32bit\avutil-56.dll"
OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\bin\32bit\swscale-5.dll"
!endif
OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\data\obs-plugins\win-capture\graphics-hook32.dll"
OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\data\obs-plugins\win-capture\graphics-hook64.dll"
OBSInstallerUtils::AddInUseFileCheck "$INSTDIR\data\obs-plugins\win-dshow\obs-virtualcam-module32.dll"

View file

@ -1981,7 +1981,7 @@ static int run_program(fstream &logFile, int argc, char *argv[])
run:
#endif
#if !defined(_WIN32) && !defined(__APPLE__)
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__FreeBSD__)
// Mounted by termina during chromeOS linux container startup
// https://chromium.googlesource.com/chromiumos/overlays/board-overlays/+/master/project-termina/chromeos-base/termina-lxd-scripts/files/lxd_setup.sh
os_dir_t *crosDir = os_opendir("/opt/google/cros-containers");

View file

@ -144,6 +144,13 @@ bool IsAlwaysOnTop(QWidget *window)
return (window->windowFlags() & Qt::WindowStaysOnTopHint) != 0;
}
void disableColorSpaceConversion(QWidget *window)
{
NSView *view =
(__bridge NSView *)reinterpret_cast<void *>(window->winId());
view.window.colorSpace = NSColorSpace.sRGBColorSpace;
}
void SetAlwaysOnTop(QWidget *window, bool enable)
{
Qt::WindowFlags flags = window->windowFlags();

View file

@ -67,4 +67,5 @@ QString GetMonitorName(const QString &id);
void EnableOSXVSync(bool enable);
void EnableOSXDockIcon(bool enable);
void InstallNSApplicationSubclass();
void disableColorSpaceConversion(QWidget *window);
#endif

View file

@ -531,6 +531,8 @@ VolumeMeter::VolumeMeter(QWidget *parent, obs_volmeter_t *obs_volmeter,
bool vertical)
: QWidget(parent), obs_volmeter(obs_volmeter), vertical(vertical)
{
setAttribute(Qt::WA_OpaquePaintEvent, true);
// Use a font that can be rendered small.
tickFont = QFont("Arial");
tickFont.setPixelSize(7);
@ -1041,6 +1043,11 @@ void VolumeMeter::paintEvent(QPaintEvent *event)
// Actual painting of the widget starts here.
QPainter painter(this);
// Paint window background color (as widget is opaque)
QColor background = palette().color(QPalette::ColorRole::Window);
painter.fillRect(rect, background);
if (vertical) {
// Invert the Y axis to ease the math
painter.translate(0, height);

View file

@ -45,11 +45,13 @@ void StringToHash(const wchar_t *in, BYTE *out)
bool CalculateFileHash(const wchar_t *path, BYTE *hash)
{
static BYTE hashBuffer[1048576];
static __declspec(thread) vector<BYTE> hashBuffer;
blake2b_state blake2;
if (blake2b_init(&blake2, BLAKE2_HASH_LENGTH) != 0)
return false;
hashBuffer.resize(1048576);
WinHandle handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ,
nullptr, OPEN_EXISTING, 0, nullptr);
if (handle == INVALID_HANDLE_VALUE)
@ -57,14 +59,14 @@ bool CalculateFileHash(const wchar_t *path, BYTE *hash)
for (;;) {
DWORD read = 0;
if (!ReadFile(handle, hashBuffer, sizeof(hashBuffer), &read,
if (!ReadFile(handle, &hashBuffer[0], hashBuffer.size(), &read,
nullptr))
return false;
if (!read)
break;
if (blake2b_update(&blake2, hashBuffer, read) != 0)
if (blake2b_update(&blake2, &hashBuffer[0], read) != 0)
return false;
}

View file

@ -1427,6 +1427,23 @@ static bool Update(wchar_t *cmdLine)
/* ------------------------------------- *
* Install virtual camera */
auto runcommand = [](wchar_t *cmd) {
STARTUPINFO si = {};
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
PROCESS_INFORMATION pi;
bool success = !!CreateProcessW(nullptr, cmd, nullptr, nullptr,
false, CREATE_NEW_CONSOLE,
nullptr, nullptr, &si, &pi);
if (success) {
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
}
};
if (!bIsPortable) {
wchar_t regsvr[MAX_PATH];
wchar_t src[MAX_PATH];
@ -1441,20 +1458,20 @@ static bool Update(wchar_t *cmdLine)
StringCbCat(src, sizeof(src),
L"\\data\\obs-plugins\\win-dshow\\");
StringCbCopy(tmp, sizeof(tmp), L"\"\"");
StringCbCopy(tmp, sizeof(tmp), L"\"");
StringCbCat(tmp, sizeof(tmp), regsvr);
StringCbCat(tmp, sizeof(tmp), L"\" /s \"");
StringCbCat(tmp, sizeof(tmp), src);
StringCbCat(tmp, sizeof(tmp), L"obs-virtualcam-module");
StringCbCopy(tmp2, sizeof(tmp2), tmp);
StringCbCat(tmp2, sizeof(tmp2), L"32.dll\"\"");
_wsystem(tmp2);
StringCbCat(tmp2, sizeof(tmp2), L"32.dll\"");
runcommand(tmp2);
if (is_64bit_windows()) {
StringCbCopy(tmp2, sizeof(tmp2), tmp);
StringCbCat(tmp2, sizeof(tmp2), L"64.dll\"\"");
_wsystem(tmp2);
StringCbCat(tmp2, sizeof(tmp2), L"64.dll\"");
runcommand(tmp2);
}
}

View file

@ -50,8 +50,14 @@ static inline QString MakeQuickTransitionText(QuickTransition *qt)
void OBSBasic::InitDefaultTransitions()
{
struct AddTransitionVal {
QString id;
QString name;
};
ui->transitions->blockSignals(true);
std::vector<OBSSource> transitions;
std::vector<AddTransitionVal> addables;
size_t idx = 0;
const char *id;
@ -73,25 +79,57 @@ void OBSBasic::InitDefaultTransitions()
obs_source_release(tr);
} else {
QString addString = QTStr("Add") +
QStringLiteral(": ") +
QT_UTF8(name);
ui->transitions->addItem(
addString,
QVariant::fromValue(QString(QT_UTF8(id))));
AddTransitionVal val;
val.name = QTStr("Add") + QStringLiteral(": ") +
QT_UTF8(name);
val.id = QT_UTF8(id);
addables.push_back(val);
}
}
if (ui->transitions->count())
ui->transitions->insertSeparator(ui->transitions->count());
for (OBSSource &tr : transitions) {
ui->transitions->addItem(QT_UTF8(obs_source_get_name(tr)),
QVariant::fromValue(OBSSource(tr)));
}
if (addables.size())
ui->transitions->insertSeparator(ui->transitions->count());
for (AddTransitionVal &val : addables) {
ui->transitions->addItem(val.name, QVariant::fromValue(val.id));
}
ui->transitions->blockSignals(false);
}
int OBSBasic::TransitionCount()
{
int idx = 0;
for (int i = 0; i < ui->transitions->count(); i++) {
QVariant v = ui->transitions->itemData(i);
if (!v.toString().isEmpty()) {
idx = i;
break;
}
}
/* should always have at least fade and cut due to them being
* defaults */
assert(idx != 0);
return idx - 1; /* remove separator from equation */
}
int OBSBasic::AddTransitionBeforeSeparator(const QString &name,
obs_source_t *source)
{
int idx = TransitionCount();
ui->transitions->blockSignals(true);
ui->transitions->insertItem(idx, name,
QVariant::fromValue(OBSSource(source)));
ui->transitions->blockSignals(false);
return idx;
}
void OBSBasic::AddQuickTransitionHotkey(QuickTransition *qt)
{
DStr hotkeyId;
@ -506,10 +544,9 @@ void OBSBasic::AddTransition(QString id)
source = obs_source_create_private(QT_TO_UTF8(id), name.c_str(),
NULL);
InitTransition(source);
ui->transitions->addItem(
QT_UTF8(name.c_str()),
QVariant::fromValue(OBSSource(source)));
ui->transitions->setCurrentIndex(ui->transitions->count() - 1);
int idx = AddTransitionBeforeSeparator(QT_UTF8(name.c_str()),
source);
ui->transitions->setCurrentIndex(idx);
CreatePropertiesWindow(source);
obs_source_release(source);
@ -548,7 +585,15 @@ void OBSBasic::on_transitionRemove_clicked()
}
}
ui->transitions->blockSignals(true);
ui->transitions->removeItem(idx);
ui->transitions->setCurrentIndex(-1);
ui->transitions->blockSignals(false);
int bottomIdx = TransitionCount() - 1;
if (idx > bottomIdx)
idx = bottomIdx;
ui->transitions->setCurrentIndex(idx);
if (api)
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
@ -1540,9 +1585,7 @@ void OBSBasic::LoadTransitions(obs_data_array_t *transitions)
obs_source_create_private(id, name, settings);
if (!obs_obj_invalid(source)) {
InitTransition(source);
ui->transitions->addItem(
QT_UTF8(name),
QVariant::fromValue(OBSSource(source)));
AddTransitionBeforeSeparator(QT_UTF8(name), source);
}
obs_data_release(settings);

View file

@ -326,6 +326,10 @@ OBSBasic::OBSBasic(QWidget *parent)
renameSource->setShortcut({Qt::Key_F2});
#endif
#ifdef __linux__
ui->actionE_xit->setShortcut(Qt::CTRL + Qt::Key_Q);
#endif
auto addNudge = [this](const QKeySequence &seq, const char *s) {
QAction *nudge = new QAction(ui->preview);
nudge->setShortcut(seq);
@ -1554,6 +1558,8 @@ void OBSBasic::AddVCamButton()
vcamButton->setProperty("themeID", "vcamButton");
ui->buttonsVLayout->insertWidget(2, vcamButton);
setTabOrder(ui->recordButton, vcamButton);
setTabOrder(vcamButton, ui->modeSwitch);
}
void OBSBasic::ResetOutputs()
@ -1588,6 +1594,9 @@ void OBSBasic::ResetOutputs()
replayBufferButton->setProperty("themeID",
"replayBufferButton");
ui->buttonsVLayout->insertLayout(2, replayLayout);
setTabOrder(ui->recordButton, replayBufferButton);
setTabOrder(replayBufferButton,
ui->buttonsVLayout->itemAt(3)->widget());
}
if (sysTrayReplayBuffer)
@ -1867,6 +1876,10 @@ void OBSBasic::OBSInit()
SystemTray(true);
#endif
#ifdef __APPLE__
disableColorSpaceConversion(this);
#endif
bool has_last_version = config_has_user_value(App()->GlobalConfig(),
"General", "LastVersion");
bool first_run =
@ -7035,15 +7048,6 @@ OBSProjector *OBSBasic::OpenProjector(obs_source_t *source, int monitor,
if (monitor > 9 || monitor > QGuiApplication::screens().size() - 1)
return nullptr;
if (monitor > -1) {
for (size_t i = 0; i < projectors.size(); i++) {
if (projectors[i]->GetMonitor() == monitor) {
DeleteProjector(projectors[i]);
break;
}
}
}
OBSProjector *projector =
new OBSProjector(nullptr, source, monitor, type);
@ -8211,6 +8215,10 @@ void OBSBasic::UpdateReplayBuffer(bool activate)
connect(replay.data(), &QAbstractButton::clicked, this,
&OBSBasic::ReplayBufferSave);
replayLayout->addWidget(replay.data());
setTabOrder(replayLayout->itemAt(0)->widget(),
replayLayout->itemAt(1)->widget());
setTabOrder(replayLayout->itemAt(1)->widget(),
ui->buttonsVLayout->itemAt(3)->widget());
}
#define MBYTE (1024ULL * 1024ULL)

View file

@ -401,6 +401,9 @@ private:
void CreateProgramDisplay();
void CreateProgramOptions();
int TransitionCount();
int AddTransitionBeforeSeparator(const QString &name,
obs_source_t *source);
void AddQuickTransitionId(int id);
void AddQuickTransition();
void AddQuickTransitionHotkey(QuickTransition *qt);