Reputation: 11
I used directshow.net
with my web-cam and it worked so well. But when I closed the form and opened it again, it gives me an error in the method SetupGraph()
because the value that come from the next code line is negative.
hr = capGraph.RenderStream(ref cat, ref med, capFilter, null, null);
but when I unplugged my camera, it works good the second time.
I hope it's not a big deal.
Upvotes: 1
Views: 1397
Reputation: 9338
You can try to call yourMediaControl.StopWhenReady()
method and after that release all com object instances like graph
, source
, grabber
, capture graph
with Marshal.ReleaseComObject.
The IMediaControl.StopWhenReady method pauses the filter graph, allowing filters to queue data, and then stops the filter graph.
Main thing is that each time you start webcam video you need to do all this:
Upvotes: 1