Multiple connections to a capture minidriver



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
shared video stream. Here's the approach I use. I have a user mode
which captures the stream from a physical video stream source (web
if it matters) then it transfers captured frames to a WDM stream
The minidriver is installed as a virtual video capture source in the
so other user mode applications can connect to it and capture the
stream. This minidriver is a modified version of the Micrsoft's
sample from the DDK. To support multiple connections (output pins) I
set the
NumberOfPossibleInstances in the HW_STREAM_INFORMATION to a required
(say 32). Then I made several more changes to support datastructures
every stream instance and to track creation and closing of those

After all this I came up with the following result: those applications
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
NumberOfPossibleInstances value set for the stream) connected to the
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
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
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
NumberOfPossibleInstances parameter to get several connections to the
output pin in the filter.

Could someone please advise, what can be the trick to make VfW
to work with the WDM driver which servs more than one instance of a
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

Thanks in advance,
Al K.

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