[ros-diffs] [janderwald] 45768: [BDAPLGIN] - Set output variable to null to fixup lazy callers [KSPROXY] - Enumerate input / output pins and their names - Start implementing input / output pin - Implement IEnumPins interface for CKsProxy filter [MSDVBNP] - Fix a bug (IEnumPins::Next should increase reference count on pin) - Fix a bug (IPin::QueryFilterInfo should increase reference count on parent filter) - Reference leakage is now fixed

janderwald at svn.reactos.org janderwald at svn.reactos.org
Tue Mar 2 21:18:29 CET 2010


Author: janderwald
Date: Tue Mar  2 21:18:29 2010
New Revision: 45768

URL: http://svn.reactos.org/svn/reactos?rev=45768&view=rev
Log:
[BDAPLGIN]
- Set output variable to null to fixup lazy callers
[KSPROXY]
- Enumerate input / output pins and their names
- Start implementing input / output pin
- Implement IEnumPins interface for CKsProxy filter
[MSDVBNP]
- Fix a bug (IEnumPins::Next should increase reference count on pin)
- Fix a bug (IPin::QueryFilterInfo should increase reference count on parent filter)
- Reference leakage is now fixed

Added:
    trunk/reactos/dll/directx/ksproxy/enumpins.cpp   (with props)
    trunk/reactos/dll/directx/ksproxy/input_pin.cpp   (with props)
    trunk/reactos/dll/directx/ksproxy/output_pin.cpp   (with props)
Modified:
    trunk/reactos/dll/directx/bdaplgin/bdaplgin.cpp
    trunk/reactos/dll/directx/bdaplgin/devicecontrol.cpp
    trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp
    trunk/reactos/dll/directx/ksproxy/ksproxy.rbuild
    trunk/reactos/dll/directx/ksproxy/precomp.h
    trunk/reactos/dll/directx/ksproxy/proxy.cpp
    trunk/reactos/dll/directx/msdvbnp/enum_mediatypes.cpp
    trunk/reactos/dll/directx/msdvbnp/enumpins.cpp
    trunk/reactos/dll/directx/msdvbnp/networkprovider.cpp
    trunk/reactos/dll/directx/msdvbnp/pin.cpp
    trunk/reactos/dll/directx/msdvbnp/scanningtuner.cpp

Modified: trunk/reactos/dll/directx/bdaplgin/bdaplgin.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/bdaplgin.cpp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/bdaplgin.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/bdaplgin.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -11,7 +11,6 @@
 
 const GUID CBDADeviceControl_GUID = {STATIC_KSMETHODSETID_BdaChangeSync};
 const GUID CBDAPinControl_GUID = {0x0DED49D5, 0xA8B7, 0x4d5d, {0x97, 0xA1, 0x12, 0xB0, 0xC1, 0x95, 0x87, 0x4D}};
