Skip to content

Interface reference

This chapter is for applications that build their own DirectShow graphs. When the filters are used from the TVideoGrabber SDK, none of this is needed: see Using from TVideoGrabber.

CLSIDs

Filter CLSID
Datastead NDI Source {42CF8276-8A83-4516-B05C-6C0CAF698FF0}
Datastead NDI Sink {B3521313-F725-4694-AADD-6362B2C70060}

Interface IIDs

Interface IID
IDatasteadNDISource {EB569364-3E5B-4123-9C74-682055882E20}
IDatasteadNDISource2 {4646F216-28EF-48D0-9A67-7C5E4A1BDF2C}
IDatasteadNDISink {9EE6845C-C5D5-4E68-A003-05BB33A4BBFF}
IDatasteadNDISink2 {4E28ADD3-6D6A-48CE-9A46-503D9AE925AD}

All the methods return an HRESULT. The strings passed in are LPWSTR; the strings returned by Get... are allocated by the filter with CoTaskMemAlloc (or SysAllocString for the BSTR of GetNDISessionsList) and must be freed by the caller.


IDatasteadNDISource

Implemented by the NDI Source filter.

DECLARE_INTERFACE_(IDatasteadNDISource, IUnknown)
{
    HRESULT GetFilterVersion(LPWSTR* Value);
    HRESULT SetNDIName(LPWSTR Value);
    HRESULT GetNDIName(LPWSTR* Value);
    HRESULT SetNDIConnectionTimeoutMs(int Value);
    HRESULT GetNDIConnectionTimeoutMs(int* Value);
    HRESULT SetNDIBandwidthType(int Value);
    HRESULT GetNDIBandwidthType(int* Value);
    HRESULT GetNDISessionsList(bool AsXML, bool ReportURLInfo, BSTR* SessionList);
};

GetFilterVersion

Returns the version of the filter, as a string.

SetNDIName / GetNDIName

Name of the NDI source to receive. Accepts the full name COMPUTERNAME (STREAMNAME), the stream name alone (STREAMNAME), or a name starting with localhost, which is replaced by the name of the local computer. See NDI source names.

Call it before the output pins are connected and the graph is run.

SetNDIConnectionTimeoutMs / GetNDIConnectionTimeoutMs

Time, in milliseconds, allowed for finding the source on the network and receiving its first frames. Default: 2500.

SetNDIBandwidthType / GetNDIBandwidthType

Bandwidth requested from the sender: -10 metadata only, 10 audio only, 0 lowest (proxy stream), 100 highest (default).

GetNDISessionsList

Enumerates the NDI sources currently visible on the network. The discovery lasts up to the connection timeout.

  • AsXML = false: one source per line, as NAME or NAME|URL when ReportURLInfo is true,
  • AsXML = true: an XML document:
<?xml version="1.0" encoding="UTF-8" ?>
<Sessions>
   <Session>
      <Name>DESKTOP-5B66SBT (MYSTREAM)</Name>
      <URLInfo>192.168.1.20:5961</URLInfo>
   </Session>
</Sessions>

SessionList is NULL when no source was found.


IDatasteadNDISource2

Derives from IDatasteadNDISource and adds:

HRESULT EnableDisableStreams(bool VideoEnabled, bool AudioEnabled, bool DataEnabled);

Selects which streams are received and delivered. Disabling the audio when it is not needed makes the connection faster.


IDatasteadNDISink

Implemented by the NDI Sink filter.

DECLARE_INTERFACE_(IDatasteadNDISink, IUnknown)
{
    HRESULT GetFilterVersion(LPWSTR* Value);
    HRESULT SetNDIName(LPWSTR Value);
    HRESULT GetNDIName(LPWSTR* Value);
    HRESULT SetAvgTimePerFrame(int AvgTimePerFrame_100ns);
};

SetNDIName / GetNDIName

Name of the stream published on the network. NDI prepends the computer name, so MYSTREAM is published as COMPUTERNAME (MYSTREAM). Default: DATASTEAD_UNNAMED_SOURCE.

SetAvgTimePerFrame

Forces the frame rate announced to the receivers, in 100 ns units (400000 = 25 fps, 333333 = 30 fps). 0 (default) lets the filter take it from the connected media type, or measure it.


IDatasteadNDISink2

#define NDISINK2_SETTINGID_FORMATTYPE 1

DECLARE_INTERFACE_(IDatasteadNDISink2, IUnknown)
{
    HRESULT ConfigureSetting(int SettingId, int ConfigurationValue);
};

Generic settings entry point. The only setting defined today is NDISINK2_SETTINGID_FORMATTYPE (id 1), the frame format type announced in the NDI metadata: 0 interleaved, 1 progressive (default), 2 field 0, 3 field 1.


License key

In the licensed package, the license key is passed to the filter through SetNDIName, by prefixing it with lcs=:

pNDISink->SetNDIName(L"lcs=YOUR-LICENSE-KEY");   // activates the licensed mode
pNDISink->SetNDIName(L"MYSTREAM");               // then the real NDI name

The call that carries the key returns S_FALSE and does not change the NDI name; the key is verified when the graph is run. The same applies to the NDI Source filter. Without a valid key, the filter runs in evaluation mode and marks the video frames.