I am working on a project to develope a 1080i video capture card supporting
8 bit and 10 bit luma / chroma samples. This driver is for hardware
demostration / evaluation
purposes and not a production driver.
I have modified the AVSHWS sample driver to support Interlaced video -
basically convert the IntersectHandler, CaptureVideoInfoHeader, and
DispatchSetFormat routines
to use KS_DATARANGE_VIDEO2 and KS_DATAFORMAT_VIDEOINFOHEADER2.
With 8 bit samples I was successful in displaying the color bar pattern, in
1080 interlaced format.
I modified the data range for the FourCC code of v210 which supports 10 bit
samples. I have installed
the BlackMagic codec for 10 bit 4:2:2 which is the filter I am trying to
connect to.
The KS_DATARANGE_VIDEO2 parameters are provide below should there still be
problems with it.
The FourCC description for v210 can be found at:
http://developer.apple.com/quicktime/icefloe/dispatch019.html#v210
My problem is that after eleven calls to my IntersectHandler that return
STATUS_SUCCESS
there is never a call to my DispatchSetFormat routine. (Each was preceeded
by the STATUS_BUFFER_OVERFLOW
return status) Graphedit then displays the following message after the
Render Pin command.
No combination of intermediate filters could be found to make the
connection. Return Code: 0x80040217
I have used KsStudio to build a graph, after two attemps the capture output
pin connects to the Video Capture Sink filter.
When I check the Istanciated Objects window the capture filter data range
seems to be incorrect parameter for biCompression
parameter which is now 808530550 (0x0p) (yes there is an extra nibble) was
0x30, 0x31, 0x32, 0x76 (012v) when returned in
the IntersectHandler. The 8 bit sample version of the driver displayed
FOURCC_YVU2 mmioFourCC(“Y”,“U”,“Y”,“2”)
Also the KsStudio Check topology option displays the following message:
Pin has 0 internal connections. This is an orphaned pin and will be ignored
by most graph builders.
This same message was displayed for the 8 bit sample size, so it may not be
significant.
My next step is to compile the DirectX SDK baseclasses and see if I can
trace into the callers of my IntersectHandler, as suggested at:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2276461&SiteID=1
Any suggestions to a better approach would be appriecated.
Below is the KS_DATARANGE_VIDEO2 structure that is used by the
IntersectHandler, I have
added the 8 bit sample values as comments that were used to display the
1080i color bars.
I only compile single data range at any time.
#define DMAX_X 1920
#define DMAX_Y 540
#define D_X 48
#define D_Y 16
const
KS_DATARANGE_VIDEO2
Formatv210_Capture = {
//
// KSDATARANGE_VIDEO2
//
{
sizeof (KS_DATARANGE_VIDEO2), // FormatSize
0, // Flags
/* 8 bit DMAX_X * DMAX_Y * 2, // SampleSize end
8 bit */
(DMAX_X / 6) * 16 * DMAX_Y, // SampleSize 6 luma/chroma
pairs packed in 16 bytes
0, // Reserved
STATICGUIDOF (KSDATAFORMAT_TYPE_VIDEO), // aka. MEDIATYPE_Video
/* 8 bit FOURCC_YUY2, 0x0000, 0x0010, 0x80, 0x00,
0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71, //aka. MEDIASUBTYPE_YUY2,
end 8 bit */
FOURCC_v210, 0x0000, 0x0010, 0x80, 0x00,
0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71, //aka. MEDIASUBTYPE_v210,
STATICGUIDOF (KSDATAFORMAT_SPECIFIER_VIDEOINFO2) // aka.
FORMAT_VideoInfo
},
TRUE, // BOOL, bFixedSizeSamples (all samples same size?)
TRUE, // BOOL, bTemporalCompression (all I frames?)
0, // Reserved (was StreamDescriptionFlags)
0, // Reserved (was MemoryAllocationFlags
// (KS_VIDEO_ALLOC_*))
//
// _KS_VIDEO_STREAM_CONFIG_CAPS
//
{
STATICGUIDOF( KSDATAFORMAT_SPECIFIER_VIDEOINFO2 ), // GUID
KS_AnalogVideo_NTSC_M_J | KS_AnalogVideo_NTSC_M, //
AnalogVideoStandard AnalogVideoStandard
DMAX_X, DMAX_Y, // InputSize, (the inherent size of the incoming
signal
// with every digitized pixel
unique)
D_X,D_Y, // MinCroppingSize, smallest rcSrc
cropping rect allowed
DMAX_X, DMAX_Y, // MaxCroppingSize, largest rcSrc cropping rect
allowed
1, // CropGranularityX, granularity of cropping size
1, // CropGranularityY
1, // CropAlignX, alignment of cropping rect
1, // CropAlignY;
D_X, D_Y, // MinOutputSize, smallest bitmap stream
can produce
DMAX_X, DMAX_Y, // MaxOutputSize, largest bitmap stream can produce
2, // OutputGranularityX, granularity of output bitmap
size
1, // OutputGranularityY;
0, // StretchTapsX (0 no stretch, 1 pix dup, 2
interp…)
0, // StretchTapsY
2, // ShrinkTapsX
2, // ShrinkTapsY
333667, // MinFrameInterval, 100 nS units 29.97 fps
100000000, // MaxFrameInterval, 100 nS units
10 * 2 * 30 * D_X * D_Y, // MinBitsPerSecond;
10 * 2 * 30 * DMAX_X * DMAX_Y, // MaxBitsPerSecond;
},
//
// KS_VIDEOINFOHEADER2 (default format)
//
{
0, 0, 0, 0, // RECT rcSource;
0, 0, 0, 0, // RECT rcTarget;
DMAX_X * DMAX_Y * 2 * 30 * 10 * 2, // DWORD dwBitRate;
0L, // DWORD dwBitErrorRate;
333667, // REFERENCE_TIME
AvgTimePerFrame; // 29.97 fps
(KS_INTERLACE_IsInterlaced | KS_INTERLACE_1FieldPerSample), //
DWORD dwInterlaceFlags;
0, // DWORD dwCopyProtectionFlags;
16, // DWORD dwPicAspectRatioX;
9, // DWORD dwPicAspectRatioY;
0, // DWORD dwReserved1;
0, // DWORD dwReserved2;
{
sizeof (KS_BITMAPINFOHEADER), // DWORD biSize;
DMAX_X, // LONG biWidth;
DMAX_Y, // LONG biHeight;
1, // WORD biPlanes;
/* 8 bit 16, // WORD biBitCount;
end 8 bit */
20, // WORD biBitCount;
/* 8 bit FOURCC_YUV2, // DWORD biCompression;
end 8 bit */
FOURCC_v210, // DWORD biCompression;
/* 8 bit DMAX_X * DMAX_Y * 2, // SampleSize end
8 bit */
(DMAX_X / 6) * 16 * DMAX_Y, // DWORD biSizeImage;
0, // LONG biXPelsPerMeter;
0, // LONG biYPelsPerMeter;
0, // DWORD biClrUsed;
0 // DWORD biClrImportant;
}
}
};