-
 
 static INTERFACE_TABLE InterfaceTable[] =
 {

Modified: trunk/reactos/dll/directx/bdaplgin/devicecontrol.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/devicecontrol.cpp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/devicecontrol.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/devicecontrol.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -498,6 +498,10 @@
     IBaseFilter *pFilter = NULL;
     HANDLE hFile;
 
+#ifdef BDAPLGIN_TRACE
+    OutputDebugStringW(L"CBDADeviceControl_fnConstructor\n");
+#endif
+
     //DebugBreak();
 
     // sanity check
@@ -540,10 +544,6 @@
     // construct device control
     CBDADeviceControl * handler = new CBDADeviceControl(pUnkOuter, pFilter, hFile);
 
-#ifdef BDAPLGIN_TRACE
-    OutputDebugStringW(L"CBDADeviceControl_fnConstructor\n");
-#endif
-
     if (!handler)
         return E_OUTOFMEMORY;
 

Modified: trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/bdaplgin/pincontrol.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -59,6 +59,7 @@
     IN  REFIID refiid,
     OUT PVOID* Output)
 {
+    *Output = NULL;
     if (IsEqualGUID(refiid, IID_IUnknown))
     {
         *Output = PVOID(this);
@@ -77,7 +78,6 @@
     LPOLESTR lpstr;
     StringFromCLSID(refiid, &lpstr);
     swprintf(Buffer, L"CBDAPinControl::QueryInterface: NoInterface for %s", lpstr);
-    DebugBreak();
     OutputDebugStringW(Buffer);
     CoTaskMemFree(lpstr);
 #endif
@@ -290,6 +290,8 @@
     OutputDebugStringW(L"CBDAPinControl_fnConstructor");
 #endif
 
+    DebugBreak();
+
     if (!handler)
         return E_OUTOFMEMORY;
 

Added: trunk/reactos/dll/directx/ksproxy/enumpins.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ksproxy/enumpins.cpp?rev=45768&view=auto
==============================================================================
--- trunk/reactos/dll/directx/ksproxy/enumpins.cpp (added)
+++ trunk/reactos/dll/directx/ksproxy/enumpins.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -1,0 +1,179 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS Network Provider for MPEG2 based networks
+ * FILE:            dll/directx/msdvbnp/enumpins.cpp
+ * PURPOSE:         IEnumPins interface
+ *
+ * PROGRAMMERS:     Johannes Anderwald (janderwald at reactos.org)
+ */
+#include "precomp.h"
+
+class CEnumPins : public IEnumPins
+{
+public:
+    STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
+
+    STDMETHODIMP_(ULONG) AddRef()
+    {
+        InterlockedIncrement(&m_Ref);
+        return m_Ref;
+    }
+    STDMETHODIMP_(ULONG) Release()
+    {
+        InterlockedDecrement(&m_Ref);
+        if (!m_Ref)
+        {
+            delete this;
+            return 0;
+        }
+        return m_Ref;
+    }
+
+
+    HRESULT STDMETHODCALLTYPE Next(ULONG cPins, IPin **ppPins, ULONG *pcFetched);
+    HRESULT STDMETHODCALLTYPE Skip(ULONG cPins);
+    HRESULT STDMETHODCALLTYPE Reset();
+    HRESULT STDMETHODCALLTYPE Clone(IEnumPins **ppEnum);
+
+    CEnumPins(std::vector<IPin*> Pins) : m_Ref(0), m_Pins(Pins), m_Index(0){};
+    virtual ~CEnumPins(){};
+
+protected:
+    LONG m_Ref;
+    std::vector<IPin*> m_Pins;
+    ULONG m_Index;
+};
+
+HRESULT
+STDMETHODCALLTYPE
+CEnumPins::QueryInterface(
+    IN  REFIID refiid,
+    OUT PVOID* Output)
+{
+    *Output = NULL;
+    if (IsEqualGUID(refiid, IID_IUnknown))
+    {
+        *Output = PVOID(this);
+        reinterpret_cast<IUnknown*>(*Output)->AddRef();
+        return NOERROR;
+    }
+    if (IsEqualGUID(refiid, IID_IEnumPins))
+    {
+        *Output = (IEnumPins*)(this);
+        reinterpret_cast<IEnumPins*>(*Output)->AddRef();
+        return NOERROR;
+    }
+
+    WCHAR Buffer[MAX_PATH];
+    LPOLESTR lpstr;
+    StringFromCLSID(refiid, &lpstr);
+    swprintf(Buffer, L"CEnumPins::QueryInterface: NoInterface for %s\n", lpstr);
+    OutputDebugStringW(Buffer);
+    CoTaskMemFree(lpstr);
+
+    return E_NOINTERFACE;
+}
+
+HRESULT
+STDMETHODCALLTYPE
+CEnumPins::Next(
+    ULONG cPins,
+    IPin **ppPins,
+    ULONG *pcFetched)
+{
+    ULONG i = 0;
+
+    if (!ppPins)
+        return E_POINTER;
+
+    if (cPins > 1 && !pcFetched)
+        return E_INVALIDARG;
+
+    WCHAR Buffer[MAX_PATH];
+    swprintf(Buffer, L"CEnumPins::Next: this %p m_Index %lx cPins %u\n", this, m_Index, cPins);
+    OutputDebugStringW(Buffer);
+
+    while(i < cPins)
+    {
+        if (m_Index + i >= m_Pins.size())
+            break;
+
+        ppPins[i] = m_Pins[m_Index + i];
+        m_Pins[m_Index + i]->AddRef();
+
+        i++;
+    }
+
+    if (pcFetched)
+    {
+        *pcFetched = i;
+    }
+
+    m_Index += i;
+    OutputDebugStringW(L"CEnumPins::Next: done\n");
+    if (i < cPins)
+        return S_FALSE;
+    else
+        return S_OK;
+}
+
+HRESULT
+STDMETHODCALLTYPE
+CEnumPins::Skip(
+    ULONG cPins)
+{
+    if (cPins + m_Index >= m_Pins.size())
+    {
+        return S_FALSE;
+    }
+
+    m_Index += cPins;
+    return S_OK;
+}
+
+HRESULT
+STDMETHODCALLTYPE
+CEnumPins::Reset()
+{
+    m_Index = 0;
+    return S_OK;
+}
+
+HRESULT
+STDMETHODCALLTYPE
+CEnumPins::Clone(
+    IEnumPins **ppEnum)
+{
+    OutputDebugStringW(L"CEnumPins::Clone : NotImplemented\n");
+    return E_NOTIMPL;
+}
+
+HRESULT
+WINAPI
+CEnumPins_fnConstructor(
+    std::vector<IPin*> Pins,
+    REFIID riid,
+    LPVOID * ppv)
+{
+    CEnumPins * handler = new CEnumPins(Pins);
+
+#ifdef MSDVBNP_TRACE
+    WCHAR Buffer[MAX_PATH];
+    LPOLESTR lpstr;
+    StringFromCLSID(riid, &lpstr);
+    swprintf(Buffer, L"CEnumPins_fnConstructor riid %s pUnknown %p\n", lpstr, pUnknown);
+    OutputDebugStringW(Buffer);
+#endif
+
+    if (!handler)
+        return E_OUTOFMEMORY;
+
+    if (FAILED(handler->QueryInterface(riid, ppv)))
+    {
+        /* not supported */
+        delete handler;
+        return E_NOINTERFACE;
+    }
+
+    return NOERROR;
+}

Propchange: trunk/reactos/dll/directx/ksproxy/enumpins.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/reactos/dll/directx/ksproxy/input_pin.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ksproxy/input_pin.cpp?rev=45768&view=auto
==============================================================================
--- trunk/reactos/dll/directx/ksproxy/input_pin.cpp (added)
+++ trunk/reactos/dll/directx/ksproxy/input_pin.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -1,0 +1,239 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS WDM Streaming ActiveMovie Proxy
+ * FILE:            dll/directx/ksproxy/input_cpp.cpp
+ * PURPOSE:         InputPin of Proxy Filter
+ *
+ * PROGRAMMERS:     Johannes Anderwald (janderwald at reactos.org)
+ */
+#include "precomp.h"
+
+class CInputPin : public IPin
+/*
+                  public IQualityControl,
+                  public IKsObject,
+                  public IKsPinEx,
+                  public IKsPinPipe,
+                  public ISpecifyPropertyPages,
+                  public IStreamBuilder,
+                  public IKsPropertySet,
+                  public IKsPinFactory,
+                  public IKsControl,
+                  public IKsAggregateControl
+*/
+{
+public:
+    STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
+
+    STDMETHODIMP_(ULONG) AddRef()
+    {
+        InterlockedIncrement(&m_Ref);
+        return m_Ref;
+    }
+    STDMETHODIMP_(ULONG) Release()
+    {
+        InterlockedDecrement(&m_Ref);
+        if (!m_Ref)
+        {
+            delete this;
+            return 0;
+        }
+        return m_Ref;
+    }
+
+    //IPin methods
+    HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
+    HRESULT STDMETHODCALLTYPE ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt);
+    HRESULT STDMETHODCALLTYPE Disconnect();
+    HRESULT STDMETHODCALLTYPE ConnectedTo(IPin **pPin);
+    HRESULT STDMETHODCALLTYPE ConnectionMediaType(AM_MEDIA_TYPE *pmt);
+    HRESULT STDMETHODCALLTYPE QueryPinInfo(PIN_INFO *pInfo);
+    HRESULT STDMETHODCALLTYPE QueryDirection(PIN_DIRECTION *pPinDir);
+    HRESULT STDMETHODCALLTYPE QueryId(LPWSTR *Id);
+    HRESULT STDMETHODCALLTYPE QueryAccept(const AM_MEDIA_TYPE *pmt);
+    HRESULT STDMETHODCALLTYPE EnumMediaTypes(IEnumMediaTypes **ppEnum);
+    HRESULT STDMETHODCALLTYPE QueryInternalConnections(IPin **apPin, ULONG *nPin);
+    HRESULT STDMETHODCALLTYPE EndOfStream();
+    HRESULT STDMETHODCALLTYPE BeginFlush();
+    HRESULT STDMETHODCALLTYPE EndFlush();
+    HRESULT STDMETHODCALLTYPE NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+    CInputPin(IBaseFilter * ParentFilter, LPCWSTR PinName) : m_Ref(0), m_ParentFilter(ParentFilter), m_PinName(PinName){};
+    virtual ~CInputPin(){};
+
+protected:
+    LONG m_Ref;
+    IBaseFilter * m_ParentFilter;
+    LPCWSTR m_PinName;
+};
+
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::QueryInterface(
+    IN  REFIID refiid,
+    OUT PVOID* Output)
+{
+    *Output = NULL;
+    if (IsEqualGUID(refiid, IID_IUnknown) ||
+        IsEqualGUID(refiid, IID_IPin))
+    {
+        *Output = PVOID(this);
+        reinterpret_cast<IUnknown*>(*Output)->AddRef();
+        return NOERROR;
+    }
+
+    WCHAR Buffer[MAX_PATH];
+    LPOLESTR lpstr;
+    StringFromCLSID(refiid, &lpstr);
+    swprintf(Buffer, L"CInputPin::QueryInterface: NoInterface for %s\n", lpstr);
+    OutputDebugStringW(Buffer);
+    CoTaskMemFree(lpstr);
+
+    return E_NOINTERFACE;
+}
+
+//-------------------------------------------------------------------
+// IPin interface
+//
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
+{
+    OutputDebugStringW(L"CInputPin::Connect called\n");
+    return E_NOTIMPL;
+}
+
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt)
+{
+    OutputDebugStringW(L"CInputPin::ReceiveConnection called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::Disconnect( void)
+{
+    OutputDebugStringW(L"CInputPin::Disconnect called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::ConnectedTo(IPin **pPin)
+{
+    OutputDebugStringW(L"CInputPin::ConnectedTo called\n");
+    return VFW_E_NOT_CONNECTED;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
+{
+    OutputDebugStringW(L"CInputPin::ConnectionMediaType called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::QueryPinInfo(PIN_INFO *pInfo)
+{
+    wcscpy(pInfo->achName, m_PinName);
+    pInfo->dir = PINDIR_INPUT;
+    pInfo->pFilter = m_ParentFilter;
+    m_ParentFilter->AddRef();
+
+    return S_OK;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::QueryDirection(PIN_DIRECTION *pPinDir)
+{
+    if (pPinDir)
+    {
+        *pPinDir = PINDIR_INPUT;
+        return S_OK;
+    }
+
+    return E_POINTER;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::QueryId(LPWSTR *Id)
+{
+    *Id = (LPWSTR)CoTaskMemAlloc((wcslen(m_PinName)+1)*sizeof(WCHAR));
+    if (!*Id)
+        return E_OUTOFMEMORY;
+
+    wcscpy(*Id, m_PinName);
+    return S_OK;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::QueryAccept(const AM_MEDIA_TYPE *pmt)
+{
+    OutputDebugStringW(L"CInputPin::QueryAccept called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::EnumMediaTypes(IEnumMediaTypes **ppEnum)
+{
+    OutputDebugStringW(L"CInputPin::EnumMediaTypes called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::QueryInternalConnections(IPin **apPin, ULONG *nPin)
+{
+    OutputDebugStringW(L"CInputPin::QueryInternalConnections called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::EndOfStream( void)
+{
+    OutputDebugStringW(L"CInputPin::EndOfStream called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::BeginFlush( void)
+{
+    OutputDebugStringW(L"CInputPin::BeginFlush called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::EndFlush( void)
+{
+    OutputDebugStringW(L"CInputPin::EndFlush called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+CInputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+    OutputDebugStringW(L"CInputPin::NewSegment called\n");
+    return E_NOTIMPL;
+}
+
+HRESULT
+WINAPI
+CInputPin_Constructor(
+    IBaseFilter * ParentFilter,
+    LPCWSTR PinName,
+    REFIID riid,
+    LPVOID * ppv)
+{
+    CInputPin * handler = new CInputPin(ParentFilter, PinName);
+
+    if (!handler)
+        return E_OUTOFMEMORY;
+
+    if (FAILED(handler->QueryInterface(riid, ppv)))
+    {
+        /* not supported */
+        delete handler;
+        return E_NOINTERFACE;
+    }
+
+    return S_OK;
+}

Propchange: trunk/reactos/dll/directx/ksproxy/input_pin.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/dll/directx/ksproxy/ksproxy.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ksproxy/ksproxy.rbuild?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ksproxy/ksproxy.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ksproxy/ksproxy.rbuild [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -26,9 +26,12 @@
 	<file>cvpconfig.cpp</file>
 	<file>cvpvbiconfig.cpp</file>
 	<file>datatype.cpp</file>
+	<file>enumpins.cpp</file>
+	<file>input_pin.cpp</file>
 	<file>interface.cpp</file>
 	<file>ksproxy.cpp</file>
 	<file>ksproxy.rc</file>
+	<file>output_pin.cpp</file>
 	<file>proxy.cpp</file>
 	<file>qualityforward.cpp</file>
 </module>

Added: trunk/reactos/dll/directx/ksproxy/output_pin.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ksproxy/output_pin.cpp?rev=45768&view=auto
==============================================================================
--- trunk/reactos/dll/directx/ksproxy/output_pin.cpp (added)
+++ trunk/reactos/dll/directx/ksproxy/output_pin.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -1,0 +1,242 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS WDM Streaming ActiveMovie Proxy
+ * FILE:            dll/directx/ksproxy/input_cpp.cpp
+ * PURPOSE:         InputPin of Proxy Filter
+ *
+ * PROGRAMMERS:     Johannes Anderwald (janderwald at reactos.org)
+ */
+#include "precomp.h"
+
+class COutputPin : public IPin
+/*
+                  public IQualityControl,
+                  public IKsObject,
+                  public IKsPinEx,
+                  public IKsPinPipe,
+                  public ISpecifyPropertyPages,
+                  public IStreamBuilder,
+                  public IKsPropertySet,
+                  public IKsPinFactory,
+                  public IKsControl,
+                  public IKsAggregateControl
+                  public IMediaSeeking,
+                  public IAMStreamConfig,
+                  public IMemAllocatorNotifyCallbackTemp
+*/
+{
+public:
+    STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
+
+    STDMETHODIMP_(ULONG) AddRef()
+    {
+        InterlockedIncrement(&m_Ref);
+        return m_Ref;
+    }
+    STDMETHODIMP_(ULONG) Release()
+    {
+        InterlockedDecrement(&m_Ref);
+        if (!m_Ref)
+        {
+            delete this;
+            return 0;
+        }
+        return m_Ref;
+    }
+
+    //IPin methods
+    HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
+    HRESULT STDMETHODCALLTYPE ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt);
+    HRESULT STDMETHODCALLTYPE Disconnect();
+    HRESULT STDMETHODCALLTYPE ConnectedTo(IPin **pPin);
+    HRESULT STDMETHODCALLTYPE ConnectionMediaType(AM_MEDIA_TYPE *pmt);
+    HRESULT STDMETHODCALLTYPE QueryPinInfo(PIN_INFO *pInfo);
+    HRESULT STDMETHODCALLTYPE QueryDirection(PIN_DIRECTION *pPinDir);
+    HRESULT STDMETHODCALLTYPE QueryId(LPWSTR *Id);
+    HRESULT STDMETHODCALLTYPE QueryAccept(const AM_MEDIA_TYPE *pmt);
+    HRESULT STDMETHODCALLTYPE EnumMediaTypes(IEnumMediaTypes **ppEnum);
+    HRESULT STDMETHODCALLTYPE QueryInternalConnections(IPin **apPin, ULONG *nPin);
+    HRESULT STDMETHODCALLTYPE EndOfStream();
+    HRESULT STDMETHODCALLTYPE BeginFlush();
+    HRESULT STDMETHODCALLTYPE EndFlush();
+    HRESULT STDMETHODCALLTYPE NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+
+    COutputPin(IBaseFilter * ParentFilter, LPCWSTR PinName) : m_Ref(0), m_ParentFilter(ParentFilter), m_PinName(PinName){};
+    virtual ~COutputPin(){};
+
+protected:
+    LONG m_Ref;
+    IBaseFilter * m_ParentFilter;
+    LPCWSTR m_PinName;
+};
+
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::QueryInterface(
+    IN  REFIID refiid,
+    OUT PVOID* Output)
+{
+    *Output = NULL;
+    if (IsEqualGUID(refiid, IID_IUnknown) ||
+        IsEqualGUID(refiid, IID_IPin))
+    {
+        *Output = PVOID(this);
+        reinterpret_cast<IUnknown*>(*Output)->AddRef();
+        return NOERROR;
+    }
+
+    WCHAR Buffer[MAX_PATH];
+    LPOLESTR lpstr;
+    StringFromCLSID(refiid, &lpstr);
+    swprintf(Buffer, L"COutputPin::QueryInterface: NoInterface for %s\n", lpstr);
+    OutputDebugStringW(Buffer);
+    CoTaskMemFree(lpstr);
+
+    return E_NOINTERFACE;
+}
+
+//-------------------------------------------------------------------
+// IPin interface
+//
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
+{
+    OutputDebugStringW(L"COutputPin::Connect called\n");
+    return E_NOTIMPL;
+}
+
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt)
+{
+    OutputDebugStringW(L"COutputPin::ReceiveConnection called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::Disconnect( void)
+{
+    OutputDebugStringW(L"COutputPin::Disconnect called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::ConnectedTo(IPin **pPin)
+{
+    OutputDebugStringW(L"COutputPin::ConnectedTo called\n");
+    return VFW_E_NOT_CONNECTED;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
+{
+    OutputDebugStringW(L"COutputPin::ConnectionMediaType called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::QueryPinInfo(PIN_INFO *pInfo)
+{
+    wcscpy(pInfo->achName, m_PinName);
+    pInfo->dir = PINDIR_OUTPUT;
+    pInfo->pFilter = m_ParentFilter;
+    m_ParentFilter->AddRef();
+
+    return S_OK;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::QueryDirection(PIN_DIRECTION *pPinDir)
+{
+    if (pPinDir)
+    {
+        *pPinDir = PINDIR_OUTPUT;
+        return S_OK;
+    }
+
+    return E_POINTER;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::QueryId(LPWSTR *Id)
+{
+    *Id = (LPWSTR)CoTaskMemAlloc((wcslen(m_PinName)+1)*sizeof(WCHAR));
+    if (!*Id)
+        return E_OUTOFMEMORY;
+
+    wcscpy(*Id, m_PinName);
+    return S_OK;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::QueryAccept(const AM_MEDIA_TYPE *pmt)
+{
+    OutputDebugStringW(L"COutputPin::QueryAccept called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::EnumMediaTypes(IEnumMediaTypes **ppEnum)
+{
+    OutputDebugStringW(L"COutputPin::EnumMediaTypes called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::QueryInternalConnections(IPin **apPin, ULONG *nPin)
+{
+    OutputDebugStringW(L"COutputPin::QueryInternalConnections called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::EndOfStream( void)
+{
+    OutputDebugStringW(L"COutputPin::EndOfStream called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::BeginFlush( void)
+{
+    OutputDebugStringW(L"COutputPin::BeginFlush called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::EndFlush( void)
+{
+    OutputDebugStringW(L"COutputPin::EndFlush called\n");
+    return E_NOTIMPL;
+}
+HRESULT
+STDMETHODCALLTYPE
+COutputPin::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
+{
+    OutputDebugStringW(L"COutputPin::NewSegment called\n");
+    return E_NOTIMPL;
+}
+
+HRESULT
+WINAPI
+COutputPin_Constructor(
+    IBaseFilter * ParentFilter,
+    LPCWSTR PinName,
+    REFIID riid,
+    LPVOID * ppv)
+{
+    COutputPin * handler = new COutputPin(ParentFilter, PinName);
+
+    if (!handler)
+        return E_OUTOFMEMORY;
+
+    if (FAILED(handler->QueryInterface(riid, ppv)))
+    {
+        /* not supported */
+        delete handler;
+        return E_NOINTERFACE;
+    }
+
+    return S_OK;
+}

Propchange: trunk/reactos/dll/directx/ksproxy/output_pin.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/dll/directx/ksproxy/precomp.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ksproxy/precomp.h?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ksproxy/precomp.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ksproxy/precomp.h [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -97,3 +97,30 @@
     IUnknown * pUnkOuter,
     REFIID riid,
     LPVOID * ppv);
+
+/* input_pin.cpp */
+HRESULT
+WINAPI
+CInputPin_Constructor(
+    IBaseFilter * ParentFilter,
+    LPCWSTR PinName,
+    REFIID riid,
+    LPVOID * ppv);
+
+/* output_pin.cpp */
+HRESULT
+WINAPI
+COutputPin_Constructor(
+    IBaseFilter * ParentFilter,
+    LPCWSTR PinName,
+    REFIID riid,
+    LPVOID * ppv);
+
+/* enumpins.cpp */
+HRESULT
+WINAPI
+CEnumPins_fnConstructor(
+    std::vector<IPin*> Pins,
+    REFIID riid,
+    LPVOID * ppv)
+;

Modified: trunk/reactos/dll/directx/ksproxy/proxy.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ksproxy/proxy.cpp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ksproxy/proxy.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ksproxy/proxy.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -36,6 +36,7 @@
 {
 public:
     typedef std::vector<IUnknown *>ProxyPluginVector;
+    typedef std::vector<IPin *> PinVector;
 
     STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
 
@@ -81,7 +82,7 @@
     // IKsObject
     HANDLE STDMETHODCALLTYPE KsGetObjectHandle();
 
-    CKsProxy() : m_Ref(0), m_pGraph(0), m_ReferenceClock(0), m_FilterState(State_Stopped), m_hDevice(0), m_Plugins(0) {};
+    CKsProxy() : m_Ref(0), m_pGraph(0), m_ReferenceClock(0), m_FilterState(State_Stopped), m_hDevice(0), m_Plugins(), m_Pins() {};
     virtual ~CKsProxy()
     {
         if (m_hDevice)
@@ -90,7 +91,11 @@
 
     HRESULT STDMETHODCALLTYPE GetSupportedSets(LPGUID * pOutGuid, PULONG NumGuids);
     HRESULT STDMETHODCALLTYPE LoadProxyPlugins(LPGUID pGuids, ULONG NumGuids);
-
+    HRESULT STDMETHODCALLTYPE GetNumberOfPins(PULONG NumPins);
+    HRESULT STDMETHODCALLTYPE GetPinInstanceCount(ULONG PinId, PKSPIN_CINSTANCES Instances);
+    HRESULT STDMETHODCALLTYPE GetPinDataflow(ULONG PinId, KSPIN_DATAFLOW * DataFlow);
+    HRESULT STDMETHODCALLTYPE GetPinName(ULONG PinId, KSPIN_DATAFLOW DataFlow, ULONG PinCount, LPWSTR * OutPinName);
+    HRESULT STDMETHODCALLTYPE CreatePins();
 protected:
     LONG m_Ref;
     IFilterGraph *m_pGraph;
@@ -98,6 +103,7 @@
     FILTER_STATE m_FilterState;
     HANDLE m_hDevice;
     ProxyPluginVector m_Plugins;
+    PinVector m_Pins;
 };
 
 HRESULT
@@ -291,6 +297,206 @@
     return S_OK;
 }
 
+HRESULT
+STDMETHODCALLTYPE
+CKsProxy::GetNumberOfPins(
+    PULONG NumPins)
+{
+    KSPROPERTY Property;
+    ULONG BytesReturned;
+
+    // setup request
+    Property.Set = KSPROPSETID_Pin;
+    Property.Id = KSPROPERTY_PIN_CTYPES;
+    Property.Flags = KSPROPERTY_TYPE_GET;
+
+    return KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)NumPins, sizeof(ULONG), &BytesReturned);
+}
+
+HRESULT
+STDMETHODCALLTYPE
+CKsProxy::GetPinInstanceCount(
+    ULONG PinId,
+    PKSPIN_CINSTANCES Instances)
+{
+    KSP_PIN Property;
+    ULONG BytesReturned;
+
+    // setup request
+    Property.Property.Set = KSPROPSETID_Pin;
+    Property.Property.Id = KSPROPERTY_PIN_CINSTANCES;
+    Property.Property.Flags = KSPROPERTY_TYPE_GET;
+    Property.PinId = PinId;
+    Property.Reserved = 0;
+
+    return KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_PIN), (PVOID)Instances, sizeof(KSPIN_CINSTANCES), &BytesReturned);
+}
+
+HRESULT
+STDMETHODCALLTYPE
+CKsProxy::GetPinDataflow(
+    ULONG PinId,
+    KSPIN_DATAFLOW * DataFlow)
+{
+    KSP_PIN Property;
+    ULONG BytesReturned;
+
+    // setup request
+    Property.Property.Set = KSPROPSETID_Pin;
+    Property.Property.Id = KSPROPERTY_PIN_DATAFLOW;
+    Property.Property.Flags = KSPROPERTY_TYPE_GET;
+    Property.PinId = PinId;
+    Property.Reserved = 0;
+
+    return KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_PIN), (PVOID)DataFlow, sizeof(KSPIN_DATAFLOW), &BytesReturned);
+}
+
+HRESULT
+STDMETHODCALLTYPE
+CKsProxy::GetPinName(
+    ULONG PinId,
+    KSPIN_DATAFLOW DataFlow,
+    ULONG PinCount,
+    LPWSTR * OutPinName)
+{
+    KSP_PIN Property;
+    LPWSTR PinName;
+    ULONG BytesReturned;
+    HRESULT hr;
+    WCHAR Buffer[100];
+
+    // setup request
+    Property.Property.Set = KSPROPSETID_Pin;
+    Property.Property.Id = KSPROPERTY_PIN_NAME;
+    Property.Property.Flags = KSPROPERTY_TYPE_GET;
+    Property.PinId = PinId;
+    Property.Reserved = 0;
+
+    // #1 try get it from pin directly
+    hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_PIN), NULL, 0, &BytesReturned);
+
+    if (hr == MAKE_HRESULT(SEVERITY_ERROR, FACILITY_WIN32, ERROR_MORE_DATA))
+    {
+        // allocate pin name
+        PinName = (LPWSTR)CoTaskMemAlloc(BytesReturned);
+        if (!PinName)
+            return E_OUTOFMEMORY;
+
+        // retry with allocated buffer
+        hr = KsSynchronousDeviceControl(m_hDevice, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSP_PIN), PinName, BytesReturned, &BytesReturned);
+        if (SUCCEEDED(hr))
+        {
+            *OutPinName = PinName;
+            return hr;
+        }
+
+        //free buffer
+        CoTaskMemFree(PinName);
+    }
+
+    //
+    // TODO: retrieve pin name from topology node
+    //
+
+    if (DataFlow == KSPIN_DATAFLOW_IN)
+    {
+        swprintf(Buffer, L"Input%lu", PinCount);
+    }
+    else
+    {
+        swprintf(Buffer, L"Output%lu", PinCount);
+    }
+
+    // allocate pin name 
+    PinName = (LPWSTR)CoTaskMemAlloc((wcslen(Buffer)+1) * sizeof(WCHAR));
+    if (!PinName)
+        return E_OUTOFMEMORY;
+
+    // copy pin name
+    wcscpy(PinName, Buffer);
+
+    // store result
+    *OutPinName = PinName;
+    // done
+    return S_OK;
+}
+
+HRESULT
+STDMETHODCALLTYPE
+CKsProxy::CreatePins()
+{
+    ULONG NumPins, Index;
+    KSPIN_CINSTANCES Instances;
+    KSPIN_DATAFLOW DataFlow;
+    HRESULT hr;
+    WCHAR Buffer[100];
+    LPWSTR PinName;
+    IPin * pPin;
+    ULONG InputPin = 0;
+    ULONG OutputPin = 0;
+
+    // get number of pins
+    hr = GetNumberOfPins(&NumPins);
+    if (FAILED(hr))
+        return hr;
+
+    for(Index = 0; Index < NumPins; Index++)
+    {
+        // query current instance count
+        hr = GetPinInstanceCount(Index, &Instances);
+        if (FAILED(hr))
+            continue;
+
+        if (Instances.CurrentCount == Instances.PossibleCount)
+        {
+            // already maximum reached for this pin
+            continue;
+        }
+
+        // get direction of pin
+        hr = GetPinDataflow(Index, &DataFlow);
+        if (FAILED(hr))
+            continue;
+
+        if (DataFlow == KSPIN_DATAFLOW_IN)
+            hr = GetPinName(Index, DataFlow, InputPin, &PinName);
+        else
+            hr = GetPinName(Index, DataFlow, OutputPin, &PinName);
+
+        if (FAILED(hr))
+            continue;
+
+        // construct the pins
+        if (DataFlow == KSPIN_DATAFLOW_IN)
+        {
+            hr = CInputPin_Constructor((IBaseFilter*)this, PinName, IID_IPin, (void**)&pPin);
+            if (FAILED(hr))
+            {
+                CoTaskMemFree(PinName);
+                continue;
+            }
+            InputPin++;
+        }
+        else
+        {
+            hr = COutputPin_Constructor((IBaseFilter*)this, PinName, IID_IPin, (void**)&pPin);
+            if (FAILED(hr))
+            {
+                CoTaskMemFree(PinName);
+                continue;
+            }
+            OutputPin++;
+        }
+
+        // store pins
+        m_Pins.push_back(pPin);
+
+        swprintf(Buffer, L"Index %lu DataFlow %lu Name %s\n", Index, DataFlow, PinName);
+        OutputDebugStringW(Buffer);
+    }
+
+    return S_OK;
+}
 
 HRESULT
 STDMETHODCALLTYPE
@@ -336,6 +542,19 @@
 
     // load all proxy plugins
     hr = LoadProxyPlugins(pGuid, NumGuids);
+    if (FAILED(hr))
+    {
+        CloseHandle(m_hDevice);
+        m_hDevice = NULL;
+        return hr;
+    }
+
+    // free sets
+    CoTaskMemFree(pGuid);
+
+    // now create the input / output pins
+    hr = CreatePins();
+
 
     CloseHandle(m_hDevice);
     m_hDevice = NULL;
@@ -438,8 +657,8 @@
 CKsProxy::EnumPins(
     IEnumPins **ppEnum)
 {
-    OutputDebugStringW(L"CKsProxy::EnumPins : NotImplemented\n");
-    return E_NOTIMPL;
+    OutputDebugStringW(L"CKsProxy::EnumPins\n");
+    return CEnumPins_fnConstructor(m_Pins, IID_IEnumPins, (void**)ppEnum);
 }
 
 HRESULT

Modified: trunk/reactos/dll/directx/msdvbnp/enum_mediatypes.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/msdvbnp/enum_mediatypes.cpp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/msdvbnp/enum_mediatypes.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/msdvbnp/enum_mediatypes.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -23,7 +23,7 @@
         InterlockedDecrement(&m_Ref);
         if (!m_Ref)
         {
-            //delete this;
+            delete this;
             return 0;
         }
         return m_Ref;

Modified: trunk/reactos/dll/directx/msdvbnp/enumpins.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/msdvbnp/enumpins.cpp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/msdvbnp/enumpins.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/msdvbnp/enumpins.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -23,7 +23,7 @@
         InterlockedDecrement(&m_Ref);
         if (!m_Ref)
         {
-            //delete this;
+            delete this;
             return 0;
         }
         return m_Ref;
@@ -95,6 +95,8 @@
             break;
 
         ppPins[i] = m_Pins[m_Index + i];
+        m_Pins[m_Index + i]->AddRef();
+
         i++;
     }
 

Modified: trunk/reactos/dll/directx/msdvbnp/networkprovider.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/msdvbnp/networkprovider.cpp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/msdvbnp/networkprovider.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/msdvbnp/networkprovider.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -25,7 +25,7 @@
         InterlockedDecrement(&m_Ref);
         if (!m_Ref)
         {
-            //delete this;
+            delete this;
             return 0;
         }
         return m_Ref;

Modified: trunk/reactos/dll/directx/msdvbnp/pin.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/msdvbnp/pin.cpp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/msdvbnp/pin.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/msdvbnp/pin.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -26,7 +26,7 @@
         InterlockedDecrement(&m_Ref);
         if (!m_Ref)
         {
-            //delete this;
+            delete this;
             return 0;
         }
         return m_Ref;
@@ -137,6 +137,7 @@
     wcscpy(pInfo->achName, PIN_ID);
     pInfo->dir = PINDIR_OUTPUT;
     pInfo->pFilter = m_ParentFilter;
+    m_ParentFilter->AddRef();
 
     return S_OK;
 }
@@ -182,7 +183,7 @@
     }
 
     MediaType->majortype = KSDATAFORMAT_TYPE_BDA_ANTENNA;
-    MediaType->subtype = GUID_NULL;
+    MediaType->subtype = MEDIASUBTYPE_None;
     MediaType->formattype = GUID_NULL;
     MediaType->bFixedSizeSamples = true;
     MediaType->bTemporalCompression = false;

Modified: trunk/reactos/dll/directx/msdvbnp/scanningtuner.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/msdvbnp/scanningtuner.cpp?rev=45768&r1=45767&r2=45768&view=diff
==============================================================================
--- trunk/reactos/dll/directx/msdvbnp/scanningtuner.cpp [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/msdvbnp/scanningtuner.cpp [iso-8859-1] Tue Mar  2 21:18:29 2010
@@ -23,7 +23,7 @@
         InterlockedDecrement(&m_Ref);
         if (!m_Ref)
         {
-            //delete this;
+            delete this;
             return 0;
         }
         return m_Ref;




More information about the Ros-diffs mailing list