This chapter contains a description of all NetX Duo RTSP server services (listed below) in alphabetic order.
Note
|
In the Return Values section in the following API descriptions, values in BOLD are not affected by the NX_DISABLE_ERROR_CHECKING define that is used to disable API error checking, while non-bold values are completely disabled. |
Create an RTSP server instance
UINT nx_rtsp_server_create(
NX_RTSP_SERVER *rtsp_server_ptr,
CHAR *server_name,
UINT server_name_length,
NX_IP *ip_ptr,
NX_PACKET_POOL *rtsp_packet_pool,
VOID *stack_ptr,
ULONG stack_size,
UINT priority,
UINT server_port,
UINT (*disconnect_callback)(NX_RTSP_CLIENT *rtsp_client_ptr))
-
rtsp_server_ptr: Pointer to RTSP server.
-
server_name: Name of RTSP server.
-
server_name_length: Length of RTSP server name.
-
ip_ptr: Pointer to the created IP instance.
-
rtsp_packet_pool: Pointer to RTSP packet pool.
-
stack_ptr: RTSP server thread’s stack pointer.
-
stack_size: RTSP server thread’s stack size.
-
priority: Priority of RTSP server thread.
-
server_port: RTSP server’s listening port.
-
disconnect_callback: Pointer to disconnect callback function. This function is called when an RTSP client disconnects from the server.
-
NX_SUCCESS (0x00) Successful RTSP server creation.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
/* Create the RTSP Server instance "rtsp_0". */
status = nx_rtsp_server_create(&rtsp_0, "RTSP Server",
sizeof("RTSP Server") - 1, ip_ptr, pool_ptr,
rtsp_server_stack, DEMO_RTSP_SERVER_STACK_SIZE,
3, 554, rtsp_disconnect_callback);
/* If status is NX_SUCCESS an RTSP server instance was successfully created. */
Delete an RTSP server instance
-
NX_SUCCESS (0x00) Successful RTSP server deletion.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Set the callback function for DESCRIBE request
UINT nx_rtsp_server_describe_callback_set(
NX_RTSP_SERVER *rtsp_server_ptr,
UINT (*callback)(
NX_RTSP_CLIENT *rtsp_client_ptr,
UCHAR *uri,
UINT uri_length));
This service sets callback function for DESCRIBE request. This callback function is called when an RTSP client sends a DESCRIBE request to the server. nx_rtsp_server_sdp_set should be called in the callback function to set the SDP information for the DESCRIBE response.
-
rtsp_server_ptr: Pointer to RTSP server.
-
callback: Pointer to DESCRIBE request callback function. If the URI is valid and the SDP string is set successfully, this function should return NX_SUCCESS. Otherwise, this function should return another status. In addition, nx_rtsp_server_error_response_send can be called to send the specified error status code. The parameters of this callback function are:
-
rtsp_client_ptr: Pointer to RTSP client.
-
uri: Pointer to the URI of DESCRIBE request.
-
uri_length: Length of the URI of DESCRIBE request.
-
-
NX_SUCCESS (0x00) Successful DESCRIBE request callback function set.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Send the error response packet
UINT nx_rtsp_server_error_response_send(
NX_RTSP_CLIENT *rtsp_client_ptr,
UINT status_code);
-
rtsp_client_ptr: Pointer to RTSP client.
-
status_code: Status code of the error response.
-
NX_SUCCESS (0x00) Successful error response sending.
-
NX_RTSP_SERVER_NO_PACKET (0x7003) No response packet available.
-
NX_RTSP_SERVER_INVALID_PARAMETER (0x7007) Invalid status code.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Update the keep-alive timer
This service updates the keep-alive timer. If RTP is used for media transport, the keep-alive timer is updated when an RTCP packet is received.
Set the callback function for PAUSE request
UINT nx_rtsp_server_pause_callback_set(
NX_RTSP_SERVER *rtsp_server_ptr,
UINT (*callback)(
NX_RTSP_CLIENT *rtsp_client_ptr,
UCHAR *uri,
UINT uri_length,
UCHAR *range_ptr,
UINT range_length));
This service sets callback function for PAUSE request. This callback function is called when an RTSP client sends a PAUSE request to the server. nx_rtsp_server_range_npt_set can be called in the callback function to set the NPT range for the PAUSE response.
-
rtsp_server_ptr: Pointer to RTSP server.
-
callback: Pointer to PAUSE request callback function. If the URI is valid and the stream delivery can be paused, this function should return NX_SUCCESS. Otherwise, this function should return another status. In addition, nx_rtsp_server_error_response_send can be called to send the specified error status code. The parameters of this callback function are:
-
rtsp_client_ptr: Pointer to RTSP client.
-
uri: Pointer to the URI of PAUSE request.
-
uri_length: Length of the URI of PAUSE request.
-
range_ptr: Pointer to the Range field of PAUSE request.
-
range_length: Length of the Range field of PAUSE request.
-
-
NX_SUCCESS (0x00) Successful PAUSE request callback function set.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Set the callback function for PLAY request
UINT nx_rtsp_server_play_callback_set(
NX_RTSP_SERVER *rtsp_server_ptr,
UINT (*callback)(
NX_RTSP_CLIENT *rtsp_client_ptr,
UCHAR *uri,
UINT uri_length,
UCHAR *range_ptr,
UINT range_length));
This service sets callback function for PLAY request. This callback function is called when an RTSP client sends a PLAY request to the server. nx_rtsp_server_range_npt_set can be called in the callback function to set the NPT range for the PLAY response. nx_rtsp_server_rtp_info_set must be called in the callback function to set the RTP-Info header for the PLAY response.
-
rtsp_server_ptr: Pointer to RTSP server.
-
callback: Pointer to PLAY request callback function. If the URI is valid and the stream delivery can be started, this function should return NX_SUCCESS. Otherwise, this function should return another status. In addition, nx_rtsp_server_error_response_send can be called to send the specified error status code. The parameters of this callback function are:
-
rtsp_client_ptr: Pointer to RTSP client.
-
uri: Pointer to the URI of PLAY request.
-
uri_length: Length of the URI of PLAY request.
-
range_ptr: Pointer to the Range field of PLAY request.
-
range_length: Length of the Range field of PLAY request.
-
-
NX_SUCCESS (0x00) Successful PLAY request callback function set.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Set the NPT start and end time
UINT nx_rtsp_server_range_npt_set(
NX_RTSP_CLIENT *rtsp_client_ptr
UINT npt_start,
UINT npt_end);
This service sets the NPT start and end time in Range field. This function can only be called in PLAY and PAUSE request callback functions.
-
rtsp_client_ptr: Pointer to RTSP client.
-
npt_start: The NPT start time in milliseconds.
-
npt_end: The NPT end time in milliseconds.
-
NX_SUCCESS (0x00) Successful NPT start and end time set.
-
NX_RTSP_SERVER_INVALID_REQUEST (0x7006) Called by invalid request callback.
-
NX_RTSP_SERVER_INVALID_PARAMETER (0x7007) Invalid parameter that npt_end is less than npt_start.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Set the RTP-Info to the response packet
UINT nx_rtsp_server_rtp_info_set(
NX_RTSP_CLIENT *rtsp_client_ptr
UCHAR *track_id,
UINT track_id_len,
UINT rtp_seq,
UINT rtp_time);
This service sets the RTP-Info to the response packet. This function can only be called in PLAY callback function.
-
rtsp_client_ptr: Pointer to RTSP client.
-
track_id: Pointer to track ID, which is the ID of the resource.
-
track_id_len: The length of track ID.
-
rtp_seq: The RTP sequence number.
-
rtp_time: The RTP timestamp.
-
NX_SUCCESS (0x00) Successful RTP-Info set.
-
NX_RTSP_SERVER_NO_PACKET (0x7003) No response packet available.
-
NX_RTSP_SERVER_INVALID_REQUEST (0x7006) Called by invalid request callback.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Set the SDP string to the response packet
UINT nx_rtsp_server_sdp_set(
NX_RTSP_CLIENT *rtsp_client_ptr
UCHAR *sdp_string,
UINT sdp_length);
This service sets the SDP string to the response packet. This function can only be called in DESCRIBE callback function.
-
rtsp_client_ptr: Pointer to RTSP client.
-
sdp_string: Pointer to SDP string.
-
sdp_length: The length of SDP string.
-
NX_SUCCESS (0x00) Successful SDP string set.
-
NX_RTSP_SERVER_NO_PACKET (0x7003) No response packet available.
-
NX_RTSP_SERVER_INVALID_REQUEST (0x7006) Called by invalid request callback.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Set the callback function for SETUP request
UINT nx_rtsp_server_setup_callback_set(
NX_RTSP_SERVER *rtsp_server_ptr,
UINT (*callback)(
NX_RTSP_CLIENT *rtsp_client_ptr,
UCHAR *uri,
UINT uri_length,
NX_RTSP_TRANSPORT *transport_ptr));
This service sets callback function for SETUP request. This callback function is called when an RTSP client sends a SETUP request to the server. The client transport information is passed to the callback function. And the callback function must set the server transport information back.
-
rtsp_server_ptr: Pointer to RTSP server.
-
callback: Pointer to SETUP request callback function. If the URI is valid and the transport information can be resolved and set successfully, this function should return NX_SUCCESS. Otherwise, this function should return another status. In addition, nx_rtsp_server_error_response_send can be called to send the specified error status code. The parameters of this callback function are:
-
rtsp_client_ptr: Pointer to RTSP client.
-
uri: Pointer to URI of SETUP request.
-
uri_length: The length of URI of SETUP request.
-
transport_ptr: Pointer to transport information. This parameter is an input and output parameter. The client transport information is passed through this parameter, and the server transport information must be set back to this parameter. The client transport information includes the transport protocol (UDP/TCP), transport mode (unicast/multicast), client IP address, and the client RTP/RTCP port pair. The server transport information includes the RTP SSRC, server IP address, and the server RTP/RTCP port pair. If using multicast mode with server choosing the multicast address, the client multicast address, ports, and TTL must also be set back to this parameter.
-
-
NX_SUCCESS (0x00) Successful SETUP request callback function set.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Set the callback function for SET_PARAMETER request
UINT nx_rtsp_server_set_parameter_callback_set(
NX_RTSP_SERVER *rtsp_server_ptr,
UINT (*callback)(
NX_RTSP_CLIENT *rtsp_client_ptr,
UCHAR *uri,
UINT uri_length,
UCHAR *parameter_ptr,
ULONG parameter_length));
This service sets callback function for SET_PARAMETER request. This callback function is called when an RTSP client sends a SET_PARAMETER request to the server. The parameters which the client requests to update are passed to the callback function.
-
rtsp_server_ptr: Pointer to RTSP server.
-
callback: Pointer to SET_PARAMETER request callback function. If the URI is valid and the parameters can be updated successfully, this function should return NX_SUCCESS. Otherwise, this function should return another status. In addition, nx_rtsp_server_error_response_send can be called to send the specified error status code. The parameters of this callback function are:
-
rtsp_client_ptr: Pointer to RTSP client.
-
uri: Pointer to URI of SET_PARAMETER request.
-
uri_length: The length of URI of SET_PARAMETER request.
-
parameter_ptr: Pointer to parameter of SET_PARAMETER request.
-
parameter_length: The length of parameter of SET_PARAMETER request.
-
-
NX_SUCCESS (0x00) Successful SET_PARAMETER request callback function set.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Start the RTSP server
This service starts the RTSP server. This function must be called after the RTSP server is created.
-
NX_SUCCESS (0x00) Successful RTSP server start.
-
NX_RTSP_SERVER_ALREADY_STARTED (0x7003) RTSP server already started.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Stop the RTSP server
-
NX_SUCCESS (0x00) Successful RTSP Server stop.
-
NX_RTSP_SERVER_NOT_STARTED (0x7003) RTSP server not started.
-
NX_PTR_ERROR (0x07) Invalid pointer input.
Set the callback function for TEARDOWN request
UINT nx_rtsp_server_teardown_callback_set(
NX_RTSP_SERVER *rtsp_server_ptr,
UINT (*callback)(
NX_RTSP_CLIENT *rtsp_client_ptr,
UCHAR *uri,
UINT uri_length));
This service sets callback function for TEARDOWN request. This callback function is called when an RTSP client sends a TEARDOWN request to the server. The transport sessions should be closed in this callback function.
-
rtsp_server_ptr: Pointer to RTSP server.
-
callback: Pointer to TEARDOWN request callback function. If the URI is valid and the transport session can be closed successfully, this function should return NX_SUCCESS. Otherwise, this function should return another status. In addition, nx_rtsp_server_error_response_send can be called to send the specified error status code. The parameters of this callback function are:
-
rtsp_client_ptr: Pointer to RTSP client.
-
uri: Pointer to URI of TEARDOWN request.
-
uri_length: The length of URI of TEARDOWN request.
-
-
NX_SUCCESS (0x00) Successful TEARDOWN request callback function set.
-
NX_PTR_ERROR (0x07) Invalid pointer input.