Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
DevlinRocha authored Nov 21, 2024
2 parents 674d88a + dfc3a69 commit 48a2bbb
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 37 deletions.
4 changes: 2 additions & 2 deletions UI/frontend-plugins/frontend-tools/scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void ScriptsTool::ReloadScript(const char *path)
if (strcmp(script_path, path) == 0) {
obs_script_reload(script);

OBSDataAutoRelease settings = obs_data_create();
OBSDataAutoRelease settings = obs_script_get_settings(script);

obs_properties_t *prop = obs_script_get_properties(script);
obs_properties_apply_settings(prop, settings);
Expand Down Expand Up @@ -349,7 +349,7 @@ void ScriptsTool::on_addScripts_clicked()
item->setData(Qt::UserRole, QString(file));
ui->scripts->addItem(item);

OBSDataAutoRelease settings = obs_data_create();
OBSDataAutoRelease settings = obs_script_get_settings(script);

obs_properties_t *prop = obs_script_get_properties(script);
obs_properties_apply_settings(prop, settings);
Expand Down
21 changes: 14 additions & 7 deletions UI/multitrack-video-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ bool MultitrackVideoDeveloperModeEnabled()
}

static OBSServiceAutoRelease create_service(const GoLiveApi::Config &go_live_config,
const std::optional<std::string> &rtmp_url, const QString &in_stream_key)
const std::optional<std::string> &rtmp_url, const QString &in_stream_key,
std::optional<bool> use_rtmps)
{
const char *url = nullptr;
QString stream_key = in_stream_key;
Expand All @@ -69,6 +70,9 @@ static OBSServiceAutoRelease create_service(const GoLiveApi::Config &go_live_con
if (qstrnicmp("RTMP", endpoint.protocol.c_str(), 4))
continue;

if (use_rtmps.has_value() && *use_rtmps != (qstricmp("RTMPS", endpoint.protocol.c_str()) == 0))
continue;

url = endpoint.url_template.c_str();
if (endpoint.authentication && !endpoint.authentication->empty()) {
blog(LOG_INFO, "Using stream key supplied by autoconfig");
Expand Down Expand Up @@ -292,11 +296,14 @@ static OBSOutputs SetupOBSOutput(QWidget *parent, const QString &multitrack_vide
static void SetupSignalHandlers(bool recording, MultitrackVideoOutput *self, obs_output_t *output, OBSSignal &start,
OBSSignal &stop, OBSSignal &deactivate);

void MultitrackVideoOutput::PrepareStreaming(
QWidget *parent, const char *service_name, obs_service_t *service, const std::optional<std::string> &rtmp_url,
const QString &stream_key, const char *audio_encoder_id, std::optional<uint32_t> maximum_aggregate_bitrate,
std::optional<uint32_t> maximum_video_tracks, std::optional<std::string> custom_config,
obs_data_t *dump_stream_to_file_config, size_t main_audio_mixer, std::optional<size_t> vod_track_mixer)
void MultitrackVideoOutput::PrepareStreaming(QWidget *parent, const char *service_name, obs_service_t *service,
const std::optional<std::string> &rtmp_url, const QString &stream_key,
const char *audio_encoder_id,
std::optional<uint32_t> maximum_aggregate_bitrate,
std::optional<uint32_t> maximum_video_tracks,
std::optional<std::string> custom_config,
obs_data_t *dump_stream_to_file_config, size_t main_audio_mixer,
std::optional<size_t> vod_track_mixer, std::optional<bool> use_rtmps)
{
{
const std::lock_guard<std::mutex> current_lock{current_mutex};
Expand Down Expand Up @@ -396,7 +403,7 @@ void MultitrackVideoOutput::PrepareStreaming(
throw MultitrackVideoError::warning(
QTStr("FailedToStartStream.FallbackToDefault").arg(multitrack_video_name));

auto multitrack_video_service = create_service(service_config, rtmp_url, stream_key);
auto multitrack_video_service = create_service(service_config, rtmp_url, stream_key, use_rtmps);
if (!multitrack_video_service)
throw MultitrackVideoError::warning(
QTStr("FailedToStartStream.FallbackToDefault").arg(multitrack_video_name));
Expand Down
2 changes: 1 addition & 1 deletion UI/multitrack-video-output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct MultitrackVideoOutput {
const char *audio_encoder_id, std::optional<uint32_t> maximum_aggregate_bitrate,
std::optional<uint32_t> maximum_video_tracks, std::optional<std::string> custom_config,
obs_data_t *dump_stream_to_file_config, size_t main_audio_mixer,
std::optional<size_t> vod_track_mixer);
std::optional<size_t> vod_track_mixer, std::optional<bool> use_rtmps);
signal_handler_t *StreamingSignalHandler();
void StartedStreaming();
void StopStreaming();
Expand Down
11 changes: 0 additions & 11 deletions UI/window-basic-auto-config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,17 +427,6 @@ bool AutoConfigStreamPage::validatePage()
multitrackVideoBitrate += bitrate;
}

// grab a streamkey from the go live config if we can
for (auto &endpoint : config.ingest_endpoints) {
const char *p = endpoint.protocol.c_str();
const char *auth = endpoint.authentication ? endpoint.authentication->c_str()
: nullptr;
if (qstrnicmp("RTMP", p, 4) == 0 && auth && *auth) {
wiz->key = auth;
break;
}
}

if (multitrackVideoBitrate > 0) {
wiz->startingBitrate = multitrackVideoBitrate;
wiz->idealBitrate = multitrackVideoBitrate;
Expand Down
18 changes: 11 additions & 7 deletions UI/window-basic-main-outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ std::shared_future<void> SimpleOutput::SetupStreaming(obs_service_t *service, Se
auto audio_bitrate = GetAudioBitrate();
auto vod_track_mixer = IsVodTrackEnabled(service) ? std::optional{1} : std::nullopt;

auto handle_multitrack_video_result = [&](std::optional<bool> multitrackVideoResult) {
auto handle_multitrack_video_result = [=](std::optional<bool> multitrackVideoResult) {
if (multitrackVideoResult.has_value())
return multitrackVideoResult.value();

Expand Down Expand Up @@ -1100,7 +1100,7 @@ std::shared_future<void> SimpleOutput::SetupStreaming(obs_service_t *service, Se
};

return SetupMultitrackVideo(service, GetSimpleAACEncoderForBitrate(audio_bitrate), 0, vod_track_mixer,
[&, continuation](std::optional<bool> res) {
[=](std::optional<bool> res) {
continuation(handle_multitrack_video_result(res));
});
}
Expand Down Expand Up @@ -2021,7 +2021,6 @@ std::shared_future<void> AdvancedOutput::SetupStreaming(obs_service_t *service,
SetupStreamingContinuation_t continuation)
{
int multiTrackAudioMixes = config_get_int(main->Config(), "AdvOut", "StreamMultiTrackAudioMixes");
int idx = 0;

bool is_multitrack_output = allowsMultiTrack();

Expand Down Expand Up @@ -2049,7 +2048,7 @@ std::shared_future<void> AdvancedOutput::SetupStreaming(obs_service_t *service,
const char *audio_encoder_id = config_get_string(main->Config(), "AdvOut", "AudioEncoder");
int streamTrackIndex = config_get_int(main->Config(), "AdvOut", "TrackIndex") - 1;

auto handle_multitrack_video_result = [&](std::optional<bool> multitrackVideoResult) {
auto handle_multitrack_video_result = [=](std::optional<bool> multitrackVideoResult) {
if (multitrackVideoResult.has_value())
return multitrackVideoResult.value();

Expand Down Expand Up @@ -2088,6 +2087,7 @@ std::shared_future<void> AdvancedOutput::SetupStreaming(obs_service_t *service,
if (!is_multitrack_output) {
obs_output_set_audio_encoder(streamOutput, streamAudioEnc, 0);
} else {
int idx = 0;
for (int i = 0; i < MAX_AUDIO_MIXES; i++) {
if ((multiTrackAudioMixes & (1 << i)) != 0) {
obs_output_set_audio_encoder(streamOutput, streamTrack[i], idx);
Expand All @@ -2100,7 +2100,7 @@ std::shared_future<void> AdvancedOutput::SetupStreaming(obs_service_t *service,
};

return SetupMultitrackVideo(service, audio_encoder_id, static_cast<size_t>(streamTrackIndex),
VodTrackMixerIdx(service), [&, continuation](std::optional<bool> res) {
VodTrackMixerIdx(service), [=](std::optional<bool> res) {
continuation(handle_multitrack_video_result(res));
});
}
Expand Down Expand Up @@ -2425,9 +2425,13 @@ std::shared_future<void> BasicOutputHandler::SetupMultitrackVideo(obs_service_t
}

std::optional<std::string> custom_rtmp_url;
std::optional<bool> use_rtmps;
auto server = obs_data_get_string(settings, "server");
if (strcmp(server, "auto") != 0) {
if (strncmp(server, "auto", 4) != 0) {
custom_rtmp_url = server;
} else {
QString server_ = server;
use_rtmps = server_.contains("rtmps", Qt::CaseInsensitive);
}

auto service_custom_server = obs_data_get_bool(settings, "using_custom_server");
Expand Down Expand Up @@ -2485,7 +2489,7 @@ std::shared_future<void> BasicOutputHandler::SetupMultitrackVideo(obs_service_t
multitrackVideo->PrepareStreaming(main, service_name.c_str(), service, custom_rtmp_url, key,
audio_encoder_id.c_str(), maximum_aggregate_bitrate,
maximum_video_tracks, custom_config, stream_dump_config,
main_audio_mixer, vod_track_mixer);
main_audio_mixer, vod_track_mixer, use_rtmps);
} catch (const MultitrackVideoError &error_) {
error.emplace(error_);
}
Expand Down
6 changes: 6 additions & 0 deletions UI/window-basic-main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,16 @@ static void AddExtraModulePaths()
plugins_data_path = s;

if (!plugins_path.empty() && !plugins_data_path.empty()) {
#if defined(__APPLE__)
plugins_path += "/%module%.plugin/Contents/MacOS";
plugins_data_path += "/%module%.plugin/Contents/Resources";
obs_add_module_path(plugins_path.c_str(), plugins_data_path.c_str());
#else
string data_path_with_module_suffix;
data_path_with_module_suffix += plugins_data_path;
data_path_with_module_suffix += "/%module%";
obs_add_module_path(plugins_path.c_str(), data_path_with_module_suffix.c_str());
#endif
}

if (portable_mode)
Expand Down
2 changes: 1 addition & 1 deletion cmake/linux/cpackconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif()

set(CPACK_SOURCE_PACKAGE_FILE_NAME "obs-studio-${CPACK_PACKAGE_VERSION}-sources")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_SOURCE_IGNORE_FILES "/.git" "/.*build.*" "/.ccache" "/.deps")
set(CPACK_SOURCE_IGNORE_FILES "/.git" "/build_${CMAKE_SYSTEM_PROCESSOR}" "/.ccache" "/.deps")
set(CPACK_ARCHIVE_THREADS 0)

if(OS_LINUX)
Expand Down
8 changes: 4 additions & 4 deletions plugins/decklink/win/platform.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "../platform.hpp"

#include <util/platform.h>
#include <comdef.h>

IDeckLinkDiscovery *CreateDeckLinkDiscoveryInstance(void)
{
Expand Down Expand Up @@ -31,11 +32,10 @@ bool DeckLinkStringToStdString(decklink_string_t input, std::string &output)
if (input == nullptr)
return false;

size_t len = wcslen(input);
size_t utf8_len = os_wcs_to_utf8(input, len, nullptr, 0);
char *out = _com_util::ConvertBSTRToString(input);
output = std::string(out);

output.resize(utf8_len);
os_wcs_to_utf8(input, len, &output[0], utf8_len);
delete[] out;

return true;
}
2 changes: 1 addition & 1 deletion plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ static void *enc_create(obs_data_t *settings, obs_encoder_t *encoder, const char

if (codec_desc->props & AV_CODEC_PROP_LOSSLESS)
// Set by encoder on init, not known at this time
enc->context->bit_rate = -1;
enc->context->bit_rate = 0;
else
enc->context->bit_rate = bitrate * 1000;

Expand Down
4 changes: 3 additions & 1 deletion plugins/win-capture/graphics-hook/d3d10-capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,9 @@ static inline void d3d10_copy_texture(ID3D10Resource *dst, ID3D10Resource *src)

static inline void d3d10_shtex_capture(ID3D10Resource *backbuffer)
{
d3d10_copy_texture(data.texture, backbuffer);
if (data.texture) {
d3d10_copy_texture(data.texture, backbuffer);
}
}

static void d3d10_shmem_capture_copy(int i)
Expand Down
4 changes: 3 additions & 1 deletion plugins/win-capture/graphics-hook/d3d11-capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ static inline void d3d11_copy_texture(ID3D11Resource *dst, ID3D11Resource *src)

static inline void d3d11_shtex_capture(ID3D11Resource *backbuffer)
{
d3d11_copy_texture(data.texture, backbuffer);
if (data.texture) {
d3d11_copy_texture(data.texture, backbuffer);
}
}

static void d3d11_shmem_capture_copy(int i)
Expand Down
4 changes: 4 additions & 0 deletions plugins/win-capture/graphics-hook/d3d12-capture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ static inline void d3d12_copy_texture(ID3D11Resource *dst, ID3D11Resource *src)

static inline void d3d12_shtex_capture(IDXGISwapChain *swap)
{
if (!data.device11on12) {
return;
}

bool dxgi_1_4 = data.dxgi_1_4;
UINT cur_idx;

Expand Down
2 changes: 1 addition & 1 deletion shared/obs-hook-config/graphics-hook-ver.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#define HOOK_VER_MAJOR 1
#define HOOK_VER_MINOR 8
#define HOOK_VER_PATCH 5
#define HOOK_VER_PATCH 6

#ifndef STRINGIFY
#define STRINGIFY(s) #s
Expand Down

0 comments on commit 48a2bbb

Please sign in to comment.