qcap: Added AVI compressor output pin stub implementation.

This commit is contained in:
Jacek Caban 2013-12-30 16:38:18 +01:00 committed by Alexandre Julliard
parent 792c53ad25
commit 71687bef17
2 changed files with 113 additions and 6 deletions

View File

@ -35,6 +35,7 @@ typedef struct {
IPersistPropertyBag IPersistPropertyBag_iface;
BaseInputPin *in;
BaseOutputPin *out;
} AVICompressor;
static inline AVICompressor *impl_from_BaseFilter(BaseFilter *filter)
@ -93,6 +94,8 @@ static ULONG WINAPI AVICompressor_Release(IBaseFilter *iface)
if(!ref) {
if(This->in)
BaseInputPinImpl_Release(&This->in->pin.IPin_iface);
if(This->out)
BaseOutputPinImpl_Release(&This->out->pin.IPin_iface);
heap_free(This);
}
@ -171,8 +174,8 @@ static IPin* WINAPI AVICompressor_GetPin(BaseFilter *iface, int pos)
ret = &This->in->pin.IPin_iface;
break;
case 1:
FIXME("out pin not implemented\n");
return NULL;
ret = &This->out->pin.IPin_iface;
break;
default:
TRACE("No pin %d\n", pos);
return NULL;
@ -184,9 +187,7 @@ static IPin* WINAPI AVICompressor_GetPin(BaseFilter *iface, int pos)
static LONG WINAPI AVICompressor_GetPinCount(BaseFilter *iface)
{
AVICompressor *This = impl_from_BaseFilter(iface);
FIXME("(%p)\n", This);
return 1;
return 2;
}
static const BaseFilterFuncTable filter_func_table = {
@ -351,9 +352,93 @@ static const BaseInputPinFuncTable AVICompressorBaseInputPinVtbl = {
AVICompressorIn_Receive
};
static HRESULT WINAPI AVICompressorOut_QueryInterface(IPin *iface, REFIID riid, void **ppv)
{
return BaseInputPinImpl_QueryInterface(iface, riid, ppv);
}
static ULONG WINAPI AVICompressorOut_AddRef(IPin *iface)
{
AVICompressor *This = impl_from_IPin(iface);
return IBaseFilter_AddRef(&This->filter.IBaseFilter_iface);
}
static ULONG WINAPI AVICompressorOut_Release(IPin *iface)
{
AVICompressor *This = impl_from_IPin(iface);
return IBaseFilter_Release(&This->filter.IBaseFilter_iface);
}
static const IPinVtbl AVICompressorOutputPinVtbl = {
AVICompressorOut_QueryInterface,
AVICompressorOut_AddRef,
AVICompressorOut_Release,
BaseOutputPinImpl_Connect,
BaseOutputPinImpl_ReceiveConnection,
BaseOutputPinImpl_Disconnect,
BasePinImpl_ConnectedTo,
BasePinImpl_ConnectionMediaType,
BasePinImpl_QueryPinInfo,
BasePinImpl_QueryDirection,
BasePinImpl_QueryId,
BasePinImpl_QueryAccept,
BasePinImpl_EnumMediaTypes,
BasePinImpl_QueryInternalConnections,
BaseOutputPinImpl_EndOfStream,
BaseOutputPinImpl_BeginFlush,
BaseOutputPinImpl_EndFlush,
BasePinImpl_NewSegment
};
static LONG WINAPI AVICompressorOut_GetMediaTypeVersion(BasePin *base)
{
FIXME("(%p)\n", base);
return 0;
}
static HRESULT WINAPI AVICompressorOut_GetMediaType(BasePin *base, int iPosition, AM_MEDIA_TYPE *amt)
{
AVICompressor *This = impl_from_IBaseFilter(base->pinInfo.pFilter);
FIXME("(%p)->(%d %p)\n", This, iPosition, amt);
return E_NOTIMPL;
}
static const BasePinFuncTable AVICompressorOutputBasePinVtbl = {
NULL,
BaseOutputPinImpl_AttemptConnection,
AVICompressorOut_GetMediaTypeVersion,
AVICompressorOut_GetMediaType
};
static HRESULT WINAPI AVICompressorOut_DecideBufferSize(BaseOutputPin *base, IMemAllocator *alloc, ALLOCATOR_PROPERTIES *ppropInputRequest)
{
FIXME("\n");
return E_NOTIMPL;
}
static HRESULT WINAPI AVICompressorOut_DecideAllocator(BaseOutputPin *base,
IMemInputPin *pPin, IMemAllocator **pAlloc)
{
TRACE("(%p)->(%p %p)\n", base, pPin, pAlloc);
return BaseOutputPinImpl_DecideAllocator(base, pPin, pAlloc);
}
static HRESULT WINAPI AVICompressorOut_BreakConnect(BaseOutputPin *base)
{
FIXME("(%p)\n", base);
return E_NOTIMPL;
}
static const BaseOutputPinFuncTable AVICompressorBaseOutputPinVtbl = {
AVICompressorOut_DecideBufferSize,
AVICompressorOut_DecideAllocator,
AVICompressorOut_BreakConnect
};
IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr)
{
PIN_INFO in_pin_info = {NULL, PINDIR_INPUT, {'I','n','p','u','t',0}};
PIN_INFO out_pin_info = {NULL, PINDIR_OUTPUT, {'O','u','t','p','u','t',0}};
AVICompressor *compressor;
HRESULT hres;
@ -380,6 +465,16 @@ IUnknown* WINAPI QCAP_createAVICompressor(IUnknown *outer, HRESULT *phr)
return NULL;
}
out_pin_info.pFilter = &compressor->filter.IBaseFilter_iface;
hres = BaseOutputPin_Construct(&AVICompressorOutputPinVtbl, sizeof(BaseOutputPin), &out_pin_info,
&AVICompressorOutputBasePinVtbl, &AVICompressorBaseOutputPinVtbl,
&compressor->filter.csFilter, (IPin**)&compressor->out);
if(FAILED(hres)) {
IBaseFilter_Release(&compressor->filter.IBaseFilter_iface);
*phr = hres;
return NULL;
}
*phr = S_OK;
return (IUnknown*)&compressor->filter.IBaseFilter_iface;
}

