if (IsEqualGUID(refiid, IID_IUnknown) ||
IsEqualGUID(refiid, IID_IPin))
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::QueryInterface IID_IPin\n");
+#endif
*Output = PVOID(this);
reinterpret_cast<IUnknown*>(*Output)->AddRef();
return NOERROR;
if (FAILED(hr))
return hr;
}
-
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::QueryInterface IID_IKsObject\n");
+#endif
*Output = (IKsObject*)(this);
reinterpret_cast<IKsObject*>(*Output)->AddRef();
return NOERROR;
if (FAILED(hr))
return hr;
}
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::QueryInterface IID_IKsPropertySet\n");
+#endif
*Output = (IKsPropertySet*)(this);
reinterpret_cast<IKsPropertySet*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_IKsControl))
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::QueryInterface IID_IKsControl\n");
+#endif
*Output = (IKsControl*)(this);
reinterpret_cast<IKsControl*>(*Output)->AddRef();
return NOERROR;
#endif
else if (IsEqualGUID(refiid, IID_IKsPinFactory))
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::QueryInterface IID_IKsPinFactory\n");
+#endif
*Output = (IKsPinFactory*)(this);
reinterpret_cast<IKsPinFactory*>(*Output)->AddRef();
return NOERROR;
}
else if (IsEqualGUID(refiid, IID_ISpecifyPropertyPages))
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::QueryInterface IID_ISpecifyPropertyPages\n");
+#endif
*Output = (ISpecifyPropertyPages*)(this);
reinterpret_cast<ISpecifyPropertyPages*>(*Output)->AddRef();
return NOERROR;
return NOERROR;
}
+#ifdef KSPROXY_TRACE
WCHAR Buffer[MAX_PATH];
LPOLESTR lpstr;
StringFromCLSID(refiid, &lpstr);
swprintf(Buffer, L"COutputPin::QueryInterface: NoInterface for %s PinId %u PinName %s\n", lpstr, m_PinId, m_PinName);
OutputDebugStringW(Buffer);
CoTaskMemFree(lpstr);
+#endif
return E_NOINTERFACE;
}
COutputPin::SuggestAllocatorProperties(
const ALLOCATOR_PROPERTIES *pprop)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::SuggestAllocatorProperties\n");
+#endif
if (m_Pin)
{
COutputPin::GetAllocatorProperties(
ALLOCATOR_PROPERTIES *pprop)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::GetAllocatorProperties\n");
+#endif
if (!m_Pin)
{
COutputPin::SetFormat(
AM_MEDIA_TYPE *pmt)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::SetFormat NotImplemented\n");
+#endif
return E_NOTIMPL;
}
STDMETHODCALLTYPE
COutputPin::GetFormat(AM_MEDIA_TYPE **ppmt)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::GetFormat NotImplemented\n");
+#endif
return E_NOTIMPL;
}
int *piCount,
int *piSize)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::GetNumberOfCapabilities NotImplemented\n");
+#endif
return E_NOTIMPL;
}
AM_MEDIA_TYPE **ppmt,
BYTE *pSCC)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::GetStreamCaps NotImplemented\n");
+#endif
return E_NOTIMPL;
}
STDMETHODCALLTYPE
COutputPin::NotifyRelease()
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::NotifyRelease\n");
+#endif
// notify thread of new available sample
SetEvent(m_hBufferAvailable);
IBaseFilter *pSelf,
Quality q)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::Notify NotImplemented\n");
+#endif
return E_NOTIMPL;
}
COutputPin::SetSink(
IQualityControl *piqc)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::SetSink NotImplemented\n");
+#endif
return E_NOTIMPL;
}
COutputPin::KsAddAggregate(
IN REFGUID AggregateClass)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::KsAddAggregate NotImplemented\n");
+#endif
return E_NOTIMPL;
}
COutputPin::KsRemoveAggregate(
REFGUID AggregateClass)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::KsRemoveAggregate NotImplemented\n");
+#endif
return E_NOTIMPL;
}
KSPIN_INTERFACE& Interface,
KSPIN_MEDIUM& Medium)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::KsCreateSinkPinHandle NotImplemented\n");
+#endif
return E_NOTIMPL;
}
ULONG BytesReturned;
HRESULT hr;
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::KsPropagateAcquire\n");
+#endif
assert(m_hPin != INVALID_HANDLE_VALUE);
State = KSSTATE_ACQUIRE;
hr = KsProperty(&Property, sizeof(KSPROPERTY), (LPVOID)&State, sizeof(KSSTATE), &BytesReturned);
+ if (SUCCEEDED(hr))
+ {
+ m_State = State;
+ }
//TODO
//propagate to connected pin on the pipe
ULONG Proportion,
REFERENCE_TIME TimeDelta)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::KsQualityNotify NotImplemented\n");
+#endif
return E_NOTIMPL;
}
IMediaSample* Sample,
HRESULT hr)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::KsNotifyError NotImplemented\n");
+#endif
}
STDMETHODCALLTYPE
COutputPin::GetPages(CAUUID *pPages)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::GetPages NotImplemented\n");
+#endif
if (!pPages)
return E_POINTER;
COutputPin::KsPinFactory(
ULONG* PinFactory)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::KsPinFactory\n");
+#endif
+
*PinFactory = m_PinId;
return S_OK;
}
IPin *ppinOut,
IGraphBuilder *pGraph)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::Render\n");
+#endif
return S_OK;
}
IPin *ppinOut,
IGraphBuilder *pGraph)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::Backout\n");
+#endif
+
return S_OK;
}
//-------------------------------------------------------------------
STDMETHODCALLTYPE
COutputPin::KsGetObjectHandle()
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::KsGetObjectHandle\n");
+#endif
+
assert(m_hPin != INVALID_HANDLE_VALUE);
return m_hPin;
}
ULONG* BytesReturned)
{
HRESULT hr;
- WCHAR Buffer[100];
- LPOLESTR pstr;
assert(m_hPin != INVALID_HANDLE_VALUE);
hr = KsSynchronousDeviceControl(m_hPin, IOCTL_KS_PROPERTY, (PVOID)Property, PropertyLength, (PVOID)PropertyData, DataLength, BytesReturned);
-
+#ifdef KSPROXY_TRACE
+ WCHAR Buffer[100];
+ LPOLESTR pstr;
StringFromCLSID(Property->Set, &pstr);
swprintf(Buffer, L"COutputPin::KsProperty Set %s Id %lu Flags %x hr %x\n", pstr, Property->Id, Property->Flags, hr);
OutputDebugStringW(Buffer);
+#endif
return hr;
}
ULONG* BytesReturned)
{
assert(m_hPin != INVALID_HANDLE_VALUE);
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::KsMethod\n");
+#endif
return KsSynchronousDeviceControl(m_hPin, IOCTL_KS_METHOD, (PVOID)Method, MethodLength, (PVOID)MethodData, DataLength, BytesReturned);
}
{
assert(m_hPin != INVALID_HANDLE_VALUE);
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::KsEvent\n");
+#endif
if (EventLength)
return KsSynchronousDeviceControl(m_hPin, IOCTL_KS_ENABLE_EVENT, (PVOID)Event, EventLength, (PVOID)EventData, DataLength, BytesReturned);
KSPROPERTY Property;
ULONG BytesReturned;
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::QuerySupported\n");
+#endif
Property.Set = guidPropSet;
Property.Id = dwPropID;
HRESULT hr;
ALLOCATOR_PROPERTIES Properties;
IMemAllocatorCallbackTemp *pMemCallback;
- WCHAR Buffer[200];
+#ifdef KSPROXY_TRACE
+ WCHAR Buffer[200];
OutputDebugStringW(L"COutputPin::Connect called\n");
+#endif
+
if (pmt)
{
hr = pReceivePin->QueryAccept(pmt);
hr = pReceivePin->QueryInterface(IID_IMemInputPin, (void**)&m_MemInputPin);
if (FAILED(hr))
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::Connect no IMemInputPin interface\n");
+#endif
+
DebugBreak();
return hr;
}
hr = m_MemAllocator->SetProperties(&Properties, &m_Properties);
if (FAILED(hr))
{
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin::Connect IMemAllocator::SetProperties failed with hr %lx\n", hr);
OutputDebugStringW(Buffer);
+#endif
m_MemAllocator->Release();
m_MemInputPin->Release();
return hr;
hr = m_MemAllocator->Commit();
if (FAILED(hr))
{
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin::Connect IMemAllocator::Commit failed with hr %lx\n", hr);
OutputDebugStringW(Buffer);
+#endif
m_MemAllocator->Release();
m_MemInputPin->Release();
return hr;
hr = m_MemAllocator->QueryInterface(IID_IMemAllocatorCallbackTemp, (void**)&pMemCallback);
if (FAILED(hr))
{
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin::Connect No IMemAllocatorCallbackTemp interface hr %lx\n", hr);
OutputDebugStringW(Buffer);
+#endif
m_MemAllocator->Release();
m_MemInputPin->Release();
return hr;
if (FAILED(hr))
{
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin::Connect IMemAllocatorNotifyCallbackTemp::SetNotify failed hr %lx\n", hr);
OutputDebugStringW(Buffer);
+#endif
m_MemAllocator->Release();
m_MemInputPin->Release();
return hr;
hr = m_MemInputPin->NotifyAllocator(m_MemAllocator, TRUE);
if (FAILED(hr))
{
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin::Connect IMemInputPin::NotifyAllocator failed with hr %lx\n", hr);
OutputDebugStringW(Buffer);
+#endif
m_MemAllocator->Release();
m_MemInputPin->Release();
return hr;
// increment reference count
pReceivePin->AddRef();
m_Pin = pReceivePin;
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::Connect success\n");
+#endif
}
else
{
STDMETHODCALLTYPE
COutputPin::Disconnect( void)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::Disconnect\n");
+#endif
if (!m_Pin)
{
CloseHandle(m_hPin);
m_hPin = INVALID_HANDLE_VALUE;
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::Disconnect\n");
+#endif
return S_OK;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::ConnectedTo(IPin **pPin)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::ConnectedTo\n");
+#endif
if (!pPin)
return E_POINTER;
STDMETHODCALLTYPE
COutputPin::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::ConnectionMediaType called\n");
+#endif
+
return E_NOTIMPL;
}
HRESULT
STDMETHODCALLTYPE
COutputPin::QueryAccept(const AM_MEDIA_TYPE *pmt)
{
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"COutputPin::QueryAccept called\n");
+#endif
+
return E_NOTIMPL;
}
HRESULT
}
else
{
+#ifdef KSPROXY_TRACE
WCHAR Buffer[100];
swprintf(Buffer, L"COutputPin::CreatePin unexpected communication %u %s\n", m_Communication, m_PinName);
OutputDebugStringW(Buffer);
DebugBreak();
+#endif
+
hr = E_FAIL;
}
CopyMemory(&m_Interface, Interface, sizeof(KSPIN_INTERFACE));
CopyMemory(&m_MediaFormat, pmt, sizeof(AM_MEDIA_TYPE));
+#ifdef KSPROXY_TRACE
LPOLESTR pMajor, pSub, pFormat;
StringFromIID(m_MediaFormat.majortype, &pMajor);
StringFromIID(m_MediaFormat.subtype , &pSub);
CoTaskMemFree(pSub);
CoTaskMemFree(pFormat);
OutputDebugStringW(Buffer);
+#endif
if (pmt->cbFormat)
{
HRESULT hr;
PKSSTREAM_SEGMENT StreamSegment;
HANDLE hEvent;
- WCHAR Buffer[200];
IMediaSample * Samples[1];
+#ifdef KSPROXY_TRACE
+ WCHAR Buffer[200];
+#endif
+
// first wait for the start event to signal
WaitForSingleObject(m_hStartEvent, INFINITE);
&StreamSegment);
if (FAILED(hr) || !StreamSegment)
{
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin::IoProcessRoutine KsProcessMediaSamples FAILED PinName %s hr %lx\n", m_PinName, hr);
OutputDebugStringW(Buffer);
+#endif
break;
}
// now deliver the sample
hr = m_MemInputPin->Receive(Sample);
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin::IoProcessRoutine PinName %s IMemInputPin::Receive hr %lx Sample %p m_MemAllocator %p\n", m_PinName, hr, Sample, m_MemAllocator);
OutputDebugStringW(Buffer);
+#endif
+
if (FAILED(hr))
- DebugBreak();
+ break;
+
Sample = NULL;
}
}while(TRUE);
HRESULT hr = S_OK;
KSPROPERTY Property;
KSSTATE CurState;
- WCHAR Buffer[200];
ULONG BytesReturned;
-
COutputPin * pPin = (COutputPin*)Pin;
+#ifdef KSPROXY_TRACE
+ WCHAR Buffer[200];
+#endif
+
Property.Set = KSPROPSETID_Connection;
Property.Id = KSPROPERTY_CONNECTION_STATE;
Property.Flags = KSPROPERTY_TYPE_SET;
if (FAILED(hr))
{
// failed to initialize I/O thread
+#ifdef KSPROXY_TRACE
OutputDebugStringW(L"Failed to initialize I/O Thread\n");
+#endif
LeaveCriticalSection(&pPin->m_Lock);
return hr;
}
CurState = KSSTATE_ACQUIRE;
hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_STOP KSSTATE_ACQUIRE PinName %s hr %lx\n", pPin->m_PinName, hr);
OutputDebugStringW(Buffer);
+#endif
+
if (FAILED(hr))
{
LeaveCriticalSection(&pPin->m_Lock);
CurState = KSSTATE_PAUSE;
hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin_SetState Setting State CurState KSSTATE_ACQUIRE KSSTATE_PAUSE PinName %s hr %lx\n", pPin->m_PinName, hr);
OutputDebugStringW(Buffer);
+#endif
+
if (FAILED(hr))
{
LeaveCriticalSection(&pPin->m_Lock);
CurState = KSSTATE_RUN;
hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_PAUSE KSSTATE_RUN PinName %s hr %lx\n", pPin->m_PinName, hr);
OutputDebugStringW(Buffer);
+#endif
if (SUCCEEDED(hr))
{
CurState = KSSTATE_PAUSE;
hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_RUN KSSTATE_PAUSE PinName %s hr %lx\n", pPin->m_PinName, hr);
OutputDebugStringW(Buffer);
+#endif
if (FAILED(hr))
{
CurState = KSSTATE_ACQUIRE;
hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_PAUSE KSSTATE_ACQUIRE PinName %s hr %lx\n", pPin->m_PinName, hr);
OutputDebugStringW(Buffer);
+#endif
if (FAILED(hr))
{
CurState = KSSTATE_STOP;
hr = pPin->KsProperty(&Property, sizeof(KSPROPERTY), &CurState, sizeof(KSSTATE), &BytesReturned);
+#ifdef KSPROXY_TRACE
swprintf(Buffer, L"COutputPin_SetState Setting State CurState: KSSTATE_ACQUIRE KSSTATE_STOP PinName %s hr %lx\n", pPin->m_PinName, hr);
OutputDebugStringW(Buffer);
+#endif
if (SUCCEEDED(hr))
{