Commit 28a51155 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

strmbase: Store the filter as a strmbase_filter pointer in the BasePin structure.

parent 85e559fa
...@@ -64,7 +64,7 @@ static inline AVICompressor *impl_from_IBaseFilter(IBaseFilter *iface) ...@@ -64,7 +64,7 @@ static inline AVICompressor *impl_from_IBaseFilter(IBaseFilter *iface)
static inline AVICompressor *impl_from_BasePin(BasePin *pin) static inline AVICompressor *impl_from_BasePin(BasePin *pin)
{ {
return impl_from_IBaseFilter(pin->pinInfo.pFilter); return impl_from_strmbase_filter(pin->filter);
} }
static HRESULT ensure_driver(AVICompressor *This) static HRESULT ensure_driver(AVICompressor *This)
...@@ -315,8 +315,7 @@ static const IPersistPropertyBagVtbl PersistPropertyBagVtbl = { ...@@ -315,8 +315,7 @@ static const IPersistPropertyBagVtbl PersistPropertyBagVtbl = {
static inline AVICompressor *impl_from_IPin(IPin *iface) static inline AVICompressor *impl_from_IPin(IPin *iface)
{ {
BasePin *bp = CONTAINING_RECORD(iface, BasePin, IPin_iface); return impl_from_strmbase_filter(CONTAINING_RECORD(iface, BasePin, IPin_iface)->filter);
return impl_from_IBaseFilter(bp->pinInfo.pFilter);
} }
static HRESULT WINAPI AVICompressorIn_QueryInterface(IPin *iface, REFIID riid, void **ppv) static HRESULT WINAPI AVICompressorIn_QueryInterface(IPin *iface, REFIID riid, void **ppv)
...@@ -536,7 +535,7 @@ static const IPinVtbl AVICompressorOutputPinVtbl = { ...@@ -536,7 +535,7 @@ static const IPinVtbl AVICompressorOutputPinVtbl = {
static HRESULT WINAPI AVICompressorOut_GetMediaType(BasePin *base, int iPosition, AM_MEDIA_TYPE *amt) static HRESULT WINAPI AVICompressorOut_GetMediaType(BasePin *base, int iPosition, AM_MEDIA_TYPE *amt)
{ {
AVICompressor *This = impl_from_IBaseFilter(base->pinInfo.pFilter); AVICompressor *This = impl_from_strmbase_filter(base->filter);
TRACE("(%p)->(%d %p)\n", base, iPosition, amt); TRACE("(%p)->(%d %p)\n", base, iPosition, amt);
...@@ -591,8 +590,8 @@ static const BaseOutputPinFuncTable AVICompressorBaseOutputPinVtbl = { ...@@ -591,8 +590,8 @@ static const BaseOutputPinFuncTable AVICompressorBaseOutputPinVtbl = {
IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr) IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr)
{ {
PIN_INFO in_pin_info = {NULL, PINDIR_INPUT, {'I','n',0}}; static const WCHAR source_name[] = {'O','u','t',0};
PIN_INFO out_pin_info = {NULL, PINDIR_OUTPUT, {'O','u','t',0}}; static const WCHAR sink_name[] = {'I','n',0};
AVICompressor *compressor; AVICompressor *compressor;
compressor = heap_alloc_zero(sizeof(*compressor)); compressor = heap_alloc_zero(sizeof(*compressor));
...@@ -605,13 +604,10 @@ IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr) ...@@ -605,13 +604,10 @@ IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr)
compressor->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl; compressor->IPersistPropertyBag_iface.lpVtbl = &PersistPropertyBagVtbl;
in_pin_info.pFilter = &compressor->filter.IBaseFilter_iface; strmbase_sink_init(&compressor->sink, &AVICompressorInputPinVtbl,
strmbase_sink_init(&compressor->sink, &AVICompressorInputPinVtbl, &in_pin_info, &compressor->filter, sink_name, &AVICompressorBaseInputPinVtbl, NULL);
&AVICompressorBaseInputPinVtbl, &compressor->filter.csFilter, NULL); strmbase_source_init(&compressor->source, &AVICompressorOutputPinVtbl,
&compressor->filter, source_name, &AVICompressorBaseOutputPinVtbl);
out_pin_info.pFilter = &compressor->filter.IBaseFilter_iface;
strmbase_source_init(&compressor->source, &AVICompressorOutputPinVtbl, &out_pin_info,
&AVICompressorBaseOutputPinVtbl, &compressor->filter.csFilter);
*phr = S_OK; *phr = S_OK;
return &compressor->filter.IUnknown_inner; return &compressor->filter.IUnknown_inner;
......
...@@ -54,13 +54,12 @@ static inline SmartTeeFilter *impl_from_IBaseFilter(IBaseFilter *iface) ...@@ -54,13 +54,12 @@ static inline SmartTeeFilter *impl_from_IBaseFilter(IBaseFilter *iface)
static inline SmartTeeFilter *impl_from_BasePin(BasePin *pin) static inline SmartTeeFilter *impl_from_BasePin(BasePin *pin)
{ {
return impl_from_IBaseFilter(pin->pinInfo.pFilter); return impl_from_strmbase_filter(pin->filter);
} }
static inline SmartTeeFilter *impl_from_IPin(IPin *iface) static inline SmartTeeFilter *impl_from_IPin(IPin *iface)
{ {
BasePin *bp = CONTAINING_RECORD(iface, BasePin, IPin_iface); return impl_from_strmbase_filter(CONTAINING_RECORD(iface, BasePin, IPin_iface)->filter);
return impl_from_IBaseFilter(bp->pinInfo.pFilter);
} }
static HRESULT WINAPI SmartTeeFilter_Stop(IBaseFilter *iface) static HRESULT WINAPI SmartTeeFilter_Stop(IBaseFilter *iface)
...@@ -471,41 +470,36 @@ static const BaseOutputPinFuncTable SmartTeeFilterPreviewFuncs = { ...@@ -471,41 +470,36 @@ static const BaseOutputPinFuncTable SmartTeeFilterPreviewFuncs = {
}; };
IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr) IUnknown* WINAPI QCAP_createSmartTeeFilter(IUnknown *outer, HRESULT *phr)
{ {
PIN_INFO inputPinInfo = {NULL, PINDIR_INPUT, {'I','n','p','u','t',0}}; static const WCHAR captureW[] = {'C','a','p','t','u','r','e',0};
PIN_INFO capturePinInfo = {NULL, PINDIR_OUTPUT, {'C','a','p','t','u','r','e',0}}; static const WCHAR previewW[] = {'P','r','e','v','i','e','w',0};
PIN_INFO previewPinInfo = {NULL, PINDIR_OUTPUT, {'P','r','e','v','i','e','w',0}}; static const WCHAR inputW[] = {'I','n','p','u','t',0};
SmartTeeFilter *object;
HRESULT hr; HRESULT hr;
SmartTeeFilter *This = NULL;
This = CoTaskMemAlloc(sizeof(*This)); if (!(object = CoTaskMemAlloc(sizeof(*object))))
if (This == NULL) { {
*phr = E_OUTOFMEMORY; *phr = E_OUTOFMEMORY;
return NULL; return NULL;
} }
memset(This, 0, sizeof(*This)); memset(object, 0, sizeof(*object));
strmbase_filter_init(&This->filter, &SmartTeeFilterVtbl, outer, &CLSID_SmartTee, &filter_ops);
inputPinInfo.pFilter = &This->filter.IBaseFilter_iface; strmbase_filter_init(&object->filter, &SmartTeeFilterVtbl, outer, &CLSID_SmartTee, &filter_ops);
strmbase_sink_init(&This->sink, &SmartTeeFilterInputVtbl, &inputPinInfo, strmbase_sink_init(&object->sink, &SmartTeeFilterInputVtbl, &object->filter,
&SmartTeeFilterInputFuncs, &This->filter.csFilter, NULL); inputW, &SmartTeeFilterInputFuncs, NULL);
hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC_SERVER,
&IID_IMemAllocator, (void**)&This->sink.pAllocator); &IID_IMemAllocator, (void **)&object->sink.pAllocator);
if (FAILED(hr)) if (FAILED(hr))
{ {
*phr = hr; *phr = hr;
strmbase_filter_cleanup(&This->filter); strmbase_filter_cleanup(&object->filter);
return NULL; return NULL;
} }
capturePinInfo.pFilter = &This->filter.IBaseFilter_iface; strmbase_source_init(&object->capture, &SmartTeeFilterCaptureVtbl,
strmbase_source_init(&This->capture, &SmartTeeFilterCaptureVtbl, &capturePinInfo, &object->filter, captureW, &SmartTeeFilterCaptureFuncs);
&SmartTeeFilterCaptureFuncs, &This->filter.csFilter); strmbase_source_init(&object->preview, &SmartTeeFilterPreviewVtbl,
&object->filter, previewW, &SmartTeeFilterPreviewFuncs);
previewPinInfo.pFilter = &This->filter.IBaseFilter_iface;
strmbase_source_init(&This->preview, &SmartTeeFilterPreviewVtbl, &previewPinInfo,
&SmartTeeFilterPreviewFuncs, &This->filter.csFilter);
*phr = S_OK; *phr = S_OK;
return &This->filter.IUnknown_inner; return &object->filter.IUnknown_inner;
} }
...@@ -635,7 +635,6 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr) ...@@ -635,7 +635,6 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr)
{ {
static const WCHAR source_name[] = {'O','u','t','p','u','t',0}; static const WCHAR source_name[] = {'O','u','t','p','u','t',0};
VfwCapture *object; VfwCapture *object;
PIN_INFO pin_info;
if (!(object = CoTaskMemAlloc(sizeof(*object)))) if (!(object = CoTaskMemAlloc(sizeof(*object))))
{ {
...@@ -650,11 +649,8 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr) ...@@ -650,11 +649,8 @@ IUnknown * WINAPI QCAP_createVFWCaptureFilter(IUnknown *outer, HRESULT *phr)
object->IPersistPropertyBag_iface.lpVtbl = &IPersistPropertyBag_VTable; object->IPersistPropertyBag_iface.lpVtbl = &IPersistPropertyBag_VTable;
object->init = FALSE; object->init = FALSE;
pin_info.dir = PINDIR_OUTPUT; strmbase_source_init(&object->source, &VfwPin_Vtbl, &object->filter,
pin_info.pFilter = &object->filter.IBaseFilter_iface; source_name, &output_BaseOutputFuncTable);
lstrcpyW(pin_info.achName, source_name);
strmbase_source_init(&object->source, &VfwPin_Vtbl, &pin_info,
&output_BaseOutputFuncTable, &object->filter.csFilter);
object->IKsPropertySet_iface.lpVtbl = &IKsPropertySet_VTable; object->IKsPropertySet_iface.lpVtbl = &IKsPropertySet_VTable;
......
...@@ -675,7 +675,6 @@ static HRESULT AVISplitter_ProcessOldIndex(AVISplitterImpl *This) ...@@ -675,7 +675,6 @@ static HRESULT AVISplitter_ProcessOldIndex(AVISplitterImpl *This)
static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE * pData, DWORD cb, ALLOCATOR_PROPERTIES *props) static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE * pData, DWORD cb, ALLOCATOR_PROPERTIES *props)
{ {
PIN_INFO piOutput;
const RIFFCHUNK * pChunk; const RIFFCHUNK * pChunk;
HRESULT hr; HRESULT hr;
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
...@@ -685,11 +684,9 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE ...@@ -685,11 +684,9 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
DWORD nstdindex = 0; DWORD nstdindex = 0;
static const WCHAR wszStreamTemplate[] = {'S','t','r','e','a','m',' ','%','0','2','d',0}; static const WCHAR wszStreamTemplate[] = {'S','t','r','e','a','m',' ','%','0','2','d',0};
StreamData *stream; StreamData *stream;
WCHAR name[18];
ZeroMemory(&amt, sizeof(amt)); ZeroMemory(&amt, sizeof(amt));
piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = &This->Parser.filter.IBaseFilter_iface;
wsprintfW(piOutput.achName, wszStreamTemplate, This->Parser.cStreams);
This->streams = CoTaskMemRealloc(This->streams, sizeof(StreamData) * (This->Parser.cStreams+1)); This->streams = CoTaskMemRealloc(This->streams, sizeof(StreamData) * (This->Parser.cStreams+1));
stream = This->streams + This->Parser.cStreams; stream = This->streams + This->Parser.cStreams;
ZeroMemory(stream, sizeof(*stream)); ZeroMemory(stream, sizeof(*stream));
...@@ -792,7 +789,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE ...@@ -792,7 +789,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
case ckidSTREAMNAME: case ckidSTREAMNAME:
TRACE("processing stream name\n"); TRACE("processing stream name\n");
/* FIXME: this doesn't exactly match native version (we omit the "##)" prefix), but hey... */ /* FIXME: this doesn't exactly match native version (we omit the "##)" prefix), but hey... */
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)(pChunk + 1), pChunk->cb, piOutput.achName, ARRAY_SIZE(piOutput.achName)); MultiByteToWideChar(CP_ACP, 0, (LPCSTR)(pChunk + 1), pChunk->cb, name, ARRAY_SIZE(name));
break; break;
case ckidSTREAMHANDLERDATA: case ckidSTREAMHANDLERDATA:
FIXME("process stream handler data\n"); FIXME("process stream handler data\n");
...@@ -872,7 +869,8 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE ...@@ -872,7 +869,8 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
stream->dwLength = dwLength; /* TODO: Use this for mediaseeking */ stream->dwLength = dwLength; /* TODO: Use this for mediaseeking */
stream->packet_queued = CreateEventW(NULL, 0, 0, NULL); stream->packet_queued = CreateEventW(NULL, 0, 0, NULL);
hr = Parser_AddPin(&(This->Parser), &piOutput, props, &amt); swprintf(name, ARRAY_SIZE(name), wszStreamTemplate, This->Parser.cStreams);
hr = Parser_AddPin(&This->Parser, name, props, &amt);
CoTaskMemFree(amt.pbFormat); CoTaskMemFree(amt.pbFormat);
...@@ -1023,7 +1021,7 @@ static HRESULT AVISplitter_Disconnect(LPVOID iface); ...@@ -1023,7 +1021,7 @@ static HRESULT AVISplitter_Disconnect(LPVOID iface);
static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, ALLOCATOR_PROPERTIES *props) static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, ALLOCATOR_PROPERTIES *props)
{ {
PullPin *This = impl_PullPin_from_IPin(iface); PullPin *This = impl_PullPin_from_IPin(iface);
AVISplitterImpl *pAviSplit = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); AVISplitterImpl *pAviSplit = impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface);
HRESULT hr; HRESULT hr;
RIFFLIST list; RIFFLIST list;
LONGLONG pos = 0; /* in bytes */ LONGLONG pos = 0; /* in bytes */
......
...@@ -469,7 +469,6 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi ...@@ -469,7 +469,6 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
{ {
HANDLE hFile; HANDLE hFile;
AsyncReader *This = impl_from_IFileSourceFilter(iface); AsyncReader *This = impl_from_IFileSourceFilter(iface);
PIN_INFO pin_info;
TRACE("%p->(%s, %p)\n", This, debugstr_w(pszFileName), pmt); TRACE("%p->(%s, %p)\n", This, debugstr_w(pszFileName), pmt);
...@@ -485,12 +484,8 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi ...@@ -485,12 +484,8 @@ static HRESULT WINAPI FileSource_Load(IFileSourceFilter * iface, LPCOLESTR pszFi
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
} }
/* create pin */ strmbase_source_init(&This->source, &FileAsyncReaderPin_Vtbl, &This->filter,
pin_info.dir = PINDIR_OUTPUT; wszOutputPinName, &output_BaseOutputFuncTable);
pin_info.pFilter = &This->filter.IBaseFilter_iface;
lstrcpyW(pin_info.achName, wszOutputPinName);
strmbase_source_init(&This->source, &FileAsyncReaderPin_Vtbl, &pin_info,
&output_BaseOutputFuncTable, &This->filter.csFilter);
BaseFilterImpl_IncrementPinVersion(&This->filter); BaseFilterImpl_IncrementPinVersion(&This->filter);
This->file = hFile; This->file = hFile;
......
...@@ -355,7 +355,7 @@ static HRESULT MPEGSplitter_query_accept(LPVOID iface, const AM_MEDIA_TYPE *pmt) ...@@ -355,7 +355,7 @@ static HRESULT MPEGSplitter_query_accept(LPVOID iface, const AM_MEDIA_TYPE *pmt)
} }
static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *header, PIN_INFO *ppiOutput, AM_MEDIA_TYPE *pamt) static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *header, AM_MEDIA_TYPE *pamt)
{ {
WAVEFORMATEX *format; WAVEFORMATEX *format;
int bitrate_index; int bitrate_index;
...@@ -369,9 +369,6 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade ...@@ -369,9 +369,6 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade
int mode; int mode;
ZeroMemory(pamt, sizeof(*pamt)); ZeroMemory(pamt, sizeof(*pamt));
ppiOutput->dir = PINDIR_OUTPUT;
ppiOutput->pFilter = &This->Parser.filter.IBaseFilter_iface;
wsprintfW(ppiOutput->achName, wszAudioStream);
pamt->formattype = FORMAT_WaveFormatEx; pamt->formattype = FORMAT_WaveFormatEx;
pamt->majortype = MEDIATYPE_Audio; pamt->majortype = MEDIATYPE_Audio;
...@@ -480,14 +477,13 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade ...@@ -480,14 +477,13 @@ static HRESULT MPEGSplitter_init_audio(MPEGSplitterImpl *This, const BYTE *heade
static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props) static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props)
{ {
PullPin *pPin = impl_PullPin_from_IPin(iface); PullPin *pPin = impl_PullPin_from_IPin(iface);
MPEGSplitterImpl *This = impl_from_IBaseFilter(pPin->pin.pinInfo.pFilter); MPEGSplitterImpl *This = impl_from_IBaseFilter(&pPin->pin.filter->IBaseFilter_iface);
HRESULT hr; HRESULT hr;
LONGLONG pos = 0; /* in bytes */ LONGLONG pos = 0; /* in bytes */
BYTE header[10]; BYTE header[10];
int streamtype; int streamtype;
LONGLONG total, avail; LONGLONG total, avail;
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
PIN_INFO piOutput;
IAsyncReader_Length(pPin->pReader, &total, &avail); IAsyncReader_Length(pPin->pReader, &total, &avail);
This->EndOfFile = total; This->EndOfFile = total;
...@@ -570,7 +566,7 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATO ...@@ -570,7 +566,7 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATO
LONGLONG duration = 0; LONGLONG duration = 0;
WAVEFORMATEX *format; WAVEFORMATEX *format;
hr = MPEGSplitter_init_audio(This, header, &piOutput, &amt); hr = MPEGSplitter_init_audio(This, header, &amt);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
format = (WAVEFORMATEX*)amt.pbFormat; format = (WAVEFORMATEX*)amt.pbFormat;
...@@ -581,7 +577,7 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATO ...@@ -581,7 +577,7 @@ static HRESULT MPEGSplitter_pre_connect(IPin *iface, IPin *pConnectPin, ALLOCATO
props->cbBuffer = 0x4000 / format->nBlockAlign * props->cbBuffer = 0x4000 / format->nBlockAlign *
format->nBlockAlign; format->nBlockAlign;
props->cBuffers = 3; props->cBuffers = 3;
hr = Parser_AddPin(&(This->Parser), &piOutput, props, &amt); hr = Parser_AddPin(&This->Parser, wszAudioStream, props, &amt);
} }
if (FAILED(hr)) if (FAILED(hr))
......
...@@ -80,7 +80,6 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown ...@@ -80,7 +80,6 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown
SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate) SourceSeeking_ChangeStart start, SourceSeeking_ChangeRate rate)
{ {
HRESULT hr; HRESULT hr;
PIN_INFO piInput;
strmbase_filter_init(&pParser->filter, vtbl, outer, clsid, func_table); strmbase_filter_init(&pParser->filter, vtbl, outer, clsid, func_table);
...@@ -89,11 +88,6 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown ...@@ -89,11 +88,6 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown
pParser->cStreams = 0; pParser->cStreams = 0;
pParser->sources = CoTaskMemAlloc(0 * sizeof(IPin *)); pParser->sources = CoTaskMemAlloc(0 * sizeof(IPin *));
/* construct input pin */
piInput.dir = PINDIR_INPUT;
piInput.pFilter = &pParser->filter.IBaseFilter_iface;
lstrcpynW(piInput.achName, sink_name, ARRAY_SIZE(piInput.achName));
if (!start) if (!start)
start = Parser_ChangeStart; start = Parser_ChangeStart;
...@@ -105,7 +99,9 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown ...@@ -105,7 +99,9 @@ HRESULT Parser_Create(ParserImpl *pParser, const IBaseFilterVtbl *vtbl, IUnknown
SourceSeeking_Init(&pParser->sourceSeeking, &Parser_Seeking_Vtbl, stop, start, rate, &pParser->filter.csFilter); SourceSeeking_Init(&pParser->sourceSeeking, &Parser_Seeking_Vtbl, stop, start, rate, &pParser->filter.csFilter);
hr = PullPin_Construct(&Parser_InputPin_Vtbl, &piInput, fnProcessSample, (LPVOID)pParser, fnQueryAccept, fnCleanup, fnRequest, fnDone, &pParser->filter.csFilter, (IPin **)&pParser->pInputPin); hr = PullPin_Construct(&Parser_InputPin_Vtbl, &pParser->filter, sink_name,
fnProcessSample, (void *)pParser, fnQueryAccept, fnCleanup, fnRequest,
fnDone, (IPin **)&pParser->pInputPin);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -346,7 +342,7 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { ...@@ -346,7 +342,7 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
Parser_OutputPin_DecideAllocator, Parser_OutputPin_DecideAllocator,
}; };
HRESULT Parser_AddPin(ParserImpl *filter, const PIN_INFO *pin_info, HRESULT Parser_AddPin(ParserImpl *filter, const WCHAR *name,
ALLOCATOR_PROPERTIES *props, const AM_MEDIA_TYPE *mt) ALLOCATOR_PROPERTIES *props, const AM_MEDIA_TYPE *mt)
{ {
Parser_OutputPin **old_sources; Parser_OutputPin **old_sources;
...@@ -361,14 +357,12 @@ HRESULT Parser_AddPin(ParserImpl *filter, const PIN_INFO *pin_info, ...@@ -361,14 +357,12 @@ HRESULT Parser_AddPin(ParserImpl *filter, const PIN_INFO *pin_info,
memcpy(filter->sources, old_sources, filter->cStreams * sizeof(filter->sources[0])); memcpy(filter->sources, old_sources, filter->cStreams * sizeof(filter->sources[0]));
filter->sources[filter->cStreams] = object; filter->sources[filter->cStreams] = object;
strmbase_source_init(&object->pin, &Parser_OutputPin_Vtbl, pin_info, strmbase_source_init(&object->pin, &Parser_OutputPin_Vtbl, &filter->filter,
&output_BaseOutputFuncTable, &filter->filter.csFilter); name, &output_BaseOutputFuncTable);
object->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); object->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(object->pmt, mt); CopyMediaType(object->pmt, mt);
object->dwSamplesProcessed = 0; object->dwSamplesProcessed = 0;
object->pin.pin.pinInfo.pFilter = &filter->filter.IBaseFilter_iface;
object->allocProps = *props; object->allocProps = *props;
filter->cStreams++; filter->cStreams++;
BaseFilterImpl_IncrementPinVersion(&filter->filter); BaseFilterImpl_IncrementPinVersion(&filter->filter);
...@@ -539,7 +533,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid, ...@@ -539,7 +533,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid,
*ppv = iface; *ppv = iface;
/* The Parser filter does not support querying IMediaSeeking, return it directly */ /* The Parser filter does not support querying IMediaSeeking, return it directly */
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
*ppv = &impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter)->sourceSeeking; *ppv = &impl_from_IBaseFilter(&This->pin.pin.filter->IBaseFilter_iface)->sourceSeeking;
if (*ppv) if (*ppv)
{ {
...@@ -555,7 +549,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid, ...@@ -555,7 +549,7 @@ static HRESULT WINAPI Parser_OutputPin_QueryInterface(IPin * iface, REFIID riid,
static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt) static HRESULT WINAPI Parser_OutputPin_Connect(IPin * iface, IPin * pReceivePin, const AM_MEDIA_TYPE * pmt)
{ {
Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface); Parser_OutputPin *This = unsafe_impl_Parser_OutputPin_from_IPin(iface);
ParserImpl *parser = impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter); ParserImpl *parser = impl_from_IBaseFilter(&This->pin.pin.filter->IBaseFilter_iface);
/* Set the allocator to our input pin's */ /* Set the allocator to our input pin's */
EnterCriticalSection(This->pin.pin.pCritSec); EnterCriticalSection(This->pin.pin.pCritSec);
...@@ -610,7 +604,7 @@ static HRESULT WINAPI Parser_PullPin_QueryInterface(IPin * iface, REFIID riid, L ...@@ -610,7 +604,7 @@ static HRESULT WINAPI Parser_PullPin_QueryInterface(IPin * iface, REFIID riid, L
* querying IMediaSeeking * querying IMediaSeeking
*/ */
if (IsEqualIID(riid, &IID_IMediaSeeking)) if (IsEqualIID(riid, &IID_IMediaSeeking))
*ppv = &impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->sourceSeeking; *ppv = &impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface)->sourceSeeking;
if (*ppv) if (*ppv)
{ {
...@@ -634,10 +628,10 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface) ...@@ -634,10 +628,10 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface)
if (This->pin.pConnectedTo) if (This->pin.pConnectedTo)
{ {
FILTER_STATE state; FILTER_STATE state;
ParserImpl *Parser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); ParserImpl *Parser = impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
hr = IBaseFilter_GetState(This->pin.pinInfo.pFilter, INFINITE, &state); hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
if (SUCCEEDED(hr) && (state == State_Stopped) && SUCCEEDED(Parser->fnDisconnect(Parser))) if (SUCCEEDED(hr) && (state == State_Stopped) && SUCCEEDED(Parser->fnDisconnect(Parser)))
...@@ -645,7 +639,7 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface) ...@@ -645,7 +639,7 @@ static HRESULT WINAPI Parser_PullPin_Disconnect(IPin * iface)
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
PullPin_Disconnect(iface); PullPin_Disconnect(iface);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
hr = Parser_RemoveOutputPins(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); hr = Parser_RemoveOutputPins(impl_from_IBaseFilter(&This->pin.filter->IBaseFilter_iface));
} }
else else
hr = VFW_E_NOT_STOPPED; hr = VFW_E_NOT_STOPPED;
...@@ -671,7 +665,7 @@ static HRESULT WINAPI Parser_PullPin_ReceiveConnection(IPin * iface, IPin * pRec ...@@ -671,7 +665,7 @@ static HRESULT WINAPI Parser_PullPin_ReceiveConnection(IPin * iface, IPin * pRec
BasePin *This = (BasePin *)iface; BasePin *This = (BasePin *)iface;
EnterCriticalSection(This->pCritSec); EnterCriticalSection(This->pCritSec);
Parser_RemoveOutputPins(impl_from_IBaseFilter(This->pinInfo.pFilter)); Parser_RemoveOutputPins(impl_from_IBaseFilter(&This->filter->IBaseFilter_iface));
LeaveCriticalSection(This->pCritSec); LeaveCriticalSection(This->pCritSec);
} }
......
...@@ -50,7 +50,8 @@ struct ParserImpl ...@@ -50,7 +50,8 @@ struct ParserImpl
SourceSeeking sourceSeeking; SourceSeeking sourceSeeking;
}; };
extern HRESULT Parser_AddPin(ParserImpl * This, const PIN_INFO * piOutput, ALLOCATOR_PROPERTIES * props, const AM_MEDIA_TYPE * amt); extern HRESULT Parser_AddPin(ParserImpl *filter, const WCHAR *name,
ALLOCATOR_PROPERTIES *props, const AM_MEDIA_TYPE *mt);
HRESULT Parser_Create(ParserImpl *parser, const IBaseFilterVtbl *vtbl, IUnknown *outer, HRESULT Parser_Create(ParserImpl *parser, const IBaseFilterVtbl *vtbl, IUnknown *outer,
const CLSID *clsid, const struct strmbase_filter_ops *func_table, const WCHAR *sink_name, const CLSID *clsid, const struct strmbase_filter_ops *func_table, const WCHAR *sink_name,
......
...@@ -166,19 +166,18 @@ static HRESULT deliver_newsegment(IPin *pin, LPVOID data) ...@@ -166,19 +166,18 @@ static HRESULT deliver_newsegment(IPin *pin, LPVOID data)
/*** PullPin implementation ***/ /*** PullPin implementation ***/
static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, const PIN_INFO *info, static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, struct strmbase_filter *filter,
SAMPLEPROC_PULL pSampleProc, void *pUserData, QUERYACCEPTPROC pQueryAccept, const WCHAR *name, SAMPLEPROC_PULL pSampleProc, void *pUserData,
CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, QUERYACCEPTPROC pQueryAccept, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest,
LPCRITICAL_SECTION pCritSec, PullPin *pPinImpl) STOPPROCESSPROC pDone, PullPin *pPinImpl)
{ {
/* Common attributes */ /* Common attributes */
pPinImpl->pin.IPin_iface.lpVtbl = PullPin_Vtbl; pPinImpl->pin.IPin_iface.lpVtbl = PullPin_Vtbl;
pPinImpl->pin.pConnectedTo = NULL; pPinImpl->pin.pConnectedTo = NULL;
pPinImpl->pin.pCritSec = pCritSec; pPinImpl->pin.pCritSec = &filter->csFilter;
/* avoid copying uninitialized data */ wcscpy(pPinImpl->pin.name, name);
wcscpy(pPinImpl->pin.pinInfo.achName, info->achName); pPinImpl->pin.dir = PINDIR_INPUT;
pPinImpl->pin.pinInfo.dir = info->dir; pPinImpl->pin.filter = filter;
pPinImpl->pin.pinInfo.pFilter = info->pFilter;
ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE)); ZeroMemory(&pPinImpl->pin.mtCurrent, sizeof(AM_MEDIA_TYPE));
/* Input pin attributes */ /* Input pin attributes */
...@@ -209,27 +208,22 @@ static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, const PIN_INFO *info, ...@@ -209,27 +208,22 @@ static HRESULT PullPin_Init(const IPinVtbl *PullPin_Vtbl, const PIN_INFO *info,
return S_OK; return S_OK;
} }
HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, struct strmbase_filter *filter, const WCHAR *name,
SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept,
CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone,
LPCRITICAL_SECTION pCritSec, IPin ** ppPin) IPin ** ppPin)
{ {
PullPin * pPinImpl; PullPin * pPinImpl;
*ppPin = NULL; *ppPin = NULL;
if (pPinInfo->dir != PINDIR_INPUT)
{
ERR("Pin direction(%x) != PINDIR_INPUT\n", pPinInfo->dir);
return E_INVALIDARG;
}
pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl)); pPinImpl = CoTaskMemAlloc(sizeof(*pPinImpl));
if (!pPinImpl) if (!pPinImpl)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (SUCCEEDED(PullPin_Init(PullPin_Vtbl, pPinInfo, pSampleProc, pUserData, pQueryAccept, pCleanUp, pCustomRequest, pDone, pCritSec, pPinImpl))) if (SUCCEEDED(PullPin_Init(PullPin_Vtbl, filter, name, pSampleProc, pUserData,
pQueryAccept, pCleanUp, pCustomRequest, pDone, pPinImpl)))
{ {
*ppPin = &pPinImpl->pin.IPin_iface; *ppPin = &pPinImpl->pin.IPin_iface;
return S_OK; return S_OK;
...@@ -348,7 +342,7 @@ HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv) ...@@ -348,7 +342,7 @@ HRESULT WINAPI PullPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv)
else if (IsEqualIID(riid, &IID_IMediaSeeking) || else if (IsEqualIID(riid, &IID_IMediaSeeking) ||
IsEqualIID(riid, &IID_IQualityControl)) IsEqualIID(riid, &IID_IQualityControl))
{ {
return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, riid, ppv); return IBaseFilter_QueryInterface(&This->pin.filter->IBaseFilter_iface, riid, ppv);
} }
if (*ppv) if (*ppv)
...@@ -525,7 +519,7 @@ static void PullPin_Thread_Stop(PullPin *This) ...@@ -525,7 +519,7 @@ static void PullPin_Thread_Stop(PullPin *This)
SetEvent(This->hEventStateChanged); SetEvent(This->hEventStateChanged);
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
IBaseFilter_Release(This->pin.pinInfo.pFilter); IPin_Release(&This->pin.IPin_iface);
CoUninitialize(); CoUninitialize();
ExitThread(0); ExitThread(0);
...@@ -576,16 +570,13 @@ static HRESULT PullPin_InitProcessing(PullPin * This) ...@@ -576,16 +570,13 @@ static HRESULT PullPin_InitProcessing(PullPin * This)
assert(WaitForSingleObject(This->thread_sleepy, 0) == WAIT_TIMEOUT); assert(WaitForSingleObject(This->thread_sleepy, 0) == WAIT_TIMEOUT);
This->state = Req_Sleepy; This->state = Req_Sleepy;
/* AddRef the filter to make sure it and its pins will be around IPin_AddRef(&This->pin.IPin_iface);
* as long as the thread */
IBaseFilter_AddRef(This->pin.pinInfo.pFilter);
This->hThread = CreateThread(NULL, 0, PullPin_Thread_Main, This, 0, &dwThreadId); This->hThread = CreateThread(NULL, 0, PullPin_Thread_Main, This, 0, &dwThreadId);
if (!This->hThread) if (!This->hThread)
{ {
hr = HRESULT_FROM_WIN32(GetLastError()); hr = HRESULT_FROM_WIN32(GetLastError());
IBaseFilter_Release(This->pin.pinInfo.pFilter); IPin_Release(&This->pin.IPin_iface);
} }
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
...@@ -769,7 +760,7 @@ HRESULT WINAPI PullPin_EndFlush(IPin * iface) ...@@ -769,7 +760,7 @@ HRESULT WINAPI PullPin_EndFlush(IPin * iface)
if (This->pReader) if (This->pReader)
IAsyncReader_EndFlush(This->pReader); IAsyncReader_EndFlush(This->pReader);
IBaseFilter_GetState(This->pin.pinInfo.pFilter, INFINITE, &state); IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state);
if (state != State_Stopped) if (state != State_Stopped)
PullPin_StartProcessing(This); PullPin_StartProcessing(This);
......
...@@ -102,10 +102,10 @@ typedef struct PullPin ...@@ -102,10 +102,10 @@ typedef struct PullPin
#define Req_Pause 3 #define Req_Pause 3
/*** Constructors ***/ /*** Constructors ***/
HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, const PIN_INFO * pPinInfo, HRESULT PullPin_Construct(const IPinVtbl *PullPin_Vtbl, struct strmbase_filter *filter, const WCHAR *name,
SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept, SAMPLEPROC_PULL pSampleProc, LPVOID pUserData, QUERYACCEPTPROC pQueryAccept,
CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone, CLEANUPPROC pCleanUp, REQUESTPROC pCustomRequest, STOPPROCESSPROC pDone,
LPCRITICAL_SECTION pCritSec, IPin ** ppPin); IPin **ppPin);
void PullPin_destroy(PullPin *pin) DECLSPEC_HIDDEN; void PullPin_destroy(PullPin *pin) DECLSPEC_HIDDEN;
/**************************/ /**************************/
......
...@@ -51,9 +51,9 @@ static inline WAVEParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface ) ...@@ -51,9 +51,9 @@ static inline WAVEParserImpl *impl_from_IMediaSeeking( IMediaSeeking *iface )
return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.sourceSeeking.IMediaSeeking_iface); return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.sourceSeeking.IMediaSeeking_iface);
} }
static inline WAVEParserImpl *impl_from_IBaseFilter( IBaseFilter *iface ) static inline WAVEParserImpl *impl_from_strmbase_filter(struct strmbase_filter *iface)
{ {
return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.filter.IBaseFilter_iface); return CONTAINING_RECORD(iface, WAVEParserImpl, Parser.filter);
} }
static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos) static LONGLONG bytepos_to_duration(WAVEParserImpl *This, LONGLONG bytepos)
...@@ -246,13 +246,8 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, ...@@ -246,13 +246,8 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
RIFFLIST list; RIFFLIST list;
RIFFCHUNK chunk; RIFFCHUNK chunk;
LONGLONG pos = 0; /* in bytes */ LONGLONG pos = 0; /* in bytes */
PIN_INFO piOutput;
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
WAVEParserImpl * pWAVEParser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); WAVEParserImpl *pWAVEParser = impl_from_strmbase_filter(This->pin.filter);
piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = &pWAVEParser->Parser.filter.IBaseFilter_iface;
lstrcpynW(piOutput.achName, outputW, ARRAY_SIZE(piOutput.achName));
hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list); hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list);
pos += sizeof(list); pos += sizeof(list);
...@@ -314,7 +309,7 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, ...@@ -314,7 +309,7 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
props->cBuffers = 3; props->cBuffers = 3;
pWAVEParser->nBlockAlign = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign; pWAVEParser->nBlockAlign = ((WAVEFORMATEX*)amt.pbFormat)->nBlockAlign;
pWAVEParser->nAvgBytesPerSec = ((WAVEFORMATEX*)amt.pbFormat)->nAvgBytesPerSec; pWAVEParser->nAvgBytesPerSec = ((WAVEFORMATEX*)amt.pbFormat)->nAvgBytesPerSec;
hr = Parser_AddPin(&(pWAVEParser->Parser), &piOutput, props, &amt); hr = Parser_AddPin(&pWAVEParser->Parser, outputW, props, &amt);
CoTaskMemFree(amt.pbFormat); CoTaskMemFree(amt.pbFormat);
pWAVEParser->Parser.sourceSeeking.llCurrent = 0; pWAVEParser->Parser.sourceSeeking.llCurrent = 0;
...@@ -410,7 +405,7 @@ static const IBaseFilterVtbl WAVEParser_Vtbl = ...@@ -410,7 +405,7 @@ static const IBaseFilterVtbl WAVEParser_Vtbl =
static void wave_parser_destroy(struct strmbase_filter *iface) static void wave_parser_destroy(struct strmbase_filter *iface)
{ {
WAVEParserImpl *filter = impl_from_IBaseFilter(&iface->IBaseFilter_iface); WAVEParserImpl *filter = impl_from_strmbase_filter(iface);
Parser_Destroy(&filter->Parser); Parser_Destroy(&filter->Parser);
} }
......
...@@ -135,14 +135,6 @@ out: ...@@ -135,14 +135,6 @@ out:
return hr; return hr;
} }
static void Copy_PinInfo(PIN_INFO * pDest, const PIN_INFO * pSrc)
{
/* avoid copying uninitialized data */
lstrcpyW(pDest->achName, pSrc->achName);
pDest->dir = pSrc->dir;
pDest->pFilter = pSrc->pFilter;
}
static void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt) static void dump_AM_MEDIA_TYPE(const AM_MEDIA_TYPE * pmt)
{ {
if (!pmt) if (!pmt)
...@@ -176,13 +168,13 @@ LONG WINAPI BasePinImpl_GetMediaTypeVersion(BasePin *iface) ...@@ -176,13 +168,13 @@ LONG WINAPI BasePinImpl_GetMediaTypeVersion(BasePin *iface)
ULONG WINAPI BasePinImpl_AddRef(IPin *iface) ULONG WINAPI BasePinImpl_AddRef(IPin *iface)
{ {
BasePin *pin = impl_from_IPin(iface); BasePin *pin = impl_from_IPin(iface);
return IBaseFilter_AddRef(pin->pinInfo.pFilter); return IBaseFilter_AddRef(&pin->filter->IBaseFilter_iface);
} }
ULONG WINAPI BasePinImpl_Release(IPin *iface) ULONG WINAPI BasePinImpl_Release(IPin *iface)
{ {
BasePin *pin = impl_from_IPin(iface); BasePin *pin = impl_from_IPin(iface);
return IBaseFilter_Release(pin->pinInfo.pFilter); return IBaseFilter_Release(&pin->filter->IBaseFilter_iface);
} }
HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface) HRESULT WINAPI BasePinImpl_Disconnect(IPin * iface)
...@@ -261,40 +253,40 @@ HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt ...@@ -261,40 +253,40 @@ HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt
return hr; return hr;
} }
HRESULT WINAPI BasePinImpl_QueryPinInfo(IPin * iface, PIN_INFO * pInfo) HRESULT WINAPI BasePinImpl_QueryPinInfo(IPin *iface, PIN_INFO *info)
{ {
BasePin *This = impl_from_IPin(iface); BasePin *pin = impl_from_IPin(iface);
TRACE("(%p)->(%p)\n", This, pInfo); TRACE("pin %p, info %p.\n", pin, info);
Copy_PinInfo(pInfo, &This->pinInfo); info->dir = pin->dir;
IBaseFilter_AddRef(pInfo->pFilter); IBaseFilter_AddRef(info->pFilter = &pin->filter->IBaseFilter_iface);
lstrcpyW(info->achName, pin->name);
return S_OK; return S_OK;
} }
HRESULT WINAPI BasePinImpl_QueryDirection(IPin * iface, PIN_DIRECTION * pPinDir) HRESULT WINAPI BasePinImpl_QueryDirection(IPin *iface, PIN_DIRECTION *dir)
{ {
BasePin *This = impl_from_IPin(iface); BasePin *pin = impl_from_IPin(iface);
TRACE("(%p)->(%p)\n", This, pPinDir); TRACE("pin %p, dir %p.\n", pin, dir);
*pPinDir = This->pinInfo.dir; *dir = pin->dir;
return S_OK; return S_OK;
} }
HRESULT WINAPI BasePinImpl_QueryId(IPin * iface, LPWSTR * Id) HRESULT WINAPI BasePinImpl_QueryId(IPin *iface, WCHAR **id)
{ {
BasePin *This = impl_from_IPin(iface); BasePin *pin = impl_from_IPin(iface);
TRACE("(%p)->(%p)\n", This, Id); TRACE("pin %p, id %p.\n", pin, id);
*Id = CoTaskMemAlloc((lstrlenW(This->pinInfo.achName) + 1) * sizeof(WCHAR)); if (!(*id = CoTaskMemAlloc((lstrlenW(pin->name) + 1) * sizeof(WCHAR))))
if (!*Id)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
lstrcpyW(*Id, This->pinInfo.achName); lstrcpyW(*id, pin->name);
return S_OK; return S_OK;
} }
...@@ -362,7 +354,7 @@ HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOI ...@@ -362,7 +354,7 @@ HRESULT WINAPI BaseOutputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOI
else if (IsEqualIID(riid, &IID_IMediaSeeking) || else if (IsEqualIID(riid, &IID_IMediaSeeking) ||
IsEqualIID(riid, &IID_IQualityControl)) IsEqualIID(riid, &IID_IQualityControl))
{ {
return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, riid, ppv); return IBaseFilter_QueryInterface(&This->pin.filter->IBaseFilter_iface, riid, ppv);
} }
if (*ppv) if (*ppv)
...@@ -712,22 +704,17 @@ HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *This, IPin *pR ...@@ -712,22 +704,17 @@ HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *This, IPin *pR
return hr; return hr;
} }
static void strmbase_pin_init(BasePin *pin, const IPinVtbl *vtbl, void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter,
const BasePinFuncTable *func_table, const PIN_INFO *info, CRITICAL_SECTION *cs) const WCHAR *name, const BaseOutputPinFuncTable *func_table)
{
memset(pin, 0, sizeof(*pin));
pin->IPin_iface.lpVtbl = vtbl;
pin->pCritSec = cs;
pin->dRate = 1.0;
Copy_PinInfo(&pin->pinInfo, info);
pin->pFuncsTable = func_table;
}
void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl,
const PIN_INFO *info, const BaseOutputPinFuncTable *func_table, CRITICAL_SECTION *cs)
{ {
memset(pin, 0, sizeof(*pin)); memset(pin, 0, sizeof(*pin));
strmbase_pin_init(&pin->pin, vtbl, &func_table->base, info, cs); pin->pin.IPin_iface.lpVtbl = vtbl;
pin->pin.pCritSec = &filter->csFilter;
pin->pin.dRate = 1.0;
pin->pin.filter = filter;
pin->pin.dir = PINDIR_OUTPUT;
lstrcpyW(pin->pin.name, name);
pin->pin.pFuncsTable = &func_table->base;
pin->pFuncsTable = func_table; pin->pFuncsTable = func_table;
} }
...@@ -762,7 +749,7 @@ HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID ...@@ -762,7 +749,7 @@ HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID
*ppv = &This->IMemInputPin_iface; *ppv = &This->IMemInputPin_iface;
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
{ {
return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, &IID_IMediaSeeking, ppv); return IBaseFilter_QueryInterface(&This->pin.filter->IBaseFilter_iface, &IID_IMediaSeeking, ppv);
} }
if (*ppv) if (*ppv)
...@@ -1045,12 +1032,17 @@ static const IMemInputPinVtbl MemInputPin_Vtbl = ...@@ -1045,12 +1032,17 @@ static const IMemInputPinVtbl MemInputPin_Vtbl =
MemInputPin_ReceiveCanBlock MemInputPin_ReceiveCanBlock
}; };
void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter,
const PIN_INFO *info, const BaseInputPinFuncTable *func_table, CRITICAL_SECTION *cs, const WCHAR *name, const BaseInputPinFuncTable *func_table, IMemAllocator *allocator)
IMemAllocator *allocator)
{ {
memset(pin, 0, sizeof(*pin)); memset(pin, 0, sizeof(*pin));
strmbase_pin_init(&pin->pin, vtbl, &func_table->base, info, cs); pin->pin.IPin_iface.lpVtbl = vtbl;
pin->pin.pCritSec = &filter->csFilter;
pin->pin.dRate = 1.0;
pin->pin.filter = filter;
pin->pin.dir = PINDIR_INPUT;
lstrcpyW(pin->pin.name, name);
pin->pin.pFuncsTable = &func_table->base;
pin->pFuncsTable = func_table; pin->pFuncsTable = func_table;
pin->pAllocator = pin->preferred_allocator = allocator; pin->pAllocator = pin->preferred_allocator = allocator;
if (pin->preferred_allocator) if (pin->preferred_allocator)
......
...@@ -236,7 +236,6 @@ HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtb ...@@ -236,7 +236,6 @@ HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtb
IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name, IUnknown *outer, const CLSID *clsid, const WCHAR *sink_name,
const BaseRendererFuncTable *pBaseFuncsTable) const BaseRendererFuncTable *pBaseFuncsTable)
{ {
PIN_INFO piInput;
HRESULT hr; HRESULT hr;
memset(filter, 0, sizeof(*filter)); memset(filter, 0, sizeof(*filter));
...@@ -244,13 +243,8 @@ HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtb ...@@ -244,13 +243,8 @@ HRESULT WINAPI strmbase_renderer_init(BaseRenderer *filter, const IBaseFilterVtb
filter->pFuncsTable = pBaseFuncsTable; filter->pFuncsTable = pBaseFuncsTable;
/* construct input pin */ strmbase_sink_init(&filter->sink, &BaseRenderer_InputPin_Vtbl, &filter->filter,
piInput.dir = PINDIR_INPUT; sink_name, &input_BaseInputFuncTable, NULL);
piInput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpynW(piInput.achName, sink_name, ARRAY_SIZE(piInput.achName));
strmbase_sink_init(&filter->sink, &BaseRenderer_InputPin_Vtbl, &piInput,
&input_BaseInputFuncTable, &filter->filter.csFilter, NULL);
hr = CreatePosPassThru(outer ? outer : (IUnknown *)&filter->filter.IBaseFilter_iface, TRUE, hr = CreatePosPassThru(outer ? outer : (IUnknown *)&filter->filter.IBaseFilter_iface, TRUE,
&filter->sink.pin.IPin_iface, &filter->pPosition); &filter->sink.pin.IPin_iface, &filter->pPosition);
......
...@@ -275,8 +275,6 @@ static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid, ...@@ -275,8 +275,6 @@ static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid,
{ {
ISeekingPassThru *passthru; ISeekingPassThru *passthru;
HRESULT hr; HRESULT hr;
PIN_INFO piInput;
PIN_INFO piOutput;
strmbase_filter_init(&filter->filter, &transform_vtbl, outer, clsid, &filter_ops); strmbase_filter_init(&filter->filter, &transform_vtbl, outer, clsid, &filter_ops);
...@@ -287,19 +285,11 @@ static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid, ...@@ -287,19 +285,11 @@ static HRESULT strmbase_transform_init(IUnknown *outer, const CLSID *clsid,
filter->pFuncsTable = func_table; filter->pFuncsTable = func_table;
ZeroMemory(&filter->pmt, sizeof(filter->pmt)); ZeroMemory(&filter->pmt, sizeof(filter->pmt));
/* construct input pin */ strmbase_sink_init(&filter->sink, &TransformFilter_InputPin_Vtbl, &filter->filter,
piInput.dir = PINDIR_INPUT; wcsInputPinName, &tf_input_BaseInputFuncTable, NULL);
piInput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpynW(piInput.achName, wcsInputPinName, ARRAY_SIZE(piInput.achName));
piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpynW(piOutput.achName, wcsOutputPinName, ARRAY_SIZE(piOutput.achName));
strmbase_sink_init(&filter->sink, &TransformFilter_InputPin_Vtbl, &piInput, strmbase_source_init(&filter->source, &TransformFilter_OutputPin_Vtbl, &filter->filter,
&tf_input_BaseInputFuncTable, &filter->filter.csFilter, NULL); wcsOutputPinName, &tf_output_BaseOutputFuncTable);
strmbase_source_init(&filter->source, &TransformFilter_OutputPin_Vtbl,
&piOutput, &tf_output_BaseOutputFuncTable, &filter->filter.csFilter);
QualityControlImpl_Create(&filter->sink.pin.IPin_iface, QualityControlImpl_Create(&filter->sink.pin.IPin_iface,
&filter->filter.IBaseFilter_iface, &filter->qcimpl); &filter->filter.IBaseFilter_iface, &filter->qcimpl);
......
...@@ -95,6 +95,11 @@ static inline GSTImpl *impl_from_IBaseFilter(IBaseFilter *iface) ...@@ -95,6 +95,11 @@ static inline GSTImpl *impl_from_IBaseFilter(IBaseFilter *iface)
return CONTAINING_RECORD(iface, GSTImpl, filter.IBaseFilter_iface); return CONTAINING_RECORD(iface, GSTImpl, filter.IBaseFilter_iface);
} }
static inline GSTImpl *impl_from_strmbase_filter(struct strmbase_filter *iface)
{
return CONTAINING_RECORD(iface, GSTImpl, filter);
}
const char* media_quark_string = "media-sample"; const char* media_quark_string = "media-sample";
static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0}; static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0};
...@@ -104,7 +109,7 @@ static const IPinVtbl GST_InputPin_Vtbl; ...@@ -104,7 +109,7 @@ static const IPinVtbl GST_InputPin_Vtbl;
static const IBaseFilterVtbl GST_Vtbl; static const IBaseFilterVtbl GST_Vtbl;
static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl; static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl;
static BOOL create_pin(GSTImpl *filter, const PIN_INFO *pin_info, const AM_MEDIA_TYPE *mt); static BOOL create_pin(GSTImpl *filter, const WCHAR *name, const AM_MEDIA_TYPE *mt);
static HRESULT GST_RemoveOutputPins(GSTImpl *This); static HRESULT GST_RemoveOutputPins(GSTImpl *This);
static HRESULT WINAPI GST_ChangeCurrent(IMediaSeeking *iface); static HRESULT WINAPI GST_ChangeCurrent(IMediaSeeking *iface);
static HRESULT WINAPI GST_ChangeStop(IMediaSeeking *iface); static HRESULT WINAPI GST_ChangeStop(IMediaSeeking *iface);
...@@ -293,7 +298,7 @@ static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps) ...@@ -293,7 +298,7 @@ static gboolean accept_caps_sink(GstPad *pad, GstCaps *caps)
static gboolean setcaps_sink(GstPad *pad, GstCaps *caps) static gboolean setcaps_sink(GstPad *pad, GstCaps *caps)
{ {
GSTOutPin *pin = gst_pad_get_element_private(pad); GSTOutPin *pin = gst_pad_get_element_private(pad);
GSTImpl *This = impl_from_IBaseFilter(pin->pin.pin.pinInfo.pFilter); GSTImpl *This = impl_from_strmbase_filter(pin->pin.pin.filter);
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
GstStructure *arg; GstStructure *arg;
const char *typename; const char *typename;
...@@ -471,7 +476,7 @@ static gboolean event_sink(GstPad *pad, GstObject *parent, GstEvent *event) ...@@ -471,7 +476,7 @@ static gboolean event_sink(GstPad *pad, GstObject *parent, GstEvent *event)
IPin_EndOfStream(pin->pin.pin.pConnectedTo); IPin_EndOfStream(pin->pin.pin.pConnectedTo);
return TRUE; return TRUE;
case GST_EVENT_FLUSH_START: case GST_EVENT_FLUSH_START:
if (impl_from_IBaseFilter(pin->pin.pin.pinInfo.pFilter)->ignore_flush) { if (impl_from_strmbase_filter(pin->pin.pin.filter)->ignore_flush) {
/* gst-plugins-base prior to 1.7 contains a bug which causes /* gst-plugins-base prior to 1.7 contains a bug which causes
* our sink pins to receive a flush-start event when the * our sink pins to receive a flush-start event when the
* decodebin changes from PAUSED to READY (including * decodebin changes from PAUSED to READY (including
...@@ -606,7 +611,7 @@ static DWORD CALLBACK push_data(LPVOID iface) ...@@ -606,7 +611,7 @@ static DWORD CALLBACK push_data(LPVOID iface)
static GstFlowReturn got_data_sink(GstPad *pad, GstObject *parent, GstBuffer *buf) static GstFlowReturn got_data_sink(GstPad *pad, GstObject *parent, GstBuffer *buf)
{ {
GSTOutPin *pin = gst_pad_get_element_private(pad); GSTOutPin *pin = gst_pad_get_element_private(pad);
GSTImpl *This = impl_from_IBaseFilter(pin->pin.pin.pinInfo.pFilter); GSTImpl *This = impl_from_strmbase_filter(pin->pin.pin.filter);
HRESULT hr; HRESULT hr;
BYTE *ptr = NULL; BYTE *ptr = NULL;
IMediaSample *sample; IMediaSample *sample;
...@@ -781,8 +786,6 @@ out: ...@@ -781,8 +786,6 @@ out:
static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This) static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This)
{ {
HRESULT hr;
PIN_INFO piOutput;
const char *typename; const char *typename;
char *name; char *name;
AM_MEDIA_TYPE amt = {{0}}; AM_MEDIA_TYPE amt = {{0}};
...@@ -793,18 +796,17 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This) ...@@ -793,18 +796,17 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This)
int ret; int ret;
BOOL isvid = FALSE, isaud = FALSE; BOOL isvid = FALSE, isaud = FALSE;
gchar my_name[1024]; gchar my_name[1024];
WCHAR nameW[128];
TRACE("%p %p %p\n", This, bin, pad); TRACE("%p %p %p\n", This, bin, pad);
piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = &This->filter.IBaseFilter_iface;
name = gst_pad_get_name(pad); name = gst_pad_get_name(pad);
MultiByteToWideChar(CP_UNIXCP, 0, name, -1, piOutput.achName, ARRAY_SIZE(piOutput.achName) - 1); MultiByteToWideChar(CP_UNIXCP, 0, name, -1, nameW, ARRAY_SIZE(nameW) - 1);
nameW[ARRAY_SIZE(nameW) - 1] = 0;
TRACE("Name: %s\n", name); TRACE("Name: %s\n", name);
strcpy(my_name, "qz_sink_"); strcpy(my_name, "qz_sink_");
strcat(my_name, name); strcat(my_name, name);
g_free(name); g_free(name);
piOutput.achName[ARRAY_SIZE(piOutput.achName) - 1] = 0;
caps = gst_pad_query_caps(pad, NULL); caps = gst_pad_query_caps(pad, NULL);
caps = gst_caps_make_writable(caps); caps = gst_caps_make_writable(caps);
...@@ -825,7 +827,7 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This) ...@@ -825,7 +827,7 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This)
return; return;
} }
if (!create_pin(This, &piOutput, &amt)) if (!create_pin(This, nameW, &amt))
{ {
ERR("Failed to allocate memory.\n"); ERR("Failed to allocate memory.\n");
return; return;
...@@ -1098,7 +1100,7 @@ static void unknown_type(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer u ...@@ -1098,7 +1100,7 @@ static void unknown_type(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer u
static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props) static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props)
{ {
GSTImpl *This = impl_from_IBaseFilter(pPin->pin.pinInfo.pFilter); GSTImpl *This = impl_from_strmbase_filter(pPin->pin.filter);
int ret, i; int ret, i;
LONGLONG avail, duration; LONGLONG avail, duration;
GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE( GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE(
...@@ -1198,7 +1200,7 @@ static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface ) ...@@ -1198,7 +1200,7 @@ static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface )
static IPin *gstdemux_get_pin(struct strmbase_filter *base, unsigned int index) static IPin *gstdemux_get_pin(struct strmbase_filter *base, unsigned int index)
{ {
GSTImpl *filter = impl_from_IBaseFilter(&base->IBaseFilter_iface); GSTImpl *filter = impl_from_strmbase_filter(base);
if (!index) if (!index)
return &filter->pInputPin.pin.IPin_iface; return &filter->pInputPin.pin.IPin_iface;
...@@ -1209,7 +1211,7 @@ static IPin *gstdemux_get_pin(struct strmbase_filter *base, unsigned int index) ...@@ -1209,7 +1211,7 @@ static IPin *gstdemux_get_pin(struct strmbase_filter *base, unsigned int index)
static void gstdemux_destroy(struct strmbase_filter *iface) static void gstdemux_destroy(struct strmbase_filter *iface)
{ {
GSTImpl *filter = impl_from_IBaseFilter(&iface->IBaseFilter_iface); GSTImpl *filter = impl_from_strmbase_filter(iface);
IPin *connected = NULL; IPin *connected = NULL;
HRESULT hr; HRESULT hr;
...@@ -1253,7 +1255,6 @@ static const struct strmbase_filter_ops filter_ops = ...@@ -1253,7 +1255,6 @@ static const struct strmbase_filter_ops filter_ops =
IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr) IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr)
{ {
PIN_INFO *piInput;
GSTImpl *This; GSTImpl *This;
if (!init_gstreamer()) if (!init_gstreamer())
...@@ -1281,10 +1282,9 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr) ...@@ -1281,10 +1282,9 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *outer, HRESULT *phr)
This->push_event = CreateEventW(NULL, 0, 0, NULL); This->push_event = CreateEventW(NULL, 0, 0, NULL);
This->bus = NULL; This->bus = NULL;
piInput = &This->pInputPin.pin.pinInfo; This->pInputPin.pin.dir = PINDIR_INPUT;
piInput->dir = PINDIR_INPUT; This->pInputPin.pin.filter = &This->filter;
piInput->pFilter = &This->filter.IBaseFilter_iface; lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name));
lstrcpynW(piInput->achName, wcsInputPinName, ARRAY_SIZE(piInput->achName));
This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl; This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl;
This->pInputPin.pin.pConnectedTo = NULL; This->pInputPin.pin.pConnectedTo = NULL;
This->pInputPin.pin.pCritSec = &This->filter.csFilter; This->pInputPin.pin.pCritSec = &This->filter.csFilter;
...@@ -1721,7 +1721,7 @@ static HRESULT WINAPI GSTOutPin_DecideBufferSize(BaseOutputPin *iface, IMemAlloc ...@@ -1721,7 +1721,7 @@ static HRESULT WINAPI GSTOutPin_DecideBufferSize(BaseOutputPin *iface, IMemAlloc
static HRESULT WINAPI GSTOutPin_DecideAllocator(BaseOutputPin *base, IMemInputPin *pPin, IMemAllocator **pAlloc) static HRESULT WINAPI GSTOutPin_DecideAllocator(BaseOutputPin *base, IMemInputPin *pPin, IMemAllocator **pAlloc)
{ {
GSTOutPin *pin = impl_source_from_IPin(&base->pin.IPin_iface); GSTOutPin *pin = impl_source_from_IPin(&base->pin.IPin_iface);
GSTImpl *GSTfilter = impl_from_IBaseFilter(pin->pin.pin.pinInfo.pFilter); GSTImpl *GSTfilter = impl_from_strmbase_filter(pin->pin.pin.filter);
HRESULT hr; HRESULT hr;
TRACE("pin %p, peer %p, allocator %p.\n", pin, pPin, pAlloc); TRACE("pin %p, peer %p, allocator %p.\n", pin, pPin, pAlloc);
...@@ -1810,7 +1810,7 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = { ...@@ -1810,7 +1810,7 @@ static const BaseOutputPinFuncTable output_BaseOutputFuncTable = {
GSTOutPin_DecideAllocator, GSTOutPin_DecideAllocator,
}; };
static BOOL create_pin(GSTImpl *filter, const PIN_INFO *pin_info, const AM_MEDIA_TYPE *mt) static BOOL create_pin(GSTImpl *filter, const WCHAR *name, const AM_MEDIA_TYPE *mt)
{ {
GSTOutPin *pin, **new_array; GSTOutPin *pin, **new_array;
...@@ -1821,8 +1821,8 @@ static BOOL create_pin(GSTImpl *filter, const PIN_INFO *pin_info, const AM_MEDIA ...@@ -1821,8 +1821,8 @@ static BOOL create_pin(GSTImpl *filter, const PIN_INFO *pin_info, const AM_MEDIA
if (!(pin = heap_alloc_zero(sizeof(*pin)))) if (!(pin = heap_alloc_zero(sizeof(*pin))))
return FALSE; return FALSE;
strmbase_source_init(&pin->pin, &GST_OutputPin_Vtbl, pin_info, strmbase_source_init(&pin->pin, &GST_OutputPin_Vtbl, &filter->filter, name,
&output_BaseOutputFuncTable, &filter->filter.csFilter); &output_BaseOutputFuncTable);
pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(pin->pmt, mt); CopyMediaType(pin->pmt, mt);
pin->caps_event = CreateEventW(NULL, FALSE, FALSE, NULL); pin->caps_event = CreateEventW(NULL, FALSE, FALSE, NULL);
...@@ -1872,6 +1872,7 @@ static inline GSTInPin *impl_sink_from_IPin(IPin *iface) ...@@ -1872,6 +1872,7 @@ static inline GSTInPin *impl_sink_from_IPin(IPin *iface)
static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
{ {
GSTInPin *This = impl_sink_from_IPin(iface); GSTInPin *This = impl_sink_from_IPin(iface);
GSTImpl *filter = impl_from_strmbase_filter(This->pin.filter);
PIN_DIRECTION pindirReceive; PIN_DIRECTION pindirReceive;
HRESULT hr = S_OK; HRESULT hr = S_OK;
...@@ -1903,7 +1904,7 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1903,7 +1904,7 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
This->pReader = NULL; This->pReader = NULL;
This->pAlloc = NULL; This->pAlloc = NULL;
ResetEvent(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->push_event); ResetEvent(filter->push_event);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader); hr = IPin_QueryInterface(pReceivePin, &IID_IAsyncReader, (LPVOID *)&This->pReader);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
...@@ -1926,9 +1927,9 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1926,9 +1927,9 @@ static HRESULT WINAPI GSTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
This->pin.pConnectedTo = pReceivePin; This->pin.pConnectedTo = pReceivePin;
IPin_AddRef(pReceivePin); IPin_AddRef(pReceivePin);
hr = IMemAllocator_Commit(This->pAlloc); hr = IMemAllocator_Commit(This->pAlloc);
SetEvent(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->push_event); SetEvent(filter->push_event);
} else { } else {
GST_RemoveOutputPins(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); GST_RemoveOutputPins(filter);
if (This->pReader) if (This->pReader)
IAsyncReader_Release(This->pReader); IAsyncReader_Release(This->pReader);
This->pReader = NULL; This->pReader = NULL;
...@@ -1953,10 +1954,10 @@ static HRESULT WINAPI GSTInPin_Disconnect(IPin *iface) ...@@ -1953,10 +1954,10 @@ static HRESULT WINAPI GSTInPin_Disconnect(IPin *iface)
mark_wine_thread(); mark_wine_thread();
hr = IBaseFilter_GetState(This->pin.pinInfo.pFilter, INFINITE, &state); hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
if (This->pin.pConnectedTo) { if (This->pin.pConnectedTo) {
GSTImpl *Parser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); GSTImpl *Parser = impl_from_strmbase_filter(This->pin.filter);
if (SUCCEEDED(hr) && state == State_Stopped) { if (SUCCEEDED(hr) && state == State_Stopped) {
IMemAllocator_Decommit(This->pAlloc); IMemAllocator_Decommit(This->pAlloc);
...@@ -2026,7 +2027,7 @@ static HRESULT WINAPI GSTInPin_QueryInterface(IPin * iface, REFIID riid, LPVOID ...@@ -2026,7 +2027,7 @@ static HRESULT WINAPI GSTInPin_QueryInterface(IPin * iface, REFIID riid, LPVOID
*ppv = iface; *ppv = iface;
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
{ {
return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, &IID_IMediaSeeking, ppv); return IBaseFilter_QueryInterface(&This->pin.filter->IBaseFilter_iface, &IID_IMediaSeeking, ppv);
} }
if (*ppv) if (*ppv)
......
...@@ -176,7 +176,7 @@ static const IPinVtbl QT_InputPin_Vtbl; ...@@ -176,7 +176,7 @@ static const IPinVtbl QT_InputPin_Vtbl;
static const IBaseFilterVtbl QT_Vtbl; static const IBaseFilterVtbl QT_Vtbl;
static const IMediaSeekingVtbl QT_Seeking_Vtbl; static const IMediaSeekingVtbl QT_Seeking_Vtbl;
static HRESULT QT_AddPin(QTSplitter *This, const PIN_INFO *piOutput, const AM_MEDIA_TYPE *amt, BOOL video); static HRESULT QT_AddPin(QTSplitter *filter, const WCHAR *name, const AM_MEDIA_TYPE *mt, BOOL video);
static HRESULT QT_RemoveOutputPins(QTSplitter *This); static HRESULT QT_RemoveOutputPins(QTSplitter *This);
static HRESULT WINAPI QTSplitter_ChangeStart(IMediaSeeking *iface); static HRESULT WINAPI QTSplitter_ChangeStart(IMediaSeeking *iface);
...@@ -286,7 +286,6 @@ static const struct strmbase_filter_ops filter_ops = ...@@ -286,7 +286,6 @@ static const struct strmbase_filter_ops filter_ops =
IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr) IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
{ {
PIN_INFO *piInput;
QTSplitter *This; QTSplitter *This;
static const WCHAR wcsInputPinName[] = {'I','n','p','u','t',' ','P','i','n',0}; static const WCHAR wcsInputPinName[] = {'I','n','p','u','t',' ','P','i','n',0};
...@@ -313,10 +312,9 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr) ...@@ -313,10 +312,9 @@ IUnknown * CALLBACK QTSplitter_create(IUnknown *outer, HRESULT *phr)
This->aSession = NULL; This->aSession = NULL;
This->runEvent = CreateEventW(NULL, 0, 0, NULL); This->runEvent = CreateEventW(NULL, 0, 0, NULL);
piInput = &This->pInputPin.pin.pinInfo; This->pInputPin.pin.dir = PINDIR_INPUT;
piInput->dir = PINDIR_INPUT; This->pInputPin.pin.filter = &This->filter;
piInput->pFilter = &This->filter.IBaseFilter_iface; lstrcpynW(This->pInputPin.pin.name, wcsInputPinName, ARRAY_SIZE(This->pInputPin.pin.name));
lstrcpynW(piInput->achName, wcsInputPinName, ARRAY_SIZE(piInput->achName));
This->pInputPin.pin.IPin_iface.lpVtbl = &QT_InputPin_Vtbl; This->pInputPin.pin.IPin_iface.lpVtbl = &QT_InputPin_Vtbl;
This->pInputPin.pin.pConnectedTo = NULL; This->pInputPin.pin.pConnectedTo = NULL;
This->pInputPin.pin.pCritSec = &This->filter.csFilter; This->pInputPin.pin.pCritSec = &This->filter.csFilter;
...@@ -825,7 +823,6 @@ static HRESULT QT_Process_Video_Track(QTSplitter* filter, Track trk) ...@@ -825,7 +823,6 @@ static HRESULT QT_Process_Video_Track(QTSplitter* filter, Track trk)
{ {
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
VIDEOINFOHEADER * pvi; VIDEOINFOHEADER * pvi;
PIN_INFO piOutput;
HRESULT hr = S_OK; HRESULT hr = S_OK;
OSErr err; OSErr err;
static const WCHAR szwVideoOut[] = {'V','i','d','e','o',0}; static const WCHAR szwVideoOut[] = {'V','i','d','e','o',0};
...@@ -913,11 +910,7 @@ static HRESULT QT_Process_Video_Track(QTSplitter* filter, Track trk) ...@@ -913,11 +910,7 @@ static HRESULT QT_Process_Video_Track(QTSplitter* filter, Track trk)
duration = GetMediaDisplayDuration(videoMedia); duration = GetMediaDisplayDuration(videoMedia);
pvi->AvgTimePerFrame = (100000.0 * sampleCount * timeScale) / duration; pvi->AvgTimePerFrame = (100000.0 * sampleCount * timeScale) / duration;
piOutput.dir = PINDIR_OUTPUT; hr = QT_AddPin(filter, szwVideoOut, &amt, TRUE);
piOutput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpyW(piOutput.achName,szwVideoOut);
hr = QT_AddPin(filter, &piOutput, &amt, TRUE);
if (FAILED(hr)) if (FAILED(hr))
ERR("Failed to add Video Track\n"); ERR("Failed to add Video Track\n");
else else
...@@ -930,7 +923,6 @@ static HRESULT QT_Process_Audio_Track(QTSplitter* filter, Track trk) ...@@ -930,7 +923,6 @@ static HRESULT QT_Process_Audio_Track(QTSplitter* filter, Track trk)
{ {
AM_MEDIA_TYPE amt; AM_MEDIA_TYPE amt;
WAVEFORMATEX* pvi; WAVEFORMATEX* pvi;
PIN_INFO piOutput;
HRESULT hr = S_OK; HRESULT hr = S_OK;
static const WCHAR szwAudioOut[] = {'A','u','d','i','o',0}; static const WCHAR szwAudioOut[] = {'A','u','d','i','o',0};
Media audioMedia; Media audioMedia;
...@@ -967,11 +959,7 @@ static HRESULT QT_Process_Audio_Track(QTSplitter* filter, Track trk) ...@@ -967,11 +959,7 @@ static HRESULT QT_Process_Audio_Track(QTSplitter* filter, Track trk)
DisposeHandle((Handle)aDesc); DisposeHandle((Handle)aDesc);
piOutput.dir = PINDIR_OUTPUT; hr = QT_AddPin(filter, szwAudioOut, &amt, FALSE);
piOutput.pFilter = &filter->filter.IBaseFilter_iface;
lstrcpyW(piOutput.achName,szwAudioOut);
hr = QT_AddPin(filter, &piOutput, &amt, FALSE);
if (FAILED(hr)) if (FAILED(hr))
ERR("Failed to add Audio Track\n"); ERR("Failed to add Audio Track\n");
else else
...@@ -1051,6 +1039,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1051,6 +1039,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
HRESULT hr = S_OK; HRESULT hr = S_OK;
ALLOCATOR_PROPERTIES props; ALLOCATOR_PROPERTIES props;
QTInPin *This = impl_from_IPin(iface); QTInPin *This = impl_from_IPin(iface);
QTSplitter *filter = impl_from_strmbase_filter(This->pin.filter);
IMemAllocator *pAlloc; IMemAllocator *pAlloc;
TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt); TRACE("(%p/%p)->(%p, %p)\n", This, iface, pReceivePin, pmt);
...@@ -1085,13 +1074,13 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1085,13 +1074,13 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
} }
LeaveCriticalSection(This->pin.pCritSec); LeaveCriticalSection(This->pin.pCritSec);
EnterCriticalSection(&impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->filter.csFilter); EnterCriticalSection(&filter->filter.csFilter);
hr = QT_Process_Movie(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); hr = QT_Process_Movie(filter);
if (FAILED(hr)) if (FAILED(hr))
{ {
IAsyncReader_Release(This->pReader); IAsyncReader_Release(This->pReader);
This->pReader = NULL; This->pReader = NULL;
LeaveCriticalSection(&impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->filter.csFilter); LeaveCriticalSection(&filter->filter.csFilter);
TRACE("Unable to process movie\n"); TRACE("Unable to process movie\n");
return hr; return hr;
} }
...@@ -1099,7 +1088,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1099,7 +1088,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
This->pAlloc = NULL; This->pAlloc = NULL;
props.cBuffers = 8; props.cBuffers = 8;
props.cbAlign = 1; props.cbAlign = 1;
props.cbBuffer = impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->outputSize + props.cbAlign; props.cbBuffer = filter->outputSize + props.cbAlign;
props.cbPrefix = 0; props.cbPrefix = 0;
hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC, hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC,
&IID_IMemAllocator, (LPVOID *)&pAlloc); &IID_IMemAllocator, (LPVOID *)&pAlloc);
...@@ -1122,7 +1111,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1122,7 +1111,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
} }
else else
{ {
QT_RemoveOutputPins(impl_from_IBaseFilter(This->pin.pinInfo.pFilter)); QT_RemoveOutputPins(filter);
if (This->pReader) if (This->pReader)
IAsyncReader_Release(This->pReader); IAsyncReader_Release(This->pReader);
This->pReader = NULL; This->pReader = NULL;
...@@ -1131,7 +1120,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin, ...@@ -1131,7 +1120,7 @@ static HRESULT WINAPI QTInPin_ReceiveConnection(IPin *iface, IPin *pReceivePin,
This->pAlloc = NULL; This->pAlloc = NULL;
} }
TRACE("Size: %i\n", props.cbBuffer); TRACE("Size: %i\n", props.cbBuffer);
LeaveCriticalSection(&impl_from_IBaseFilter(This->pin.pinInfo.pFilter)->filter.csFilter); LeaveCriticalSection(&filter->filter.csFilter);
return hr; return hr;
} }
...@@ -1143,11 +1132,11 @@ static HRESULT WINAPI QTInPin_Disconnect(IPin *iface) ...@@ -1143,11 +1132,11 @@ static HRESULT WINAPI QTInPin_Disconnect(IPin *iface)
FILTER_STATE state; FILTER_STATE state;
TRACE("()\n"); TRACE("()\n");
hr = IBaseFilter_GetState(This->pin.pinInfo.pFilter, INFINITE, &state); hr = IBaseFilter_GetState(&This->pin.filter->IBaseFilter_iface, INFINITE, &state);
EnterCriticalSection(This->pin.pCritSec); EnterCriticalSection(This->pin.pCritSec);
if (This->pin.pConnectedTo) if (This->pin.pConnectedTo)
{ {
QTSplitter *Parser = impl_from_IBaseFilter(This->pin.pinInfo.pFilter); QTSplitter *Parser = impl_from_strmbase_filter(This->pin.filter);
if (SUCCEEDED(hr) && state == State_Stopped) if (SUCCEEDED(hr) && state == State_Stopped)
{ {
...@@ -1182,38 +1171,26 @@ static HRESULT WINAPI QTInPin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *pmt) ...@@ -1182,38 +1171,26 @@ static HRESULT WINAPI QTInPin_QueryAccept(IPin *iface, const AM_MEDIA_TYPE *pmt)
static HRESULT WINAPI QTInPin_EndOfStream(IPin *iface) static HRESULT WINAPI QTInPin_EndOfStream(IPin *iface)
{ {
QTInPin *pin = impl_from_IPin(iface); FIXME("iface %p, stub!\n", iface);
QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter);
FIXME("Propagate message on %p\n", This);
return S_OK; return S_OK;
} }
static HRESULT WINAPI QTInPin_BeginFlush(IPin *iface) static HRESULT WINAPI QTInPin_BeginFlush(IPin *iface)
{ {
QTInPin *pin = impl_from_IPin(iface); FIXME("iface %p, stub!\n", iface);
QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter);
FIXME("Propagate message on %p\n", This);
return S_OK; return S_OK;
} }
static HRESULT WINAPI QTInPin_EndFlush(IPin *iface) static HRESULT WINAPI QTInPin_EndFlush(IPin *iface)
{ {
QTInPin *pin = impl_from_IPin(iface); FIXME("iface %p, stub!\n", iface);
QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter);
FIXME("Propagate message on %p\n", This);
return S_OK; return S_OK;
} }
static HRESULT WINAPI QTInPin_NewSegment(IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate) static HRESULT WINAPI QTInPin_NewSegment(IPin *iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
{ {
QTInPin *pin = impl_from_IPin(iface);
QTSplitter *This = impl_from_IBaseFilter(pin->pin.pinInfo.pFilter);
BasePinImpl_NewSegment(iface, tStart, tStop, dRate); BasePinImpl_NewSegment(iface, tStart, tStop, dRate);
FIXME("Propagate message on %p\n", This); FIXME("iface %p, stub!\n", iface);
return S_OK; return S_OK;
} }
...@@ -1230,7 +1207,7 @@ static HRESULT WINAPI QTInPin_QueryInterface(IPin * iface, REFIID riid, LPVOID * ...@@ -1230,7 +1207,7 @@ static HRESULT WINAPI QTInPin_QueryInterface(IPin * iface, REFIID riid, LPVOID *
else if (IsEqualIID(riid, &IID_IPin)) else if (IsEqualIID(riid, &IID_IPin))
*ppv = iface; *ppv = iface;
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
return IBaseFilter_QueryInterface(This->pin.pinInfo.pFilter, &IID_IMediaSeeking, ppv); return IBaseFilter_QueryInterface(&This->pin.filter->IBaseFilter_iface, &IID_IMediaSeeking, ppv);
if (*ppv) if (*ppv)
{ {
...@@ -1304,7 +1281,7 @@ static HRESULT WINAPI QTOutPin_QueryInterface(IPin *iface, REFIID riid, void **p ...@@ -1304,7 +1281,7 @@ static HRESULT WINAPI QTOutPin_QueryInterface(IPin *iface, REFIID riid, void **p
else if (IsEqualIID(riid, &IID_IPin)) else if (IsEqualIID(riid, &IID_IPin))
*ppv = iface; *ppv = iface;
else if (IsEqualIID(riid, &IID_IMediaSeeking)) else if (IsEqualIID(riid, &IID_IMediaSeeking))
return IBaseFilter_QueryInterface(This->pin.pin.pinInfo.pFilter, &IID_IMediaSeeking, ppv); return IBaseFilter_QueryInterface(&This->pin.pin.filter->IBaseFilter_iface, &IID_IMediaSeeking, ppv);
else if (IsEqualIID(riid, &IID_IQualityControl)) else if (IsEqualIID(riid, &IID_IQualityControl))
*ppv = &This->IQualityControl_iface; *ppv = &This->IQualityControl_iface;
...@@ -1345,7 +1322,7 @@ static HRESULT WINAPI QTOutPin_DecideAllocator(BaseOutputPin *iface, IMemInputPi ...@@ -1345,7 +1322,7 @@ static HRESULT WINAPI QTOutPin_DecideAllocator(BaseOutputPin *iface, IMemInputPi
{ {
HRESULT hr; HRESULT hr;
QTOutPin *This = impl_QTOutPin_from_BaseOutputPin(iface); QTOutPin *This = impl_QTOutPin_from_BaseOutputPin(iface);
QTSplitter *QTfilter = impl_from_IBaseFilter(This->pin.pin.pinInfo.pFilter); QTSplitter *QTfilter = impl_from_strmbase_filter(This->pin.pin.filter);
*pAlloc = NULL; *pAlloc = NULL;
if (QTfilter->pInputPin.pAlloc) if (QTfilter->pInputPin.pAlloc)
...@@ -1444,7 +1421,7 @@ static const OutputQueueFuncTable output_OutputQueueFuncTable = { ...@@ -1444,7 +1421,7 @@ static const OutputQueueFuncTable output_OutputQueueFuncTable = {
OutputQueueImpl_ThreadProc OutputQueueImpl_ThreadProc
}; };
static HRESULT QT_AddPin(QTSplitter *filter, const PIN_INFO *pin_info, static HRESULT QT_AddPin(QTSplitter *filter, const WCHAR *name,
const AM_MEDIA_TYPE *mt, BOOL video) const AM_MEDIA_TYPE *mt, BOOL video)
{ {
QTOutPin *pin; QTOutPin *pin;
...@@ -1457,8 +1434,8 @@ static HRESULT QT_AddPin(QTSplitter *filter, const PIN_INFO *pin_info, ...@@ -1457,8 +1434,8 @@ static HRESULT QT_AddPin(QTSplitter *filter, const PIN_INFO *pin_info,
else else
filter->pAudio_Pin = pin; filter->pAudio_Pin = pin;
strmbase_source_init(&pin->pin, &QT_OutputPin_Vtbl, piOutput, strmbase_source_init(&pin->pin, &QT_OutputPin_Vtbl, &filter->filter, name,
&output_BaseOutputFuncTable, &filter->filter.csFilter); &output_BaseOutputFuncTable);
pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)); pin->pmt = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
CopyMediaType(pin->pmt, mt); CopyMediaType(pin->pmt, mt);
pin->IQualityControl_iface.lpVtbl = &QTOutPin_QualityControl_Vtbl; pin->IQualityControl_iface.lpVtbl = &QTOutPin_QualityControl_Vtbl;
......
...@@ -30,16 +30,17 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType); ...@@ -30,16 +30,17 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType);
typedef struct BasePin typedef struct BasePin
{ {
IPin IPin_iface; IPin IPin_iface;
LPCRITICAL_SECTION pCritSec; CRITICAL_SECTION *pCritSec;
PIN_INFO pinInfo; struct strmbase_filter *filter;
IPin * pConnectedTo; PIN_DIRECTION dir;
AM_MEDIA_TYPE mtCurrent; WCHAR name[128];
REFERENCE_TIME tStart; IPin *pConnectedTo;
REFERENCE_TIME tStop; AM_MEDIA_TYPE mtCurrent;
double dRate; REFERENCE_TIME tStart, tStop;
double dRate;
const struct BasePinFuncTable* pFuncsTable;
const struct BasePinFuncTable* pFuncsTable;
} BasePin; } BasePin;
typedef HRESULT (WINAPI *BasePin_CheckMediaType)(BasePin *This, const AM_MEDIA_TYPE *pmt); typedef HRESULT (WINAPI *BasePin_CheckMediaType)(BasePin *This, const AM_MEDIA_TYPE *pmt);
...@@ -133,8 +134,8 @@ HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputP ...@@ -133,8 +134,8 @@ HRESULT WINAPI BaseOutputPinImpl_DecideAllocator(BaseOutputPin *This, IMemInputP
HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *pin, IPin *peer, const AM_MEDIA_TYPE *mt); HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(BaseOutputPin *pin, IPin *peer, const AM_MEDIA_TYPE *mt);
void strmbase_source_cleanup(BaseOutputPin *pin); void strmbase_source_cleanup(BaseOutputPin *pin);
void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, const PIN_INFO *info, void strmbase_source_init(BaseOutputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter,
const BaseOutputPinFuncTable *func_table, CRITICAL_SECTION *cs); const WCHAR *name, const BaseOutputPinFuncTable *func_table);
/* Base Input Pin */ /* Base Input Pin */
HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv); HRESULT WINAPI BaseInputPinImpl_QueryInterface(IPin * iface, REFIID riid, LPVOID * ppv);
...@@ -146,8 +147,8 @@ HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface); ...@@ -146,8 +147,8 @@ HRESULT WINAPI BaseInputPinImpl_BeginFlush(IPin * iface);
HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface); HRESULT WINAPI BaseInputPinImpl_EndFlush(IPin * iface);
HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate); HRESULT WINAPI BaseInputPinImpl_NewSegment(IPin * iface, REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, const PIN_INFO *info, void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, struct strmbase_filter *filter,
const BaseInputPinFuncTable *func_table, CRITICAL_SECTION *cs, IMemAllocator *allocator); const WCHAR *name, const BaseInputPinFuncTable *func_table, IMemAllocator *allocator);
void strmbase_sink_cleanup(BaseInputPin *pin); void strmbase_sink_cleanup(BaseInputPin *pin);
struct strmbase_filter struct strmbase_filter
......
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