(API Change) Fix "apply service settings" functions
API changed from: ------------------------ EXPORT void obs_service_apply_encoder_settings(obs_service_t *service, obs_encoder_t *video_encoder, obs_encoder_t *audio_encoder); void obs_service_info::apply_encoder_settings(void *data obs_encoder_t *video_encoder, obs_encoder_t *audio_encoder); To: ------------------------ EXPORT void obs_service_apply_encoder_settings(obs_service_t *service, obs_data_t *video_encoder_settings, obs_data_t *audio_encoder_settings); void obs_service_info::apply_encoder_settings(void *data obs_data_t *video_encoder_settings, obs_data_t *audio_encoder_settings); These changes make it so that instead of an encoder potentially being updated more than once with different settings, that these functions will be called for the specific settings being used, and the settings will be updated according to what's required by the service. This fixes that design flaw and ensures that there's no case where obs_encoder_update is called where the settings might not have service-specific settings applied.
This commit is contained in:
@@ -237,17 +237,13 @@ bool obs_service_initialize(struct obs_service *service,
|
||||
}
|
||||
|
||||
void obs_service_apply_encoder_settings(obs_service_t *service,
|
||||
obs_encoder_t *video_encoder, obs_encoder_t *audio_encoder)
|
||||
obs_data_t *video_encoder_settings,
|
||||
obs_data_t *audio_encoder_settings)
|
||||
{
|
||||
if (!service || !service->info.apply_encoder_settings)
|
||||
return;
|
||||
|
||||
if (video_encoder && video_encoder->info.type != OBS_ENCODER_VIDEO)
|
||||
video_encoder = NULL;
|
||||
if (audio_encoder && audio_encoder->info.type != OBS_ENCODER_AUDIO)
|
||||
audio_encoder = NULL;
|
||||
|
||||
if (video_encoder || audio_encoder)
|
||||
if (video_encoder_settings || audio_encoder_settings)
|
||||
service->info.apply_encoder_settings(service->context.data,
|
||||
video_encoder, audio_encoder);
|
||||
video_encoder_settings, audio_encoder_settings);
|
||||
}
|
||||
|
@@ -65,8 +65,9 @@ struct obs_service_info {
|
||||
|
||||
bool (*supports_multitrack)(void *data);
|
||||
|
||||
void (*apply_encoder_settings)(void *data, obs_encoder_t *video_encoder,
|
||||
obs_encoder_t *audio_encoder);
|
||||
void (*apply_encoder_settings)(void *data,
|
||||
obs_data_t *video_encoder_settings,
|
||||
obs_data_t *audio_encoder_settings);
|
||||
|
||||
/* TODO: more stuff later */
|
||||
};
|
||||
|
@@ -1341,11 +1341,12 @@ EXPORT const char *obs_service_get_password(const obs_service_t *service);
|
||||
/**
|
||||
* Applies service-specific video encoder settings.
|
||||
*
|
||||
* @param video_encoder Video encoder to apply settings to. Optional.
|
||||
* @param audio_encoder Audio encoder to apply settings to. Optional.
|
||||
* @param video_encoder_settings Video encoder settings. Optional.
|
||||
* @param audio_encoder_settings Audio encoder settings. Optional.
|
||||
*/
|
||||
EXPORT void obs_service_apply_encoder_settings(obs_service_t *service,
|
||||
obs_encoder_t *video_encoder, obs_encoder_t *audio_encoder);
|
||||
obs_data_t *video_encoder_settings,
|
||||
obs_data_t *audio_encoder_settings);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
Reference in New Issue
Block a user