Exemplo n.º 1
0
void DisplayDMOTypeInfo(const GUID *pCLSID, 
                        ULONG& ulNumInputsSupplied,  CListBox& ListInputTypes,
                        ULONG& ulNumOutputsSupplied, CListBox& ListOutputTypes)
{
    const int NUM_PAIRS=20;
    HRESULT hr;
    DMO_PARTIAL_MEDIATYPE aInputTypes[NUM_PAIRS]={0}, 
                          aOutputTypes[NUM_PAIRS]={0};
    ULONG ulNumInputTypes=NUM_PAIRS, ulNumOutputTypes=NUM_PAIRS, i;
    TCHAR szCLSID[128];

    // Read type/subtype information
    hr = DMOGetTypes(
        *pCLSID,
        ulNumInputTypes,  &ulNumInputsSupplied,  aInputTypes,
        ulNumOutputTypes, &ulNumOutputsSupplied, aOutputTypes);

    if (FAILED(hr))
        return;

    // Show input type/subtype pairs
    for (i=0; i<ulNumInputsSupplied; i++)
    {
        GetTypeSubtypeString(szCLSID, aInputTypes[i]);
        ListInputTypes.AddString(szCLSID);
    }

    // Show output type/subtype pairs
    for (i=0; i<ulNumOutputsSupplied; i++)
    {
        GetTypeSubtypeString(szCLSID, aOutputTypes[i]);
        ListOutputTypes.AddString(szCLSID);
    }
}
void MainDialog::AddTypeInfo(const GUID *pCLSID)
{
    const int NUM_PAIRS=20;
    HRESULT hr;
    DMO_PARTIAL_MEDIATYPE aInputTypes[NUM_PAIRS]={0}, 
                          aOutputTypes[NUM_PAIRS]={0};
    ULONG ulNumInputsSupplied, ulNumOutputsSupplied;
    ULONG ulNumInputTypes=NUM_PAIRS, ulNumOutputTypes=NUM_PAIRS, i;
    TCHAR szCLSID[128];
    TCHAR szNum[10];

    // Clear the type/subtype GUID boxes
    ClearTypeLists();

    // Read type/subtype information
    hr = DMOGetTypes(
        *pCLSID,
        ulNumInputTypes,
        &ulNumInputsSupplied,
        aInputTypes,
        ulNumOutputTypes,
        &ulNumOutputsSupplied,
        aOutputTypes);

	// Display the number of input/output type/subtype pairs found
    if (SUCCEEDED(hr))
	{
		hr = StringCchPrintf(szNum, NUMELMS(szNum), TEXT("%d\0"), ulNumInputsSupplied);
	}

	if (SUCCEEDED(hr))
	{
		SetDlgItemText(IDC_STATIC_NUM_ITYPES, szNum);
	}

	if (SUCCEEDED(hr))
	{
		hr = StringCchPrintf(szNum, NUMELMS(szNum), TEXT("%d\0"), ulNumOutputsSupplied);
	}
   
	if (SUCCEEDED(hr))
	{
		SetDlgItemText(IDC_STATIC_NUM_OTYPES, szNum);
	}

	if (SUCCEEDED(hr))
	{
	    // Show input type/subtype pairs
		for (i=0; i<ulNumInputsSupplied; i++)
		{
			hr = GetTypeSubtypeString(szCLSID, NUMELMS(szCLSID), aInputTypes[i]);
			if (SUCCEEDED(hr))
			{
				m_ListInputTypes.AddString(szCLSID);
			}
		}

		// Show output type/subtype pairs
		for (i=0; i<ulNumOutputsSupplied; i++)
		{
			hr = GetTypeSubtypeString(szCLSID, NUMELMS(szCLSID), aOutputTypes[i]);
			if (SUCCEEDED(hr))
			{
				m_ListOutputTypes.AddString(szCLSID);
			}
		}
	}
}