void CSystemDeviceEnumerator::EnumerateDMOs(const IID clsidDMOCategory)
{
	IEnumDMO* pEnum = NULL; 
	HRESULT hr = DMOEnum(
		clsidDMOCategory,			// Category
		DMO_ENUMF_INCLUDE_KEYED,	// Included keyed DMOs
		0, NULL,					// Input types (don't care)
		0, NULL,					// Output types (don't care)
		&pEnum);

	if (SUCCEEDED(hr)) 
	{
		CLSID clsidDMO;
		WCHAR* wszName;
		do
		{
			hr = pEnum->Next(1, &clsidDMO, &wszName, NULL);
			if (hr == S_OK) 
			{  
				// Now wszName holds the friendly name of the DMO, 
				// and clsidDMO holds the CLSID. 
				CString sName(wszName);
				m_listDMOs.push_back(sName);
				CoTaskMemFree(wszName);
			}
		} while (hr == S_OK);
		pEnum->Release();
	}
}
示例#2
0
//Инициализирует массивы *DMO*
//Функцию достаточно вызвать единожды (если не потребуется DMO другой категории)
void CDirectShow::UpdateDMOArray(DMOCATEGORY dCategory)
{
	IEnumDMO *pEnumDMO = NULL;
	LPWSTR lpwDMOTmp[E_MAX_ARR_SIZE];
	for (m_lCounter = 0; m_lCounter < E_MAX_ARR_SIZE; m_lCounter++)
	{
		lpwDMOTmp[m_lCounter] = NULL;
		if (m_lpwDMONames[m_lCounter])
		{
			delete[] m_lpwDMONames[m_lCounter];
			m_lpwDMONames[m_lCounter] = NULL;
		}
		ZeroMemory(&m_cDMOCLSIDs[m_lCounter], sizeof(m_cDMOCLSIDs[m_lCounter]));
	}
	ZeroMemory(&m_gidRecentDMOCat, sizeof(m_gidRecentDMOCat));
	switch (dCategory)
	{
		case DMO_CATEGORY_AUDIO_DECODER:
			m_gidRecentDMOCat = DMOCATEGORY_AUDIO_DECODER;
			break;
		case DMO_CATEGORY_AUDIO_EFFECT:
			m_gidRecentDMOCat = DMOCATEGORY_AUDIO_EFFECT;
			break;
		case DMO_CATEGORY_AUDIO_ENCODER:
			m_gidRecentDMOCat = DMOCATEGORY_AUDIO_ENCODER;
			break;
		case DMO_CATEGORY_VIDEO_DECODER:
			m_gidRecentDMOCat = DMOCATEGORY_VIDEO_DECODER;
			break;
		case DMO_CATEGORY_VIDEO_EFFECT:
			m_gidRecentDMOCat = DMOCATEGORY_VIDEO_EFFECT;
			break;
		case DMO_CATEGORY_VIDEO_ENCODER:
			m_gidRecentDMOCat = DMOCATEGORY_VIDEO_ENCODER;
			break;
		case DMO_CATEGORY_AUDIO_CAPTURE_EFFECT:
			m_gidRecentDMOCat = DMOCATEGORY_AUDIO_CAPTURE_EFFECT;
			break;
		default:
			return;
	}
    if (FAILED(DMOEnum(m_gidRecentDMOCat, DMO_ENUMF_INCLUDE_KEYED, 0,
		NULL, 0, NULL, &pEnumDMO))) return;
	pEnumDMO->Next(E_MAX_ARR_SIZE, &m_cDMOCLSIDs[0], &lpwDMOTmp[0], &m_lDMOCount);
	if (!m_lDMOCount) return;
	for (m_lCounter = 0; m_lCounter < m_lDMOCount; m_lCounter++)
	{
		m_lpwDMONames[m_lCounter] = new WCHAR[MAX_PATH];
		wcscpy(m_lpwDMONames[m_lCounter], lpwDMOTmp[m_lCounter]);
		CoTaskMemFree(lpwDMOTmp[m_lCounter]);
	}
	pEnumDMO->Release();
}
示例#3
0
void EnumDMO(bool bEnc)
{
	char buf[256];
	WCHAR wbuf[256];
	WCHAR *pwsz;
	IEnumDMO *pEnumDMO;
	CLSID clsid;
	DWORD dwCount;

	DMOEnum(bEnc ? DMOCATEGORY_VIDEO_ENCODER : DMOCATEGORY_VIDEO_DECODER, DMO_ENUMF_INCLUDE_KEYED, 0, NULL, 0, NULL, &pEnumDMO);
	while (pEnumDMO->Next(1, &clsid, &pwsz, &dwCount) == S_OK)
	{
		StringFromGUID2(clsid, wbuf, _countof(wbuf));
		wsprintf(buf, "DMO\t%d\t%S\t%S\n", bEnc, pwsz, wbuf);
		printf("%s", buf);
		CoTaskMemFree(pwsz);
	}
	pEnumDMO->Release();
}
示例#4
0
HRESULT AddDMOsToList(const GUID *clsid, CListBox& ListFilters, BOOL bIncludeKeyed) 
{
    HRESULT hr;    
    IEnumDMO *pEnum = NULL;
    int nFilters=0;
    DWORD dwFlags = bIncludeKeyed ? DMO_ENUMF_INCLUDE_KEYED : 0;

    // Enumerate all DMOs of the selected category  
    hr = DMOEnum(*clsid, dwFlags, 0, NULL, 0, NULL, &pEnum);
    if (FAILED(hr))
        return hr;

    // Enumerate all filters using the category enumerator
    hr = EnumDMOsToList(pEnum, ListFilters, nFilters);

    // Now that the DMOs (if any) are enumerated and added 
    // to the list, go ahead and select the first one.
    ListFilters.SetCurSel(0);
    pEnum->Release();
    return hr;
}