This topic describes how to set global and local parameters.
Global parameters
You cannot set global parameters for a specific instance. When you set global parameters, make sure that no instance is running. You cannot set these parameters when you call the open or close function. For more information about how to configure the message callback function and log callback function, see the rtsdec.c file in Native RTS SDK.
__rts_funcs->preconfig("LogCallback", addr_to_string(output_log, buf));
__rts_funcs->preconfig("LogCbParam", addr_to_string(s, buf));
__rts_funcs->preconfig("MessageCallback", addr_to_string(format_control_message, buf));
__rts_funcs->preconfig("MessageCbParam", addr_to_string(s, buf));
...
__rts_funcs->open(...);
// Do not call the preconfig function during this period.
__rts_funcs->close(...);
// The preconfig function can be called.
Local parameters
Local parameters are specific to instances. When you set a local parameter for an instance, make sure that the instance is running. You must set these parameters when you call the open or close function. The function that you call when you set a local parameter allows you to call API operations and obtain parameters. Function declaration:
long long (* ioctl)(void *handle, const char *cmd, void *arg);
Parameter description
Parameter | Type | Description |
---|---|---|
handle | void * | The handle that is obtained during streaming. |
cmd | char * | The command. For more information, see the following table. |
arg | void * | The parameters corresponding to the command. |
Command | Description | Parameter | Return value |
---|---|---|---|
get_stream_info | Obtains a stream parameter. | N/A | The pointer rts_worker_demux_info* of the stream parameter. |
reload | Reconnects a stream to the server. | N/A | If 0 is returned, the call is successful. If a value less than 0 is returned, the call fails. |
get_state | Queries a key-value pair. | ARTC_VIDEO_CACHE_SIZE, which specifies the duration of loading videos. Type: int*. | The duration of loading videos. Unit: milliseconds. |
set_aes_key | Configures a decryption key. | keyinfo. Type: char*. | If 0 is returned, the call is successful. If a value less than 0 is returned, the call fails. |
unsubscribe | Stops subscribing to a stream. | N/A | If 0 is returned, the call is successful. If a value less than 0 is returned, the call fails. |
subscribe | Subscribes to a stream. | URL. Type: char*. | If 0 is returned, the call is successful. If a value less than 0 is returned, the call fails. |