how to capture video formate in avstream upper filter driver

I am developing an avstream upper filter driver. Now using my avstream upper filter driver, I can change the stream data in control application before it is transfered to video player.

But I do not know how to get the format and video rectangle width and length eg. 640*480, my control application need these data.

I found much KSPROPERTY_PIN_DATAINTERSECTION and KSPROPERTY_PIN_DATARANGES command when i change the video format from 640*480 to 320*240. But these commands are KSPROPERTY_TYPE_GET commands,not SET commands. I can not capture any set commands in this procedure.

some documents said the player use KSPROPERTY_CONNECTION_DATAFORMAT and KSPROPERTY_CONNECTION_PROPOSEDATAFORMAT command to set the video format . BUT i can not capture this two commands.

Anyone can tell me how to get the current video format and rectange width and length?

thank you very much.

The following is my captured KSPROPERTY_PIN_DATAINTERSECTION data.

KsPinProperty(18): KsProperty->Id:KSPROPERTY_PIN_DATAINTERSECTION(0x4)
: _KsPinProperty(32): UserBuffer is 00914A78
: _KsPinProperty(33): OutputBufferLength is 98
: _KsPinProperty(34): InputBufferLength is 150
: _KsPinProperty(35): FormatSize is 0
: _KsPinProperty(36): Flags are 0
: _KsPinProperty(37): SampleSize is 25800
: _KsPinProperty(40): MajorFormat:KSDATAFORMAT_TYPE_VIDEO
: _KsPinProperty(48): SubFormat:MEDIASUBTYPE_YUY2
: _KsPinProperty(71): Specifier is KSDATAFORMAT_SPECIFIER_VIDEOINFO
: _KsPinProperty(72): VideoStandard is 0
: _KsPinProperty(73): InputSize (X, Y) are (0, 0)
: _KsPinProperty(74): MinCroppingSize (X, Y) are (0, 0)
: _KsPinProperty(75): MaxCroppingSize (X, Y) are (0, 0)
: _KsPinProperty(76): CropGranularity (X, Y) are (0, 36864000)
: _KsPinProperty(77): CropAlign (X, Y) are (0, 333333)
: _KsPinProperty(78): MinOutputSize (X, Y) are (0, 40)
: _KsPinProperty(79): MaxOutputSize (X, Y) are (320, 240)
: _KsPinProperty(80): OutputGranularity (X, Y) are (1048577, 844715353)
: _KsPinProperty(81): StretchTaps (X, Y) are (153600, 0)
: _KsPinProperty(82): ShrinkTaps (X, Y) are (0, 0)
: _KsPinProperty(83): FrameInterval (min, max) are (1310723, 17432852)
: _KsPinProperty(84): BitsPerSecond (min, max) are (7798895, 16777216)
: _KsPinProperty(94): Alignment is 8c134960
: _KsPinProperty(95): PinID is 0

xxxxx@gmail.com wrote:

I am developing an avstream upper filter driver. Now using my avstream upper filter driver, I can change the stream data in control application before it is transfered to video player.

But I do not know how to get the format and video rectangle width and length eg. 640*480, my control application need these data.

I found much KSPROPERTY_PIN_DATAINTERSECTION and KSPROPERTY_PIN_DATARANGES command when i change the video format from 640*480 to 320*240. But these commands are KSPROPERTY_TYPE_GET commands,not SET commands. I can not capture any set commands in this procedure.

A property “get” request passes information in both directions. In
KSPROPERTY_PIN_DATAINTERSECTION, for example, the caller provides a
KSP_PIN followed by a set of KSDATARANGE structures. The driver returns
the first datarange that it finds acceptable.

Anyone can tell me how to get the current video format and rectange width and length?

You just have to monitor the exchanges and remember what was returned.

The following is my captured KSPROPERTY_PIN_DATAINTERSECTION data.

KsPinProperty(18): KsProperty->Id:KSPROPERTY_PIN_DATAINTERSECTION(0x4)
: _KsPinProperty(32): UserBuffer is 00914A78
: _KsPinProperty(33): OutputBufferLength is 98
: _KsPinProperty(34): InputBufferLength is 150

See? This has 150 bytes going in, and 98 bytes going out.

: _KsPinProperty(35): FormatSize is 0
: _KsPinProperty(36): Flags are 0
: _KsPinProperty(37): SampleSize is 25800
: _KsPinProperty(40): MajorFormat:KSDATAFORMAT_TYPE_VIDEO
: _KsPinProperty(48): SubFormat:MEDIASUBTYPE_YUY2
: _KsPinProperty(71): Specifier is KSDATAFORMAT_SPECIFIER_VIDEOINFO
: _KsPinProperty(72): VideoStandard is 0
: _KsPinProperty(73): InputSize (X, Y) are (0, 0)
: _KsPinProperty(74): MinCroppingSize (X, Y) are (0, 0)
: _KsPinProperty(75): MaxCroppingSize (X, Y) are (0, 0)
: _KsPinProperty(76): CropGranularity (X, Y) are (0, 36864000)
: _KsPinProperty(77): CropAlign (X, Y) are (0, 333333)
: _KsPinProperty(78): MinOutputSize (X, Y) are (0, 40)
: _KsPinProperty(79): MaxOutputSize (X, Y) are (320, 240)
: _KsPinProperty(80): OutputGranularity (X, Y) are (1048577, 844715353)
: _KsPinProperty(81): StretchTaps (X, Y) are (153600, 0)
: _KsPinProperty(82): ShrinkTaps (X, Y) are (0, 0)
: _KsPinProperty(83): FrameInterval (min, max) are (1310723, 17432852)
: _KsPinProperty(84): BitsPerSecond (min, max) are (7798895, 16777216)
: _KsPinProperty(94): Alignment is 8c134960
: _KsPinProperty(95): PinID is 0

This data doesn’t look right. How are you decoding this? Most of these
fields should have reasonable values. 333333, for example, should be
the frame interval (30 fps).


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Tim Roberts
thank you very much! And I’m so sorry to reply.

I use the following way to capture the video format.
I can store the video format in KSPROPERTY_PIN_DATAINTERSECTION, So I think the last video format in complete routine is the right video format record.

But this method is not the best way. Maybe it can only work on some web camera device. And this propety is only sent to PIN. I can not capture KSPROPERTY_PIN_DATAINTERSECTION in logitech’s web camera device.

xxxxx@gmail.com wrote:

I use the following way to capture the video format.
I can store the video format in KSPROPERTY_PIN_DATAINTERSECTION, So I think the last video format in complete routine is the right video format record.

But this method is not the best way. Maybe it can only work on some web camera device. And this propety is only sent to PIN. I can not capture KSPROPERTY_PIN_DATAINTERSECTION in logitech’s web camera device.

Yes, it varies by device, and it also depends on the application.

There are six properties related to dataformats:
1 KSPROPERTY_PIN_DATARANGES
2 KSPROPERTY_PIN_CONSTRAINEDDATARANGES
3 KSPROPERTY_PIN_PROPOPSEDDATAFORMAT
4 KSPROPERTY_PIN_DATAINTERSECTION
5 KSPROPERTY_CONNECTION_PROPOSEDDATAFORMAT
6 KSPROPERTY_CONNECTION_DATAFORMAT

#1 reports every property the pin can EVER support. #2 reports the
properties the pin can CURRENTLY support. #3 and #4 are requests from a
client to inquire whether a format is acceptable. #5 and #6 are used
after a pin is connected.

I have rarely seen #2, #3, and #5. #6 is the most useful one, because
that’s the real format that the client wants. However, some clients
simply accept the defaults, which comes from #1 and #4.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.