(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:
jp9000
2015-03-07 16:32:00 -08:00
parent 56f4dd5359
commit b03eae57c6
5 changed files with 46 additions and 57 deletions

View File

@@ -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);
}