[DDK Newbie] Need some help with the Testcap example driver

For the last couple of weeks I have been working on a wdm video capture
driver which is based on the Testcap example driver included with the XP SP1
DDK.

I am more or less done, there is just one thing that I cant seem to figure
out how to do successfully.

The Testcap sample also implements a TvTuner, AudioTuner and a Video
Crossbar - for which I have no use in my driver and I would like to remove
them.

Either by removing the necessary things from the source / .inf file or by
blocking their functionality in the code somehow without interfering with
the video capture part.

The video crossbar selects the video input [from 5 different sources] for
the capture filter, I cant figure out how to remove the crossbar and still
have the video capture working.[I only have one source].

One of the things I tried was to set the constant DRIVER_STREAM_COUNT
defined in “capstrm.h” to be just 2, which prevents the crossbar from
showing up in the AmCap tool, but the video capture no longer works. :confused:

Is there somone on this list that have done a similar thing before?

To sum up, I want to turn the Testcap sample into a video capture only
filter, with only one pin [capture pin], without the crossbar selecting the
input source.

Any help or hints on how to do this would be greatly appreciated. :]

Thanks,

Johan
Still a newbie…


Hitta rätt på nätet med MSN Sök http://search.msn.se/

You definitely have to do at least two things:

  1. remove KSCATEGORY_TVTUNER, KSCATEGORY_CROSSBAR and KSCATEGORY_TVAUDIO from the list of
    supported categories.

  2. remove unwanted interfaces by commenting out those AddInterface directives in the INF that you
    don’t want.

Also to be safe remove StreamClassRegisterFilterWithNoKSPins for the categories that you don’t
care about (see above).

This should do it.
– Max.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of DDK Developer
Sent: Thursday, February 19, 2004 6:57 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] [DDK Newbie] Need some help with the Testcap example
driver

For the last couple of weeks I have been working on a wdm video
capture driver which is based on the Testcap example driver included
with the XP SP1 DDK.

I am more or less done, there is just one thing that I cant seem to
figure out how to do successfully.

The Testcap sample also implements a TvTuner, AudioTuner and a Video
Crossbar - for which I have no use in my driver and I would like to
remove them.

Either by removing the necessary things from the source / .inf file or
by blocking their functionality in the code somehow without
interfering with the video capture part.

The video crossbar selects the video input [ from 5 different sources
] for the capture filter, I cant figure out how to remove the crossbar
and still have the video capture working.[I only have one source].

One of the things I tried was to set the constant DRIVER_STREAM_COUNT
defined in “capstrm.h” to be just 2, which prevents the crossbar from
showing up in the AmCap tool, but the video capture no longer works.
:confused:

Is there somone on this list that have done a similar thing before?

To sum up, I want to turn the Testcap sample into a video capture only
filter, with only one pin [capture pin], without the crossbar
selecting the input source.

Any help or hints on how to do this would be greatly appreciated. :]

Thanks,

Johan
Still a newbie…


Hitta rätt på nätet med MSN Sök http://search.msn.se/


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

You are currently subscribed to ntdev as: xxxxx@yahoo.com To
unsubscribe send a blank email to xxxxx@lists.osr.com

Hi, Max!

Hope, You will be so kind and help me too.
I have a real problem with IKsReferenceClock::GetTime(). As commented in DDK
help
these function “returns the current stream time for the associated pin,
specified by DEFAULT in 100-nanosecond units”. I’ve found that renderer to
which my capture filter is attached
measured time simply in microseconds. So how can I determine which time
units are used?

Thanks,
Igor V. Slewsarev.

Max,

Thank you for your help.

I have done all the three things that you suggested. But it is not working.

In Graphedt, rendering the capture or preview pin now freezes Graphedt.

In AmCap the “Capture Filter” option is no longer available from the
“Options menu” ( but good news is that so is the “Video crossbar” and the
other non wanted options ) and selecting preview does nothing.

Any idea on what else needs to be done?

Thanks,

Johan

