diff --git a/src/requesthandler/RequestHandler_Inputs.cpp b/src/requesthandler/RequestHandler_Inputs.cpp index b29bfe1f..a14c0f14 100644 --- a/src/requesthandler/RequestHandler_Inputs.cpp +++ b/src/requesthandler/RequestHandler_Inputs.cpp @@ -616,32 +616,6 @@ RequestResult RequestHandler::SetInputAudioMonitorType(const Request& request) return RequestResult::Success(); } -std::vector GetListPropertyItems(obs_property_t *property) -{ - std::vector ret; - - enum obs_combo_format itemFormat = obs_property_list_format(property); - size_t itemCount = obs_property_list_item_count(property); - - for (size_t i = 0; i < itemCount; i++) { - json itemData; - itemData["itemName"] = obs_property_list_item_name(property, i); - itemData["itemEnabled"] = !obs_property_list_item_disabled(property, i); - if (itemFormat == OBS_COMBO_FORMAT_INT) { - itemData["itemValue"] = obs_property_list_item_int(property, i); - } else if (itemFormat == OBS_COMBO_FORMAT_FLOAT) { - itemData["itemValue"] = obs_property_list_item_float(property, i); - } else if (itemFormat == OBS_COMBO_FORMAT_STRING) { - itemData["itemValue"] = obs_property_list_item_string(property, i); - } else { - itemData["itemValue"] = nullptr; - } - ret.push_back(itemData); - } - - return ret; -} - /** * Gets the items of a list property from an input's properties. * @@ -677,7 +651,7 @@ RequestResult RequestHandler::GetInputPropertiesListPropertyItems(const Request& return RequestResult::Error(RequestStatus::InvalidResourceType, "The property found is not a list."); json responseData; - responseData["propertyItems"] = GetListPropertyItems(property); + responseData["propertyItems"] = Utils::Obs::ArrayHelper::GetListPropertyItems(property); return RequestResult::Success(responseData); } diff --git a/src/utils/Obs.h b/src/utils/Obs.h index a41511e3..943b6b7f 100644 --- a/src/utils/Obs.h +++ b/src/utils/Obs.h @@ -122,6 +122,7 @@ namespace Utils { std::vector GetSceneItemList(obs_scene_t *scene, bool basic = false); std::vector GetInputList(std::string inputKind = ""); std::vector GetInputKindList(bool unversioned = false, bool includeDisabled = false); + std::vector GetListPropertyItems(obs_property_t *property); std::vector GetTransitionKindList(); std::vector GetSceneTransitionList(); } diff --git a/src/utils/Obs_ArrayHelper.cpp b/src/utils/Obs_ArrayHelper.cpp index f408fe58..bbd032c3 100644 --- a/src/utils/Obs_ArrayHelper.cpp +++ b/src/utils/Obs_ArrayHelper.cpp @@ -201,6 +201,32 @@ std::vector Utils::Obs::ArrayHelper::GetInputKindList(bool unversio return ret; } +std::vector Utils::Obs::ArrayHelper::GetListPropertyItems(obs_property_t *property) +{ + std::vector ret; + + enum obs_combo_format itemFormat = obs_property_list_format(property); + size_t itemCount = obs_property_list_item_count(property); + + for (size_t i = 0; i < itemCount; i++) { + json itemData; + itemData["itemName"] = obs_property_list_item_name(property, i); + itemData["itemEnabled"] = !obs_property_list_item_disabled(property, i); + if (itemFormat == OBS_COMBO_FORMAT_INT) { + itemData["itemValue"] = obs_property_list_item_int(property, i); + } else if (itemFormat == OBS_COMBO_FORMAT_FLOAT) { + itemData["itemValue"] = obs_property_list_item_float(property, i); + } else if (itemFormat == OBS_COMBO_FORMAT_STRING) { + itemData["itemValue"] = obs_property_list_item_string(property, i); + } else { + itemData["itemValue"] = nullptr; + } + ret.push_back(itemData); + } + + return ret; +} + std::vector Utils::Obs::ArrayHelper::GetTransitionKindList() { std::vector ret;