dear all,
I try to develop a usb 2.0 camera, but meet some problem.
it is fine to use amcap to play video of "RGB24" format, but
modify it to RGB565 made the amcap has error message(
IsEqualGUID(GetBitmapSubtype(&VidInfoHdr->bmiHeader), *pmt->Subtype()) )
I wonder the "KS_DATARANGE_VIDEO" define is not correct to cause this error
message. How do I to modify the definition of "KS_DATARANGE_VIDEO" ??

thanks.

My definition is list in below:

#define FCC_FORMAT_RGB565 0xe436eb7b
#define D_X 640
#define D_Y 480
KS_DATARANGE_VIDEO _StreamFormat_RGB565_640x480 =
{
// KSDATARANGE
{
sizeof (KS_DATARANGE_VIDEO),
0, // Flags
(D_X * D_Y * 16) / 8, // SampleSize
0, // Reserved
//MEDIATYPE_Video
STATIC_KSDATAFORMAT_TYPE_VIDEO,
//MEDIASUBTYPE_RGB565
FCC_FORMAT_RGB565, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf,
0x0b, 0xa7, 0x70,
//FORMAT_VideoInfo
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO
},

TRUE, // BOOL, bFixedSizeSamples (all samples same size?)
TRUE, // BOOL, bTemporalCompression (all I frames?)
KS_VIDEOSTREAM_CAPTURE, // StreamDescriptionFlags
0, // MemoryAllocationFlags (KS_VIDEO_ALLOC_*)

// _KS_VIDEO_STREAM_CONFIG_CAPS
{
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO,
KS_AnalogVideo_None, // VideoStandard
D_X, D_Y, // InputSize, (the inherent size of the
incoming signal
// with every digitized pixel
unique)
D_X, D_Y, // MinCroppingSize, smallest rcSrc cropping
rect allowed
D_X, D_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
D_X, D_Y, // MaxOutputSize, largest bitmap stream can
produce
1, // OutputGranularityX, granularity of output
bitmap size
1, // OutputGranularityY;
0, // StretchTapsX
0, // StretchTapsY
0, // ShrinkTapsX
0, // ShrinkTapsY
333333, // MinFrameInterval, 100 nS units => 30 fps
5000000, // MaxFrameInterval, 100 nS units => 2 fps
16 * 2 * D_X * D_Y, // MinBitsPerSecond;
16 * 30 * D_X * D_Y // MaxBitsPerSecond;
},

// KS_VIDEOINFOHEADER (default format)
{
0,0,0,0, // RECT rcSource;
0,0,0,0, // RECT rcTarget;
D_X * D_Y * 16 * 15, // DWORD dwBitRate;
0L, // DWORD dwBitErrorRate;
666666, // REFERENCE_TIME
AvgTimePerFrame;
sizeof (KS_BITMAPINFOHEADER), // DWORD biSize;
D_X, // LONG biWidth;
D_Y, // LONG biHeight;
1, // WORD biPlanes;
16, // WORD biBitCount;
0, // DWORD biCompression;
(D_X * D_Y * 16) / 8, // DWORD biSizeImage;
0, // LONG biXPelsPerMeter;
0, // LONG biYPelsPerMeter;
0, // DWORD biClrUsed;
0 // DWORD biClrImportant;
}
};
#undef D_X
#undef D_Y

Re: how to define "KS_DATARANGE_VIDEO" for RGB565 in videocap by Igor

Igor
Wed Oct 13 04:19:38 CDT 2004

For RGB565 bmiHeader.biCompression should be BI_BITFIELDS;
Also don't forget to add dwBitMasks[iMASK_COLORS] == {0x7c00, 0x3e0, 0x1f}
array right after BITMAPINFOHEADER;



Re: how to define "KS_DATARANGE_VIDEO" for RGB565 in videocap by Igor

Igor
Wed Oct 13 04:30:34 CDT 2004

I've made a mistake: bitmasks should be {0xf800, 0x7e0, 0x1f};



Re: how to define "KS_DATARANGE_VIDEO" for RGB565 in videocap by tiyayin

tiyayin
Thu Oct 14 01:09:01 CDT 2004

dear Igor Slewsarev,
where could I to add dwBitMasks[iMask_COLORS] in my code of driver??
I don't understand those thing

thank you very much

"Igor Slewsarev" wrote:

> I've made a mistake: bitmasks should be {0xf800, 0x7e0, 0x1f};
>
>
>

Re: how to define "KS_DATARANGE_VIDEO" for RGB565 in videocap by Igor

Igor
Thu Oct 14 03:31:37 CDT 2004

Dear tiyayin (is this your real name?),
Try to define your own type, e.g.
typedef struct _KS_DATARANGE_VIDEO_WITH_MASKS {
KSDATARANGE DataRange;
BOOL bFixedSizeSamples;
BOOL bTemporalCompression;
DWORD StreamDescriptionFlags;
DWORD MemoryAllocationFlags;
KS_VIDEO_STREAM_CONFIG_CAPS ConfigCaps;
KS_VIDEOINFOHEADER VideoInfoHeader;
DWORD dwBitMasks[KS_iMASK_COLORS];
} KS_DATARANGE_VIDEO_WITH_MASK, and etc.;
or
typedef struct _KS_DATARANGE_VIDEO_WITH_MASKS {
KS_DATARANGE_VIDEO VideoDataRange;
DWORD dwBitMasks[KS_iMASK_COLORS];
} and etc.

Please lookup DDK help for a definition of KS_VIDEOINFO;
hope, all your questions will disappear