Hi:
I am writing a AVSTREAM driver for a video camera which generate MPEG-4 data.
When I connect my filter to DirectShow Mpeg4s Decoder DMO in GrahpEdit, error code
0x80040217 was returned.
I tried to write a Win32 application to make the connection.
The AM_MEDIA_TYPE support by my source output pin can be accepted by the decoder,
IPin::QueryAccept(…) == S_OK
but both IGraphBuilder::Connect and IGraphBuilder::ConnectDirect failed. (0x80040217)
I have studied the DirectShow 9.0 document = “How Filters Connect”, and make some changes in my driver, but still failed.
I am sure that my driver works perfectly with MJPEG foramt.
What’s the mystery of MPEG-4 in kernel mode driver?
I can render a ASF file(M4S2) with ASF reader filer and Mpeg4s decoder DMO in GraphEdit, so I guess the system did support the correct MPEG-4 decoder codec.
Please help to give me some direction.
Here is the part of my code
#define D_X 704
#define D_Y 576
#define MAX_FR 30
#define MIN_FR 1
#define AVG_FR 30
const
KS_DATARANGE_VIDEO_M4S2
VF_M4S2_320_240 =
{
//KSDATARANGE
{
sizeof(KS_DATARANGE_VIDEO2) + VFCP_DATARANGE_EXTENSION_SIZE, //FormatSize
0, //Flags
0, //SampleSize
0, //Reserved
STATIC_KSDATAFORMAT_TYPE_VIDEO, //MajorFormat,
0x3253344D, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71, //SubFormat M4S2
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO2 //Specifier
},
FALSE, //bFixedSizeSamples
TRUE, //bTemporalCompression,
0, //StreamDescriptionFlags
0, //MemoryAllocationFlags
//KS_VIDEO_STREAM_CONFIG_CAPS
{
STATIC_KSDATAFORMAT_SPECIFIER_VIDEOINFO2,
KS_AnalogVideo_None,
D_X, D_Y,
D_X, D_Y,
D_X, D_Y,
1,
1,
1,
1,
D_X, D_Y,
D_X, D_Y,
1,
1,
0,
0,
0,
0,
10000000 / MAX_FR,
10000000 / MIN_FR,
MIN_FR * 24 * D_X * D_Y,
MAX_FR * 24 * D_X * D_Y
},
//KS_VIDEOINFOHEADER2
{
0, 0, D_X, D_Y, //rcSource
0, 0, D_X, D_Y, //rcTarget
0, //dwBitRate
0, //dwBitErrorRate
10000000 / AVG_FR, //AvgTimePerFrame
0, //InterlacedFlags
0, //CopyProtectFlags
D_X, //PicAspectRatioX
D_Y, //PicAspectRatioY
0, //ControlFlags
0, //Reserved2
sizeof(KS_BITMAPINFOHEADER) + VFCP_DATARANGE_EXTENSION_SIZE, //biSize
D_X, //biWidth
D_Y, //biHeight
1, //biPlanes
24, //biBitCount
FOURCC_M4S2, //biCompression
D_X * D_Y * 3, //biSizeImage
0, //biXPelsPerMeter
0, //biYPelsPerMeter
0, //biClrUsed
0 //biClrImportant
},
const
PKSDATARANGE
VFCPDataRanges[1] =
{
(PKSDATARANGE) &VF_M4S2_704_576
}
DECLARE_SIMPLE_FRAMING_EX(VFCPAllocatorFraming,
STATICGUIDOF(KSMEMORY_TYPE_KERNEL_NONPAGED),
KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY | KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY,
10, //Frames
0, //Alignment
704*576*3, //MinFrameSize
704*576*3); //MaxFrameSize