Commit 5c1409b5 authored by Aric Stewart's avatar Aric Stewart Committed by Alexandre Julliard

strmbase: Move OutputPin implementation to strmbase.

parent 0410e50e
......@@ -5,7 +5,6 @@ C_SRCS = \
capturegraph.c \
dllsetup.c \
enummedia.c \
pin.c \
qcap_main.c \
v4l.c \
vfwcapture.c \
......
......@@ -35,21 +35,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(qcap);
BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2,
BOOL bWildcards)
{
TRACE("pmt1: ");
dump_AM_MEDIA_TYPE(pmt1);
TRACE("pmt2: ");
dump_AM_MEDIA_TYPE(pmt2);
return (((bWildcards && (IsEqualGUID(&pmt1->majortype, &GUID_NULL) ||
IsEqualGUID(&pmt2->majortype, &GUID_NULL))) ||
IsEqualGUID(&pmt1->majortype, &pmt2->majortype)) &&
((bWildcards && (IsEqualGUID(&pmt1->subtype, &GUID_NULL) ||
IsEqualGUID(&pmt2->subtype, &GUID_NULL))) ||
IsEqualGUID(&pmt1->subtype, &pmt2->subtype)));
}
void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt)
{
if (!pmt)
......
/*
* IPin function declarations to allow inheritance
*
* Copyright 2003 Robert Shearman
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* This function will process incoming samples to the pin.
* Any return value valid in IMemInputPin::Receive is allowed here
*/
typedef HRESULT (* SAMPLEPROC)(LPVOID userdata, IMediaSample * pSample);
/* This function will determine whether a type is supported or not.
* It is allowed to return any error value (within reason), as opposed
* to IPin::QueryAccept which is only allowed to return S_OK or S_FALSE.
*/
typedef HRESULT (* QUERYACCEPTPROC)(LPVOID userdata, const AM_MEDIA_TYPE * pmt);
/* This function is called prior to finalizing a connection with
* another pin and can be used to get things from the other pin
* like IMemInput interfaces.
*/
typedef HRESULT (* PRECONNECTPROC)(IPin * iface, IPin * pConnectPin);
typedef struct OutputPin
{
/* inheritance C style! */
BasePin pin;
IMemInputPin * pMemInputPin;
HRESULT (* pConnectSpecific)(IPin * iface, IPin * pReceiver, const AM_MEDIA_TYPE * pmt);
ALLOCATOR_PROPERTIES allocProps;
} OutputPin;
/*** Initializers ***/
HRESULT OutputPin_Init(const PIN_INFO * pPinInfo, const ALLOCATOR_PROPERTIES *props,
LPCRITICAL_SECTION pCritSec, OutputPin * pPinImpl);
/* Output Pin */
HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI OutputPin_Disconnect(IPin * iface);
HRESULT WINAPI OutputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT OutputPin_GetDeliveryBuffer(OutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags);
HRESULT OutputPin_SendSample(OutputPin * This, IMediaSample * pSample);
......@@ -37,7 +37,6 @@ extern IUnknown * WINAPI QCAP_createInfinitePinTeeFilter(IUnknown *pUnkOuter, HR
extern IUnknown * WINAPI QCAP_createSmartTeeFilter(IUnknown *pUnkOuter, HRESULT *phr);
extern IUnknown * WINAPI QCAP_createAudioInputMixerPropertyPage(IUnknown *pUnkOuter, HRESULT *phr);
BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2, BOOL bWildcards);
void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt);
enum YUV_Format {
......
......@@ -43,7 +43,6 @@
#include "capture.h"
#include "qcap_main.h"
#include "pin.h"
#include <stdio.h>
#include <fcntl.h>
......@@ -619,7 +618,7 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
EnterCriticalSection(&capBox->CritSect);
if (capBox->stopped)
break;
hr = OutputPin_GetDeliveryBuffer((OutputPin *)capBox->pOut, &pSample, NULL, NULL, 0);
hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin *)capBox->pOut, &pSample, NULL, NULL, 0);
if (SUCCEEDED(hr))
{
int len;
......@@ -638,7 +637,7 @@ static DWORD WINAPI ReadThread(LPVOID lParam)
V4l_GetFrame(capBox, &pInput);
capBox->renderer(capBox, pOutput, pInput);
Resize(capBox, pTarget, pOutput);
hr = OutputPin_SendSample((OutputPin *)capBox->pOut, pSample);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin *)capBox->pOut, pSample);
TRACE("%p -> Frame %u: %x\n", capBox, ++framecount, hr);
IMediaSample_Release(pSample);
V4l_FreeFrame(capBox);
......@@ -686,7 +685,7 @@ HRESULT qcap_driver_run(Capture *capBox, FILTER_STATE *state)
{
IMemAllocator * pAlloc = NULL;
ALLOCATOR_PROPERTIES ap, actual;
OutputPin *out;
BaseOutputPin *out;
ap.cBuffers = 3;
if (!capBox->swresize)
......@@ -697,7 +696,7 @@ HRESULT qcap_driver_run(Capture *capBox, FILTER_STATE *state)
ap.cbAlign = 1;
ap.cbPrefix = 0;
out = (OutputPin *)capBox->pOut;
out = (BaseOutputPin *)capBox->pOut;
hr = IMemInputPin_GetAllocator(out->pMemInputPin, &pAlloc);
if (SUCCEEDED(hr))
......
......@@ -35,7 +35,6 @@
#include "qcap_main.h"
#include "wine/debug.h"
#include "pin.h"
#include "capture.h"
#include "uuids.h"
#include "vfwmsgs.h"
......@@ -78,7 +77,7 @@ typedef struct VfwCapture
/* VfwPin implementation */
typedef struct VfwPinImpl
{
OutputPin pin;
BaseOutputPin pin;
Capture *driver_info;
VfwCapture *parent;
const IKsPropertySetVtbl * KSP_VT;
......@@ -786,13 +785,10 @@ VfwPin_Construct( IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec,
{
static const WCHAR wszOutputPinName[] = { 'O','u','t','p','u','t',0 };
ALLOCATOR_PROPERTIES ap;
VfwPinImpl * pPinImpl;
PIN_INFO piOutput;
HRESULT hr;
pPinImpl = CoTaskMemAlloc( sizeof(*pPinImpl) );
if (!pPinImpl)
return E_OUTOFMEMORY;
ppPin = NULL;
/* What we put here doesn't matter, the
driver function should override it then commit */
......@@ -806,17 +802,15 @@ VfwPin_Construct( IBaseFilter * pBaseFilter, LPCRITICAL_SECTION pCritSec,
lstrcpyW(piOutput.achName, wszOutputPinName);
ObjectRefCount(TRUE);
hr = OutputPin_Init(&piOutput, &ap, pCritSec, &pPinImpl->pin);
hr = BaseOutputPin_Construct(&VfwPin_Vtbl, sizeof(VfwPinImpl), &piOutput, &ap, NULL, pCritSec, ppPin);
if (SUCCEEDED(hr))
{
VfwPinImpl *pPinImpl = (VfwPinImpl*)*ppPin;
pPinImpl->KSP_VT = &KSP_VTable;
pPinImpl->pin.pin.lpVtbl = &VfwPin_Vtbl;
*ppPin = (IPin *)(&pPinImpl->pin.pin.lpVtbl);
return S_OK;
}
CoTaskMemFree(pPinImpl);
return E_FAIL;
return hr;
}
static HRESULT WINAPI VfwPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
......@@ -924,9 +918,9 @@ static const IPinVtbl VfwPin_Vtbl =
VfwPin_QueryInterface,
VfwPin_AddRef,
VfwPin_Release,
OutputPin_Connect,
OutputPin_ReceiveConnection,
OutputPin_Disconnect,
BaseOutputPinImpl_Connect,
BaseOutputPinImpl_ReceiveConnection,
BaseOutputPinImpl_Disconnect,
BasePinImpl_ConnectedTo,
BasePinImpl_ConnectionMediaType,
BasePinImpl_QueryPinInfo,
......
......@@ -120,7 +120,7 @@ static HRESULT ACMWrapper_ProcessSampleData(InputPin *pin, IMediaSample *pSample
while(hr == S_OK && ash.cbSrcLength)
{
hr = OutputPin_GetDeliveryBuffer((OutputPin*)This->tf.ppPins[1], &pOutSample, NULL, NULL, 0);
hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin*)This->tf.ppPins[1], &pOutSample, NULL, NULL, 0);
if (FAILED(hr))
{
ERR("Unable to get delivery buffer (%x)\n", hr);
......@@ -205,7 +205,7 @@ static HRESULT ACMWrapper_ProcessSampleData(InputPin *pin, IMediaSample *pSample
TRACE("Sample stop time: %u.%03u\n", (DWORD)(tStart/10000000), (DWORD)((tStart/10000)%1000));
LeaveCriticalSection(&This->tf.csFilter);
hr = OutputPin_SendSample((OutputPin*)This->tf.ppPins[1], pOutSample);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)This->tf.ppPins[1], pOutSample);
EnterCriticalSection(&This->tf.csFilter);
if (hr != S_OK && hr != VFW_E_NOT_CONNECTED) {
......@@ -272,7 +272,7 @@ static HRESULT ACMWrapper_ConnectInput(InputPin *pin, const AM_MEDIA_TYPE * pmt)
This->has = drv;
/* Update buffer size of media samples in output */
((OutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pWfOut->nAvgBytesPerSec / 2;
((BaseOutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pWfOut->nAvgBytesPerSec / 2;
TRACE("Connection accepted\n");
return S_OK;
}
......
......@@ -112,7 +112,7 @@ static HRESULT AVIDec_ProcessSampleData(InputPin *pin, IMediaSample *pSample)
/* Update input size to match sample size */
This->pBihIn->biSizeImage = cbSrcStream;
hr = OutputPin_GetDeliveryBuffer((OutputPin*)This->tf.ppPins[1], &pOutSample, NULL, NULL, 0);
hr = BaseOutputPinImpl_GetDeliveryBuffer((BaseOutputPin*)This->tf.ppPins[1], &pOutSample, NULL, NULL, 0);
if (FAILED(hr)) {
ERR("Unable to get delivery buffer (%x)\n", hr);
goto error;
......@@ -149,7 +149,7 @@ static HRESULT AVIDec_ProcessSampleData(InputPin *pin, IMediaSample *pSample)
IMediaSample_SetTime(pOutSample, NULL, NULL);
LeaveCriticalSection(&This->tf.csFilter);
hr = OutputPin_SendSample((OutputPin*)This->tf.ppPins[1], pOutSample);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)This->tf.ppPins[1], pOutSample);
if (hr != S_OK && hr != VFW_E_NOT_CONNECTED)
ERR("Error sending sample (%x)\n", hr);
IMediaSample_Release(pOutSample);
......@@ -269,7 +269,7 @@ static HRESULT AVIDec_ConnectInput(InputPin *pin, const AM_MEDIA_TYPE * pmt)
assert(0);
/* Update buffer size of media samples in output */
((OutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pBihOut->biSizeImage;
((BaseOutputPin*)This->tf.ppPins[1])->allocProps.cbBuffer = This->pBihOut->biSizeImage;
TRACE("Connection accepted\n");
return S_OK;
......
......@@ -311,7 +311,7 @@ static HRESULT AVISplitter_Receive(AVISplitterImpl *This, IMediaSample *sample,
IMediaSample_SetTime(sample, &start, &stop);
hr = OutputPin_SendSample(&pin->pin, sample);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)&pin->pin, sample);
/* Uncomment this if you want to debug the time differences between the
* different streams, it is useful for that
......
......@@ -24,16 +24,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
BOOL CompareMediaTypes(const AM_MEDIA_TYPE * pmt1, const AM_MEDIA_TYPE * pmt2, BOOL bWildcards)
{
TRACE("pmt1: ");
dump_AM_MEDIA_TYPE(pmt1);
TRACE("pmt2: ");
dump_AM_MEDIA_TYPE(pmt2);
return (((bWildcards && (IsEqualGUID(&pmt1->majortype, &GUID_NULL) || IsEqualGUID(&pmt2->majortype, &GUID_NULL))) || IsEqualGUID(&pmt1->majortype, &pmt2->majortype)) &&
((bWildcards && (IsEqualGUID(&pmt1->subtype, &GUID_NULL) || IsEqualGUID(&pmt2->subtype, &GUID_NULL))) || IsEqualGUID(&pmt1->subtype, &pmt2->subtype)));
}
void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt)
{
if (!pmt)
......
......@@ -773,7 +773,7 @@ typedef struct DATAREQUEST
typedef struct FileAsyncReader
{
OutputPin pin;
BaseOutputPin pin;
const struct IAsyncReaderVtbl * lpVtblAR;
HANDLE hFile;
......@@ -886,8 +886,8 @@ static const IPinVtbl FileAsyncReaderPin_Vtbl =
FileAsyncReaderPin_QueryInterface,
BasePinImpl_AddRef,
FileAsyncReaderPin_Release,
OutputPin_Connect,
OutputPin_ReceiveConnection,
BaseOutputPinImpl_Connect,
BaseOutputPinImpl_ReceiveConnection,
BasePinImpl_Disconnect,
BasePinImpl_ConnectedTo,
BasePinImpl_ConnectionMediaType,
......@@ -897,19 +897,19 @@ static const IPinVtbl FileAsyncReaderPin_Vtbl =
FileAsyncReaderPin_QueryAccept,
FileAsyncReaderPin_EnumMediaTypes,
BasePinImpl_QueryInternalConnections,
OutputPin_EndOfStream,
OutputPin_BeginFlush,
OutputPin_EndFlush,
OutputPin_NewSegment
BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush,
BaseOutputPinImpl_EndFlush,
BaseOutputPinImpl_NewSegment
};
/* Function called as a helper to IPin_Connect */
/* specific AM_MEDIA_TYPE - it cannot be NULL */
/* this differs from standard OutputPin_ConnectSpecific only in that it
/* this differs from standard OutputPin_AttemptConnection only in that it
* doesn't need the IMemInputPin interface on the receiving pin */
static HRESULT FileAsyncReaderPin_ConnectSpecific(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
static HRESULT WINAPI FileAsyncReaderPin_AttemptConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
{
OutputPin *This = (OutputPin *)iface;
BaseOutputPin *This = (BaseOutputPin *)iface;
HRESULT hr;
TRACE("(%p, %p)\n", pReceivePin, pmt);
......@@ -943,7 +943,7 @@ static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter
piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = pBaseFilter;
strcpyW(piOutput.achName, wszOutputPinName);
hr = OutputPin_Construct(&FileAsyncReaderPin_Vtbl, sizeof(FileAsyncReader), &piOutput, NULL, pCritSec, ppPin);
hr = BaseOutputPin_Construct(&FileAsyncReaderPin_Vtbl, sizeof(FileAsyncReader), &piOutput, NULL, FileAsyncReaderPin_AttemptConnection, pCritSec, ppPin);
if (SUCCEEDED(hr))
{
......@@ -954,7 +954,6 @@ static HRESULT FileAsyncReader_Construct(HANDLE hFile, IBaseFilter * pBaseFilter
pPinImpl->sample_list = NULL;
pPinImpl->handle_list = NULL;
pPinImpl->queued_number = 0;
pPinImpl->pin.pConnectSpecific = FileAsyncReaderPin_ConnectSpecific;
InitializeCriticalSection(&pPinImpl->csList);
pPinImpl->csList.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": FileAsyncReader.csList");
}
......
......@@ -226,7 +226,7 @@ static HRESULT FillBuffer(MPEGSplitterImpl *This, IMediaSample *pCurrentSample)
IMediaSample_SetTime(pCurrentSample, &time, &This->position);
hr = OutputPin_SendSample(&pOutputPin->pin, pCurrentSample);
hr = BaseOutputPinImpl_Deliver((BaseOutputPin*)&pOutputPin->pin, pCurrentSample);
if (hr != S_OK)
{
......
......@@ -234,7 +234,7 @@ HRESULT WINAPI Parser_Stop(IBaseFilter * iface)
for (i = 1; i < (This->cStreams + 1); i++)
{
OutputPin_DecommitAllocator((OutputPin *)This->ppPins[i]);
BaseOutputPinImpl_Inactive((BaseOutputPin *)This->ppPins[i]);
}
LeaveCriticalSection(&This->csFilter);
......@@ -308,7 +308,7 @@ HRESULT WINAPI Parser_Run(IBaseFilter * iface, REFERENCE_TIME tStart)
for (i = 1; i < (This->cStreams + 1); i++)
{
hr = OutputPin_CommitAllocator((OutputPin *)This->ppPins[i]);
hr = BaseOutputPinImpl_Active((BaseOutputPin *)This->ppPins[i]);
if (SUCCEEDED(hr))
hr_any = hr;
}
......@@ -491,7 +491,7 @@ HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PR
This->ppPins = CoTaskMemAlloc((This->cStreams + 2) * sizeof(IPin *));
memcpy(This->ppPins, ppOldPins, (This->cStreams + 1) * sizeof(IPin *));
hr = OutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, props, &This->csFilter, This->ppPins + (This->cStreams + 1));
hr = BaseOutputPin_Construct(&Parser_OutputPin_Vtbl, sizeof(Parser_OutputPin), piOutput, props, NULL, &This->csFilter, This->ppPins + (This->cStreams + 1));
if (SUCCEEDED(hr))
{
......@@ -532,7 +532,7 @@ static HRESULT Parser_RemoveOutputPins(ParserImpl * This)
for (i = 0; i < This->cStreams; i++)
{
hr = OutputPin_DeliverDisconnect((OutputPin *)ppOldPins[i + 1]);
hr = BaseOutputPinImpl_BreakConnect((BaseOutputPin *)ppOldPins[i + 1]);
TRACE("Disconnect: %08x\n", hr);
IPin_Release(ppOldPins[i + 1]);
}
......@@ -684,7 +684,7 @@ static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin,
This->pin.alloc = parser->pInputPin->pAlloc;
LeaveCriticalSection(This->pin.pin.pCritSec);
return OutputPin_Connect(iface, pReceivePin, pmt);
return BaseOutputPinImpl_Connect(iface, pReceivePin, pmt);
}
static HRESULT WINAPI Parser_OutputPin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE * pmt)
......@@ -703,8 +703,8 @@ static const IPinVtbl Parser_OutputPin_Vtbl =
BasePinImpl_AddRef,
Parser_OutputPin_Release,
Parser_OutputPin_Connect,
OutputPin_ReceiveConnection,
OutputPin_Disconnect,
BaseOutputPinImpl_ReceiveConnection,
BaseOutputPinImpl_Disconnect,
BasePinImpl_ConnectedTo,
BasePinImpl_ConnectionMediaType,
BasePinImpl_QueryPinInfo,
......@@ -713,10 +713,10 @@ static const IPinVtbl Parser_OutputPin_Vtbl =
Parser_OutputPin_QueryAccept,
Parser_OutputPin_EnumMediaTypes,
BasePinImpl_QueryInternalConnections,
OutputPin_EndOfStream,
OutputPin_BeginFlush,
OutputPin_EndFlush,
OutputPin_NewSegment
BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush,
BaseOutputPinImpl_EndFlush,
BaseOutputPinImpl_NewSegment
};
static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface)
......
......@@ -49,7 +49,7 @@ struct ParserImpl
typedef struct Parser_OutputPin
{
OutputPin pin;
BaseOutputPin pin;
AM_MEDIA_TYPE * pmt;
LONGLONG dwSamplesProcessed;
......
......@@ -84,19 +84,6 @@ typedef struct InputPin
IMemAllocator *preferred_allocator;
} InputPin;
typedef struct OutputPin
{
/* inheritance C style! */
BasePin pin;
IMemInputPin * pMemInputPin;
HRESULT (* pConnectSpecific)(IPin * iface, IPin * pReceiver, const AM_MEDIA_TYPE * pmt);
BOOL custom_allocator;
IMemAllocator *alloc;
BOOL readonly;
ALLOCATOR_PROPERTIES allocProps;
} OutputPin;
typedef struct PullPin
{
/* inheritance C style! */
......@@ -134,7 +121,6 @@ typedef struct PullPin
/*** Constructors ***/
HRESULT InputPin_Construct(const IPinVtbl *InputPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PUSH pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
HRESULT OutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, STOPPROCESSPROC, REQUESTPROC pCustomRequest, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
/**************************/
......@@ -151,23 +137,6 @@ HRESULT WINAPI InputPin_BeginFlush(IPin * iface);
HRESULT WINAPI InputPin_EndFlush(IPin * iface);
HRESULT WINAPI InputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
/* Output Pin */
HRESULT WINAPI OutputPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
ULONG WINAPI OutputPin_Release(IPin * iface);
HRESULT WINAPI OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI OutputPin_Disconnect(IPin * iface);
HRESULT WINAPI OutputPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI OutputPin_EndOfStream(IPin * iface);
HRESULT WINAPI OutputPin_BeginFlush(IPin * iface);
HRESULT WINAPI OutputPin_EndFlush(IPin * iface);
HRESULT WINAPI OutputPin_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
HRESULT OutputPin_CommitAllocator(OutputPin * This);
HRESULT OutputPin_DecommitAllocator(OutputPin * This);
HRESULT OutputPin_GetDeliveryBuffer(OutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags);
HRESULT OutputPin_SendSample(OutputPin * This, IMediaSample * pSample);
HRESULT OutputPin_DeliverDisconnect(OutputPin * This);
/* Pull Pin */
HRESULT WINAPI PullPin_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI PullPin_Disconnect(IPin * iface);
......
......@@ -117,7 +117,7 @@ HRESULT TransformFilter_Create(TransformFilterImpl* pTransformFilter, const CLSI
((InputPin *)pTransformFilter->ppPins[0])->pUserData = pTransformFilter->ppPins[0];
hr = OutputPin_Construct(&TransformFilter_OutputPin_Vtbl, sizeof(OutputPin), &piOutput, &props, &pTransformFilter->csFilter, &pTransformFilter->ppPins[1]);
hr = BaseOutputPin_Construct(&TransformFilter_OutputPin_Vtbl, sizeof(BaseOutputPin), &piOutput, &props, NULL, &pTransformFilter->csFilter, &pTransformFilter->ppPins[1]);
if (FAILED(hr))
ERR("Cannot create output pin (%x)\n", hr);
......@@ -295,7 +295,7 @@ static HRESULT WINAPI TransformFilter_Run(IBaseFilter * iface, REFERENCE_TIME tS
if (This->pFuncsTable->pfnProcessBegin)
hr = This->pFuncsTable->pfnProcessBegin(This);
if (SUCCEEDED(hr))
hr = OutputPin_CommitAllocator((OutputPin *)This->ppPins[1]);
hr = BaseOutputPinImpl_Active((BaseOutputPin *)This->ppPins[1]);
}
if (SUCCEEDED(hr))
......@@ -624,12 +624,12 @@ static HRESULT WINAPI TransformFilter_Output_EnumMediaTypes(IPin * iface, IEnumM
static const IPinVtbl TransformFilter_OutputPin_Vtbl =
{
OutputPin_QueryInterface,
BaseOutputPinImpl_QueryInterface,
BasePinImpl_AddRef,
OutputPin_Release,
OutputPin_Connect,
OutputPin_ReceiveConnection,
OutputPin_Disconnect,
BaseOutputPinImpl_Release,
BaseOutputPinImpl_Connect,
BaseOutputPinImpl_ReceiveConnection,
BaseOutputPinImpl_Disconnect,
BasePinImpl_ConnectedTo,
BasePinImpl_ConnectionMediaType,
BasePinImpl_QueryPinInfo,
......@@ -638,8 +638,8 @@ static const IPinVtbl TransformFilter_OutputPin_Vtbl =
TransformFilter_Output_QueryAccept,
TransformFilter_Output_EnumMediaTypes,
BasePinImpl_QueryInternalConnections,
OutputPin_EndOfStream,
OutputPin_BeginFlush,
OutputPin_EndFlush,
OutputPin_NewSegment
BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush,
BaseOutputPinImpl_EndFlush,
BaseOutputPinImpl_NewSegment
};
......@@ -132,7 +132,7 @@ static HRESULT WAVEParser_Sample(LPVOID iface, IMediaSample * pSample, DWORD_PTR
IMediaSample_SetTime(pSample, &tAviStart, &tAviStop);
hr = OutputPin_SendSample(&pOutputPin->pin, pSample);
hr = BaseOutputPinImpl_Deliver(&pOutputPin->pin, pSample);
if (hr != S_OK && hr != S_FALSE && hr != VFW_E_WRONG_STATE)
ERR("Error sending sample (%x)\n", hr);
else if (hr != S_OK)
......
......@@ -26,6 +26,7 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);
typedef HRESULT (WINAPI *BasePin_GetMediaType)(IPin* iface, int iPosition, AM_MEDIA_TYPE *amt);
typedef LONG (WINAPI *BasePin_GetMediaTypeVersion)(IPin* iface);
typedef HRESULT (WINAPI *BasePin_AttemptConnection)(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
typedef IPin* (WINAPI *BaseFilter_GetPin)(IBaseFilter* iface, int iPosition);
typedef LONG (WINAPI *BaseFilter_GetPinCount)(IBaseFilter* iface);
......@@ -47,6 +48,19 @@ typedef struct BasePin
AM_MEDIA_TYPE mtCurrent;
} BasePin;
typedef struct BaseOutputPin
{
/* inheritance C style! */
BasePin pin;
IMemInputPin * pMemInputPin;
BasePin_AttemptConnection pAttemptConnection;
BOOL custom_allocator;
IMemAllocator *alloc;
BOOL readonly;
ALLOCATOR_PROPERTIES allocProps;
} BaseOutputPin;
/* Base Pin */
HRESULT WINAPI BasePinImpl_GetMediaType(IPin *iface, int iPosition, AM_MEDIA_TYPE *pmt);
LONG WINAPI BasePinImpl_GetMediaTypeVersion(IPin *iface);
......@@ -60,3 +74,21 @@ HRESULT WINAPI BasePinImpl_QueryId(IPin * iface, LPWSTR * Id);
HRESULT WINAPI BasePinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI BasePinImpl_EnumMediaTypes(IPin * iface, IEnumMediaTypes ** ppEnum);
HRESULT WINAPI BasePinImpl_QueryInternalConnections(IPin * iface, IPin ** apPin, ULONG * cPin);
/* Base Output Pin */
HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
ULONG WINAPI BaseOutputPinImpl_Release(IPin * iface);
HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI BaseOutputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt);
HRESULT WINAPI BaseOutputPinImpl_Disconnect(IPin * iface);
HRESULT WINAPI BaseOutputPinImpl_EndOfStream(IPin * iface);
HRESULT WINAPI BaseOutputPinImpl_BeginFlush(IPin * iface);
HRESULT WINAPI BaseOutputPinImpl_EndFlush(IPin * iface);
HRESULT WINAPI BaseOutputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
HRESULT WINAPI BaseOutputPinImpl_GetDeliveryBuffer(BaseOutputPin * This, IMediaSample ** ppSample, REFERENCE_TIME * tStart, REFERENCE_TIME * tStop, DWORD dwFlags);
HRESULT WINAPI BaseOutputPinImpl_Deliver(BaseOutputPin * This, IMediaSample * pSample);
HRESULT WINAPI BaseOutputPinImpl_BreakConnect(BaseOutputPin * This);
HRESULT WINAPI BaseOutputPinImpl_Active(BaseOutputPin * This);
HRESULT WINAPI BaseOutputPinImpl_Inactive(BaseOutputPin * This);
HRESULT WINAPI BaseOutputPin_Construct(const IPinVtbl *OutputPin_Vtbl, LONG outputpin_size, const PIN_INFO * pPinInfo, ALLOCATOR_PROPERTIES *props, BasePin_AttemptConnection pConnectProc, LPCRITICAL_SECTION pCritSec, IPin ** ppPin);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment