Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DirectShow source filter for virtual video input

657 views
Skip to first unread message

dominolog

unread,
Feb 13, 2009, 2:46:43 PM2/13/09
to
Hello

I'd like to know how to develop using DirectShow a virtual input video
device for screen capture? This means I want that this virtual device
is available for enumerator as a normal USB camera and instead of
capturing video provides the desktop window capture.
As far as I'm concerned, it is a task for creating a source filer in
DShow. Is that true?

Dominik

Alessandro Angeli

unread,
Feb 13, 2009, 3:24:57 PM2/13/09
to
From: "dominolog"

There is no such thing as a "normal USB camera", since they
can work in several different ways. Assuming you want a
virtual device that works with most video capture
applications, creating a DirectShow video capture source is
your best bet.

You can use the PushSourceDesktop sample in the SDK to
implement such a filter with the following modifications (as
explained here:
http://msdn.microsoft.com/en-us/library/dd391011.aspx):

1. CPushPinDesktop::FillBuffer() should use
m_pFilter->StreamTime()+delay as rtStart (the delay should
be 50-500 millisecs)

2. CPushPinDesktop must implement IKsPropertySet

3. you must override CPushSourceDesktop::GetState() to
return VFW_S_CANT_CUE when needed

4. you need to register the filter in the
CLSID_VideoInputDeviceCategory category (as explained here:
http://msdn.microsoft.com/en-us/library/dd376682.aspx)


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


The March Hare [MVP]

unread,
Feb 13, 2009, 4:56:24 PM2/13/09
to
On Fri, 13 Feb 2009 11:46:43 -0800 (PST), dominolog wrote:

> As far as I'm concerned, it is a task for creating a source filer in
> DShow. Is that true?

Not exactly, as Alessandro explained.

For an example of a virtual camera filter see my Downloads page through the
link in my sig below.

--
Please read this before replying:
1. Dshow & posting help: http://tmhare.mvps.org/help.htm
2. Trim & respond inline (please don't top post or snip everything)
3. Benefit others: follow up if you are helped or you found a solution

dominolog

unread,
Feb 14, 2009, 6:23:52 AM2/14/09
to
On 13 Lut, 21:24, "Alessandro Angeli" <nob...@nowhere.in.the.net>
wrote:

Thanks Alessandro

I owe You a big beer.

Dominik Tomczak

dominolog

unread,
Feb 16, 2009, 8:22:05 AM2/16/09
to

Hello Again

One more question - I coludn't find how to register the source filter
in system enumerator so that the source filter is visible as a virtual
camera (visible ie. for Skype).
Any hints?

Thanks
Dominik Tomczak

Roman Ryl...

unread,
Feb 16, 2009, 9:11:40 AM2/16/09
to
Hi,

> One more question - I coludn't find how to register the source filter
> in system enumerator so that the source filter is visible as a virtual
> camera (visible ie. for Skype).
> Any hints?

IFilterMapper2::RegisterFilter(...,
&CLSID_VideoInputDeviceCategory, ...)

Roman

dominolog

unread,
Feb 16, 2009, 10:28:41 AM2/16/09
to

Does this mean that I have to write a small exe app to do it? Isn't it
possible to simply modify registry? My point is I want to have an
installator for my dll filter that does this for me. I can write a vbs
script for doing this but I hoped there is a more clearer way for
obtaining that.

Dominik

Alessandro Angeli

unread,
Feb 16, 2009, 10:35:45 AM2/16/09
to
From: "dominolog"

> Does this mean that I have to write a small exe app to do
> it? Isn't it possible to simply modify registry? My point
> is I want to have an installator for my dll filter that
> does this for me. I can write a vbs script for doing this
> but I hoped there is a more clearer way for obtaining
> that.

http://msdn.microsoft.com/en-us/library/dd376682.aspx

dominolog

unread,
Feb 17, 2009, 8:19:09 AM2/17/09
to
On 16 Lut, 16:35, "Alessandro Angeli" <nob...@nowhere.in.the.net>
wrote:

Hello

Ok, this is all clear now for me. Except for one thing - I'm not sure
how to provide a config dialog for my source filter? There is a
standard mechanism for filter config - ie. Skype has a "settings"
button for USB camera that displays the camera vendor's configuration
dialog. How to expose such a dialog from my filter?

Regards
Dominik

Roman Ryl...

unread,
Feb 17, 2009, 10:24:53 AM2/17/09
to
Hi,

> Ok, this is all clear now for me. Except for one thing - I'm not sure
> how to provide a config dialog for my source filter? There is a
> standard mechanism for filter config - ie. Skype has a "settings"
> button for USB camera that displays the camera vendor's configuration
> dialog. How to expose such a dialog from my filter?

You implement ISpecifyPropertyPages interface on your filter and this
expose associated property pages. Skype will enumerate them,
instantiate them and associate with an instance of your filter.

Roman

Alessandro Angeli

unread,
Feb 17, 2009, 2:19:21 PM2/17/09
to
From: "dominolog"

> I'm not sure how to provide a config dialog for my source
> filter? There is a standard mechanism for filter config -
> ie. Skype has a "settings" button for USB camera that
> displays the camera vendor's configuration dialog. How to
> expose such a dialog from my filter?

http://msdn.microsoft.com/en-us/library/dd375010.aspx

dominolog

unread,
Feb 18, 2009, 7:18:32 AM2/18/09
to
On 17 Lut, 20:19, "Alessandro Angeli" <nob...@nowhere.in.the.net>
wrote:

Thanks for answers. I'll follow your hints.

Regards
Dominik

0 new messages