HOW TO? Multiple connections to a capture minidriver


A

Anatoly Smelkov

Hello, everybody,

I have a task to share a single video stream among several user mode
applications at the same time. User mode apps can be written to use
DirectShow or VfW architecture -- I need both of those to work with the
shared video stream. Here's the approach I use. I have a user mode part
which captures the stream from a physical video stream source (web camera,
if it matters) then it transfers captured frames to a WDM stream minidriver.
The minidriver is installed as a virtual video capture source in the system
so other user mode applications can connect to it and capture the video
stream. This minidriver is a modified version of the Micrsoft's testcap
sample from the DDK. To support multiple connections (output pins) I set the
NumberOfPossibleInstances in the HW_STREAM_INFORMATION to a required number
(say 32). Then I made several more changes to support datastructures for
every stream instance and to track creation and closing of those instances.

After all this I came up with the following result: those applications that
use DirectShow for video capturing can connect to my driver and capture the
video stream with no problem. I can have several such applications (up to
NumberOfPossibleInstances value set for the stream) connected to the WDM
driver at the same time. BUT VfW applications now can't connect to the
driver at all! Not even a single instance can be created! As soon as I start
an old style app using VfW and try to select my virtual capture source as an
input source I end up with the error "Video device already in use" ("You
cannot use this device... close the application that is using it..." and all
that crap).

I would think that it's the way the VfW to WDM mapper works and there's no
solution to the problem, but I have a working driver (binary) that can do
the job. I looked at it's internals from a debugger and can see that it is
also a modified version of MS' testcap sample and it also increases the
NumberOfPossibleInstances parameter to get several connections to the same
output pin in the filter.

Could someone please advise, what can be the trick to make VfW applications
to work with the WDM driver which servs more than one instance of a single
stream? I've been trying to figure out the answer for several weeks and I'm
starting to feel a bit suicidal now. Any advise will be highly appreciated.

Thanks in advance,
Anatoly Smelkov
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top