Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions frontend/settings/OBSBasicSettings_Stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -953,11 +953,25 @@ void OBSBasicSettings::on_server_currentIndexChanged(int /*index*/)
void OBSBasicSettings::UpdateVodTrackSetting()
{
bool enableForCustomServer = config_get_bool(App()->GetUserConfig(), "General", "EnableCustomServerVodTrack");
bool enableVodTrack = ui->service->currentText() == "Twitch";
bool enableVodTrack = false;
bool wasEnabled = !!vodTrackCheckbox;

if (enableForCustomServer && IsCustomService())
if (enableForCustomServer && IsCustomService()) {
enableVodTrack = true;
} else if (!IsCustomService()) {
QString serviceName = ui->service->currentText();
OBSDataAutoRelease settings = obs_data_create();
obs_data_set_string(settings, "service", QT_TO_UTF8(serviceName));
OBSServiceAutoRelease temp_service =
obs_service_create_private("rtmp_common", "vod track query service", settings);
OBSDataAutoRelease serviceSettings = obs_service_get_settings(temp_service);

if (obs_data_has_user_value(serviceSettings, "supports_vod_track")) {
enableVodTrack = obs_data_get_bool(serviceSettings, "supports_vod_track");
} else {
enableVodTrack = (serviceName == "Twitch");
}
}

if (enableVodTrack == wasEnabled)
return;
Expand Down
4 changes: 2 additions & 2 deletions frontend/utility/AdvancedOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,8 @@ inline std::optional<size_t> AdvancedOutput::VodTrackMixerIdx(obs_service_t *ser
vodTrackEnabled = enableForCustomServer ? vodTrackEnabled : false;
} else {
OBSDataAutoRelease settings = obs_service_get_settings(service);
const char *service = obs_data_get_string(settings, "service");
if (!ServiceSupportsVodTrack(service))
const char *serviceName = obs_data_get_string(settings, "service");
if (!ServiceSupportsVodTrack(serviceName, settings))
vodTrackEnabled = false;
}

Expand Down
5 changes: 4 additions & 1 deletion frontend/utility/BasicOutputHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ inline bool can_use_output(const char *prot, const char *output, const char *pro

const char *GetStreamOutputType(const obs_service_t *service);

inline bool ServiceSupportsVodTrack(const char *service)
inline bool ServiceSupportsVodTrack(const char *service, obs_data_t *settings)
{
if (settings && obs_data_has_user_value(settings, "supports_vod_track"))
return obs_data_get_bool(settings, "supports_vod_track");

static const char *vodTrackServices[] = {"Twitch"};

for (const char *vodTrackService : vodTrackServices) {
Expand Down
2 changes: 1 addition & 1 deletion frontend/utility/SimpleOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ bool SimpleOutput::IsVodTrackEnabled(obs_service_t *service)
if (strcmp(id, "rtmp_custom") == 0)
return enableForCustomServer ? enable : false;
else
return advanced && enable && ServiceSupportsVodTrack(name);
return advanced && enable && ServiceSupportsVodTrack(name, settings);
}

void SimpleOutput::SetupVodTrack(obs_service_t *service)
Expand Down
5 changes: 5 additions & 0 deletions plugins/rtmp-services/data/schema/service-schema-v5.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@
"default": [
""
]
},
"supports_vod_track": {
"type": "boolean",
"description": "Whether or not the service supports a separate VOD audio track.",
"default": false
}
},
"additionalProperties": false,
Expand Down
5 changes: 5 additions & 0 deletions plugins/rtmp-services/rtmp-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,11 @@ static void copy_info_to_settings(json_t *service, obs_data_t *settings)
dstr_free(&str);

update_protocol(service, settings);

json_t *vod_track_val = json_object_get(service, "supports_vod_track");
if (vod_track_val && json_is_boolean(vod_track_val)) {
obs_data_set_bool(settings, "supports_vod_track", json_is_true(vod_track_val));
}
}

static inline json_t *find_service(json_t *root, const char *name, const char **p_new_name)
Expand Down
Loading