diff --git a/src/utils/Obs.cpp b/src/utils/Obs.cpp index 03320cc2..f155064c 100644 --- a/src/utils/Obs.cpp +++ b/src/utils/Obs.cpp @@ -153,6 +153,24 @@ uint64_t Utils::Obs::NumberHelper::GetOutputDuration(obs_output_t *output) return util_mul_div64(totalFrames, frameTimeNs, 1000000ULL); } +size_t Utils::Obs::NumberHelper::GetSceneCount() +{ + size_t ret; + auto sceneEnumProc = [](void *param, obs_source_t *scene) { + auto ret = reinterpret_cast(param); + + if (obs_source_is_group(scene)) + return true; + + (*ret)++; + return true; + }; + + obs_enum_scenes(sceneEnumProc, &ret); + + return ret; +} + std::vector Utils::Obs::ListHelper::GetSceneCollectionList() { char** sceneCollections = obs_frontend_get_scene_collections(); diff --git a/src/utils/Obs.h b/src/utils/Obs.h index 0bab4033..3cae86f9 100644 --- a/src/utils/Obs.h +++ b/src/utils/Obs.h @@ -40,6 +40,7 @@ namespace Utils { namespace NumberHelper { uint64_t GetOutputDuration(obs_output_t *output); + size_t GetSceneCount(); } namespace ListHelper {