Skip to content

Commit

Permalink
Merge branch 'obsproject:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
decahedron1 authored Aug 12, 2024
2 parents 963a492 + 8adc76f commit 0ad997f
Show file tree
Hide file tree
Showing 100 changed files with 7,464 additions and 4,139 deletions.
3 changes: 2 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
"CMAKE_INSTALL_LIBDIR": "lib/CMAKE_SYSTEM_PROCESSOR-linux-gnu",
"OBS_CMAKE_VERSION": {"type": "STRING", "value": "3.0.0"},
"ENABLE_AJA": false,
"ENABLE_NATIVE_NVENC": false,
"ENABLE_NVENC": false,
"ENABLE_FFMPEG_NVENC": true,
"ENABLE_VLC": true,
"ENABLE_WAYLAND": true,
"ENABLE_WEBRTC": false
Expand Down
2 changes: 2 additions & 0 deletions UI/screenshot-obj.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/

#pragma once

#include <QObject>
#include <string>
#include <thread>
Expand Down
7 changes: 3 additions & 4 deletions UI/volume-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,8 +1557,7 @@ void VolumeSlider::paintEvent(QPaintEvent *event)
}

QPainter painter(this);
QColor *tickColor = new QColor;
tickColor->setRgb(91, 98, 115, 255);
QColor tickColor(91, 98, 115, 255);

obs_fader_conversion_t fader_db_to_def = obs_fader_db_to_def(fad);

Expand All @@ -1584,7 +1583,7 @@ void VolumeSlider::paintEvent(QPaintEvent *event)

float xPos = groove.left() + (tickValue * sliderWidth) +
(handle.width() / 2);
painter.fillRect(xPos, yPos, 1, tickLength, *tickColor);
painter.fillRect(xPos, yPos, 1, tickLength, tickColor);
}
}

Expand All @@ -1603,7 +1602,7 @@ void VolumeSlider::paintEvent(QPaintEvent *event)
float yPos = groove.height() + groove.top() -
(tickValue * sliderHeight) -
(handle.height() / 2);
painter.fillRect(xPos, yPos, tickLength, 1, *tickColor);
painter.fillRect(xPos, yPos, tickLength, 1, tickColor);
}
}

Expand Down
14 changes: 8 additions & 6 deletions UI/window-basic-main-outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,15 +609,17 @@ const char *get_simple_output_encoder(const char *encoder)
} else if (strcmp(encoder, SIMPLE_ENCODER_AMD_AV1) == 0) {
return "av1_texture_amf";
} else if (strcmp(encoder, SIMPLE_ENCODER_NVENC) == 0) {
return EncoderAvailable("jim_nvenc") ? "jim_nvenc"
: "ffmpeg_nvenc";
return EncoderAvailable("obs_nvenc_h264_tex")
? "obs_nvenc_h264_tex"
: "ffmpeg_nvenc";
#ifdef ENABLE_HEVC
} else if (strcmp(encoder, SIMPLE_ENCODER_NVENC_HEVC) == 0) {
return EncoderAvailable("jim_hevc_nvenc") ? "jim_hevc_nvenc"
: "ffmpeg_hevc_nvenc";
return EncoderAvailable("obs_nvenc_hevc_tex")
? "obs_nvenc_hevc_tex"
: "ffmpeg_hevc_nvenc";
#endif
} else if (strcmp(encoder, SIMPLE_ENCODER_NVENC_AV1) == 0) {
return "jim_av1_nvenc";
return "obs_nvenc_av1_tex";
} else if (strcmp(encoder, SIMPLE_ENCODER_APPLE_H264) == 0) {
return "com.apple.videotoolbox.videoencoder.ave.avc";
#ifdef ENABLE_HEVC
Expand Down Expand Up @@ -1848,7 +1850,7 @@ void AdvancedOutput::UpdateStreamSettings()
blog(LOG_WARNING, "User is ignoring service settings.");
}

if (dynBitrate && astrcmpi(streamEncoder, "jim_nvenc") == 0)
if (dynBitrate && strstr(streamEncoder, "nvenc") != nullptr)
obs_data_set_bool(settings, "lookahead", false);

video_t *video = obs_get_video();
Expand Down
31 changes: 12 additions & 19 deletions UI/window-basic-main-profiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ bool OBSBasic::CreateProfile(const std::string &newName, bool create_new,
return false;
}

