mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-30 23:33:02 +00:00
3bf1333c84
The number of files in the source directory was a little bit much and just made file naming more complex than it had to be. Therefore all files were moved into subdirectories where it matters. Filters now reside in source/filters/, Sources in source/sources/, OBS Wrappers in obs/, OBS GS Wrappers in obs/gs/, Transitions will reside in source/transitions, Graphics Helpers will be in gfx/.
81 lines
2.7 KiB
C++
81 lines
2.7 KiB
C++
/*
|
|
* Modern effects for a modern Streamer
|
|
* Copyright (C) 2017-2018 Michael Fabian Dirks
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
*/
|
|
|
|
#pragma once
|
|
#include <functional>
|
|
#include <map>
|
|
#include <memory>
|
|
|
|
// OBS
|
|
#ifdef _MSC_VER
|
|
#pragma warning(push)
|
|
#pragma warning(disable : 4201)
|
|
#endif
|
|
#include <obs.h>
|
|
#ifdef _MSC_VER
|
|
#pragma warning(pop)
|
|
#endif
|
|
|
|
namespace obs {
|
|
class source_tracker {
|
|
friend class std::_Ref_count_obj<obs::source_tracker>;
|
|
|
|
std::map<std::string, obs_weak_source_t*> source_map;
|
|
|
|
static void source_create_handler(void* ptr, calldata_t* data);
|
|
static void source_destroy_handler(void* ptr, calldata_t* data);
|
|
|
|
public: // Singleton
|
|
static void initialize();
|
|
static void finalize();
|
|
static std::shared_ptr<obs::source_tracker> get();
|
|
|
|
private:
|
|
source_tracker();
|
|
~source_tracker();
|
|
|
|
public:
|
|
// Callback function for enumerating sources.
|
|
//
|
|
// @param std::string Name of the Source
|
|
// @param obs_source_t* Source
|
|
// @return true to abort enumeration, false to keep going.
|
|
typedef std::function<bool(std::string, obs_source_t*)> enumerate_cb_t;
|
|
|
|
// Filter function for enumerating sources.
|
|
//
|
|
// @param std::string Name of the Source
|
|
// @param obs_source_t* Source
|
|
// @return true to skip, false to pass along.
|
|
typedef std::function<bool(std::string, obs_source_t*)> filter_cb_t;
|
|
|
|
//! Enumerate all tracked sources
|
|
//
|
|
// @param enumerate_cb The function called for each tracked source.
|
|
// @param filter_cb Filter function to narrow down results.
|
|
void enumerate(enumerate_cb_t enumerate_cb, filter_cb_t filter_cb = nullptr);
|
|
|
|
public:
|
|
static bool filter_sources(std::string name, obs_source_t* source);
|
|
static bool filter_audio_sources(std::string name, obs_source_t* source);
|
|
static bool filter_video_sources(std::string name, obs_source_t* source);
|
|
static bool filter_transitions(std::string name, obs_source_t* source);
|
|
static bool filter_scenes(std::string name, obs_source_t* source);
|
|
};
|
|
} // namespace obs
|