Add source properties window (very preliminary)
- Add a properties window for sources so that you can now actually edit the settings for sources. Also, display the source by itself in the window (Note: not working on mac, and possibly not working on linux). When changing the settings for a source, it will call obs_source_update on that source when you have modified any values automatically. - Add a properties 'widget', eventually I want to turn this in to a regular nice properties view like you'd see in the designer, but right now it just uses a form layout in a QScrollArea with regular controls to display the properties. It's clunky but works for the time being. - Make it so that swap chains and the main graphics subsystem will automatically use at least one backbuffer if none was specified - Fix bug where displays weren't added to the main display array - Make it so that you can get the properties of a source via the actual pointer of a source/encoder/output in addition to being able to look up properties via identifier. - When registering source types, check for required functions (wasn't doing it before). getheight/getwidth should not be optional if it's a video source as well. - Add an RAII OBSObj wrapper to obs.hpp for non-reference-counted libobs pointers - Add an RAII OBSSignal wrapper to obs.hpp for libobs signals to automatically disconnect them on destruction - Move the "scale and center" calculation in window-basic-main.cpp to its own function and in its own source file - Add an 'update' callback to WASAPI audio sources
This commit is contained in:
@@ -63,10 +63,91 @@ public:
|
||||
};
|
||||
|
||||
using OBSSource = OBSRef<obs_source_t, obs_source_addref, obs_source_release>;
|
||||
using OBSScene = OBSRef<obs_scene_t, obs_scene_addref, obs_scene_release>;
|
||||
using OBSScene = OBSRef<obs_scene_t, obs_scene_addref, obs_scene_release>;
|
||||
using OBSSceneItem = OBSRef<obs_sceneitem_t, obs_sceneitem_addref,
|
||||
obs_sceneitem_release>;
|
||||
|
||||
using OBSData = OBSRef<obs_data_t, obs_data_addref, obs_data_release>;
|
||||
using OBSDataArray = OBSRef<obs_data_array_t, obs_data_array_addref,
|
||||
obs_data_array_release>;
|
||||
|
||||
/* objects that are not meant to be instanced */
|
||||
template<typename T, void destroy(T)> class OBSObj {
|
||||
T obj;
|
||||
|
||||
public:
|
||||
inline OBSObj() : obj(nullptr) {}
|
||||
inline OBSObj(T obj_) : obj(obj_) {}
|
||||
|
||||
inline ~OBSObj() {destroy(obj);}
|
||||
|
||||
inline OBSObj &operator=(T obj_)
|
||||
{
|
||||
if (obj_ != obj)
|
||||
destroy(obj);
|
||||
obj = obj_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline operator T() const {return obj;}
|
||||
|
||||
inline bool operator==(T p) const {return obj == p;}
|
||||
inline bool operator!=(T p) const {return obj != p;}
|
||||
};
|
||||
|
||||
using OBSDisplay = OBSObj<obs_display_t, obs_display_destroy>;
|
||||
using OBSEncoder = OBSObj<obs_encoder_t, obs_encoder_destroy>;
|
||||
using OBSView = OBSObj<obs_view_t, obs_view_destroy>;
|
||||
using OBSOutput = OBSObj<obs_output_t, obs_output_destroy>;
|
||||
|
||||
/* signal handler connection */
|
||||
class OBSSignal {
|
||||
signal_handler_t handler;
|
||||
const char *signal;
|
||||
signal_callback_t callback;
|
||||
void *param;
|
||||
|
||||
public:
|
||||
inline OBSSignal()
|
||||
: handler (nullptr),
|
||||
signal (nullptr),
|
||||
callback (nullptr),
|
||||
param (nullptr)
|
||||
{}
|
||||
|
||||
inline OBSSignal(signal_handler_t handler_,
|
||||
const char *signal_,
|
||||
signal_callback_t callback_,
|
||||
void *param_)
|
||||
: handler (handler_),
|
||||
signal (signal_),
|
||||
callback (callback_),
|
||||
param (param_)
|
||||
{
|
||||
signal_handler_connect(handler, signal, callback, param);
|
||||
}
|
||||
|
||||
inline void Disconnect()
|
||||
{
|
||||
signal_handler_disconnect(handler, signal, callback, param);
|
||||
handler = nullptr;
|
||||
signal = nullptr;
|
||||
callback = nullptr;
|
||||
param = nullptr;
|
||||
}
|
||||
|
||||
inline ~OBSSignal() {Disconnect();}
|
||||
|
||||
inline void Connect(signal_handler_t handler_,
|
||||
const char *signal_,
|
||||
signal_callback_t callback_,
|
||||
void *param_)
|
||||
{
|
||||
Disconnect();
|
||||
|
||||
handler = handler_;
|
||||
signal = signal_;
|
||||
callback = callback_;
|
||||
param = param_;
|
||||
signal_handler_connect(handler, signal, callback, param);
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user