Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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

C#
// Add the filter to the graph
                    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

C#
//add File writer
IBaseFilter pFilewriter2 = (IBaseFilter)new FileWriter();
hr = m_FilterGraph.AddFilter(pFilewriter2, "File writer");               
//set destination filename
IFileSinkFilter pFilewriter2_sink = pFilewriter2 as IFileSinkFilter;               
hr = pFilewriter2_sink.SetFileName("D:\\Test.avi", null);

//connect File writer
hr = m_FilterGraph.ConnectDirect(GetPin(ipsb, "Out"), GetPin(pFilewriter2, "in"), null);


and this is the GetPin method
C#
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;
}
Posted
Updated 21-Mar-19 2:59am
v2

Don't post this under Quick Answers - if you got the code from an article, then there is a "Add a Comment or Question" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.

If you got it from a different site, then you need to start there and ask them - we have no idea what the "GSSF sample" you mention is!
 
Share this answer
 
Comments
Nizar Belhiba 21-Mar-19 9:23am    
Sorry.. as I posted a tag "Directshow" I thought GSSF will be known.
I got the Sample from the DirectShow SDK

and Yes I've asked at DirectShow .NET, but a the same time here as well, as DirectShow.NET seems to be dead, there are only 3 posts over there from this year (two from me), all other are more than 1 year old.
 
Share this answer
 
Comments
Nizar Belhiba 21-Mar-19 9:32am    
thanks, I already have seen that post, but there isn't there much information (at least for me) on how to connect /add a new Filter.
Richard MacCutchan 21-Mar-19 9:46am    
Try posting your question there. You are much more likely to find help on the site that owns the software.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900