Testcap DDK sample and I420 stream data format

Testcap DDK sample and I420 stream data format

Post by Davi » Wed, 09 Jul 2008 11:21:00


i all,

I try to change stream data format in Testcap DDK sample from UYU2 to I420
but it work incorrect when display preview bin in some chat program, i print
debug and see stream data format width: 320, height: 240, bitcount: 24, it
is format of RGB24, but when display seem it is I420, i do not know why.

Following is my define I420 format:

#define FCC_FORMAT_YUV12A mmioFOURCC('I','4','2','0')

#define D_X 320
#define D_Y 240


static KS_DATARANGE_VIDEO StreamFormatI420_Capture =
{
// KSDATARANGE
{
sizeof (KS_DATARANGE_VIDEO), // FormatSize
0, // Flags
(D_X * D_Y * 12)/8, // SampleSize
0, // Reserved
//MEDIATYPE_Video
STATIC_KSDATAFORMAT_TYPE_VIDEO, // aka. MEDIATYPE_Video
//MEDIASUBTYPE_I420
//0x59565955, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38,
0x9b, 0x71, //MEDIASUBTYPE_UYVY,
FCC_FORMAT_YUV12A, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38,
0x9b, 0x71,
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO // 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
{
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO, // GUID
KS_AnalogVideo_NTSC_M |
KS_AnalogVideo_PAL_B, // AnalogVideoStandard
720,480, // InputSize, (the inherent size of the incoming
signal
// with every digitized pixel unique)
160,120, // MinCroppingSize, smallest rcSrc cropping rect
allowed
720,480, // MaxCroppingSize, largest rcSrc cropping rect
allowed
1, // CropGranularityX, granularity of cropping size
1, // CropGranularityY
1, // CropAlignX, alignment of cropping rect
1, // CropAlignY;
160, 120, // MinOutputSize, smallest bitmap stream can produce
720, 480, // MaxOutputSize, largest bitmap stream can produce
1, // OutputGranularityX, granularity of output bitmap
size
1, // OutputGranularityY;
0, // StretchTapsX (0 no stretch, 1 pix dup, 2
interp...)
0, // StretchTapsY
0, // ShrinkTapsX
0, // ShrinkTapsY
333667, // MinFrameInterval, 100 nS units
640000000, // MaxFrameInterval, 100 nS units
(8 * 12 * 30 * 160 * 120)/8, // MinBitsPerSecond;
(8 * 12 * 30 * 720 * 480)/8 // MaxBitsPerSecond;
},

// KS_VIDEOINFOHEADER (default format)
{
0,0,0,0, // RECT rcSource;
0,0,0,0, // RECT rcTarget;
(D_X * D_Y * 12 * 30)/8, // DWORD dwBitRate;
0L, // DWORD dwBitErrorRate;
333667, // REFERENCE_TIME
AvgTimePerFrame;

sizeof (KS_BITMAPINFOHEADER), // DWORD biSize;
D_X, // LONG
 
 
 

Testcap DDK sample and I420 stream data format

Post by Davi » Wed, 09 Jul 2008 12:11:15

i all,

I try to change stream data format in Testcap DDK sample from UYU2 to I420
but it work incorrect when display preview bin in some chat program, i print
debug and see stream data format width: 320, height: 240, bitcount: 24, it
is format of RGB24, but when display seem it is I420, i do not know why.

Following is my define I420 format:

#define FCC_FORMAT_YUV12A mmioFOURCC('I','4','2','0')

#define D_X 320
#define D_Y 240


static KS_DATARANGE_VIDEO StreamFormatI420_Capture =
{
// KSDATARANGE
{
sizeof (KS_DATARANGE_VIDEO), // FormatSize
0, // Flags
(D_X * D_Y * 12)/8, // SampleSize
0, // Reserved
//MEDIATYPE_Video
STATIC_KSDATAFORMAT_TYPE_VIDEO, // aka. MEDIATYPE_Video
//MEDIASUBTYPE_I420
//0x59565955, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38,
0x9b, 0x71, //MEDIASUBTYPE_UYVY,
FCC_FORMAT_YUV12A, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38,
0x9b, 0x71,
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO // 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
{
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO, // GUID
KS_AnalogVideo_NTSC_M |
KS_AnalogVideo_PAL_B, // AnalogVideoStandard
720,480, // InputSize, (the inherent size of the incoming
signal
// with every digitized pixel unique)
160,120, // MinCroppingSize, smallest rcSrc cropping rect
allowed
720,480, // MaxCroppingSize, largest rcSrc cropping rect
allowed
1, // CropGranularityX, granularity of cropping size
1, // CropGranularityY
1, // CropAlignX, alignment of cropping rect
1, // CropAlignY;
160, 120, // MinOutputSize, smallest bitmap stream can produce
720, 480, // MaxOutputSize, largest bitmap stream can produce
1, // OutputGranularityX, granularity of output bitmap
size
1, // OutputGranularityY;
0, // StretchTapsX (0 no stretch, 1 pix dup, 2
interp...)
0, // StretchTapsY
0, // ShrinkTapsX
0, // ShrinkTapsY
333667, // MinFrameInterval, 100 nS units
640000000, // MaxFrameInterval, 100 nS units
(8 * 12 * 30 * 160 * 120)/8, // MinBitsPerSecond;
(8 * 12 * 30 * 720 * 480)/8 // MaxBitsPerSecond;
},

// KS_VIDEOINFOHEADER (default format)
{
0,0,0,0, // RECT rcSource;
0,0,0,0, // RECT rcTarget;
(D_X * D_Y * 12 * 30)/8, // DWORD dwBitRate;
0L, // DWORD dwBitErrorRate;
333667, // REFERENCE_TIME
AvgTimePerFrame;

sizeof (KS_BITMAPINFOHEADER), // DWORD biSize;
D_X, // LONG biWidth;