This interface is used for parsing the RTSP command received by the RTSP Server. The interface is created by the LEAD RTSP Sink filter and passed to the ILMRTSPServerMedia::HandleCommand method whenever an RTSP command is received from the RTSP client.
You are expected to parse and interpret the RTSP command using this the helper functions in this interface and build a response into the ILMRTSPResponseBuilder interface.
typedef enum
{
RTSP_UNKNOWN = -1,
RTSP_DESCRIBE = 0,
RTSP_SETUP,
RTSP_PLAY,
RTSP_PAUSE,
RTSP_TEARDOWN,
RTSP_OPTIONS,
RTSP_ANNOUNCE,
RTSP_RECORD,
RTSP_REDIRECT,
RTSP_GET_PARAMETER,
RTSP_SET_PARAMETER,
} LMRTSPCommandType;
Lists the possible RTSP command types returned by the GetCommandType method.
pCommandString |
Pointer to a variable that will receive the command as a string. It can be NULL if the command string is not desired. |
pCommand |
Pointer to a variable that will receive the command as an enumeration value. It can be NULL if this information is not desired. |
This method will parse the RTSP command and will extract only the command component. You can get the command as a string or as a enumeration value.
For example, if the RTSP command was like this:
SETUP rtsp://192.168.0.185/subfolder/dvd.mpg/trackID=0 RTSP/1.0
CSeq: 2
Transport: RTP/AVP;unicast;client_port=1024-1025
User-Agent: LEAD RTSP Source
This method would return "SETUP" for pCommandString and RTSP_SETUP for pCommand.
Note that either parameter can be NULL, but at least one of the parameters must be not NULL.
The string returned in pCommandString has been allocated with the Win32 API SysAllocString, so you must free it using SysFreeString.
S_OK if successful, < 0 if an error occurred.
E_OUTOFMEMORY |
Out of memory |
E_POINTER |
Both pCommandString and pCommand are NULL |
pURL |
Pointer to a variable that will receive the full URL as a string. |
This method will parse the RTSP command and will extract the URL as a full path.
For example, for the DESCRIBE command shown in the GetCommandType method, this method would set pURL to "rtsp://192.168.0.185/subfolder/dvd.mpg/trackID=0".
The string returned in pURL has been allocated with the Win32 API SysAllocString, so you must free it using SysFreeString.
S_OK if successful, < 0 if an error occurred.
E_OUTOFMEMORY |
Out of memory |
E_POINTER |
pURL is NULL |
pURL |
Pointer to a variable that will receive the relative URL as a string. |
This method will parse the RTSP command and will extract the URL as a relative path. It will also discard any trailing "/trackID=" portions of the URL.
For example, for the DESCRIBE command shown in the GetCommandType method, this method would set pURL to "subfolder/dvd.mpg".
The string returned in pURL has been allocated with the Win32 API SysAllocString, so you must free it using SysFreeString.
S_OK if successful, < 0 if an error occurred.
E_OUTOFMEMORY |
Out of memory |
E_POINTER |
pURL is NULL |
pParameters |
Pointer to a variable that will receive the command parameters as a string. |
This method will parse the RTSP command and will extract all the command parameters as one big string.
The string returned in pParameters has been allocated with the Win32 API SysAllocString, so you must free it using SysFreeString.
For example, for the following command:
PLAY rtsp://192.168.0.185/dvr/capture.lbl RTSP/1.0
CSeq: 3
Range: npt=39.036-
User-Agent: LEAD RTSP Source
Session: 235950607
This method would set pParameters to:
CSeq: 3
Range: npt=39.036-
User-Agent: LEAD RTSP Source
Session: 235950607
In particular, you are supposed to pay attention to the "Range: npt=39.036-" parameter, which tells you that the RTSP client wants to start streaming 39.036s from the start of the media.
S_OK if successful, < 0 if an error occurred.
E_OUTOFMEMORY |
Out of memory |
E_POINTER |
pParameters is NULL |
pSessionID |
Pointer to a variable that will receive the session ID as a string. |
This method will parse the RTSP command and will extract the session ID.
The string returned in pSessionID has been allocated with the Win32 API SysAllocString, so you must free it using SysFreeString.
For example, in the command shown above for GetCommandParameters, this method would set pSessionID to "235950607".
S_OK if successful, < 0 if an error occurred.
E_OUTOFMEMORY |
Out of memory |
E_POINTER |
pSessionID is NULL |
pFullCommand |
Pointer to a variable that will receive the full command as a string. |
This method retrieve the full RTSP command as one big string.
The string returned in pFullCommand has been allocated with the Win32 API SysAllocString, so you must free it using SysFreeString.
For example, in the command shown above for GetCommandParameters, this method would set pFullCommand to:
PLAY rtsp://192.168.0.185/dvr/capture.lbl RTSP/1.0
CSeq: 3
Range: npt=39.036-
User-Agent: LEAD RTSP Source
Session: 235950607
The end of line is marked with <CR><LF> (hex values 0x0D 0x0A).
S_OK if successful, < 0 if an error occurred.
E_OUTOFMEMORY |
Out of memory |
E_POINTER |
pFullCommand is NULL |
pNetworkCardAddress |
Optional pointer to a variable that will be updated with the network card address in network byte order. It can be NULL if this information is not needed. |
pServerAddress |
Optional pointer to a variable that will be updated with the server address in network byte order. It can be NULL if this information is not needed. |
pClientAddress |
Optional pointer to a variable that will be updated with the client address in network byte order. It can be NULL if this information is not needed. |
This method retrieves the server and client addresses in network byte order.
For example, if the server is at 192.168.0.185 and a client connects from 192.168.0.219, pServerAddress will be set to 0xb900a8c0 and pClientAddress will be set to 0xdb00a8c0.
You can use this method to find out who is connecting to you. In particular, you can use this to implement your own security and restrict access to clients from some addresses.
S_OK (the function never fails).