IFileSourceFilter Interface

This is a standard DirectShow interface. It is used by several filters, including the LEAD RTSP Source, LEAD MPEG2 Transport UDP Source, LEAD Windows Media Reader  and LEAD Elementary Stream Source Filter filters to specify parameters that control the filters' behavior.

Interface Methods:

HRESULT GetCurfile(LPOLESTR *ppszFileName, AM_MEDIA_TYPE *pmt);

Parameters

ppszFileName

A valid pointer to a pointer that will receive a copy of the URL string. This cannot be NULL.

pmt

A pointer to an AM_MEDIA_TYPE structure. This pointer is optional and you can pass NULL if you do not need the media type.

Description

Gets the current URL string. This string contains the IP address, the port and the network card address.

If the function succeeds, the ppszFileName pointer gets updated with a pointer to a buffer containing the URL. This buffer was allocated with CoTaskMemAlloc. You are responsible for freeing this buffer when you are done with it by calling CoTaskMemFree.

If the function succeeds and pmt is set to a valid pointer to AM_MEDIA_TYPE structure, this structure gets initialized with a copy of the stream media type. You are responsible for freeing the data allocated in this structure by calling the FreeMediaType function. Please refer to the Microsoft documentation for more information on this function.

Returns

S_OK if successful, < 0 if an error occurred.

Common error codes:

Value

Meaning

E_POINTER

ppszFilename is NULL

HRESULT Load(LPCOLESTR pszFileName, const AM_MEDIA_TYPE *pmt);

Parameters

pszFileName

A valid pointer to a buffer containing the filename or the URL of the stream. This cannot be NULL.

pmt

A pointer to an AM_MEDIA_TYPE structure indicating the media type of the data being streamed. This pointer can be NULL, in which case a default media type will be assumed.

Description

For the Elementary Source Filter, the pszFileName string points to a filename (absolute or relative).

For the Windows Media Reader, the pszFileName string can point to a filename or a URL.

For the RTSP Source or UDP Source, the pszFileName string points to the URL of the UDP, TCP or RTSP stream. This string specifies the following three items:

  1. IP address of the server sending the data

  2. (Optional) The UDP, TCP or RTSP port on which the data will be received. If no port is specified, 9005 will be used for UDP/TCP and 554 for RTSP.

  3. (Optional) The IP address of network card receiving the data. If no network card is specified, the default network connection will be used.

The format of the string for UDP streaming is as follows:

udp://ip_address[:udp_port][/network_card][?param1=val1[&param2=val2]...[&paramN=valN]] 

The format of the string for TCP streaming is as follows:

tcp://ip_address[:udp_port][?param1=val1[&param2=val2]...[&paramN=valN]] 

The format of the string for RTSP streaming is as follows:

rtsp://[username[:password]@]ip_address[:rtsp_port]/server_URL[?param1=val1[&param2=val2]...[&paramN=valN]] 

For more information about string syntax, refer to UDP Source URL syntax for UDP or TCP streaming, and RTSP Source URL syntax for RTSP streaming.

To determine the IP addresses of the network connections on your a computer running Windows XP, type the ipconfig command at the DOS prompt. For more information on obtaining your machine's host name, refer to How to Get Your Own IP Address Programmatically.

One might want to use a particular network card when the system has two network connections and one is faster than the other. For example, a laptop might be connected to the network with a wireless network card and a regular network wire. In this case, it would be better to use the wired connection because it is faster and more reliable.

Returns

S_OK if successful, < 0 if an error occurred.

Common error codes:

Value

Meaning

HRESULT_FROM_WIN32(WSAHOST_NOT_FOUND)

(0x80072AF9) The URL is invalid.

HRESULT_FROM_WIN32(WSAETIMEDOUT)

(0x8007274C) The URL might be valid, but the remote end is not sending data.

E_OUTOFMEMORY

(0x8007000E) Out of memory.

E_FAIL

(0x80004005) Unspecified error.

HRESULT_FROM_WIN32(xxx)

A Windows error xxx has occurred. Consult the Microsoft documentation for the definition of the HRESULT_FROM_WIN32 macro and the complete list of Windows error codes.

Help Version 20.0.2020.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Filters C API Help