Have you looked at what makes virtualdub tick? I have used it as a capture app for quite some time and am amazed at the function and efficiency of it. If memory serves it is C++ and open source.