if (api && !rename)
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
if (!rename)
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGING);

config_set_string(App()->GlobalConfig(), "Basic", "Profile",
newName.c_str());
Expand Down Expand Up @@ -355,9 +355,9 @@ bool OBSBasic::CreateProfile(const std::string &newName, bool create_new,
wizard.exec();
}

if (api && !rename) {
api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
if (!rename) {
OnEvent(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
}
return true;
}
Expand Down Expand Up @@ -451,8 +451,7 @@ void OBSBasic::DeleteProfile(const QString &profileName)
DeleteProfile(name.c_str(), profileDir);
RefreshProfiles();
config_save_safe(App()->GlobalConfig(), "tmp", nullptr);
if (api)
api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
}

void OBSBasic::RefreshProfiles()
Expand Down Expand Up @@ -539,8 +538,7 @@ void OBSBasic::on_actionRenameProfile_triggered()
RefreshProfiles();
}

if (api)
api->on_event(OBS_FRONTEND_EVENT_PROFILE_RENAMED);
OnEvent(OBS_FRONTEND_EVENT_PROFILE_RENAMED);
}

void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)
Expand Down Expand Up @@ -589,8 +587,7 @@ void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)
return;
}

if (api)
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGING);

newPath.resize(newPath_len);

Expand Down Expand Up @@ -626,10 +623,8 @@ void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)

Auth::Load();

if (api) {
api->on_event(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
}
OnEvent(OBS_FRONTEND_EVENT_PROFILE_LIST_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGED);

if (needsRestart) {
QMessageBox::StandardButton button = OBSMessageBox::question(
Expand Down Expand Up @@ -768,8 +763,7 @@ void OBSBasic::ChangeProfile()
return;
}

if (api)
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGING);
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGING);

path.resize(path_len);

Expand Down Expand Up @@ -811,8 +805,7 @@ void OBSBasic::ChangeProfile()
blog(LOG_INFO, "Switched to profile '%s' (%s)", newName, newDir);
blog(LOG_INFO, "------------------------------------------------");

if (api)
api->on_event(OBS_FRONTEND_EVENT_PROFILE_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_PROFILE_CHANGED);

if (needsRestart) {
QMessageBox::StandardButton button = OBSMessageBox::question(
Expand Down
27 changes: 9 additions & 18 deletions UI/window-basic-main-scene-collections.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ bool OBSBasic::AddSceneCollection(bool create_new, const QString &qname)
RefreshSceneCollections();
};

if (api)
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);

new_collection(file, name);

Expand All @@ -179,10 +178,8 @@ bool OBSBasic::AddSceneCollection(bool create_new, const QString &qname)

UpdateTitleBar();

if (api) {
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED);
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
}
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);

return true;
}
Expand Down Expand Up @@ -294,8 +291,7 @@ void OBSBasic::on_actionRenameSceneCollection_triggered()
UpdateTitleBar();
RefreshSceneCollections();

if (api)
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_RENAMED);
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_RENAMED);
}

void OBSBasic::on_actionRemoveSceneCollection_triggered()
Expand Down Expand Up @@ -339,8 +335,7 @@ void OBSBasic::on_actionRemoveSceneCollection_triggered()
return;
}

if (api)
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);

oldFile.insert(0, path);
/* os_rename() overwrites if necessary, only the .bak file will remain. */
Expand All @@ -360,10 +355,8 @@ void OBSBasic::on_actionRemoveSceneCollection_triggered()

UpdateTitleBar();

if (api) {
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED);
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
}
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_LIST_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
}

void OBSBasic::on_actionImportSceneCollection_triggered()
Expand Down Expand Up @@ -461,8 +454,7 @@ void OBSBasic::ChangeSceneCollection()
return;
}

if (api)
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGING);

SaveProjectNow();

Expand All @@ -480,6 +472,5 @@ void OBSBasic::ChangeSceneCollection()

UpdateTitleBar();

if (api)
api->on_event(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_SCENE_COLLECTION_CHANGED);
}
4 changes: 1 addition & 3 deletions UI/window-basic-main-screenshot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,7 @@ ScreenshotObj::~ScreenshotObj()

main->lastScreenshot = path;

