Discussion:
WMV Encoder DMO setup
(too old to reply)
keichin
2006-05-24 03:00:12 UTC
Permalink
hello.

It becomes an error by SetOutputType() though WMV Encoder DMO(Without
Filter) is set up as follows as use.
Where is the problem?

--
void test() {

IMediaObject* m_mediaObject;

HRESULT hr;
/*
EXTERN_GUID(CLSID_CWMVEncMediaObject2,
0x96b57cdd, 0x8966, 0x410c, 0xbb, 0x1f, 0xc9, 0x7e, 0xea, 0x76,
0x5c, 0x04);
*/
CLSID clsid = CLSID_CWMVEncMediaObject2;



hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,
IID_IMediaObject, (void **)&m_mediaObject);
if (FAILED(hr)) {
MessageBox("CoCreateInstance ERROR");
return;
}

// WMV Encoder DMO SetInputType
DMO_MEDIA_TYPE in;
VIDEOINFOHEADER vih;

memset(&in, 0x00, sizeof(DMO_MEDIA_TYPE));
memset(&vih, 0x00, sizeof(VIDEOINFOHEADER));

hr = m_mediaObject->GetInputType(0,0,&in);

vih.bmiHeader.biWidth = 320;
vih.bmiHeader.biHeight = 240;
vih.bmiHeader.biPlanes = 1;
vih.bmiHeader.biBitCount = 24;
vih.bmiHeader.biCompression = 0;
vih.bmiHeader.biSizeImage = vih.bmiHeader.biWidth *
vih.bmiHeader.biHeight * (vih.bmiHeader.biBitCount / 8);
vih.bmiHeader.biXPelsPerMeter = 0;
vih.bmiHeader.biYPelsPerMeter = 0;
vih.bmiHeader.biClrUsed = 0;
vih.bmiHeader.biClrImportant = 0;
vih.bmiHeader.biSize = sizeof(vih.bmiHeader);
vih.AvgTimePerFrame = 333333;
vih.dwBitRate = 912000;

in.majortype = MEDIATYPE_Video;
in.subtype = MEDIASUBTYPE_RGB24;
in.bFixedSizeSamples = TRUE;
in.bTemporalCompression = 0;
in.lSampleSize = vih.bmiHeader.biSizeImage;
in.formattype = FORMAT_VideoInfo;
in.cbFormat = sizeof(VIDEOINFOHEADER);
in.pbFormat = (BYTE *)&vih;
in.pUnk = NULL;

hr = m_mediaObject->SetInputType(0, &in, 0);
if (FAILED(hr)) {
MessageBox("SetInputType ERROR");
}
// WMV Encoder DMO SetOutputType
DMO_MEDIA_TYPE out;
memset(&out, 0x00, sizeof(DMO_MEDIA_TYPE));
memset(&vih, 0x00, sizeof(VIDEOINFOHEADER));

vih->bmiHeader.biWidth = 320;
vih.bmiHeader.biHeight = 240;
vih.bmiHeader.biPlanes = 1;
vih.bmiHeader.biBitCount = 24;
vih.bmiHeader.biCompression = 861293911;// WMV3
vih.bmiHeader.biSizeImage = vih.bmiHeader.biWidth *
vih.bmiHeader.biHeight * (vih.bmiHeader.biBitCount / 8);
vih.bmiHeader.biXPelsPerMeter = 0;
vih.bmiHeader.biYPelsPerMeter = 0;
vih.bmiHeader.biClrUsed = 0;
vih.bmiHeader.biClrImportant = 0;
vih.bmiHeader.biSize = sizeof(viho.bmiHeader);
vih.AvgTimePerFrame = 333333;
vih.dwBitRate = 920678;

out.majortype = MEDIATYPE_Video;
out.subtype = WMV3;
out.bFixedSizeSamples = FALSE;
out.bTemporalCompression = 1;
out.lSampleSize = 0;
out.formattype = FORMAT_VideoInfo;
out.cbFormat = sizeof(VIDEOINFOHEADER);
out.pbFormat = (BYTE *)&vihp;
out.pUnk = NULL;

hr = m_mediaObject->SetOutputType(0, &out, 0);
// return DMO_E_TYPE_NOT_ACCEPTED (0x80040205)
if (FAILED(hr)) {
MessageBox("SetOutputType ERROR");
}
}
The March Hare [MVP]
2006-05-24 03:24:16 UTC
Permalink
hello....
This newsgroup is no longer active. Please see

http://tmhare.mvps.org/help.htm#where

to find the active dshow newsgroups and post in the most appropriate one.

In the future, I recommend you look at a few posts in a newsgroup before
posting in it.

060523.1
--
Microsoft MVPs: http://www.microsoft.com/mvp and
MVPs.org site http://www.mvps.org
My dshow site: http://tmhare.mvps.org
Loading...