I want to capture a stream (from S-Video) and save the stream to a file, and at the same time view the stream in a player and be able to rewind and play the stream at any position so far recorded.

I would like to include the functionality in my own (commercial) program so It would be nice if I could do this with c# or c++.

What programs/API should I use?