I have a DirectShow graph, contains file source filter, splitter filter, decoders for video and audio and renderers. (The data is possibly encrypted, so the splitter just split it to video and audion and the decoders actually decrypts the data).
Now, I want to change the graph to work with live streams instead of files as source. Is there a free (preferred open source) such source filter?
Thank you.
If by live streams you mean Windows Media over HTTP, you could try this:
First define a GUID for CLSID_NetShowSource, something like
#include <initguid.h>
DEFINE_GUID(CLSID_NetShowSource,
0x6b6d0800, 0x9ada, 0x11d0, 0xa5, 0x20, 0x0, 0xa0, 0xd1, 0x1, 0x29, 0xc0);
Then you can use it as follows:
IBaseFilter* wmsrc;
//create a basefilter instance from the GUID
hr = CoCreateInstance(CLSID_NetShowSource, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (void**)&wmsrc);
if(!FAILED(hr))
{
IFileSourceFilter* fsf;
//get us a file source filter, this can read from urls
wmsrc->QueryInterface(IID_IFileSourceFilter, (void**)&fsf);
if(fsf)
{
//wFilename is a widechar string containing the stream url
hr = fsf->Load(wFilename, NULL);
if(!FAILED(hr))
{
//at this point you can do as you wish with the filter
}
}
}
It's been a while since I implemented this, I hope it's helpful. I'm pretty sure this snippet is missing some error checking.