if (main->api)
main->api->on_event(
OBS_FRONTEND_EVENT_SCREENSHOT_TAKEN);
main->OnEvent(OBS_FRONTEND_EVENT_SCREENSHOT_TAKEN);
}
}
}
Expand Down
40 changes: 12 additions & 28 deletions UI/window-basic-main-transitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,8 @@ void OBSBasic::TransitionStopped()
EnableTransitionWidgets(true);
UpdatePreviewProgramIndicators();

if (api) {
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_STOPPED);
api->on_event(OBS_FRONTEND_EVENT_SCENE_CHANGED);
}
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_STOPPED);
OnEvent(OBS_FRONTEND_EVENT_SCENE_CHANGED);

swapScene = nullptr;
}
Expand Down Expand Up @@ -371,8 +369,7 @@ void OBSBasic::TransitionToScene(OBSSource source, bool force,

if (force) {
obs_transition_set(transition, source);
if (api)
api->on_event(OBS_FRONTEND_EVENT_SCENE_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_SCENE_CHANGED);
} else {
int duration = ui->transitionDuration->value();

Expand Down Expand Up @@ -450,8 +447,7 @@ void OBSBasic::SetTransition(OBSSource transition)
ui->transitionRemove->setEnabled(configurable);
ui->transitionProps->setEnabled(configurable);

if (api)
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_CHANGED);
}

OBSSource OBSBasic::GetCurrentTransition()
Expand Down Expand Up @@ -509,9 +505,7 @@ void OBSBasic::AddTransition(const char *id)
CreatePropertiesWindow(source);
obs_source_release(source);

if (api)
api->on_event(
OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);

ClearQuickTransitionWidgets();
RefreshQuickTransitions();
Expand Down Expand Up @@ -566,8 +560,7 @@ void OBSBasic::on_transitionRemove_clicked()

ui->transitions->removeItem(idx);

if (api)
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);

ClearQuickTransitionWidgets();
RefreshQuickTransitions();
Expand Down Expand Up @@ -607,9 +600,7 @@ void OBSBasic::RenameTransition(OBSSource transition)
if (idx != -1) {
ui->transitions->setItemText(idx, QT_UTF8(name.c_str()));

if (api)
api->on_event(
OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_LIST_CHANGED);

ClearQuickTransitionWidgets();
RefreshQuickTransitions();
Expand Down Expand Up @@ -643,9 +634,7 @@ void OBSBasic::on_transitionProps_clicked()

void OBSBasic::on_transitionDuration_valueChanged()
{
if (api) {
api->on_event(OBS_FRONTEND_EVENT_TRANSITION_DURATION_CHANGED);
}
OnEvent(OBS_FRONTEND_EVENT_TRANSITION_DURATION_CHANGED);
}

QuickTransition *OBSBasic::GetQuickTransition(int id)
Expand Down Expand Up @@ -714,9 +703,7 @@ void OBSBasic::SetCurrentScene(OBSSource scene, bool force)
outputHandler
->UpdateVirtualCamOutputSource();

if (api)
api->on_event(
OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_PREVIEW_SCENE_CHANGED);
break;
}
}
Expand Down Expand Up @@ -968,8 +955,7 @@ void OBSBasic::TBarChanged(int value)
obs_transition_set_manual_time(transition,
(float)value / T_BAR_PRECISION_F);

if (api)
api->on_event(OBS_FRONTEND_EVENT_TBAR_VALUE_CHANGED);
OnEvent(OBS_FRONTEND_EVENT_TBAR_VALUE_CHANGED);
}

int OBSBasic::GetTbarPosition()
Expand Down Expand Up @@ -1668,8 +1654,7 @@ void OBSBasic::SetPreviewProgramMode(bool enabled)
ui->previewLayout->setAlignment(programOptions,
Qt::AlignCenter);

if (api)
api->on_event(OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED);
OnEvent(OBS_FRONTEND_EVENT_STUDIO_MODE_ENABLED);

blog(LOG_INFO, "Switched to Preview/Program mode");
blog(LOG_INFO, "-----------------------------"
Expand Down Expand Up @@ -1707,8 +1692,7 @@ void OBSBasic::SetPreviewProgramMode(bool enabled)
ui->transitions->setEnabled(true);
tBarActive = false;

if (api)
api->on_event(OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED);
OnEvent(OBS_FRONTEND_EVENT_STUDIO_MODE_DISABLED);

blog(LOG_INFO, "Switched to regular Preview mode");
blog(LOG_INFO, "-----------------------------"
Expand Down
Loading

0 comments on commit 0ad997f

Please sign in to comment.