mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-07-14 23:34:08 +00:00
libobs,docs: Add connect infos to the Services API
This replace and deprecate url, key, username and password functions.
This commit is contained in:
parent
5fe417bce1
commit
ea4ac2d08d
|
@ -161,6 +161,28 @@ Service Definition Structure
|
|||
|
||||
:return: The protocol used by the service
|
||||
|
||||
.. member:: const char *(*obs_service_info.get_connect_info)(void *data, uint32_t type)
|
||||
|
||||
Output a service connection info related to a given type value:
|
||||
|
||||
- **OBS_SERVICE_CONNECT_INFO_SERVER_URL** - Server URL (0)
|
||||
|
||||
- **OBS_SERVICE_CONNECT_INFO_STREAM_ID** - Stream ID (2)
|
||||
|
||||
- **OBS_SERVICE_CONNECT_INFO_STREAM_KEY** - Stream key (alias of **OBS_SERVICE_CONNECT_INFO_STREAM_ID**)
|
||||
|
||||
- **OBS_SERVICE_CONNECT_INFO_USERNAME** - Username (4)
|
||||
|
||||
- **OBS_SERVICE_CONNECT_INFO_PASSWORD** - Password (6)
|
||||
|
||||
- **OBS_SERVICE_CONNECT_INFO_ENCRYPT_PASSPHRASE** - Encryption passphrase (8)
|
||||
|
||||
- Odd values as types are reserved for third-party protocols
|
||||
|
||||
Depending on the protocol, the service will have to provide information
|
||||
to the output to be able to connect.
|
||||
|
||||
Irrelevant or unused types can return `NULL`.
|
||||
|
||||
General Service Functions
|
||||
-------------------------
|
||||
|
@ -283,24 +305,36 @@ General Service Functions
|
|||
|
||||
:return: The URL currently used for this service
|
||||
|
||||
.. deprecated:: 29.1.0
|
||||
Use :c:func:`obs_service_get_connect_info()` instead.
|
||||
|
||||
---------------------
|
||||
|
||||
.. function:: const char *obs_service_get_key(const obs_service_t *service)
|
||||
|
||||
:return: Stream key (if any) currently used for this service
|
||||
|
||||
.. deprecated:: 29.1.0
|
||||
Use :c:func:`obs_service_get_connect_info()` instead.
|
||||
|
||||
---------------------
|
||||
|
||||
.. function:: const char *obs_service_get_username(const obs_service_t *service)
|
||||
|
||||
:return: User name (if any) currently used for this service
|
||||
|
||||
.. deprecated:: 29.1.0
|
||||
Use :c:func:`obs_service_get_connect_info()` instead.
|
||||
|
||||
---------------------
|
||||
|
||||
.. function:: const char *obs_service_get_password(const obs_service_t *service)
|
||||
|
||||
:return: Password (if any) currently used for this service
|
||||
|
||||
.. deprecated:: 29.1.0
|
||||
Use :c:func:`obs_service_get_connect_info()` instead.
|
||||
|
||||
---------------------
|
||||
|
||||
.. function:: void obs_service_apply_encoder_settings(obs_service_t *service, obs_data_t *video_encoder_settings, obs_data_t *audio_encoder_settings)
|
||||
|
@ -338,6 +372,12 @@ General Service Functions
|
|||
|
||||
:return: The output type that should be preferred with this service
|
||||
|
||||
.. function:: const char *obs_service_get_connect_info(const obs_service_t *service, uint32_t type)
|
||||
|
||||
:param type: Check :c:member:`obs_service_info.get_connect_info` for
|
||||
type values.
|
||||
:return: Connection info related to the type value.
|
||||
|
||||
.. ---------------------------------------------------------------------------
|
||||
|
||||
.. _libobs/obs-service.h: https://github.com/obsproject/obs-studio/blob/master/libobs/obs-service.h
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
15
libobs/obs.h
15
libobs/obs.h
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue