Revert service json lookup refactor in UI

Certain services have custom server lits handling which I had forgotten
about, so although it would have been nice to have this refactor, we'll
have to live with relying on the plugin properties object directly for a
while.

This also reverts obsproject/obs-studio#6530 and
obsproject/obs-studio#6683 because that change depended on this
problematic refactor code.

This reverts commits:
f2e6122881,
bc80d0ca95,
050a29da1a,
22ffc04f73,
275e510aad,
2fa5ffe4df.
This commit is contained in:
jp9000
2022-07-18 14:52:26 -07:00
parent 22ef40ba17
commit 0b9a8aa1fd
12 changed files with 411 additions and 399 deletions
+17 -9
View File
@@ -19,7 +19,6 @@
#define wiz reinterpret_cast<AutoConfig *>(wizard())
using namespace std;
using namespace json11;
/* ------------------------------------------------------------------------- */
@@ -120,19 +119,28 @@ void AutoConfigTestPage::StartRecordingEncoderStage()
void AutoConfigTestPage::GetServers(std::vector<ServerInfo> &servers)
{
Json root = get_services_json();
Json service = get_service_from_json(root, wiz->serviceName.c_str());
OBSDataAutoRelease settings = obs_data_create();
obs_data_set_string(settings, "service", wiz->serviceName.c_str());
auto &json_services = service["servers"].array_items();
for (const Json &server : json_services) {
const std::string &name = server["name"].string_value();
const std::string &url = server["url"].string_value();
obs_properties_t *ppts = obs_get_service_properties("rtmp_common");
obs_property_t *p = obs_properties_get(ppts, "service");
obs_property_modified(p, settings);
if (wiz->CanTestServer(name.c_str())) {
ServerInfo info(name, url);
p = obs_properties_get(ppts, "server");
size_t count = obs_property_list_item_count(p);
servers.reserve(count);
for (size_t i = 0; i < count; i++) {
const char *name = obs_property_list_item_name(p, i);
const char *server = obs_property_list_item_string(p, i);
if (wiz->CanTestServer(name)) {
ServerInfo info(name, server);
servers.push_back(info);
}
}
obs_properties_destroy(ppts);
}
static inline void string_depad_key(string &key)