View File

@ -1336,13 +1336,14 @@ static void test_AviMux(void)
static void test_AviCo(void)
{
IPersistPropertyBag *persist_bag;
IPin *pin, *in_pin;
IPin *pin, *in_pin, *out_pin;
IEnumPins *enum_pins;
IBaseFilter *avico;
PIN_INFO pin_info;
HRESULT hres;
static const WCHAR inputW[] = {'I','n','p','u','t',0};
static const WCHAR outputW[] = {'O','u','t','p','u','t',0};
hres = CoCreateInstance(&CLSID_AVICo, NULL, CLSCTX_INPROC_SERVER, &IID_IBaseFilter, (void**)&avico);
if(hres == REGDB_E_CLASSNOTREG) {
@ -1371,8 +1372,19 @@ static void test_AviCo(void)
ok(pin_info.dir == PINDIR_INPUT, "pin_info.dir = %d\n", pin_info.dir);
ok(!lstrcmpW(pin_info.achName, inputW), "pin_info.achName = %s\n", wine_dbgstr_w(pin_info.achName));
hres = IEnumPins_Next(enum_pins, 1, &out_pin, NULL);
ok(hres == S_OK, "Next failed: %08x\n", hres);
hres = IPin_QueryPinInfo(out_pin, &pin_info);
ok(hres == S_OK, "QueryPinInfo failed: %08x\n", hres);
ok(pin_info.pFilter == avico, "pin_info.pFilter != avico\n");
ok(pin_info.dir == PINDIR_OUTPUT, "pin_info.dir = %d\n", pin_info.dir);
ok(!lstrcmpW(pin_info.achName, outputW), "pin_info.achName = %s\n", wine_dbgstr_w(pin_info.achName));
IEnumPins_Release(enum_pins);
IPin_Release(in_pin);
IPin_Release(out_pin);
IBaseFilter_Release(avico);
}