HRESULT CNetworkProvider::RegisterDeviceFilter(IUnknown* pUnkFilterControl,ULONG* ppvRegisitrationContext) {
	RegisterDevice* device;
	FILTER_INFO filterinfo;
	HRESULT hr;
	IBaseFilter* filter;
	LOG4CPLUS_INFO(logger,"RegisterDeviceFilter start");
	IMpeg2Demultiplexer* demux;
	if (m_pNetworkProviderPin->GetConnected() != NULL){
		hr = m_pNetworkProviderPin->CreateOutputPin(m_pNetworkProviderPin->GetConnected());
	}
	CAutoLock lock(&m_Lock);
	if (pUnkFilterControl == NULL){
		return E_POINTER;
	}
	if (&ppvRegisitrationContext == NULL ){
		return E_POINTER;
	}
	hr = pUnkFilterControl->QueryInterface(IID_IBaseFilter, (void**) &filter);
	if (hr != S_OK ){
		return S_FALSE;
	}
	hr = filter->QueryFilterInfo(&filterinfo);
	filterinfo.pGraph = NULL;
	if (hr != S_OK ){
		return S_FALSE;
	}
	LOG4CPLUS_DEBUG(logger,"RegisterDeviceFilter checks finished");
	m_fid = m_fid + 1;
	device = new RegisterDevice();
	device->id = m_fid;
	device->control = filter;
	wcstombs( device->name, filterinfo.achName, sizeof(device->name)); 
	ppvRegisitrationContext = &m_fid;
	hr = pUnkFilterControl->QueryInterface(IID_IMpeg2Demultiplexer, (void**) &demux);
	if (hr == S_OK ){
		LOG4CPLUS_DEBUG(logger,"RegisterDeviceFilter device prepared for registration - Name: "<<device->name<<" - "<<m_fid<<" - "<<&m_fid);
		device->control = NULL;
		delete device;
		LOG4CPLUS_INFO(logger,"RegisterDeviceFilter demux skipped");
		return S_FALSE;
	}else{
		LOG4CPLUS_INFO(logger,"RegisterDeviceFilter device prepared for registration - Name: "<<device->name<<" - "<<m_fid<<" - "<<&m_fid);
		IBDA_DeviceControl* ctrl;
		if( filter->QueryInterface(_uuidof(IBDA_DeviceControl), (void**) &ctrl)==S_OK){
			device->deviceControl=ctrl;
		}
		m_vecDevices.push_back(device);
		CheckCapabilities(filter);
	}
	LOG4CPLUS_DEBUG(logger,"RegisterDeviceFilter finished");
	return S_OK;
}
std::unique_ptr< WindowsAdapter > CreateWindowsAdapter( const WindowsAdapterCapabilities& capabilities ) noexcept {
	ComPtr< IDXGIFactory1 > factory;
	auto hresult = CreateDXGIFactory1( __uuidof( IDXGIFactory1 ), reinterpret_cast< void** >( &factory ) );
	if ( FAILED( hresult ) ) {
		return nullptr;
	}
	int id = 0;
	auto adapter = CreateAdapter( factory, id );
	while ( adapter != nullptr ) {
		// check capabilities
		if ( adapter->CheckCapabilities( capabilities ) ) {
			return adapter;
		}
		// next adapter
		id += 1;
		adapter = CreateAdapter( factory, id );
	}
	return nullptr;
}
Example #3
0
File: device.c Project: DonCN/haiku
static status_t
OpenHook(const char *name, uint32 flags, void **cookie)
{
	status_t ret = B_OK;
	pci_info *pcii = &gPd->pcii;
	uint32 tmpUlong;

	TRACE("OpenHook (%s, %ld)\n", name, flags);
	ACQUIRE_BEN(gPd->kernel);

	if (gPd->isOpen)
		goto markAsOpen;

	/* Enable memory mapped IO and VGA I/O */
	tmpUlong = get_pci(PCI_command, 2);
	tmpUlong |= PCI_command_memory;
	tmpUlong |= PCI_command_io;
	set_pci(PCI_command, 2, tmpUlong);

	if ((ret = CreateShared()) != B_OK)
		goto done;
	if ((ret = CheckCapabilities()) != B_OK)
		goto freeShared;
	if ((ret = MapDevice()) != B_OK)
		goto freeShared;

markAsOpen:
	gPd->isOpen++;
	*cookie = gPd;
	goto done;

freeShared:
	FreeShared();

done:
	RELEASE_BEN(gPd->kernel);
	TRACE("OpenHook: %ld\n", ret);
	return ret;
}
Example #4
0
STDMETHODIMP CStreamSwitcherPassThru::CheckCapabilities(DWORD* pCaps)
{
    CallPeerSeeking(CheckCapabilities(pCaps));
}