Example #1
0
gboolean
gst_dshow_show_propertypage (IBaseFilter * base_filter)
{
  gboolean ret = FALSE;
  ISpecifyPropertyPages *pProp = NULL;
  HRESULT hres =
      base_filter->QueryInterface (IID_ISpecifyPropertyPages, (void **) &pProp);
  if (SUCCEEDED (hres)) {
    /* Get the filter's name and IUnknown pointer. */
    FILTER_INFO FilterInfo;
    CAUUID caGUID;
    IUnknown *pFilterUnk = NULL;
    hres = base_filter->QueryFilterInfo (&FilterInfo);
    base_filter->QueryInterface (IID_IUnknown, (void **) &pFilterUnk);

    /* Show the page. */
    pProp->GetPages (&caGUID);
    pProp->Release ();
    OleCreatePropertyFrame (GetDesktopWindow (), 0, 0, FilterInfo.achName,
        1, &pFilterUnk, caGUID.cElems, caGUID.pElems, 0, 0, NULL);

    pFilterUnk->Release ();
    FilterInfo.pGraph->Release ();
    CoTaskMemFree (caGUID.pElems);
  }
  return ret;
}
HRESULT videoInputCamera::ShowFilterPropertyPages(IBaseFilter *pFilter){

	ISpecifyPropertyPages *pProp;
	HRESULT hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pProp);
	if (SUCCEEDED(hr))
	{
		// Get the filter's name and IUnknown pointer.
		FILTER_INFO FilterInfo;
		hr = pFilter->QueryFilterInfo(&FilterInfo);
		IUnknown *pFilterUnk;
		pFilter->QueryInterface(IID_IUnknown, (void **)&pFilterUnk);

		// Show the page.
		CAUUID caGUID;
		pProp->GetPages(&caGUID);
		pProp->Release();
		OleCreatePropertyFrame(
			NULL,                   // Parent window
			0, 0,                   // Reserved
			FilterInfo.achName,     // Caption for the dialog box
			1,                      // Number of objects (just the filter)
			&pFilterUnk,            // Array of object pointers.
			caGUID.cElems,          // Number of property pages
			caGUID.pElems,          // Array of property page CLSIDs
			0,                      // Locale identifier
			0, NULL                 // Reserved
			);

		// Clean up.
		if(pFilterUnk)pFilterUnk->Release();
		if(FilterInfo.pGraph)FilterInfo.pGraph->Release();
		CoTaskMemFree(caGUID.pElems);
	}
	return hr;
}
Example #3
0
void CFilterProp::ShowProperties()
{
	if ( !pGB ) return;

    HRESULT hr;
    IBaseFilter *pFilter = NULL;
    TCHAR szNameToFind[128];
    ISpecifyPropertyPages *pSpecify;

    // Read the current filter name from the list box
    int nCurSel = m_ListFilters.GetCurSel();
    m_ListFilters.GetText(nCurSel, szNameToFind);

    // Read the current list box name and find it in the graph
    pFilter = FindFilterFromName(szNameToFind);
    if (!pFilter)
        return;

    // Discover if this filter contains a property page
    hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpecify);
    if (SUCCEEDED(hr)) 
    {
        do 
        {
            FILTER_INFO FilterInfo;
            hr = pFilter->QueryFilterInfo(&FilterInfo);
            if (FAILED(hr))
                break;

            CAUUID caGUID;
            hr = pSpecify->GetPages(&caGUID);
            if (FAILED(hr))
                break;

            pSpecify->Release();
        
            // Display the filter's property page
            OleCreatePropertyFrame(
                m_hWnd,                 // Parent window
                0,                      // x (Reserved)
                0,                      // y (Reserved)
                FilterInfo.achName,     // Caption for the dialog box
                1,                      // Number of filters
                (IUnknown **)&pFilter,  // Pointer to the filter 
                caGUID.cElems,          // Number of property pages
                caGUID.pElems,          // Pointer to property page CLSIDs
                0,                      // Locale identifier
                0,                      // Reserved
                NULL                    // Reserved
            );
            CoTaskMemFree(caGUID.pElems);
            FilterInfo.pGraph->Release(); 

        } while(0);
    }

    pFilter->Release();

}
Example #4
0
bool CTSProcessor::IsPropertyPageSupported() const
{
	ISpecifyPropertyPages *pSpecifyPropPages;

	if (FAILED(m_pTSProcessor->QueryInterface(IID_PPV_ARGS(&pSpecifyPropPages))))
		return false;

	pSpecifyPropPages->Release();

	return true;
}
Example #5
0
HRESULT CFilterProp::EnumFilters()
{
	if ( !pGB ) return E_FAIL;

    HRESULT hr;
    IEnumFilters *pEnum = NULL;
    IBaseFilter *pFilter = NULL;
    ULONG cFetched;

    // Clear filters list box
    m_ListFilters.ResetContent();
    
    // Get filter enumerator
    hr = pGB->EnumFilters(&pEnum);
    if (FAILED(hr))
    {
        m_ListFilters.AddString(TEXT("<ERROR>"));
        return hr;
    }

    // Enumerate all filters in the graph
    while(pEnum->Next(1, &pFilter, &cFetched) == S_OK)
    {
        FILTER_INFO FilterInfo;
        TCHAR szName[256];
        
        hr = pFilter->QueryFilterInfo(&FilterInfo);
        if (FAILED(hr))
        {
            m_ListFilters.AddString(TEXT("<ERROR>"));
        }
        else
        {
				ISpecifyPropertyPages *pSpecify;
				hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpecify);
				if (SUCCEEDED(hr)) 
				{
	            pSpecify->Release();

					// Add the filter name to the filters listbox
					USES_CONVERSION;

					lstrcpy(szName, W2T(FilterInfo.achName));
					m_ListFilters.AddString(szName);

				}
				FilterInfo.pGraph->Release();
        }       
        pFilter->Release();
    }
    pEnum->Release();

    return hr;
}
Example #6
0
//Вызывает окно свойств фильтра lpwFGFilName
//Если параметр bCheck равен TRUE, функция лишь проверит наличие у фильтра окна свойств,
//и вернет значение больше нуля, если таковое окно имеется
//Перед вызовом этой функции желательно вызвать UpdateFGFiltersArray()
//В случае ошибки/отсутствия у фильтра окна свойств функция вернет значение меньше нуля
int CDirectShow::FGFiltersPropertyPages(LPCWSTR lpwFGFilName, BOOL bCheck)
{
	if (!m_lFGFilCount) return -1;
	ISpecifyPropertyPages *pSpecifyPP = NULL;
	FILTER_INFO FI = { 0 };
	for (m_lCounter = 0; m_lCounter < m_lFGFilCount; m_lCounter++)
	{
		if (m_pFGBaseFilter[m_lCounter] == NULL) return -1;
		if (FAILED(m_pFGBaseFilter[m_lCounter]->QueryFilterInfo(&FI)))
		{
			if (m_lCounter >= (m_lFGFilCount - 1))
				return -1; else continue;
		}
		else
		{
			SR(FI.pGraph);
			if (_wcsicmp(FI.achName, lpwFGFilName) == 0)
			{
				if (FAILED(m_pFGBaseFilter[m_lCounter]->QueryInterface(IID_ISpecifyPropertyPages,
					(LPVOID *)&pSpecifyPP)))
				{
					return -1;
				}
				else
				{
					if (bCheck)
					{
						pSpecifyPP->Release();
						return 1;
					}
					else
					{
						CAUUID caUUID = { 0 };
						pSpecifyPP->GetPages(&caUUID);
						pSpecifyPP->Release();
						HRESULT hRCPF = OleCreatePropertyFrame(m_hAppWnd, 0, 0, FI.achName, 1,
							(IUnknown **)&m_pFGBaseFilter[m_lCounter], caUUID.cElems, caUUID.pElems, 0, 0, NULL);
						CoTaskMemFree(caUUID.pElems);
						if (FAILED(hRCPF))
						{
							WCHAR lpwMsg[512] = { 0 };
							swprintf(lpwMsg, L"Unable to display '%s' properties.", FI.achName);
							DSErrorMsg(hRCPF, lpwMsg);
							return -1;
						}
						break;
					}
				}
			}
		}
	}
	return 0;
}
Example #7
0
bool CTSProcessor::ShowPropertyPage(HWND hwndOwner, HINSTANCE hinst)
{
	ISpecifyPropertyPages *pSpecifyPropPages;

	if (FAILED(m_pTSProcessor->QueryInterface(IID_PPV_ARGS(&pSpecifyPropPages))))
		return false;

	CAUUID Pages;
	Pages.cElems = 0;
	Pages.pElems = nullptr;
	HRESULT hr = pSpecifyPropPages->GetPages(&Pages);
	if (SUCCEEDED(hr) && Pages.pElems != nullptr) {
		if (Pages.cElems > 0) {
			ISpecifyPropertyPages2 *pSpecifyPropPages2;
			if (SUCCEEDED(pSpecifyPropPages->QueryInterface(IID_PPV_ARGS(&pSpecifyPropPages2)))) {
				IPropertyPage **ppPropPages = new IPropertyPage*[Pages.cElems];
				ULONG PageCount = 0;
				for (ULONG i = 0; i < Pages.cElems; i++) {
					IPropertyPage *pPropPage;
					if (SUCCEEDED(pSpecifyPropPages2->CreatePage(Pages.pElems[i], &pPropPage)))
						ppPropPages[PageCount++] = pPropPage;
				}
				if (PageCount > 0) {
					hr = ShowPropertyPageFrame(ppPropPages, PageCount,
											   m_pTSProcessor, hwndOwner, hinst);
				}
				for (ULONG i = 0; i < PageCount; i++)
					ppPropPages[i]->Release();
				delete [] ppPropPages;
				pSpecifyPropPages2->Release();
			} else {
				IUnknown *pObject;
				hr = m_pTSProcessor->QueryInterface(IID_PPV_ARGS(&pObject));
				if (SUCCEEDED(hr)) {
					hr = ::OleCreatePropertyFrame(
						hwndOwner, 0, 0, L"プロパティ",
						1, &pObject, Pages.cElems, Pages.pElems,
						::GetUserDefaultLCID(),
						0, nullptr);
					pObject->Release();
				}
			}
		}
		::CoTaskMemFree(Pages.pElems);
	}

	pSpecifyPropPages->Release();

	return SUCCEEDED(hr);
}
Example #8
0
extern "C" void config()
{
  ISpecifyPropertyPages *spp;
  CAUUID cauuid;
  HRESULT hr;

  CoInitialize(0);
  warning();
  hr = CoCreateInstance(CLSID_AC3Filter, NULL, CLSCTX_INPROC_SERVER, IID_ISpecifyPropertyPages, (LPVOID *)&spp);
  hr = spp->GetPages(&cauuid);
  hr = OleCreatePropertyFrame(0, 30, 30, NULL, 1, (IUnknown **)&spp, cauuid.cElems, (GUID *)cauuid.pElems, 0, 0, NULL);
  CoTaskMemFree(cauuid.pElems);
  spp->Release();
  CoUninitialize();
}
Example #9
0
BOOL CMediaPlayerDlg::SupportsPropertyPage(IBaseFilter *pFilter)
{
    HRESULT hr;
    ISpecifyPropertyPages *pSpecify;

    // Discover if this filter contains a property page
    hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpecify);
    if (SUCCEEDED(hr))
    {
        pSpecify->Release();
        return TRUE;
    }
    else
        return FALSE;
}
Example #10
0
LONG CALLBACK CPlApplet(HWND hwndCPL, UINT uMsg, LPARAM lParam1, LPARAM lParam2) 
{ 
  ISpecifyPropertyPages *spp;
  CAUUID cauuid;
  HRESULT hr;
  LPCPLINFO lpCPlInfo; 
  
  switch (uMsg) 
  { 
  case CPL_INIT:      // first message, sent once 
    hinst = GetModuleHandle("ac3filter.ax");
    return TRUE; 
    
  case CPL_GETCOUNT:  // second message, sent once 
    return 1;
    break; 
    
  case CPL_INQUIRE:   // third message, sent once per application 
    lpCPlInfo = (LPCPLINFO) lParam2; 
    lpCPlInfo->lData = 0; 
    lpCPlInfo->idIcon = IDI_AC3FILTER;
    lpCPlInfo->idName = IDS_AC3FILTER;
    lpCPlInfo->idInfo = IDS_DESC;
    break; 
    
  case CPL_DBLCLK:    // application icon double-clicked 
    CoInitialize(0);
    warning();
    hr = CoCreateInstance(CLSID_AC3Filter, NULL, CLSCTX_INPROC_SERVER, IID_ISpecifyPropertyPages, (LPVOID *)&spp);
    hr = spp->GetPages(&cauuid);
    hr = OleCreatePropertyFrame(0, 30, 30, NULL, 1, (IUnknown **)&spp, cauuid.cElems, (GUID *)cauuid.pElems, 0, 0, NULL);
    CoTaskMemFree(cauuid.pElems);
    spp->Release();
    CoUninitialize();
    break; 
    
  case CPL_STOP:      // sent once per application before CPL_EXIT 
    break; 
    
  case CPL_EXIT:      // sent once before FreeLibrary is called 
    break; 
    
  default: 
    break; 
  } 
  return 0; 
} 
STDMETHODIMP TffDecoder::showCfgDlg(HWND owner)
{
 if (cfgDlgHnwd) return S_FALSE;
 ISpecifyPropertyPages *ispp;
 QueryInterface(IID_ISpecifyPropertyPages,(void**)&ispp);
 CAUUID pages;
 ispp->GetPages(&pages);
 IUnknown *ifflist[]={ispp};
 OleCreatePropertyFrame(owner,10,10,L"ffdshow",
                        1,ifflist,
                        pages.cElems,pages.pElems,
                        LOCALE_SYSTEM_DEFAULT,
                        0,0
                       );
 ispp->Release();
 return S_OK;
}
Example #12
0
HRESULT CBaseDSPropPage::ShowPropPageDialog(IBaseFilter *pFilter, HWND hwndOwner)
{
  CheckPointer(pFilter, E_INVALIDARG);
  CoInitialize(nullptr);

  // Get PropertyPages interface
  ISpecifyPropertyPages *pProp = nullptr;
  HRESULT hr = pFilter->QueryInterface<ISpecifyPropertyPages>(&pProp);
  if (SUCCEEDED(hr) && pProp) {
    // Get the filter's name and IUnknown pointer.
    FILTER_INFO FilterInfo;
    hr = pFilter->QueryFilterInfo(&FilterInfo);
    // We don't need the graph, so don't sit on a ref to it
    if (FilterInfo.pGraph)
      FilterInfo.pGraph->Release();

    IUnknown *pFilterUnk = nullptr;
    pFilter->QueryInterface<IUnknown>(&pFilterUnk);

    // Show the page.
    CAUUID caGUID;
    pProp->GetPages(&caGUID);
    pProp->Release();
    hr = OleCreatePropertyFrame(
        hwndOwner,              // Parent window
        0, 0,                   // Reserved
        FilterInfo.achName,     // Caption for the dialog box
        1,                      // Number of objects (just the filter)
        &pFilterUnk,            // Array of object pointers.
        caGUID.cElems,          // Number of property pages
        caGUID.pElems,          // Array of property page CLSIDs
        0,                      // Locale identifier
        0, nullptr              // Reserved
    );

    // Clean up.
    pFilterUnk->Release();
    CoTaskMemFree(caGUID.pElems);

    hr = S_OK;
  }
  CoUninitialize();
  return hr;
}
// @pymethod |PyISpecifyPropertyPages|GetPages|Description of GetPages.
PyObject *PyISpecifyPropertyPages::GetPages(PyObject *self, PyObject *args)
{
	ISpecifyPropertyPages *pISPP = GetI(self);
	if ( pISPP == NULL )
		return NULL;

	if ( !PyArg_ParseTuple(args, ":GetPages") )
		return NULL;

	CAUUID pages;
    pages.cElems=0;
    pages.pElems=NULL;

    HRESULT hr;
	PY_INTERFACE_PRECALL;
	hr = pISPP->GetPages( &pages );
	PY_INTERFACE_POSTCALL;

	if ( FAILED(hr) )
		return PyCom_BuildPyException(hr);

	PyObject *opages=PyTuple_New(pages.cElems);
    if(!opages)
    {
        ::CoTaskMemFree(pages.pElems);
        return NULL;
    }

    for(unsigned i=0;i<pages.cElems;++i)
    {
        PyObject *sub=PyWinObject_FromIID(pages.pElems[i]);
        if(!sub)
        {
            Py_DECREF(opages);
            ::CoTaskMemFree(pages.pElems);
            return NULL;
        }
		PyTuple_SET_ITEM(opages, i, sub);
    }

    ::CoTaskMemFree(pages.pElems);
    return opages;
}
Example #14
0
bool DirectShowUtil::HasPropertyPage(IBaseFilter *pFilter)
{
	bool bRet = false;

	if (pFilter) {
		ISpecifyPropertyPages *pProp = NULL;
		HRESULT hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void**)&pProp);
		if (SUCCEEDED(hr)) {
			CAUUID caGUID = {0, NULL};

			if (SUCCEEDED(pProp->GetPages(&caGUID))) {
				bRet = caGUID.cElems > 0;
				::CoTaskMemFree(caGUID.pElems);
			}
			SAFE_RELEASE(pProp);
		}
	}
	return bRet;
}
Example #15
0
// フィルタのプロパティページを開く
bool DirectShowUtil::ShowPropertyPage(IBaseFilter *pFilter, HWND hWndParent)
{
	if (!pFilter)
		return false;

	bool bRet = false;
	ISpecifyPropertyPages *pProp = NULL;

	HRESULT hr = pFilter->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pProp);
	if (SUCCEEDED(hr)) {
		CAUUID caGUID = {0, NULL};

		if (SUCCEEDED(pProp->GetPages(&caGUID))) {
			FILTER_INFO stFilterInfo;

			hr = pFilter->QueryFilterInfo(&stFilterInfo);
			if (SUCCEEDED(hr)) {
				IUnknown *pFilterUnk=NULL;

				hr = pFilter->QueryInterface(IID_IUnknown, (void **)&pFilterUnk);
				if (SUCCEEDED(hr)) {
					::OleCreatePropertyFrame(
						hWndParent,             // 親ウィンドウ。
						0, 0,                   // 予約済み。
						stFilterInfo.achName,   // ダイアログ ボックスのキャプション。
						1,                      // オブジェクト数 (フィルタのみ)。
						&pFilterUnk,            // オブジェクト ポインタの配列。
						caGUID.cElems,          // プロパティ ページ数。
						caGUID.pElems,          // プロパティ ページ CLSID の配列。
						0,                      // ロケール識別子。
						0, NULL                 // 予約済み。
					);
					SAFE_RELEASE(pFilterUnk);
					bRet = true;
				}
				SAFE_RELEASE(stFilterInfo.pGraph);
			}
			::CoTaskMemFree(caGUID.pElems);
		}
		SAFE_RELEASE(pProp);
	}
	return bRet;
}
Example #16
0
void CInMin::Setup()
{
	ISpecifyPropertyPages *pSpec = NULL;
	IBaseFilter* pBF = m_VideoCaptureDevice.GetIBaseFilter();
	if( pBF )
	{
		if( pBF->QueryInterface(IID_ISpecifyPropertyPages,(void **)&pSpec) == S_OK )
		{
			if( pSpec )
			{
				CAUUID cauuid;
				pSpec->GetPages(&cauuid);
				OleCreatePropertyFrame(0, 30, 30, NULL, 1, (IUnknown **)&pBF, cauuid.cElems, (GUID *)cauuid.pElems, 0, 0, NULL);
				CoTaskMemFree(cauuid.pElems);
				pSpec->Release();
			}
		}
	}
}
Example #17
0
    BOOL ShowPropertyPage(void)
    {
        if (!m_pFilter) return FALSE;
        ISpecifyPropertyPages *pProp;
        if ((m_res = m_pFilter->QueryInterface(IID_ISpecifyPropertyPages, (LPVOID *) &pProp)) == S_OK)
        {
            // Get the filter's name and IUnknown pointer.
            FILTER_INFO FilterInfo;
            m_res = m_pFilter->QueryFilterInfo(&FilterInfo);
            IUnknown *pFilterUnk;
            m_res = m_pFilter->QueryInterface(IID_IUnknown, (LPVOID *) &pFilterUnk);
            CAUUID caGUID;
            pProp->GetPages(&caGUID);
            pProp->Release();

            __try
            {
                m_res = OleCreatePropertyFrame(
                    NULL,                   // Parent window
                    0, 0,                   // Reserved
                    FilterInfo.achName,     // Caption for the dialog box
                    1,                      // Number of objects (just the filter)
                    &pFilterUnk,            // Array of object pointers.
                    caGUID.cElems,          // Number of property pages
                    caGUID.pElems,          // Array of property page CLSIDs
                    0,                      // Locale identifier
                    0, NULL                 // Reserved
                    );
            }
            __except(EXCEPTION_EXECUTE_HANDLER)
            {
            }
            // Clean up.
            pFilterUnk->Release();
            /* FIXME: it crashes (broken example on msdn?) */
            //FilterInfo.pGraph->Release();
            CoTaskMemFree(caGUID.pElems);
        }
Example #18
0
BOOL CDShowCtrl::SetMuxerProp()
{
	if( this->muxer == NULL ){
		return FALSE;
	}
	BOOL ret = TRUE;

	ISpecifyPropertyPages *prop = NULL;
	HRESULT hr = this->muxer->QueryInterface(IID_ISpecifyPropertyPages, (void**)&prop);
    if (FAILED(hr)){
		return FALSE;
	}

	FILTER_INFO FilterInfo;
	this->muxer->QueryFilterInfo(&FilterInfo);

	CAUUID caGUID;
	prop->GetPages(&caGUID);

	OleCreatePropertyFrame(
		NULL,                   // 親ウィンドウ
		0,                      // x (予約済み)
		0,                      // y (予約済み)
		FilterInfo.achName,     // ダイアログ ボックスのキャプション
		1,                      // フィルタの数
		(IUnknown **)&this->muxer,  // フィルタへのポインタ
		caGUID.cElems,          // プロパティ ページの数
		caGUID.pElems,          // プロパティ ページ CLSID へのポインタ
		0,                      // ロケール識別子
		0,                      // 予約済み
		NULL                    // 予約済み
	);
	CoTaskMemFree(caGUID.pElems);

	SAFE_RELEASE(prop);

	return ret;
}
/* -------------------- configure ---------------------- */
void CALLBACK configure(HWND hwnd,HINSTANCE hinst,LPTSTR lpCmdLine,int nCmdShow)
{
    IffDecoder *iff;
    if (CoInitialize(NULL)!=S_OK) return;
    if (CoCreateInstance(CLSID_FFDSHOW,NULL,CLSCTX_INPROC_SERVER,IID_IffDecoder,(void**)&iff)!=S_OK) return;
    iff->putParam(IDFF_inPlayer,0);
    ISpecifyPropertyPages *ispp;
    if (iff->QueryInterface(IID_ISpecifyPropertyPages,(void**)&ispp)==S_OK)
    {
        CAUUID pages;
        if (ispp->GetPages(&pages)==S_OK)
        {
            IUnknown *ifflist[]= {ispp};
            OleCreatePropertyFrame(NULL,10,10,L"ffdshow",
                                   1,ifflist,
                                   pages.cElems,pages.pElems,
                                   LOCALE_SYSTEM_DEFAULT,
                                   0,0
                                  );
        };
        ispp->Release();
    };
    iff->Release();
}
Example #20
0
HRESULT CAMVfwCompressDialogs::GetPropertyWindow(VfwCompressDialogs iDialog, const ACamstudioFilter *pFilter)
{
	if(!pFilter)
		return E_FAIL;
	if(!pFilter->GetFilter())
		return E_FAIL;
	
	IAMVfwCompressDialogs *pCompDialog = NULL;
	HRESULT hr = pFilter->GetFilter()->QueryInterface(IID_IAMVfwCompressDialogs, (void**)& pCompDialog);
	if(SUCCEEDED(hr))
	{
		hr = pCompDialog->ShowDialog(iDialog, m_hWnd);
		return hr;
	}
	if(iDialog == VfwCompressDialog_QueryAbout || iDialog == VfwCompressDialog_About)
	{
		return E_FAIL;
	}

	ISpecifyPropertyPages *pProp;
	hr = pFilter->GetFilter()->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pProp);
	if (SUCCEEDED(hr)) 
	{
		if(VfwCompressDialog_QueryConfig == iDialog || VfwCompressDialog_QueryAbout == iDialog)
		{
			return hr;
		}
		// Get the filter's name and IUnknown pointer.
		FILTER_INFO FilterInfo;
		hr = pFilter->GetFilter()->QueryFilterInfo(&FilterInfo);
		if(FAILED(hr))
			return E_FAIL;
		IUnknown *pFilterUnk = 0;

		if(SUCCEEDED(pFilter->GetFilter()->QueryInterface(IID_IUnknown, (void **)&pFilterUnk)))
		{
			// Show the page. 
			CAUUID caGUID;
			pProp->GetPages(&caGUID);
			pProp->Release();
			OleCreatePropertyFrame(
				m_hWnd,                 // Parent window
				0, 0,                   // Reserved
				FilterInfo.achName,     // Caption for the dialog box
				1,                      // Number of objects (just the filter)
				&pFilterUnk,            // Array of object pointers. 
				caGUID.cElems,          // Number of property pages
				caGUID.pElems,          // Array of property page CLSIDs
				0,                      // Locale identifier
				0, NULL                 // Reserved
				);

			// Clean up.
			if(pFilterUnk)
				pFilterUnk->Release();
			if(FilterInfo.pGraph)
				FilterInfo.pGraph->Release(); 
			if(caGUID.pElems)
				CoTaskMemFree(caGUID.pElems);
		}
	}
	return hr;
}
Example #21
0
void COggSplitter::ShowPopupMenu()
{
	int				groupID[16];
	HMENU			groupMenu[16];
	int				cGroups = 0;
	MENUITEMINFO	myItem;

	int				i = 0;

	AM_MEDIA_TYPE*	pmt;
	DWORD			dwGroup;
	DWORD			dwFlags;
	wchar_t*		pwzCaption;

	HMENU	hPopup = CreatePopupMenu();

	while (Info(i, &pmt, &dwFlags, NULL, &dwGroup, &pwzCaption, NULL, NULL) == NOERROR)
	{
		// Is there already a submenu for this group?
		int	j = 0;
		while ((j < cGroups) && (groupID[j] != dwGroup)) j++;

		if (j == cGroups)	// There is still no submenu ..
		{
            char*	pMenuType;

			if (!pmt)
				pMenuType = GetLocString(sidTypeOther);
			else if (pmt->majortype == MEDIATYPE_Audio)
				pMenuType = GetLocString(sidTypeAudio);
			else if (pmt->majortype == MEDIATYPE_Text)
				pMenuType = GetLocString(sidTypeSubtitle);
			else if (pmt->majortype == MEDIATYPE_Video)
			{			
				if (pmt->pbFormat)
					pMenuType = GetLocString(sidTypeVideo);
				else
					pMenuType = GetLocString(sidTypeChapter);
			}

			groupMenu[j] = CreatePopupMenu();
			groupID[j] = dwGroup;
			
			memset(&myItem, 0, sizeof(myItem));
			myItem.cbSize = sizeof(myItem);
			myItem.fMask = MIIM_TYPE | MIIM_SUBMENU;
			myItem.fType = MFT_STRING;
			myItem.hSubMenu = groupMenu[j];
			myItem.dwTypeData = pMenuType;
			myItem.cch = strlen(pMenuType);
			InsertMenuItem(hPopup, -1, TRUE, &myItem);
			cGroups++;
		}
		
		char		szItemText[128];
		wchar_t*	pwzItemText = pwzCaption;
		
		// Let´s skip the first word if not chapter
		if (pmt && ((pmt->majortype != MEDIATYPE_Video) || pmt->pbFormat))
		{
			pwzItemText = wcsstr(pwzItemText, L" ");
			pwzItemText++;
		}

		wsprintf(szItemText, "%S", pwzItemText);

		memset(&myItem, 0, sizeof(myItem));
		myItem.cbSize = sizeof(myItem);
		myItem.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
		myItem.fType = MFT_STRING | MFT_RADIOCHECK;
		myItem.fState = MFS_ENABLED;
		if (dwFlags == AMSTREAMSELECTINFO_ENABLED)
			myItem.fState |= MFS_CHECKED;
		myItem.wID = i;
		myItem.dwTypeData = szItemText;
		myItem.cch = strlen(myItem.dwTypeData);

		InsertMenuItem(groupMenu[j], -1, TRUE, &myItem);

		if (pmt)
			DeleteMediaType(pmt);
		CoTaskMemFree(pwzCaption);
		i++;
	}

	HMENU	hPropMenu = NULL;
	char	szName[MAX_FILTER_NAME];
	
	// If we are in the graph find all filters with property pages
	if (m_pGraph)
	{
		hPropMenu = CreatePopupMenu();

		// Insert the separator
		memset(&myItem, 0, sizeof(myItem));
		myItem.cbSize = sizeof(myItem);
		myItem.fMask = MIIM_TYPE;
		myItem.fType = MFT_SEPARATOR;
		InsertMenuItem(hPopup, -1, TRUE, &myItem);

		// Insert the properties item
		memset(&myItem, 0, sizeof(myItem));
		myItem.cbSize = sizeof(myItem);
		myItem.fMask = MIIM_TYPE | MIIM_SUBMENU;
		myItem.fType = MFT_STRING;
		myItem.hSubMenu = hPropMenu;
		myItem.dwTypeData = GetLocString(sidProperties);
		myItem.cch = strlen(myItem.dwTypeData);
		InsertMenuItem(hPopup, -1, TRUE, &myItem);

		IEnumFilters*			pEnum;
		IBaseFilter*			pFilter;
		ISpecifyPropertyPages*	pSPP;
		ULONG					cFetched;
		DWORD					dwID = ID_MENUITEM_PROPERTIES;

		m_pGraph->EnumFilters(&pEnum);

		do
		{
			if (FAILED(pEnum->Next(1, &pFilter, &cFetched)))
				cFetched = 0;

			if (cFetched)
			{
				if (SUCCEEDED(pFilter->QueryInterface(IID_ISpecifyPropertyPages,
														(void**)&pSPP)))
				{
					pSPP->Release();

					FILTER_INFO	Info;

					pFilter->QueryFilterInfo(&Info);
					wsprintf(szName, "%S", Info.achName);
					Info.pGraph->Release();

					memset(&myItem, 0, sizeof(myItem));
					myItem.cbSize = sizeof(myItem);
					myItem.fMask = MIIM_TYPE | MIIM_ID;
					myItem.fType = MFT_STRING;
					myItem.wID = dwID;
					myItem.dwTypeData = szName;
					myItem.cch = strlen(myItem.dwTypeData);
					InsertMenuItem(hPropMenu, -1, TRUE, &myItem);
					dwID++;
				}
				pFilter->Release();
			}
		} while (cFetched);
		pEnum->Release();
	}

	POINT	ptCursorPos;
	DWORD	dwSelection;

	GetCursorPos(&ptCursorPos);
	SetForegroundWindow(m_hTrayWnd);
	PostMessage(m_hTrayWnd, WM_NULL, 0, 0); 
	dwSelection = TrackPopupMenu(hPopup, TPM_NONOTIFY | TPM_RETURNCMD,
					ptCursorPos.x, ptCursorPos.y, 0, m_hTrayWnd, NULL);

	if (dwSelection <  ID_MENUITEM_PROPERTIES)
	{
		Enable(dwSelection, AMSTREAMSELECTENABLE_ENABLE);
		return;
	}

	GetMenuString(hPropMenu, dwSelection, szName, MAX_FILTER_NAME, MF_BYCOMMAND);
	if (m_pGraph)
	{
		wchar_t					wszName[MAX_FILTER_NAME];
		IBaseFilter*			pFilter;
		ISpecifyPropertyPages*	pSPP;
		
		wsprintfW(wszName, L"%s", szName);
		if (SUCCEEDED(m_pGraph->FindFilterByName(wszName, &pFilter)))
		{
			if (SUCCEEDED(pFilter->QueryInterface(IID_ISpecifyPropertyPages,
													(void**)&pSPP)))
			{
				IUnknown*	pFilterUnk;
				pFilter->QueryInterface(IID_IUnknown, (void **)&pFilterUnk);
				
				CAUUID caGUID;
				pSPP->GetPages(&caGUID);
				pSPP->Release();
			    OleCreatePropertyFrame(m_hTrayWnd, 0, 0, wszName, 1, &pFilterUnk,
										caGUID.cElems, caGUID.pElems, 0, 0, NULL);
				pFilterUnk->Release();
				CoTaskMemFree(caGUID.pElems);
			}
			pFilter->Release();
		}
	}

	DestroyMenu(hPopup);
}