Commit f2206d3d authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

qcap/avico: Store the sink pin inline in the AviCompressor structure.

parent cec43c18
...@@ -37,7 +37,7 @@ typedef struct { ...@@ -37,7 +37,7 @@ typedef struct {
BaseFilter filter; BaseFilter filter;
IPersistPropertyBag IPersistPropertyBag_iface; IPersistPropertyBag IPersistPropertyBag_iface;
BaseInputPin *in; BaseInputPin sink;
BaseOutputPin *out; BaseOutputPin *out;
DWORD fcc_handler; DWORD fcc_handler;
...@@ -183,7 +183,7 @@ static IPin *avi_compressor_get_pin(BaseFilter *iface, unsigned int index) ...@@ -183,7 +183,7 @@ static IPin *avi_compressor_get_pin(BaseFilter *iface, unsigned int index)
AVICompressor *filter = impl_from_BaseFilter(iface); AVICompressor *filter = impl_from_BaseFilter(iface);
if (index == 0) if (index == 0)
return &filter->in->pin.IPin_iface; return &filter->sink.pin.IPin_iface;
else if (index == 1) else if (index == 1)
return &filter->out->pin.IPin_iface; return &filter->out->pin.IPin_iface;
return NULL; return NULL;
...@@ -196,8 +196,7 @@ static void avi_compressor_destroy(BaseFilter *iface) ...@@ -196,8 +196,7 @@ static void avi_compressor_destroy(BaseFilter *iface)
if (filter->hic) if (filter->hic)
ICClose(filter->hic); ICClose(filter->hic);
heap_free(filter->videoinfo); heap_free(filter->videoinfo);
if (filter->in) strmbase_sink_cleanup(&filter->sink);
BaseInputPinImpl_Release(&filter->in->pin.IPin_iface);
if (filter->out) if (filter->out)
BaseOutputPinImpl_Release(&filter->out->pin.IPin_iface); BaseOutputPinImpl_Release(&filter->out->pin.IPin_iface);
strmbase_filter_cleanup(&filter->filter); strmbase_filter_cleanup(&filter->filter);
...@@ -484,7 +483,7 @@ static HRESULT WINAPI AVICompressorIn_Receive(BaseInputPin *base, IMediaSample * ...@@ -484,7 +483,7 @@ static HRESULT WINAPI AVICompressorIn_Receive(BaseInputPin *base, IMediaSample *
if((This->driver_flags & VIDCF_TEMPORAL) && !(This->driver_flags & VIDCF_FASTTEMPORALC)) if((This->driver_flags & VIDCF_TEMPORAL) && !(This->driver_flags & VIDCF_FASTTEMPORALC))
FIXME("Unsupported temporal compression\n"); FIXME("Unsupported temporal compression\n");
src_videoinfo = (VIDEOINFOHEADER*)This->in->pin.mtCurrent.pbFormat; src_videoinfo = (VIDEOINFOHEADER *)This->sink.pin.mtCurrent.pbFormat;
This->videoinfo->bmiHeader.biSizeImage = This->max_frame_size; This->videoinfo->bmiHeader.biSizeImage = This->max_frame_size;
res = ICCompress(This->hic, sync_point ? ICCOMPRESS_KEYFRAME : 0, &This->videoinfo->bmiHeader, buf, res = ICCompress(This->hic, sync_point ? ICCOMPRESS_KEYFRAME : 0, &This->videoinfo->bmiHeader, buf,
&src_videoinfo->bmiHeader, ptr, 0, &comp_flags, This->frame_cnt, 0, 0, NULL, NULL); &src_videoinfo->bmiHeader, ptr, 0, &comp_flags, This->frame_cnt, 0, 0, NULL, NULL);
...@@ -572,7 +571,7 @@ static HRESULT WINAPI AVICompressorOut_GetMediaType(BasePin *base, int iPosition ...@@ -572,7 +571,7 @@ static HRESULT WINAPI AVICompressorOut_GetMediaType(BasePin *base, int iPosition
amt->subtype = MEDIASUBTYPE_PCM; amt->subtype = MEDIASUBTYPE_PCM;
amt->bFixedSizeSamples = FALSE; amt->bFixedSizeSamples = FALSE;
amt->bTemporalCompression = (This->driver_flags & VIDCF_TEMPORAL) != 0; amt->bTemporalCompression = (This->driver_flags & VIDCF_TEMPORAL) != 0;
amt->lSampleSize = This->in->pin.mtCurrent.lSampleSize; amt->lSampleSize = This->sink.pin.mtCurrent.lSampleSize;
amt->formattype = FORMAT_VideoInfo; amt->formattype = FORMAT_VideoInfo;
amt->pUnk = NULL; amt->pUnk = NULL;
amt->cbFormat = This->videoinfo_size; amt->cbFormat = This->videoinfo_size;
...@@ -633,13 +632,8 @@ IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr) ...@@ -633,13 +632,8 @@ 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; in_pin_info.pFilter = &compressor->filter.IBaseFilter_iface;
hres = BaseInputPin_Construct(&AVICompressorInputPinVtbl, sizeof(BaseInputPin), &in_pin_info, strmbase_sink_init(&compressor->sink, &AVICompressorInputPinVtbl, &in_pin_info,
&AVICompressorBaseInputPinVtbl, &compressor->filter.csFilter, NULL, (IPin**)&compressor->in); &AVICompressorBaseInputPinVtbl, &compressor->filter.csFilter, NULL);
if(FAILED(hres)) {
strmbase_filter_cleanup(&compressor->filter);
*phr = hres;
return NULL;
}
out_pin_info.pFilter = &compressor->filter.IBaseFilter_iface; out_pin_info.pFilter = &compressor->filter.IBaseFilter_iface;
hres = BaseOutputPin_Construct(&AVICompressorOutputPinVtbl, sizeof(BaseOutputPin), &out_pin_info, hres = BaseOutputPin_Construct(&AVICompressorOutputPinVtbl, sizeof(BaseOutputPin), &out_pin_info,
......
...@@ -1109,7 +1109,7 @@ static const IMemInputPinVtbl MemInputPin_Vtbl = ...@@ -1109,7 +1109,7 @@ static const IMemInputPinVtbl MemInputPin_Vtbl =
MemInputPin_ReceiveCanBlock MemInputPin_ReceiveCanBlock
}; };
static void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl,
const PIN_INFO *info, const BaseInputPinFuncTable *func_table, CRITICAL_SECTION *cs, const PIN_INFO *info, const BaseInputPinFuncTable *func_table, CRITICAL_SECTION *cs,
IMemAllocator *allocator) IMemAllocator *allocator)
{ {
...@@ -1150,7 +1150,7 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size ...@@ -1150,7 +1150,7 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size
return S_OK; return S_OK;
} }
static void strmbase_sink_cleanup(BaseInputPin *pin) void strmbase_sink_cleanup(BaseInputPin *pin)
{ {
FreeMediaType(&pin->pin.mtCurrent); FreeMediaType(&pin->pin.mtCurrent);
if (pin->pAllocator) if (pin->pAllocator)
......
...@@ -151,6 +151,9 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size ...@@ -151,6 +151,9 @@ HRESULT BaseInputPin_Construct(const IPinVtbl *InputPin_Vtbl, LONG inputpin_size
const BaseInputPinFuncTable* pBaseInputFuncsTable, const BaseInputPinFuncTable* pBaseInputFuncsTable,
LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin); LPCRITICAL_SECTION pCritSec, IMemAllocator *, IPin ** ppPin);
HRESULT WINAPI BaseInputPin_Destroy(BaseInputPin *This); HRESULT WINAPI BaseInputPin_Destroy(BaseInputPin *This);
void strmbase_sink_init(BaseInputPin *pin, const IPinVtbl *vtbl, const PIN_INFO *info,
const BaseInputPinFuncTable *func_table, CRITICAL_SECTION *cs, IMemAllocator *allocator);
void strmbase_sink_cleanup(BaseInputPin *pin);
typedef struct BaseFilter typedef struct BaseFilter
{ {
......
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