From: Max Paklin
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: RE: [ntdev] [DDK Newbie] Need some help with the Testcap example
>driver
>Date: Fri, 20 Feb 2004 01:59:20 -0800 (PST)
>
>You definitely have to do at least two things:
>
>1. remove KSCATEGORY_TVTUNER, KSCATEGORY_CROSSBAR and KSCATEGORY_TVAUDIO
>from the list of
>supported categories.
>
>2. remove unwanted interfaces by commenting out those AddInterface
>directives in the INF that you
>don’t want.
>
>Also to be safe remove StreamClassRegisterFilterWithNoKSPins for the
>categories that you don’t
>care about (see above).
>
>This should do it.
>– Max.
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of DDK Developer
> > Sent: Thursday, February 19, 2004 6:57 AM
> > To: Windows System Software Devs Interest List
> > Subject: [ntdev] [DDK Newbie] Need some help with the Testcap example
> > driver
> >
> > For the last couple of weeks I have been working on a wdm video
> > capture driver which is based on the Testcap example driver included
> > with the XP SP1 DDK.
> >
> > I am more or less done, there is just one thing that I cant seem to
> > figure out how to do successfully.
> >
> > The Testcap sample also implements a TvTuner, AudioTuner and a Video
> > Crossbar - for which I have no use in my driver and I would like to
> > remove them.
> >
> > Either by removing the necessary things from the source / .inf file or
> > by blocking their functionality in the code somehow without
> > interfering with the video capture part.
> >
> > The video crossbar selects the video input [from 5 different sources
> >] for the capture filter, I cant figure out how to remove the crossbar
> > and still have the video capture working.[I only have one source].
> >
> > One of the things I tried was to set the constant DRIVER_STREAM_COUNT
> > defined in “capstrm.h” to be just 2, which prevents the crossbar from
> > showing up in the AmCap tool, but the video capture no longer works.
> > :confused:
> >
> > Is there somone on this list that have done a similar thing before?
> >
> > To sum up, I want to turn the Testcap sample into a video capture only
> > filter, with only one pin [capture pin], without the crossbar
> > selecting the input source.
> >
> > Any help or hints on how to do this would be greatly appreciated. :]
> >
> > Thanks,
> >
> > Johan
> > Still a newbie…
> >
> >
> > Hitta rätt på nätet med MSN Sök http://search.msn.se/
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > You are currently subscribed to ntdev as: xxxxx@yahoo.com To
> > unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com


Hitta rätt på nätet med MSN Sök http://search.msn.se/

> I have a real problem with IKsReferenceClock::GetTime(). As

commented in DDK help these function “returns the current
stream time for the associated pin, specified by DEFAULT in
100-nanosecond units”. I’ve found that renderer to which my
capture filter is attached measured time simply in
microseconds. So how can I determine which time units are used?

Why is it a problem? Why are you concerned and what is the reason that you want to know why units
are used?

Unless your capture pin supports clock interface KSPROPERTY_CLOCK_XXX the time you get is managed
by AVStream for you. It could be DShow reference clock, could be something else. The fact that it
is expressed in 100 ns units does not mean that actual granularity is 100 ns. It is just the way
time stamping works by default in streaming on Windows.

You can change timer resolution if you wanted to.

But anyway, I don’t understand why you would want to bother. Assuming that you don’t change timer
resolution, you should time stamp your samples using 100 ns clock. How it is converted later on
and what the graph clock granularity is should not be your concern. KS will take care of that.

And may I ask how you found out that renderer’s clock has microsecond granularity?

– Max.

> I have done all the three things that you suggested. But it

is not working.

In Graphedt, rendering the capture or preview pin now freezes
Graphedt.

Let me get it straight. You took original TestCap, modified it this way and when you render output
pin it causes GraphEdit to freeze?
Are you sure that you did not apply this modifications to “your” version of the driver?
Maybe you are dealing with some problem that you introduced?

I just did what I suggested to you and it worked fine.

In AmCap the “Capture Filter” option is no longer available
from the “Options menu” ( but good news is that so is the
“Video crossbar” and the other non wanted options ) and
selecting preview does nothing.

Any idea on what else needs to be done?

Roll back to original driver without your modifications and do what I suggested. It should work.

– Max.

>Are you sure that you did not apply this modifications to “your” version of

the
driver?
Maybe you are dealing with some problem that you introduced?

