libobs,docs: Add connect infos to the Services API

This replace and deprecate url, key, username and password functions.
This commit is contained in:
tytan652
2023-03-19 17:38:02 +01:00
parent 5fe417bce1
commit ea4ac2d08d
4 changed files with 75 additions and 4 deletions
+11
View File
@@ -501,3 +501,14 @@ const char *obs_service_get_preferred_output_type(const obs_service_t *service)
return service->info.get_output_type(service->context.data);
return NULL;
}
const char *obs_service_get_connect_info(const obs_service_t *service,
uint32_t type)
{
if (!obs_service_valid(service, "obs_service_get_info"))
return NULL;
if (!service->info.get_connect_info)
return NULL;
return service->info.get_connect_info(service->context.data, type);
}
+13
View File
@@ -33,6 +33,17 @@ struct obs_service_resolution {
int cy;
};
/* NOTE: Odd numbers are reserved for custom info from third-party protocols */
enum obs_service_connect_info {
OBS_SERVICE_CONNECT_INFO_SERVER_URL = 0,
OBS_SERVICE_CONNECT_INFO_STREAM_ID = 2,
OBS_SERVICE_CONNECT_INFO_STREAM_KEY =
2, // Alias of OBS_SERVICE_CONNECT_INFO_STREAM_ID
OBS_SERVICE_CONNECT_INFO_USERNAME = 4,
OBS_SERVICE_CONNECT_INFO_PASSWORD = 6,
OBS_SERVICE_CONNECT_INFO_ENCRYPT_PASSPHRASE = 8,
};
struct obs_service_info {
/* required */
const char *id;
@@ -93,6 +104,8 @@ struct obs_service_info {
const char *(*get_protocol)(void *data);
const char **(*get_supported_audio_codecs)(void *data);
const char *(*get_connect_info)(void *data, uint32_t type);
};
EXPORT void obs_register_service_s(const struct obs_service_info *info,
+11 -4
View File
@@ -2508,16 +2508,20 @@ EXPORT void obs_service_update(obs_service_t *service, obs_data_t *settings);
EXPORT obs_data_t *obs_service_get_settings(const obs_service_t *service);
/** Returns the URL for this service context */
EXPORT const char *obs_service_get_url(const obs_service_t *service);
OBS_DEPRECATED EXPORT const char *
obs_service_get_url(const obs_service_t *service);
/** Returns the stream key (if any) for this service context */
EXPORT const char *obs_service_get_key(const obs_service_t *service);
OBS_DEPRECATED EXPORT const char *
obs_service_get_key(const obs_service_t *service);
/** Returns the username (if any) for this service context */
EXPORT const char *obs_service_get_username(const obs_service_t *service);
OBS_DEPRECATED EXPORT const char *
obs_service_get_username(const obs_service_t *service);
/** Returns the password (if any) for this service context */
EXPORT const char *obs_service_get_password(const obs_service_t *service);
OBS_DEPRECATED EXPORT const char *
obs_service_get_password(const obs_service_t *service);
/**
* Applies service-specific video encoder settings.
@@ -2559,6 +2563,9 @@ EXPORT const char *obs_service_get_protocol(const obs_service_t *service);
EXPORT const char *
obs_service_get_preferred_output_type(const obs_service_t *service);
EXPORT const char *obs_service_get_connect_info(const obs_service_t *service,
uint32_t type);
/* ------------------------------------------------------------------------- */
/* Source frame allocation functions */
EXPORT void obs_source_frame_init(struct obs_source_frame *frame,