This is the server session interface exposed by the LEAD RTSP Sink filter. See the Creating an RTSP Server using the RTSP Sink topic for a general overview of how to use this interface.
This interface helps the ILMRTSPServerMedia interface build the response for the RTSP command and works together with the ILMRTSPServerMedia interface to stream data to the RTSP client.
The interface is implemented by the LEAD RTSP Sink filter when it acts as a sink in a convert or capture graph.
typedef enum
{
RTSPStream_Audio = 1,
RTSPStream_Video = 2,
RTSPStream_KLV = 0x20
} LMRTSPStreamType;
Lists the valid values for the pStreamType parameter that can be returned by the GetStreamType method.
Type |
Name |
Description |
long |
Timeout |
Specifies the timeout in seconds of inactivity after which the filter will call the ILMRTSPServerMedia::OnNotification method with the RTSPServerSessionNotification_Timeout notification. The ILMRTSPServerMedia interface usually sets this property when it creates this server session. The default value is 60 (for 60 seconds). |
BSTR |
SessionID |
Specifies the session ID associated with this server session. The ILMRTSPServerMedia interface must set this property when it creates this server session (possibly using the ILMRTSPServer::GenerateNewSessionID method). This value should be unique among all the server sessions created by all the ILMRTSPServerMedia objects. |
IUnknown * |
Parent |
Specifies which ILMRTSPServerMedia interface owns this session. The ILMRTSPServerMedia interface must set this property when it creates this server session. The server session uses this value to know which interface should handle the ILMRTSPServerMedia::OnNotification timeout notification. |
IUnknown * |
Security |
Specifies the security settings for this session. If NULL, this media has no security restrictions and will not use any authentication. The ILMRTSPServerMedia interface must set this property when it creates this server session. The default value is NULL (no authentication). Note that when you set the Security property to an interface, the property keeps the original interface. So if you make changes to it (like adding/removing users), the changes will be reflected in the security settings for this session. |
VARIANT_BOOL |
Output |
If set to VARIANT_TRUE, the RTP output will be enabled. If set to VARIANT_FALSE, the RTP output will be disabled. When performing multiple graph operations, this is useful to inhibit any RTP output until all the operations have completed. |
pServer |
Pointer to the ILMRTSPServer interface that has received this command. |
pCommandParser |
Pointer to the ILMRTSPCommandParser interface containing the command. |
pResponseBuilder |
Pointer to the ILMRTSPResponseBuilder interface that will contain the response. |
socket |
Pointer to the socket object that received the command. The same socket object will be used to send the response. |
The RTSP server will call ILMRTSPServerMedia::HandleCommand method when it receives an RTSP command from the client. The ILMRTSPServerMedia interface will do some processing and then call the server session's HandleCommand to assist in further processing and in preparing the response.
See ILMRTSPServerMedia::HandleCommand and the Creating an RTSP Server using the RTSP Sink topic for more information.
S_OK if successful, < 0 if an error occurred.
E_OUTOFMEMORY |
There is not enough memory to process this command. |
LTMM_E_BAD_COMMAND |
[0x80050043] The RTSP command is not recognized or not supported. |
LTMM_E_SESSION_NOT_FOUND |
The SessionID property was not set |
VFW_E_INVALID_MEDIA_TYPE |
[0x80040248] None of the media types for the source streams are supported by the RTSP Sink Filter. |
URL |
String containing the track ID whose stream type should be retrieved. |
pStreamType |
Pointer to a variable that should be filled with the stream type. |
Use this method when parsing an RTSP Setup command to find the stream type (RTSPStream_Audio or RTSPStream_Video).
The ILMRTSPServerMedia interface will typically call this method when it receives the RTSP setup command to know which stream to render the video or audio stream.
The response to DESCRIBE command will typically contain information like this:
[...] -- other data has been ignored
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=control:trackID=0
a=fmtp:96 packetization-mode=1; profile-level=874020; sprop-parameter-sets=Z00AHpcgFoe2AiAAAH0gAB1MEIA=,aO4NyAA===
m=audio 0 RTP/AVP 97
a=rtpmap:97 mpeg4-generic/48000/2
a=control:trackID=1
a=fmtp:97 streamType=2; mode=AAC-LC; config=1190
This indicates that the stream identified by "trackID=0" is video with H264 compression and that the stream identified by "trackID=1" is audio with AAC compression.
The RTSP client might respond with a SETUP command that looks like this:
SETUP rtsp://192.168.0.185/dvd.mpg/trackID=0 RTSP/1.0
[...] other data has been ignored
In this case, the ILMRTSPServerMedia interface has to determine from the URL received in the SETUP command "rtsp://192.168.0.185/dvd.mpg/trackID=0" that the RTSP client wishes to stream the video stream (because 'trackID=0' represents video with H264 compression in the DESCRIBE command). The ILMRTSPServerMedia interface can do so by parsing the original DESCRIBE command to determine this is the video stream or it can call the GetStreamType method of the ILMRTSPServerSession interface. The LEADTOOLS Multimedia implementation of the ILMRTSPServerMedia interface calls GetStreamType to determine the stream type.
Once the stream type is determined, the ILMRTSPServerMedia interface will then render the appropriate video or audio stream.
S_OK if successful, < 0 if an error occurred.
E_INVALIDARG |
The URL does not contain the correct track ID or is malformed. |
E_POINTER |
The pStreamType parameter is invalid (NULL). |
Use this to close all connections and stop sending data.
The ILMRTSPServerMedia interface will typically call this method when it wants the LEAD RTSP Sink filter to stop sending data. Possible reasons for calling this are:
The DESCRIBE command was received for this session
The server is shutting down
The server media is being removed from the server.
S_OK (this method does not currently return any error codes)
pServer |
Pointer to the ILMRTSPServer interface that has received this command. |
pCommandParser |
Pointer to the ILMRTSPCommandParser interface containing the command. |
pResponseBuilder |
Pointer to the ILMRTSPResponseBuilder interface that will contain the response. |
socket |
Pointer to the socket object that received the command. The same socket object will be used to send the response. |
The RTSP server will call ILMRTSPServerMedia::HandleCommand method when it receives an RTSP command from the client. The ILMRTSPServerMedia interface will do some processing and then call the server session's HandleCommand to assist in further processing and in preparing the response. If the client's security credentials need to be validated, before performing any processing the user can call HandleSecurity.
See the ILMRTSPServerMedia::HandleCommand and the Creating an RTSP Server using the RTSP Sink topics for more information.
S_OK if successful, < 0 if an error occurred.
LTMM_E_AUTHENTICATION_REQUIRED |
[0x8005004A] Authentication is required. |