I just reinstalled an untouched testcap sample ( XP SP1 DDK) and did the
following modifications:

  1. In camstrm.h removed the STATIC_KSCATEGORY_TVTUNER,
    STATIC_KSCATEGORY_CROSSBAR and the STATIC_KSCATEGORY_TVAUDIO from the
    Categories array.

  2. Commented out all the AddInterface and AddReg directives for
    VideoTvTuner, VideoCrossbar and VideoTvAudio.

  3. Commented out the RegisterFilterWithNoKSPins calls in capmain.c (left
    the KSCATEGORY_CAPTURE uncommented).

Results:

  • The preview and capture pins renders ok in GraphEdt.
  • In AmCap however, the only option left in the options menu is “Preview”
    and it does nothing.

I also tested with the webcam feature of MSN Messenger 6.0 - when selecting
the TESTCAP driver as the video capture source Messenger complains that
there is something wrong with the camera source, but ignoring this error and
starting up a webcam session shows the synthesized image from TESTCAP.

To me this seems like both AmCap and Messenger is doing some kind of
diagnostic test on the camera source which fails. Do you have any idea what
kind of test this might be?

The unmodified testcap sample works ok with both AmCap and Messenger.

Also, I then put back everything I changed in 1), 2) and 3) that had to do
with the CROSSBAR.

This results in that the TVAUDIO and TVTUNER is “removed” successfully, and
it now works with both AmCap and Messenger without any errors.

Last night, working with my modified driver, I did lots of changes with the
code trying to get it to work ok with AmCap and Messenger without the
crossbar part. I somehow (not sure which change made the difference) managed
to get rid of the crossbar and get it working in AmCap. :slight_smile:

But I still get the failure message in Messenger when selecting the video
capture filter as a camera source. So, what I would really like to find out
is how Messenger initially decides that there is a problem? Is there a
general way this is done?

While debugging this I see that I receive the SRB_PAGING_OUT_DRIVER packet,
but then I get nothing else.

Johan


Chat: Ha en fest på Habbo Hotel
http://habbohotel.msn.se/habbo/sv/channelizer Checka in här!

>But I still get the failure message in Messenger when selecting the video

capture filter as a camera source. So, what I would really like to find out
is how Messenger initially decides that there is a problem? Is there a
general way this is done?

Just a clarification about the above.

What I do is selecting the modified driver in the “Audio/Video Tuning
Wizard” in MSN 6.0.

I tried to find out more exactly what this Wizard does and found a post
(http://www.mcse.ms/message346466.html) from Microsoft MVP Jonathan Kay.
According to him the Audio/Video Tuning Wizard checks for something that he
calls the “Video
Conference feature” of the video capture driver.

The Audio/Tuning Wizard seems to find this feature in the unmodified testcap
sample, but after doing the modifications suggested by Max ( 1),2), and 3)
in my previous post) it no longer finds it.

Can someone think of why this is the case? Probably has something to do with
the crossbar being removed, since adding after adding back only the crossbar
the wizard finds this video conference feature again.

But why is the crossbar needed for this?

Thanks,

Johan


Chatt: Träffa nya nätkompisar på Habbo Hotel
http://habbohotel.msn.se/habbo/sv/channelizer

> 1) In camstrm.h removed the STATIC_KSCATEGORY_TVTUNER,

STATIC_KSCATEGORY_CROSSBAR and the STATIC_KSCATEGORY_TVAUDIO
from the Categories array.

  1. Commented out all the AddInterface and AddReg directives
    for VideoTvTuner, VideoCrossbar and VideoTvAudio.

  2. Commented out the RegisterFilterWithNoKSPins calls in
    capmain.c (left the KSCATEGORY_CAPTURE uncommented).

Results:

  • The preview and capture pins renders ok in GraphEdt.
  • In AmCap however, the only option left in the options menu
    is “Preview” and it does nothing.

Out of curiousity I did exactly the same thing and it worked fine under AmCap.
My guess is that some of the leftovers from your previous experiments were screwing things up.
Get yourself a clean machine and test it with modified sample (without installing original sample
first). I bet it will work fine.

