(API Change) libobs: Don't use signal for obs_load_sources
(Note: This commit also changes the UI) Changed: ------------------- void obs_load_sources(obs_data_array_t *sources_list); To: ------------------- void obs_load_sources(obs_data_array_t *sources_list, obs_source_load_cb callback, void *private_data); Signals should really never be required to use to make some function work properly. The "source_load" signal was required for the obs_load_sources function, but it's meant more for loading private data in the settings, not for general loading of sources. This changes it so that a callback is explicitly required to load the sources.
This commit is contained in:
parent
d497c63f1b
commit
aa2bea3749
@ -1474,7 +1474,8 @@ obs_source_t *obs_load_source(obs_data_t *source_data)
|
||||
return obs_load_source_type(source_data);
|
||||
}
|
||||
|
||||
void obs_load_sources(obs_data_array_t *array)
|
||||
void obs_load_sources(obs_data_array_t *array, obs_load_source_cb cb,
|
||||
void *private_data)
|
||||
{
|
||||
if (!obs) return;
|
||||
|
||||
@ -1507,6 +1508,7 @@ void obs_load_sources(obs_data_array_t *array)
|
||||
if (source->info.type == OBS_SOURCE_TYPE_TRANSITION)
|
||||
obs_transition_load(source, source_data);
|
||||
obs_source_load(source);
|
||||
cb(private_data, source);
|
||||
}
|
||||
obs_data_release(source_data);
|
||||
}
|
||||
|
@ -550,8 +550,11 @@ EXPORT obs_data_t *obs_save_source(obs_source_t *source);
|
||||
/** Loads a source from settings data */
|
||||
EXPORT obs_source_t *obs_load_source(obs_data_t *data);
|
||||
|
||||
typedef void (*obs_load_source_cb)(void *private_data, obs_source_t *source);
|
||||
|
||||
/** Loads sources from a data array */
|
||||
EXPORT void obs_load_sources(obs_data_array_t *array);
|
||||
EXPORT void obs_load_sources(obs_data_array_t *array, obs_load_source_cb cb,
|
||||
void *private_data);
|
||||
|
||||
/** Saves sources to a data array */
|
||||
EXPORT obs_data_array_t *obs_save_sources(void);
|
||||
|
@ -526,7 +526,7 @@ void OBSBasic::Load(const char *file)
|
||||
LoadAudioDevice(AUX_AUDIO_2, 4, data);
|
||||
LoadAudioDevice(AUX_AUDIO_3, 5, data);
|
||||
|
||||
obs_load_sources(sources);
|
||||
obs_load_sources(sources, OBSBasic::SourceLoaded, this);
|
||||
|
||||
if (transitions)
|
||||
LoadTransitions(transitions);
|
||||
@ -835,8 +835,6 @@ void OBSBasic::InitOBSCallbacks()
|
||||
ProfileScope("OBSBasic::InitOBSCallbacks");
|
||||
|
||||
signalHandlers.reserve(signalHandlers.size() + 6);
|
||||
signalHandlers.emplace_back(obs_get_signal_handler(), "source_load",
|
||||
OBSBasic::SourceLoaded, this);
|
||||
signalHandlers.emplace_back(obs_get_signal_handler(), "source_remove",
|
||||
OBSBasic::SourceRemoved, this);
|
||||
signalHandlers.emplace_back(obs_get_signal_handler(), "source_activate",
|
||||
@ -2031,10 +2029,9 @@ void OBSBasic::SceneItemDeselected(void *data, calldata_t *params)
|
||||
Q_ARG(bool, false));
|
||||
}
|
||||
|
||||
void OBSBasic::SourceLoaded(void *data, calldata_t *params)
|
||||
void OBSBasic::SourceLoaded(void *data, obs_source_t *source)
|
||||
{
|
||||
OBSBasic *window = static_cast<OBSBasic*>(data);
|
||||
obs_source_t *source = (obs_source_t*)calldata_ptr(params, "source");
|
||||
|
||||
if (obs_scene_from_source(source) != NULL)
|
||||
QMetaObject::invokeMethod(window,
|
||||
|
@ -329,7 +329,7 @@ private:
|
||||
static void SceneItemRemoved(void *data, calldata_t *params);
|
||||
static void SceneItemSelected(void *data, calldata_t *params);
|
||||
static void SceneItemDeselected(void *data, calldata_t *params);
|
||||
static void SourceLoaded(void *data, calldata_t *params);
|
||||
static void SourceLoaded(void *data, obs_source_t *source);
|
||||
static void SourceRemoved(void *data, calldata_t *params);
|
||||
static void SourceActivated(void *data, calldata_t *params);
|
||||
static void SourceDeactivated(void *data, calldata_t *params);
|
||||
|
Loading…
x
Reference in New Issue
Block a user