qcap: Added IPersistPropertyBag::Load implementation.
This commit is contained in:
parent
a414681648
commit
d45241dd91
|
@ -1,5 +1,5 @@
|
|||
MODULE = qcap.dll
|
||||
IMPORTS = strmiids strmbase uuid ole32 gdi32 advapi32
|
||||
IMPORTS = strmiids strmbase uuid ole32 oleaut32 gdi32 advapi32
|
||||
|
||||
C_SRCS = \
|
||||
avico.c \
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "dshow.h"
|
||||
#include "aviriff.h"
|
||||
|
||||
#include "qcap_main.h"
|
||||
|
||||
|
@ -36,6 +37,8 @@ typedef struct {
|
|||
|
||||
BaseInputPin *in;
|
||||
BaseOutputPin *out;
|
||||
|
||||
DWORD fcc_handler;
|
||||
} AVICompressor;
|
||||
|
||||
static inline AVICompressor *impl_from_BaseFilter(BaseFilter *filter)
|
||||
|
@ -234,8 +237,38 @@ static HRESULT WINAPI AVICompressorPropertyBag_InitNew(IPersistPropertyBag *ifac
|
|||
static HRESULT WINAPI AVICompressorPropertyBag_Load(IPersistPropertyBag *iface, IPropertyBag *pPropBag, IErrorLog *pErrorLog)
|
||||
{
|
||||
AVICompressor *This = impl_from_IPersistPropertyBag(iface);
|
||||
FIXME("(%p)->(%p %p)\n", This, pPropBag, pErrorLog);
|
||||
return E_NOTIMPL;
|
||||
BSTR str;
|
||||
VARIANT v;
|
||||
HRESULT hres;
|
||||
|
||||
static const WCHAR fcc_handlerW[] = {'F','c','c','H','a','n','d','l','e','r',0};
|
||||
|
||||
TRACE("(%p)->(%p %p)\n", This, pPropBag, pErrorLog);
|
||||
|
||||
V_VT(&v) = VT_EMPTY;
|
||||
hres = IPropertyBag_Read(pPropBag, fcc_handlerW, &v, NULL);
|
||||
if(FAILED(hres)) {
|
||||
WARN("Could not read FccHandler: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
if(V_VT(&v) != VT_BSTR) {
|
||||
FIXME("Got vt %d\n", V_VT(&v));
|
||||
VariantClear(&v);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
str = V_BSTR(&v);
|
||||
TRACE("FccHandler = %s\n", debugstr_w(str));
|
||||
if(SysStringLen(str) != 4) {
|
||||
FIXME("Invalid FccHandler len\n");
|
||||
SysFreeString(str);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
This->fcc_handler = FCC(str[0], str[1], str[2], str[3]);
|
||||
SysFreeString(str);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI AVICompressorPropertyBag_Save(IPersistPropertyBag *iface, IPropertyBag *pPropBag,
|
||||
|
|
|
@ -59,6 +59,7 @@ DEFINE_EXPECT(ReceiveConnection);
|
|||
DEFINE_EXPECT(GetAllocatorRequirements);
|
||||
DEFINE_EXPECT(NotifyAllocator);
|
||||
DEFINE_EXPECT(Reconnect);
|
||||
DEFINE_EXPECT(Read_FccHandler);
|
||||
|
||||
static const char *debugstr_guid(REFIID riid)
|
||||
{
|
||||
|
@ -72,6 +73,28 @@ static const char *debugstr_guid(REFIID riid)
|
|||
return buf;
|
||||
}
|
||||
|
||||
static int strcmp_wa(LPCWSTR strw, const char *stra)
|
||||
{
|
||||
CHAR buf[512];
|
||||
WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), NULL, NULL);
|
||||
return lstrcmpA(stra, buf);
|
||||
}
|
||||
|
||||
static BSTR a2bstr(const char *str)
|
||||
{
|
||||
BSTR ret;
|
||||
int len;
|
||||
|
||||
if(!str)
|
||||
return NULL;
|
||||
|
||||
len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
|
||||
ret = SysAllocStringLen(NULL, len-1);
|
||||
MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void test_smart_tee_filter(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -1333,6 +1356,59 @@ static void test_AviMux(void)
|
|||
IBaseFilter_Release(avimux);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PropertyBag_QueryInterface(IPropertyBag *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IPropertyBag, riid)) {
|
||||
*ppv = iface;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
ok(0, "unexpected call %s\n", debugstr_guid(riid));
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI PropertyBag_AddRef(IPropertyBag *iface)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static ULONG WINAPI PropertyBag_Release(IPropertyBag *iface)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PropertyBag_Read(IPropertyBag *iface, LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog *pErrorLog)
|
||||
{
|
||||
ok(!pErrorLog, "pErrorLog = %p\n", pErrorLog);
|
||||
|
||||
if(!strcmp_wa(pszPropName, "FccHandler")) {
|
||||
CHECK_EXPECT(Read_FccHandler);
|
||||
V_VT(pVar) = VT_BSTR;
|
||||
V_BSTR(pVar) = a2bstr("mrle");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
ok(0, "unexpected call: %s\n", wine_dbgstr_w(pszPropName));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PropertyBag_Write(IPropertyBag *iface, LPCOLESTR pszPropName, VARIANT *pVar)
|
||||
{
|
||||
ok(0, "unexpected call: %s\n", wine_dbgstr_w(pszPropName));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IPropertyBagVtbl PropertyBagVtbl = {
|
||||
PropertyBag_QueryInterface,
|
||||
PropertyBag_AddRef,
|
||||
PropertyBag_Release,
|
||||
PropertyBag_Read,
|
||||
PropertyBag_Write
|
||||
};
|
||||
|
||||
static IPropertyBag PropertyBag = { &PropertyBagVtbl };
|
||||
|
||||
static void test_AviCo(void)
|
||||
{
|
||||
IPersistPropertyBag *persist_bag;
|
||||
|
@ -1358,6 +1434,11 @@ static void test_AviCo(void)
|
|||
hres = IBaseFilter_QueryInterface(avico, &IID_IPersistPropertyBag, (void**)&persist_bag);
|
||||
ok(hres == S_OK, "QueryInterface(IID_IPersistPropertyBag) returned: %08x\n", hres);
|
||||
|
||||
SET_EXPECT(Read_FccHandler);
|
||||
hres = IPersistPropertyBag_Load(persist_bag, &PropertyBag, NULL);
|
||||
ok(hres == S_OK, "Load failed: %08x\n", hres);
|
||||
CHECK_CALLED(Read_FccHandler);
|
||||
|
||||
IPersistPropertyBag_Release(persist_bag);
|
||||
|
||||
hres = IBaseFilter_EnumPins(avico, &enum_pins);
|
||||
|
|
Loading…
Reference in New Issue