I also tested with the webcam feature of MSN Messenger 6.0 -
when selecting the TESTCAP driver as the video capture source
Messenger complains that there is something wrong with the
camera source, but ignoring this error and starting up a
webcam session shows the synthesized image from TESTCAP.

Oh… You removed a piece of functionality from the capture driver and expect every capture
application continue to work as is? Why is that I wonder?
Why don’t you remove everything but DriverEntry and wonder why you don’t see anything in
GraphEdit?

I don’t know what exactly MSN Messenger is doing, but it would not surprise me if it was trying to
switch inputs using Crossbar functionality, which was missing in your crippled sample.

The unmodified testcap sample works ok with both AmCap and Messenger.

Also, I then put back everything I changed in 1), 2) and 3)
that had to do with the CROSSBAR.

This proves my point (see above).

what I would really like to find out is how Messenger
initially decides that there is a problem? Is there a general
way this is done?

  1. Add crossbar and put breakpoints around crossbar properties and see what Messenger calls.
  2. Install checked build of DirectX.

Hi, Max.

I’m appreciated for your help.

Why is it a problem? Why are you concerned and what is the reason that you
want to know why units
are used?
And may I ask how you found out that renderer’s clock has microsecond
granularity?

Since I have sync. problem while capturing both audio and video from
two separate devices on my test computer (Win2K; all drivers except
mine have cert.-s;all including driver for MB embedded audio), but on
my work computer (WinXP) all works fine. Both capture drivers were
written by me, both are AVStream minidrivers and both don’t have own
clocks. I’m building DS graph with audio and video capture filters and
with default direct sound device and VMR renderer. Each device separately
works fine (vid cap device with VMR Renederer; aud cap device with default
Direct Sound device). Working togather - audio starts croaking. I’ve
investigated this problem and found that this happened then I set Duration
field in KSSTREAM_HEADER during audio frame completion. I’ve added tracing
of results of IKsReferenceClock::GetTime() calls and found that they were
in microseconds; Needless to say, that previously I’ve wrongly calculated
duration
in 100 ns units.

By the way, I (and hope not only I) will be appreciated for any example of
device clock implementation.

S.Y.
Igor V. Slewsarev

>Out of curiousity I did exactly the same thing and it worked fine under

AmCap.

Ok. It did not work with the AmCap version from the XP1 DDK, but it turns
out same driver works with the version from the DirectX9 SDK.

Oh… You removed a piece of functionality from the capture driver and
expect
every capture application continue to work as is?

Yes, I would expect that the only thing needed to work with capture
applications is to have a capture filter. The TVAudio, TVTuner and CROSSBAR
should not be necessary for the video capture functionality.

Why is that I wonder?

I have another piece of hardware, Philips ToUCam PRO webcam, which does not
have a CROSSBAR, and the A/V Tuning Wizard still works ok with it.

  1. Add crossbar and put breakpoints around crossbar properties and see what
    Messenger calls.

I did this when the crossbar was removed, and I was surprised to find that I
dont receive anything at all but the SRB_PAGING_OUT_DRIVER packet. I will
try this with the unmodified sample and see if it helps.

  1. Install checked build of DirectX.

Ok. Maybe that is what I´ll have to look at next. Thanks.


Hitta rätt på nätet med MSN Sök http://search.msn.se/

> device separately works fine (vid cap device with VMR

Renederer; aud cap device with default Direct Sound device).
Working togather - audio starts croaking. I’ve investigated
this problem and found that this happened then I set Duration
field in KSSTREAM_HEADER during audio frame completion. I’ve
added tracing of results of IKsReferenceClock::GetTime()
calls and found that they were in microseconds; Needless to
say, that previously I’ve wrongly calculated duration in 100 ns units.

Ouch.
This is very strange. The only thing that comes to mind is that audio card driver does not
implement this functionality properly (audio driver reference clock is the default choice when
DSound render ends up in the graph). However this would be a pretty wild bug.

Can you try to select audio render’s clock explicitely?

By the way, I (and hope not only I) will be appreciated for
any example of device clock implementation.

Tough samples would always be appreciated by many.
I guess the demand for samples of this kind is not there for MS to write one.

> Yes, I would expect that the only thing needed to work with

