Brian Barber
Guest
|
Posted:
Fri Mar 04, 2005 9:02 am Post subject:
WMVEncoder DMO and MP4S |
|
|
The information on the ouput pins of the WMVEncoder DMO indicate that it
supports MP4S and MP43 (among others). I created a render filter that
supports the MP4S media type (see snippet below). I place connect the source
to the WMVEncoder; that works fine. I cannot get the WMVEncdoer output pin
to connect. If I replace the MP4S GUID with MP43, it connects!!.
Why won't it connect with MP4S?
My OS is XP Pro SP2. Microsoft DirectX 9.0 SDK (Summer 2004)
// code snippet from my render filter
mediaType->SetType( &MEDIATYPE_Video);
// if GUID_MP4S is replaced with GUID_MP43
// then everything works
mediaType->SetSubtype( &GUID_MP4S); //&GUID_MP43);
mediaType->SetFormatType( &FORMAT_VideoInfo);
mediaType->bTemporalCompression = 0;
mediaType->lSampleSize = 0;
mediaType->bFixedSizeSamples = 0;
// adding the codecSpecificData was an act of (fruitless)
// desparation
BYTE *p = new BYTE[ 106]; // length of VIDEOINFOHEADER + codecSpecificData
VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)p;
BYTE codecSpecificData[18] = {0x01, 0x00, 0x00, 0x00, 0x01, 0x20, 0x02,
0x04, 0x40, 0x07, 0x68, 0x50, 0x21, 0x00, 0xa3, 0x1f};
// Initialize the media format structure ...
vih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER) + 18;
vih->bmiHeader.biCompression = 0x5334504D; // fourcc code
vih->bmiHeader.biWidth = 320;
vih->bmiHeader.biHeight = 240;
vih->bmiHeader.biPlanes = 1;
vih->bmiHeader.biBitCount = 12;
vih->rcTarget.left = 0;
vih->rcTarget.top = 0;
vih->rcTarget.right = 320;
vih->rcTarget.bottom = 240;
vih->rcSource = vih->rcTarget;
vih->dwBitRate = 5000000;
vih->dwBitErrorRate = 0;
vih->AvgTimePerFrame = 333667;
vih->bmiHeader.biXPelsPerMeter = 0;
vih->bmiHeader.biYPelsPerMeter = 0;
vih->bmiHeader.biClrUsed = 0;
vih->bmiHeader.biClrImportant = 0;
memcpy( (p + sizeof( VIDEOINFOHEADER)), codecSpecificData, 18);
mediaType->SetFormat( p, 106);
|
|