mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 13:08:50 +02:00
Merge pull request #1960 from Xaymar/patch-get_defaults2
libobs: Call both get_defaults and get_defaults2
This commit is contained in:
commit
c64d82530d
@ -66,8 +66,12 @@ static bool init_encoder(struct obs_encoder *encoder, const char *name,
|
||||
if (pthread_mutex_init(&encoder->pause.mutex, NULL) != 0)
|
||||
return false;
|
||||
|
||||
if (encoder->orig_info.get_defaults)
|
||||
if (encoder->orig_info.get_defaults) {
|
||||
encoder->orig_info.get_defaults(encoder->context.settings);
|
||||
}
|
||||
if (encoder->orig_info.get_defaults2) {
|
||||
encoder->orig_info.get_defaults2(encoder->context.settings, encoder->orig_info.type_data);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -316,10 +320,11 @@ void obs_encoder_set_name(obs_encoder_t *encoder, const char *name)
|
||||
static inline obs_data_t *get_defaults(const struct obs_encoder_info *info)
|
||||
{
|
||||
obs_data_t *settings = obs_data_create();
|
||||
if (info->get_defaults) {
|
||||
info->get_defaults(settings);
|
||||
}
|
||||
if (info->get_defaults2) {
|
||||
info->get_defaults2(settings, info->type_data);
|
||||
} else if (info->get_defaults) {
|
||||
info->get_defaults(settings);
|
||||
}
|
||||
return settings;
|
||||
}
|
||||
|
@ -239,6 +239,9 @@ struct obs_encoder_info {
|
||||
/**
|
||||
* Gets the default settings for this encoder
|
||||
*
|
||||
* If get_defaults is also defined both will be called, and the first
|
||||
* call will be to get_defaults, then to get_defaults2.
|
||||
*
|
||||
* @param[out] settings Data to assign default settings to
|
||||
* @param[in] typedata Type Data
|
||||
*/
|
||||
|
@ -324,11 +324,13 @@ static obs_source_t *obs_source_create_internal(const char *id,
|
||||
goto fail;
|
||||
|
||||
if (info) {
|
||||
if (info->get_defaults2)
|
||||
if (info->get_defaults) {
|
||||
info->get_defaults(source->context.settings);
|
||||
}
|
||||
if (info->get_defaults2) {
|
||||
info->get_defaults2(info->type_data,
|
||||
source->context.settings);
|
||||
else if (info->get_defaults)
|
||||
info->get_defaults(source->context.settings);
|
||||
}
|
||||
}
|
||||
|
||||
if (!obs_source_init(source))
|
||||
|
@ -442,6 +442,9 @@ struct obs_source_info {
|
||||
/**
|
||||
* Gets the default settings for this source
|
||||
*
|
||||
* If get_defaults is also defined both will be called, and the first
|
||||
* call will be to get_defaults, then to get_defaults2.
|
||||
*
|
||||
* @param type_data The type_data variable of this structure
|
||||
* @param[out] settings Data to assign default settings to
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user