Hi,
as I mentioned in the title I would like to add a File Writer into the graph of the GSSF Sample, instead of rendering it.
Actually What I really try to accomplish is, to add a second file Source Filter, then connect the GSSF and File source filter to an AVI Mux and finally to a File Writer.
GSSF+File Source -> AVI MUX -> File Writer.
But the first step alone would help a lot.
My goal is to create a video with 2 sources:
1- a capture of my desktop 2- another video (already recorded with a cam) also the 2 sources must be synchronous
I already created a Graph with 2 Video Sources etc.. but I couldn't find out how to delay one of the sources. I need that the File source 1 just start a few milliseconds later than the second file source.
What I have tried:
regarding adding a File Writer to the graph sample in GSSF I tried the following:
after the code
hr = m_FilterGraph.AddFilter(ipsb, "GenericSampleSourceFilter");
Marshal.ThrowExceptionForHR( hr );
I tried to add a File Writer Filter and connect it to the GSSF, but without result
IBaseFilter pFilewriter2 = (IBaseFilter)new FileWriter();
hr = m_FilterGraph.AddFilter(pFilewriter2, "File writer");
IFileSinkFilter pFilewriter2_sink = pFilewriter2 as IFileSinkFilter;
hr = pFilewriter2_sink.SetFileName("D:\\Test.avi", null);
hr = m_FilterGraph.ConnectDirect(GetPin(ipsb, "Out"), GetPin(pFilewriter2, "in"), null);
and this is the GetPin method
private IPin GetPin(IBaseFilter filter, string pinname)
{
IEnumPins epins;
int hr = filter.EnumPins(out epins);
IntPtr fetched = Marshal.AllocCoTaskMem(4);
IPin[] pins = new IPin[1];
while (epins.Next(1, pins, fetched) == 0)
{
PinInfo pinfo;
pins[0].QueryPinInfo(out pinfo);
bool found = ((pinfo.name == pinname) || (pinfo.name.Contains(pinname)));
DsUtils.FreePinInfo(pinfo);
if (found) return pins[0];
}
return null;
}