libobs: Add ability for service to specify its output type

Allows the ability to change the output type in case one service
requires a different output type.

NOTE: This should be considered a temporarily yet simple solution to a
specific problem: support for RTMP-like outputs.  This will allows
seamless integration of supporting different RTMP-like output types
within the same service.  This should probably be replaced with a more
ideal solution later, such as implementing a completely different
service type instead, when time permits.
master
jp9000 2017-07-12 23:41:06 -07:00
parent d839c77824
commit 24571599db
3 changed files with 16 additions and 0 deletions

View File

@ -393,3 +393,13 @@ const char *obs_service_get_id(const obs_service_t *service)
return obs_service_valid(service, "obs_service_get_id")
? service->info.id : NULL;
}
const char *obs_service_get_output_type(const obs_service_t *service)
{
if (!obs_service_valid(service, "obs_service_get_output_type"))
return NULL;
if (service->info.get_output_type)
return service->info.get_output_type(service->context.data);
return NULL;
}

View File

@ -72,6 +72,8 @@ struct obs_service_info {
void *type_data;
void (*free_type_data)(void *type_data);
const char *(*get_output_type)(void *data);
/* TODO: more stuff later */
};

View File

@ -1809,6 +1809,10 @@ EXPORT void *obs_service_get_type_data(obs_service_t *service);
EXPORT const char *obs_service_get_id(const obs_service_t *service);
/* NOTE: This function is temporary and should be removed/replaced at a later
* date. */
EXPORT const char *obs_service_get_output_type(const obs_service_t *service);
/* ------------------------------------------------------------------------- */
/* Source frame allocation functions */