Author: janderwald Date: Thu Apr 15 13:08:19 2010 New Revision: 46879
URL: http://svn.reactos.org/svn/reactos?rev=46879&view=rev Log: [MSDVBNP] - Fix category description [KSPROXY] - Create pin handle when other pin is connecting to the output pin - Defer loading proxy plugins when the pin is about to connect
Modified: trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp trunk/reactos/dll/directx/ksproxy/output_pin.cpp trunk/reactos/dll/directx/msdvbnp/msdvbnp.cpp
Modified: trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/pincon... ============================================================================== --- trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp [iso-8859-1] Thu Apr 15 13:08:19 2010 @@ -336,6 +336,7 @@ if (SUCCEEDED(hr)) { // register device filter + OutputDebugStringW(L"CBDAPinControl_fnConstructor registering device filter with network provider\n"); hr = pNetworkProvider->RegisterDeviceFilter(pUnknown, &RegistrationCtx); if (SUCCEEDED(hr)) { @@ -361,7 +362,6 @@ WCHAR Buffer[100]; swprintf(Buffer, L"CBDAPinControl_fnConstructor failed to register filter with %lx\n", hr); OutputDebugStringW(Buffer); - DebugBreak(); } } }
Modified: trunk/reactos/dll/directx/ksproxy/output_pin.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ksproxy/output_... ============================================================================== --- trunk/reactos/dll/directx/ksproxy/output_pin.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/directx/ksproxy/output_pin.cpp [iso-8859-1] Thu Apr 15 13:08:19 2010 @@ -246,8 +246,16 @@
ZeroMemory(m_FramingProp, sizeof(m_FramingProp)); ZeroMemory(m_FramingEx, sizeof(m_FramingEx)); + ZeroMemory(&m_MediaFormat, sizeof(AM_MEDIA_TYPE));
hr = KsGetMediaType(0, &m_MediaFormat, KsObjectParent->KsGetObjectHandle(), m_PinId); + +#ifdef KSPROXY_TRACE + WCHAR Buffer[100]; + swprintf(Buffer, L"COutputPin::COutputPin Format %p pbFormat %lu\n", &m_MediaFormat, m_MediaFormat.cbFormat); + OutputDebugStringW(Buffer); +#endif + assert(hr == S_OK);
InitializeCriticalSection(&m_Lock); @@ -1518,6 +1526,8 @@ HRESULT hr; ALLOCATOR_PROPERTIES Properties; IMemAllocatorCallbackTemp *pMemCallback; + LPGUID pGuid; + ULONG NumGuids = 0;
#ifdef KSPROXY_TRACE WCHAR Buffer[200]; @@ -1540,6 +1550,20 @@ pmt = &m_MediaFormat; }
+ if (m_hPin == INVALID_HANDLE_VALUE) + { + hr = CreatePin(pmt); + if (FAILED(hr)) + { +#ifdef KSPROXY_TRACE + swprintf(Buffer, L"COutputPin::Connect CreatePin handle failed with %lx\n", hr); + OutputDebugStringW(Buffer); +#endif + return hr; + } + } + + // query for IMemInput interface hr = pReceivePin->QueryInterface(IID_IMemInputPin, (void**)&m_MemInputPin); if (FAILED(hr)) @@ -1648,10 +1672,24 @@ return hr; }
- if (!m_hPin) - { - //FIXME create pin handle - assert(0); + + assert(m_hPin != INVALID_HANDLE_VALUE); + + // get all supported sets + if (m_Plugins.size() == 0) + { + if (GetSupportedSets(&pGuid, &NumGuids)) + { + // load all proxy plugins + if (FAILED(LoadProxyPlugins(pGuid, NumGuids))); + { +#ifdef KSPROXY_TRACE + OutputDebugStringW(L"COutputPin::Connect LoadProxyPlugins failed\n"); +#endif + } + // free sets + CoTaskMemFree(pGuid); + } }
// receive connection; @@ -2093,6 +2131,7 @@ // pin already exists //CloseHandle(m_hPin); //m_hPin = INVALID_HANDLE_VALUE; + OutputDebugStringW(L"COutputPin::CreatePinHandle pin already exists\n"); return S_OK; }
@@ -2105,9 +2144,10 @@ if (!PinConnect) { // failed + OutputDebugStringW(L"COutputPin::CreatePinHandle out of memory\n"); return E_OUTOFMEMORY; } - + OutputDebugStringW(L"COutputPin::CreatePinHandle copy pinconnect\n"); // setup request CopyMemory(&PinConnect->Interface, Interface, sizeof(KSPIN_INTERFACE)); CopyMemory(&PinConnect->Medium, Medium, sizeof(KSPIN_MEDIUM)); @@ -2118,7 +2158,7 @@
// get dataformat offset DataFormat = (PKSDATAFORMAT)(PinConnect + 1); - + OutputDebugStringW(L"COutputPin::CreatePinHandle copy format\n"); // copy data format DataFormat->FormatSize = sizeof(KSDATAFORMAT) + pmt->cbFormat; DataFormat->Flags = 0; @@ -2131,13 +2171,19 @@ if (pmt->cbFormat) { // copy extended format + WCHAR Buffer[100]; + swprintf(Buffer, L"COutputPin::CreatePinHandle copy format %p pbFormat %lu\n", pmt, pmt->cbFormat); + OutputDebugStringW(Buffer); CopyMemory((DataFormat + 1), pmt->pbFormat, pmt->cbFormat); }
// get IKsObject interface hr = m_ParentFilter->QueryInterface(IID_IKsObject, (LPVOID*)&KsObjectParent); if (FAILED(hr)) - return hr; + { + OutputDebugStringW(L"COutputPin::CreatePinHandle no IID_IKsObject interface\n"); + return hr; + }
// get parent filter handle hFilter = KsObjectParent->KsGetObjectHandle(); @@ -2146,13 +2192,19 @@ KsObjectParent->Release();
if (!hFilter) + { + OutputDebugStringW(L"COutputPin::CreatePinHandle no filter handle\n"); return E_HANDLE; - + } + + OutputDebugStringW(L"COutputPin::CreatePinHandle before creating pin\n"); // create pin - hr = KsCreatePin(hFilter, PinConnect, GENERIC_READ, &m_hPin); - - if (SUCCEEDED(hr)) - { + DWORD dwError = KsCreatePin(hFilter, PinConnect, GENERIC_READ, &m_hPin); + + if (dwError == ERROR_SUCCESS) + { + OutputDebugStringW(L"COutputPin::CreatePinHandle created pin\n"); + // store current interface / medium CopyMemory(&m_Medium, Medium, sizeof(KSPIN_MEDIUM)); CopyMemory(&m_Interface, Interface, sizeof(KSPIN_INTERFACE)); @@ -2205,37 +2257,12 @@ OutputDebugStringW(L"COutputPin::CreatePinHandle failed to initialize i/o thread\n"); }
- LPGUID pGuid; - ULONG NumGuids = 0; - - // get all supported sets - hr = GetSupportedSets(&pGuid, &NumGuids); - if (FAILED(hr)) - { -#ifdef KSPROXY_TRACE - OutputDebugStringW(L"COutputPin::CreatePinHandle GetSupportedSets failed\n"); -#endif - return hr; - } - - // load all proxy plugins - hr = LoadProxyPlugins(pGuid, NumGuids); - if (FAILED(hr)) - { -#ifdef KSPROXY_TRACE - OutputDebugStringW(L"COutputPin::CreatePinHandle LoadProxyPlugins failed\n"); -#endif - return hr; - } - - // free sets - CoTaskMemFree(pGuid); - - //TODO // connect pin pipes
} + else + OutputDebugStringW(L"COutputPin::CreatePinHandle failed to create pin\n"); // free pin connect CoTaskMemFree(PinConnect);
Modified: trunk/reactos/dll/directx/msdvbnp/msdvbnp.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/msdvbnp/msdvbnp... ============================================================================== --- trunk/reactos/dll/directx/msdvbnp/msdvbnp.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/directx/msdvbnp/msdvbnp.cpp [iso-8859-1] Thu Apr 15 13:08:19 2010 @@ -152,7 +152,7 @@ }
RegisterBDAComponent(hFilter, L"{71985F4A-1CA1-11d3-9CC8-00C04F7971E0}", L"BDA Playback Filter"); - RegisterBDAComponent(hFilter, L"{71985F4B-1CA1-11D3-9CC8-00C04F7971E0}", L"BDA Network Providerss"); + RegisterBDAComponent(hFilter, L"{71985F4B-1CA1-11D3-9CC8-00C04F7971E0}", L"BDA Network Providers"); RegisterBDAComponent(hFilter, L"{71985F48-1CA1-11d3-9CC8-00C04F7971E0}", L"BDA Source Filter"); RegisterBDAComponent(hFilter, L"{A2E3074F-6C3D-11D3-B653-00C04F79498E}", L"BDA Transport Information Renderers"); RegisterBDAComponent(hFilter, L"{FD0A5AF4-B41D-11d2-9C95-00C04F7971E0}", L"BDA Receiver Component");