capture applications is to have a capture filter. The
TVAudio, TVTuner and CROSSBAR should not be necessary for the
video capture functionality.

Crossbar is now supported by everybody and applications are used to tweaking inputs as a part of
setup process.

I have another piece of hardware, Philips ToUCam PRO webcam,
which does not have a CROSSBAR, and the A/V Tuning Wizard
still works ok with it.

Probably because it is webcam, which advertises itself differently.
I have a wild guess. Try removing KSCATEGORY_CAPTURE and leaving only KSCATEGORY_VIDEO. Maybe when
the application sees KSCATEGORY_CAPTURE (WDM Streaming Capture Devices) it assumes that it is
dealing with new device and it expects crossbar support. On the other hand the application can use
the presense of KSCATEGORY_VIDEO and absense of KSCATEGORY_CAPTURE as the sign that capture device
is “legacy” device (Video Capture Source). Then it might assume that that device is allowed to
NOT have crossbar.

– Max.

If I remember correctly the darn dialog box ignores granurality parameter provided by the driver.
At least it used to do that in DX8.

So whatever you do the dialog box will put a bunch of formats that you may or may not actually
support. What a shame!
Quit using it and write your own UI in your application. If you are dealing with third party app,
you are out of luck.

– Max.

IMHO there are three ways:

  1. Use OutputGranularityX, OutputGranularityY.
  2. Define more mediatypes (one for 640X480, another for
    320X240, etc.) 3. Return STATUS_DEVICE_INVALID_REQUEST in Pin
    Intersect hanlder (I’m talking about AVStream model) if you
    are unable to use this format.

>I have another piece of hardware, Philips ToUCam PRO webcam, which does not

have a CROSSBAR, and the A/V Tuning Wizard still works ok with it.

Probably because it is webcam, which advertises itself differently.
I have a wild guess. Try removing KSCATEGORY_CAPTURE and leaving only
KSCATEGORY_VIDEO. Maybe when
the application sees KSCATEGORY_CAPTURE (WDM Streaming Capture Devices) it
assumes that it is
dealing with new device and it expects crossbar support. On the other hand
the
application can use
NOT have crossbar.

Well, the Philips webcam also shows up as a WDM Streaming Capture Device. So
go figures… =/

I am close to give up on this one, I have thought so many times that I
actually managed to get rid of everything except the video capture from the
testcap sample and that it works with the Audio/Video tuning wizard in MSN
Messenger.

Only to find out later after cleaning the registry extensively that it stops
working after a clean reinstallation.

From: Max Paklin
>Reply-To: “Windows System Software Devs Interest List”
>
>To: “Windows System Software Devs Interest List”
>Subject: RE: [ntdev] [DDK Newbie] Need some help with the Testcap example
>driver
>Date: Tue, 24 Feb 2004 13:26:58 -0800 (PST)
>
> > Yes, I would expect that the only thing needed to work with
> > capture applications is to have a capture filter. The
> > TVAudio, TVTuner and CROSSBAR should not be necessary for the
> > video capture functionality.
>
>Crossbar is now supported by everybody and applications are used to
>tweaking inputs as a part of
>setup process.
>
>
> > I have another piece of hardware, Philips ToUCam PRO webcam,
> > which does not have a CROSSBAR, and the A/V Tuning Wizard
> > still works ok with it.
>
>Probably because it is webcam, which advertises itself differently.
>I have a wild guess. Try removing KSCATEGORY_CAPTURE and leaving only
>KSCATEGORY_VIDEO. Maybe when
>the application sees KSCATEGORY_CAPTURE (WDM Streaming Capture Devices) it
>assumes that it is
>dealing with new device and it expects crossbar support. On the other hand
>the application can use
>the presense of KSCATEGORY_VIDEO and absense of KSCATEGORY_CAPTURE as the
>sign that capture device
>is “legacy” device (Video Capture Source). Then it might assume that that
>device is allowed to
>NOT have crossbar.
>
>– Max.
>
>
>—
>Questions? First check the Kernel Driver FAQ at
>http://www.osronline.com/article.cfm?id=256
>
>You are currently subscribed to ntdev as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com

_________________________________________________________________
Hitta rätt på nätet med MSN Sök http://search.msn.se/