The IDatasteadRtspSourceConfig
interface declarations are located in the package under the following
folders:
C#
Include\C#\DatasteadRTSPSourceFilter.cs
VB.NET
Include\C#\DatasteadRTSPSourceFilter.vb
C++
Include\C++\DatasteadRTSPSourceFilter.h
Delphi
Include\Dephi\DatasteadRTSPSourceFilter.pas
The IDatasteadRtspSourceConfig interface lets configure the filter at initialization time, as well as apply realtime actions, like pausing the recording, resuming the recording, generating a new file name on the fly, etc...
The initalization settings:
- can be set by invoking SetStr(), SetInt(), SetBool(), SetDouble()
- can be retrieved by invoking GetStr(), getInt(), GetBool(), GetDouble()
The actions can be applied by invoking Action()
- add the "Datastead RTSP/RTMP DirectShow Source" filter to the graph,
- query the IDatasteadRtspSourceConfig interface,
- configure the optional parameters, if needed, and then at last invoke .Action(RTSP_Action_OpenURL, "rtsp://...") to load the URL according to the parameters previously set, e.g.:
DatasteadRtspSourceConfig.SetStr
(RTSP_Source_AuthUser_str, "root");
DatasteadRtspSourceConfig.SetStr
(RTSP_Source_AuthPassword_str, "admin");
DatasteadRtspSourceConfig.SetInt (RTSP_Source_RTSPTransport_int, 4); // 4 = UDP multicast, see next page
DatasteadRtspSourceConfig.SetBool(RTSP_Source_AutoReconnect_bool, false);
DatasteadRtspSourceConfig.SetStr (RTSP_Source_RecordingFileName_str, "c:\\folder\\camerarec.mp4");
DatasteadRtspSourceConfig.Action (RTSP_Action_OpenURL, "rtsp://192.168.0.25/axis-media/media.amp?videocodec=h264&audio=1");
Then, once the graph is started, e.g. to pause the recording after a few minutes:
DatasteadRtspSourceConfig.Action (RTSP_Action_PauseRecording, "");
and then later, e.g.:
DatasteadRtspSourceConfig.Action (RTSP_Action_ResumeRecording, "");
Note: the type of the parameter is included at the end of the name as a reminder. The function invoked must match the parameter type, otherwise the function will return E_INVALIDARG. E.g.:
int BufferDuration;
if (DatasteadRtspSourceConfig.GetInt (RTSP_Source_BufferDuration_int, &BufferDuration) == S_OK) {
// got the BufferDuration value
}
DatasteadRtspSourceConfig.SetStr (RTSP_Source_AuthUser_str, "admin");
DatasteadRtspSourceConfig.SetStr (RTSP_Source_AuthPassword_str, "pass");
wchar_t *RtspUrl = L"rtsp://192.168.1.32/axis-media/media.amp?videocodec=h264";
DatasteadRtspSourceConfig.Action (RTSP_Action_OpenURL, RtspUrl);
Although the string pointer returned by GetStr() is valid as long as the filter exists, we recommend to make copy of the string returned immediately after invoking GetStr(), to prevent any use of this string pointer after the filter has been released.
To generate a new file name during the recording, invoke, e.g.:
DatasteadRtspSourceConfig.Action(RTSP_Action_RecordToNewFileNow, "c:\folder\newfilename3.mp4");
To pause the recording, pass a "nul" file name with the same extenstion:
DatasteadRtspSourceConfig.Action(RTSP_Action_RecordToNewFileNow, "nul.mp4");
Invoke:
DatasteadRtspSourceConfig.Action(RTSP_Action_Pause_URL, "");
Invoke:
DatasteadRtspSourceConfig.Action(RTSP_Action_Resume_URL, "");