I want to add Compressor, Avi Muxer, and File Writer to my graph, at runtime. I`ve added an InfTee to my graph like this:
IBaseFilter sourceTee = (IBaseFilter)new InfTee();
graphBuilder.AddFilter(sourceTee, "Infinite Tee");
outPin = DsFindPin.ByDirection(theVideoDevice, PinDirection.Output, 0);
inPin = DsFindPin.ByDirection(sourceTee, PinDirection.Input, 0);
hr = graphBuilder.Connect(outPin, inPin);
But when I try to get output on a button click like the below code, I get an error.
private void button1_Click(object sender, EventArgs e)
{
IPin outPin, inPin;
int hr;
// Connect To Compressor
outPin = DsFindPin.ByDirection(Preview_Class.smartTeeFilter, PinDirection.Output ,1);
inPin = DsFindPin.ByDirection(Preview_Class.theVideoCompressor, PinDirection.Input, 0);
hr = Preview_Class.graphBuilder.Connect(outPin, inPin);
DsError.ThrowExceptionForHR(hr);
// etc
}
I must note that I am getting an output pin 0 for my video renderer at preview time, but I want to add recording feature by clicking a button.
Any help would be appreciated.