Skip to content

Commit

Permalink
Update issue 300
Browse files Browse the repository at this point in the history
Implement IPin::QueryInternalConnections in the Debug build of the
AnalyzerFilter for testing reasons.
  • Loading branch information
cplussharp committed Feb 18, 2017
1 parent e40cd2b commit 9f644dd
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/filters/analyzer/filter_analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,33 @@ class CAnalyzerInputPin : public CTransInPlaceInputPin
{
}

#ifdef _DEBUG
// if every Input is Connected to every Output this method should return E_NOTIMPL
// so this Debug-Implementation is just for testing
STDMETHODIMP QueryInternalConnections(IPin** apPin, ULONG* nPin)
{
if (!nPin) return E_POINTER;

if (!apPin) {
if (*nPin > 0) return E_POINTER;
*nPin = 1;
return S_FALSE;
}

if (*nPin < 1) {
*nPin = 1;
return S_FALSE;
}

// internaly connected to the output pin
apPin[0] = m_pTIPFilter->GetPin(1);
apPin[0]->AddRef();
*nPin = 1;

return S_OK;
}
#endif

protected:
CAnalyzer* m_Analyzer;

Expand Down Expand Up @@ -120,6 +147,33 @@ class CAnalyzerOutputPin : public CTransInPlaceOutputPin
DECLARE_IUNKNOWN
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv);

#ifdef _DEBUG
// if every Input is Connected to every Output this method should return E_NOTIMPL
// so this Debug-Implementation is just for testing
STDMETHODIMP QueryInternalConnections(IPin** apPin, ULONG* nPin)
{
if (!nPin) return E_POINTER;

if (!apPin) {
if (*nPin > 0) return E_POINTER;
*nPin = 1;
return S_FALSE;
}

if (*nPin < 1) {
*nPin = 1;
return S_FALSE;
}

// internaly connected to the input pin
apPin[0] = m_pTIPFilter->GetPin(0);
apPin[0]->AddRef();
*nPin = 1;

return S_OK;
}
#endif

protected:
CAnalyzer* m_Analyzer;
CAnalyzerPosPassThru* m_PassThru;
Expand Down
9 changes: 9 additions & 0 deletions src/filters/analyzer/filter_analyzer_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ CAnalyzerWriterInput::GetAllocatorRequirements(__out ALLOCATOR_PROPERTIES*pProps
return S_OK;
}

STDMETHODIMP CAnalyzerWriterInput::QueryInternalConnections(IPin** apPin, ULONG* nPin)
{
if (!nPin) return E_POINTER;

// this is a renderer so the pin has no internal connections
*nPin = 0;
return S_OK;
}

#pragma region IStream

/*********************************************************************************************
Expand Down
1 change: 1 addition & 0 deletions src/filters/analyzer/filter_analyzer_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class CAnalyzerWriterInput : public CRendererInputPin, public IStream
STDMETHODIMP NonDelegatingQueryInterface(REFIID iid, void** ppv);

STDMETHODIMP GetAllocatorRequirements(__out ALLOCATOR_PROPERTIES* pProps);
STDMETHODIMP QueryInternalConnections(IPin** apPin, ULONG* nPin);

// IStream Methods
STDMETHOD(Read) (void* pv, ULONG cb, ULONG* pcbRead);
Expand Down

0 comments on commit 9f644dd

Please sign in to comment.