Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This DMO/DSP is dual interfaced and is both a DMO with <code>IMediaObject</code> and an MFT with <code>IMFTransform</code>. The two interfaces share a lot common, and here is a code snippet to test initialization of RGB24 into YV12 conversion:</p> <pre><code>#include "stdafx.h" #include &lt;dshow.h&gt; #include &lt;dmo.h&gt; #include &lt;wmcodecdsp.h&gt; #pragma comment(lib, "strmiids.lib") #pragma comment(lib, "wmcodecdspuuid.lib") int _tmain(int argc, _TCHAR* argv[]) { ATLVERIFY(SUCCEEDED(CoInitialize(NULL))); CComPtr&lt;IMediaObject&gt; pMediaObject; ATLVERIFY(SUCCEEDED(pMediaObject.CoCreateInstance(CLSID_CColorConvertDMO))); VIDEOINFOHEADER InputVideoInfoHeader; ZeroMemory(&amp;InputVideoInfoHeader, sizeof InputVideoInfoHeader); InputVideoInfoHeader.bmiHeader.biSize = sizeof InputVideoInfoHeader.bmiHeader; InputVideoInfoHeader.bmiHeader.biWidth = 1920; InputVideoInfoHeader.bmiHeader.biHeight = 1080; InputVideoInfoHeader.bmiHeader.biPlanes = 1; InputVideoInfoHeader.bmiHeader.biBitCount = 24; InputVideoInfoHeader.bmiHeader.biCompression = BI_RGB; InputVideoInfoHeader.bmiHeader.biSizeImage = 1080 * (1920 * 3); DMO_MEDIA_TYPE InputMediaType; ZeroMemory(&amp;InputMediaType, sizeof InputMediaType); InputMediaType.majortype = MEDIATYPE_Video; InputMediaType.subtype = MEDIASUBTYPE_RGB24; InputMediaType.bFixedSizeSamples = TRUE; InputMediaType.bTemporalCompression = FALSE; InputMediaType.lSampleSize = InputVideoInfoHeader.bmiHeader.biSizeImage; InputMediaType.formattype = FORMAT_VideoInfo; InputMediaType.cbFormat = sizeof InputVideoInfoHeader; InputMediaType.pbFormat = (BYTE*) &amp;InputVideoInfoHeader; const HRESULT nSetInputTypeResult = pMediaObject-&gt;SetInputType(0, &amp;InputMediaType, 0); _tprintf(_T("nSetInputTypeResult 0x%08x\n"), nSetInputTypeResult); VIDEOINFOHEADER OutputVideoInfoHeader = InputVideoInfoHeader; OutputVideoInfoHeader.bmiHeader.biBitCount = 12; OutputVideoInfoHeader.bmiHeader.biCompression = MAKEFOURCC('Y', 'V', '1', '2'); OutputVideoInfoHeader.bmiHeader.biSizeImage = 1080 * 1920 * 12 / 8; DMO_MEDIA_TYPE OutputMediaType = InputMediaType; OutputMediaType.subtype = MEDIASUBTYPE_YV12; OutputMediaType.lSampleSize = OutputVideoInfoHeader.bmiHeader.biSizeImage; OutputMediaType.cbFormat = sizeof OutputVideoInfoHeader; OutputMediaType.pbFormat = (BYTE*) &amp;OutputVideoInfoHeader; const HRESULT nSetOutputTypeResult = pMediaObject-&gt;SetOutputType(0, &amp;OutputMediaType, 0); _tprintf(_T("nSetOutputTypeResult 0x%08x\n"), nSetOutputTypeResult); // TODO: ProcessInput, ProcessOutput pMediaObject.Release(); CoUninitialize(); return 0; } </code></pre> <p>This should work fine and print two <code>S_OK</code>s out...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload