UI: Add front-end API functions to get/modify service

This commit adds functions to get, set and save the service and its
settings, and is plugged straight into the existing internal functions
serving this purpose

(Jim: Fixed commit message and missing newline at end of file)

Closes jp9000/obs-studio#895
This commit is contained in:
Palakis
2017-04-26 09:16:37 +02:00
committed by jp9000
parent 2e0d237341
commit 9f3bb4a13f
4 changed files with 43 additions and 0 deletions

View File

@@ -317,3 +317,22 @@ void obs_frontend_pop_ui_translation(void)
if (callbacks_valid())
c->obs_frontend_pop_ui_translation();
}
void obs_frontend_set_streaming_service(obs_service_t *service)
{
if (callbacks_valid())
c->obs_frontend_set_streaming_service(service);
}
obs_service_t* obs_frontend_get_streaming_service(void)
{
return !!callbacks_valid()
? c->obs_frontend_get_streaming_service()
: nullptr;
}
void obs_frontend_save_streaming_service(void)
{
if (callbacks_valid())
c->obs_frontend_save_streaming_service();
}

View File

@@ -137,6 +137,10 @@ EXPORT void obs_frontend_push_ui_translation(
obs_frontend_translate_ui_cb translate);
EXPORT void obs_frontend_pop_ui_translation(void);
EXPORT void obs_frontend_set_streaming_service(obs_service_t *service);
EXPORT obs_service_t* obs_frontend_get_streaming_service(void);
EXPORT void obs_frontend_save_streaming_service(void);
/* ------------------------------------------------------------------------- */
#ifdef __cplusplus

View File

@@ -70,6 +70,11 @@ struct obs_frontend_callbacks {
obs_frontend_translate_ui_cb translate)=0;
virtual void obs_frontend_pop_ui_translation(void)=0;
virtual void obs_frontend_set_streaming_service(
obs_service_t *service)=0;
virtual obs_service_t *obs_frontend_get_streaming_service(void)=0;
virtual void obs_frontend_save_streaming_service()=0;
virtual void on_load(obs_data_t *settings)=0;
virtual void on_save(obs_data_t *settings)=0;
virtual void on_event(enum obs_frontend_event event)=0;